repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/labeler/MonthLabeler.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // }
import java.util.Calendar; import com.googlecode.android.widgets.DateSlider.TimeObject;
package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays months */ public class MonthLabeler extends Labeler { private final String mFormatString; public MonthLabeler(String formatString) { super(180, 60); mFormatString = formatString; } @Override
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/labeler/MonthLabeler.java import java.util.Calendar; import com.googlecode.android.widgets.DateSlider.TimeObject; package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays months */ public class MonthLabeler extends Labeler { private final String mFormatString; public MonthLabeler(String formatString) { super(180, 60); mFormatString = formatString; } @Override
public TimeObject add(long time, int val) {
andreynovikov/Androzic
src/main/java/com/androzic/Preferences.java
// Path: src/main/java/com/androzic/util/XmlUtils.java // public class XmlUtils // { // // public static void skipCurrentTag(XmlPullParser parser) // throws XmlPullParserException, IOException { // int outerDepth = parser.getDepth(); // int type; // while ((type=parser.next()) != XmlPullParser.END_DOCUMENT // && (type != XmlPullParser.END_TAG // || parser.getDepth() > outerDepth)) { // } // } // // }
import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Map; import org.droidparts.widget.MultiSelectListPreference; import org.mapsforge.map.rendertheme.XmlRenderThemeStyleLayer; import org.mapsforge.map.rendertheme.XmlRenderThemeStyleMenu; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import android.annotation.SuppressLint; import android.app.Activity; import android.app.ProgressDialog; import android.app.backup.BackupManager; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.os.Parcel; import android.os.Parcelable; import android.preference.EditTextPreference; import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceGroup; import android.preference.PreferenceScreen; import android.support.v4.app.Fragment; import android.support.v4.app.ListFragment; import android.support.v4.preference.PreferenceFragment; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.text.TextUtils; import android.util.AttributeSet; import android.util.TypedValue; import android.util.Xml; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import com.androzic.map.online.TileProvider; import com.androzic.ui.SeekbarPreference; import com.androzic.util.XmlUtils;
{ header.breadCrumbShortTitleRes = tv.resourceId; } else { header.breadCrumbShortTitle = tv.string; } } header.iconRes = sa.getResourceId(R.styleable.PreferenceHeader_icon, 0); header.fragment = sa.getString(R.styleable.PreferenceHeader_fragment); header.help = sa.getResourceId(R.styleable.PreferenceHeader_help, 0); sa.recycle(); if (curBundle == null) { curBundle = new Bundle(); } final int innerDepth = parser.getDepth(); while ((type = parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > innerDepth)) { if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) { continue; } String innerNodeName = parser.getName(); if (innerNodeName.equals("extra")) { resources.parseBundleExtra(innerNodeName, attrs, curBundle);
// Path: src/main/java/com/androzic/util/XmlUtils.java // public class XmlUtils // { // // public static void skipCurrentTag(XmlPullParser parser) // throws XmlPullParserException, IOException { // int outerDepth = parser.getDepth(); // int type; // while ((type=parser.next()) != XmlPullParser.END_DOCUMENT // && (type != XmlPullParser.END_TAG // || parser.getDepth() > outerDepth)) { // } // } // // } // Path: src/main/java/com/androzic/Preferences.java import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Map; import org.droidparts.widget.MultiSelectListPreference; import org.mapsforge.map.rendertheme.XmlRenderThemeStyleLayer; import org.mapsforge.map.rendertheme.XmlRenderThemeStyleMenu; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import android.annotation.SuppressLint; import android.app.Activity; import android.app.ProgressDialog; import android.app.backup.BackupManager; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.os.Parcel; import android.os.Parcelable; import android.preference.EditTextPreference; import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceGroup; import android.preference.PreferenceScreen; import android.support.v4.app.Fragment; import android.support.v4.app.ListFragment; import android.support.v4.preference.PreferenceFragment; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.text.TextUtils; import android.util.AttributeSet; import android.util.TypedValue; import android.util.Xml; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import com.androzic.map.online.TileProvider; import com.androzic.ui.SeekbarPreference; import com.androzic.util.XmlUtils; { header.breadCrumbShortTitleRes = tv.resourceId; } else { header.breadCrumbShortTitle = tv.string; } } header.iconRes = sa.getResourceId(R.styleable.PreferenceHeader_icon, 0); header.fragment = sa.getString(R.styleable.PreferenceHeader_fragment); header.help = sa.getResourceId(R.styleable.PreferenceHeader_help, 0); sa.recycle(); if (curBundle == null) { curBundle = new Bundle(); } final int innerDepth = parser.getDepth(); while ((type = parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > innerDepth)) { if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) { continue; } String innerNodeName = parser.getName(); if (innerNodeName.equals("extra")) { resources.parseBundleExtra(innerNodeName, attrs, curBundle);
XmlUtils.skipCurrentTag(parser);
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/labeler/MonthYearLabeler.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeLayoutView.java // public class TimeLayoutView extends LinearLayout implements TimeView { // protected long endTime, startTime; // protected String text; // protected boolean isCenter=false, isOutOfBounds=false; // protected TextView topView, bottomView; // // /** // * constructor // * // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param topTextSize text size of the top TextView in dps // * @param bottomTextSize text size of the bottom TextView in dps // * @param lineHeight LineHeight of the top TextView // */ // public TimeLayoutView(Context context, boolean isCenterView, int topTextSize, int bottomTextSize, float lineHeight) { // super(context); // setupView(context, isCenterView, topTextSize, bottomTextSize, lineHeight); // } // // /** // * Setting up the top TextView and bottom TextVew // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param topTextSize text size of the top TextView in dps // * @param bottomTextSize text size of the bottom TextView in dps // * @param lineHeight LineHeight of the top TextView // */ // protected void setupView(Context context, boolean isCenterView, int topTextSize, int bottomTextSize, float lineHeight) { // setOrientation(VERTICAL); // topView = new TextView(context); // topView.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.BOTTOM); // topView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, topTextSize); // bottomView = new TextView(context); // bottomView.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.TOP); // bottomView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, bottomTextSize); // topView.setLineSpacing(0, lineHeight); // if (isCenterView) { // isCenter = true; // topView.setTypeface(Typeface.DEFAULT_BOLD); // topView.setTextColor(0xFF333333); // bottomView.setTypeface(Typeface.DEFAULT_BOLD); // bottomView.setTextColor(0xFF444444); // topView.setPadding(0, 5-(int)(topTextSize/15.0), 0, 0); // } else { // topView.setPadding(0, 5, 0, 0); // topView.setTextColor(0xFF666666); // bottomView.setTextColor(0xFF666666); // } // addView(topView);addView(bottomView); // // } // // // public void setVals(TimeObject to) { // text = to.text.toString(); // setText(); // this.startTime = to.startTime; // this.endTime = to.endTime; // } // // // public void setVals(TimeView other) { // text = other.getTimeText().toString(); // setText(); // startTime = other.getStartTime(); // endTime = other.getEndTime(); // } // // /** // * sets the TextView texts by splitting the text into two // */ // protected void setText() { // String[] splitTime = text.split(" "); // topView.setText(splitTime[0]); // bottomView.setText(splitTime[1]); // } // // // public String getTimeText() { // return text; // } // // // public long getStartTime() { // return startTime; // } // // // public long getEndTime() { // return endTime; // } // // public boolean isOutOfBounds() { // return isOutOfBounds; // } // // public void setOutOfBounds(boolean outOfBounds) { // if (outOfBounds && !isOutOfBounds) { // topView.setTextColor(0x44666666); // bottomView.setTextColor(0x44666666); // } // else if (!outOfBounds && isOutOfBounds) { // topView.setTextColor(0xFF666666); // bottomView.setTextColor(0xFF666666); // } // isOutOfBounds = outOfBounds; // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // }
import android.content.Context; import com.googlecode.android.widgets.DateSlider.timeview.TimeLayoutView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView;
package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays months using TimeLayoutViews. */ public class MonthYearLabeler extends MonthLabeler { /** * The format string that specifies how to display the month. Since this class * uses a TimeLayoutView, the format string should consist of two strings * separated by a space. * * @param formatString */ public MonthYearLabeler(String formatString) { super(formatString); } @Override
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeLayoutView.java // public class TimeLayoutView extends LinearLayout implements TimeView { // protected long endTime, startTime; // protected String text; // protected boolean isCenter=false, isOutOfBounds=false; // protected TextView topView, bottomView; // // /** // * constructor // * // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param topTextSize text size of the top TextView in dps // * @param bottomTextSize text size of the bottom TextView in dps // * @param lineHeight LineHeight of the top TextView // */ // public TimeLayoutView(Context context, boolean isCenterView, int topTextSize, int bottomTextSize, float lineHeight) { // super(context); // setupView(context, isCenterView, topTextSize, bottomTextSize, lineHeight); // } // // /** // * Setting up the top TextView and bottom TextVew // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param topTextSize text size of the top TextView in dps // * @param bottomTextSize text size of the bottom TextView in dps // * @param lineHeight LineHeight of the top TextView // */ // protected void setupView(Context context, boolean isCenterView, int topTextSize, int bottomTextSize, float lineHeight) { // setOrientation(VERTICAL); // topView = new TextView(context); // topView.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.BOTTOM); // topView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, topTextSize); // bottomView = new TextView(context); // bottomView.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.TOP); // bottomView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, bottomTextSize); // topView.setLineSpacing(0, lineHeight); // if (isCenterView) { // isCenter = true; // topView.setTypeface(Typeface.DEFAULT_BOLD); // topView.setTextColor(0xFF333333); // bottomView.setTypeface(Typeface.DEFAULT_BOLD); // bottomView.setTextColor(0xFF444444); // topView.setPadding(0, 5-(int)(topTextSize/15.0), 0, 0); // } else { // topView.setPadding(0, 5, 0, 0); // topView.setTextColor(0xFF666666); // bottomView.setTextColor(0xFF666666); // } // addView(topView);addView(bottomView); // // } // // // public void setVals(TimeObject to) { // text = to.text.toString(); // setText(); // this.startTime = to.startTime; // this.endTime = to.endTime; // } // // // public void setVals(TimeView other) { // text = other.getTimeText().toString(); // setText(); // startTime = other.getStartTime(); // endTime = other.getEndTime(); // } // // /** // * sets the TextView texts by splitting the text into two // */ // protected void setText() { // String[] splitTime = text.split(" "); // topView.setText(splitTime[0]); // bottomView.setText(splitTime[1]); // } // // // public String getTimeText() { // return text; // } // // // public long getStartTime() { // return startTime; // } // // // public long getEndTime() { // return endTime; // } // // public boolean isOutOfBounds() { // return isOutOfBounds; // } // // public void setOutOfBounds(boolean outOfBounds) { // if (outOfBounds && !isOutOfBounds) { // topView.setTextColor(0x44666666); // bottomView.setTextColor(0x44666666); // } // else if (!outOfBounds && isOutOfBounds) { // topView.setTextColor(0xFF666666); // bottomView.setTextColor(0xFF666666); // } // isOutOfBounds = outOfBounds; // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/labeler/MonthYearLabeler.java import android.content.Context; import com.googlecode.android.widgets.DateSlider.timeview.TimeLayoutView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView; package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays months using TimeLayoutViews. */ public class MonthYearLabeler extends MonthLabeler { /** * The format string that specifies how to display the month. Since this class * uses a TimeLayoutView, the format string should consist of two strings * separated by a space. * * @param formatString */ public MonthYearLabeler(String formatString) { super(formatString); } @Override
public TimeView createView(Context context, boolean isCenterView) {
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/labeler/MonthYearLabeler.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeLayoutView.java // public class TimeLayoutView extends LinearLayout implements TimeView { // protected long endTime, startTime; // protected String text; // protected boolean isCenter=false, isOutOfBounds=false; // protected TextView topView, bottomView; // // /** // * constructor // * // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param topTextSize text size of the top TextView in dps // * @param bottomTextSize text size of the bottom TextView in dps // * @param lineHeight LineHeight of the top TextView // */ // public TimeLayoutView(Context context, boolean isCenterView, int topTextSize, int bottomTextSize, float lineHeight) { // super(context); // setupView(context, isCenterView, topTextSize, bottomTextSize, lineHeight); // } // // /** // * Setting up the top TextView and bottom TextVew // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param topTextSize text size of the top TextView in dps // * @param bottomTextSize text size of the bottom TextView in dps // * @param lineHeight LineHeight of the top TextView // */ // protected void setupView(Context context, boolean isCenterView, int topTextSize, int bottomTextSize, float lineHeight) { // setOrientation(VERTICAL); // topView = new TextView(context); // topView.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.BOTTOM); // topView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, topTextSize); // bottomView = new TextView(context); // bottomView.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.TOP); // bottomView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, bottomTextSize); // topView.setLineSpacing(0, lineHeight); // if (isCenterView) { // isCenter = true; // topView.setTypeface(Typeface.DEFAULT_BOLD); // topView.setTextColor(0xFF333333); // bottomView.setTypeface(Typeface.DEFAULT_BOLD); // bottomView.setTextColor(0xFF444444); // topView.setPadding(0, 5-(int)(topTextSize/15.0), 0, 0); // } else { // topView.setPadding(0, 5, 0, 0); // topView.setTextColor(0xFF666666); // bottomView.setTextColor(0xFF666666); // } // addView(topView);addView(bottomView); // // } // // // public void setVals(TimeObject to) { // text = to.text.toString(); // setText(); // this.startTime = to.startTime; // this.endTime = to.endTime; // } // // // public void setVals(TimeView other) { // text = other.getTimeText().toString(); // setText(); // startTime = other.getStartTime(); // endTime = other.getEndTime(); // } // // /** // * sets the TextView texts by splitting the text into two // */ // protected void setText() { // String[] splitTime = text.split(" "); // topView.setText(splitTime[0]); // bottomView.setText(splitTime[1]); // } // // // public String getTimeText() { // return text; // } // // // public long getStartTime() { // return startTime; // } // // // public long getEndTime() { // return endTime; // } // // public boolean isOutOfBounds() { // return isOutOfBounds; // } // // public void setOutOfBounds(boolean outOfBounds) { // if (outOfBounds && !isOutOfBounds) { // topView.setTextColor(0x44666666); // bottomView.setTextColor(0x44666666); // } // else if (!outOfBounds && isOutOfBounds) { // topView.setTextColor(0xFF666666); // bottomView.setTextColor(0xFF666666); // } // isOutOfBounds = outOfBounds; // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // }
import android.content.Context; import com.googlecode.android.widgets.DateSlider.timeview.TimeLayoutView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView;
package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays months using TimeLayoutViews. */ public class MonthYearLabeler extends MonthLabeler { /** * The format string that specifies how to display the month. Since this class * uses a TimeLayoutView, the format string should consist of two strings * separated by a space. * * @param formatString */ public MonthYearLabeler(String formatString) { super(formatString); } @Override public TimeView createView(Context context, boolean isCenterView) {
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeLayoutView.java // public class TimeLayoutView extends LinearLayout implements TimeView { // protected long endTime, startTime; // protected String text; // protected boolean isCenter=false, isOutOfBounds=false; // protected TextView topView, bottomView; // // /** // * constructor // * // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param topTextSize text size of the top TextView in dps // * @param bottomTextSize text size of the bottom TextView in dps // * @param lineHeight LineHeight of the top TextView // */ // public TimeLayoutView(Context context, boolean isCenterView, int topTextSize, int bottomTextSize, float lineHeight) { // super(context); // setupView(context, isCenterView, topTextSize, bottomTextSize, lineHeight); // } // // /** // * Setting up the top TextView and bottom TextVew // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param topTextSize text size of the top TextView in dps // * @param bottomTextSize text size of the bottom TextView in dps // * @param lineHeight LineHeight of the top TextView // */ // protected void setupView(Context context, boolean isCenterView, int topTextSize, int bottomTextSize, float lineHeight) { // setOrientation(VERTICAL); // topView = new TextView(context); // topView.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.BOTTOM); // topView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, topTextSize); // bottomView = new TextView(context); // bottomView.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.TOP); // bottomView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, bottomTextSize); // topView.setLineSpacing(0, lineHeight); // if (isCenterView) { // isCenter = true; // topView.setTypeface(Typeface.DEFAULT_BOLD); // topView.setTextColor(0xFF333333); // bottomView.setTypeface(Typeface.DEFAULT_BOLD); // bottomView.setTextColor(0xFF444444); // topView.setPadding(0, 5-(int)(topTextSize/15.0), 0, 0); // } else { // topView.setPadding(0, 5, 0, 0); // topView.setTextColor(0xFF666666); // bottomView.setTextColor(0xFF666666); // } // addView(topView);addView(bottomView); // // } // // // public void setVals(TimeObject to) { // text = to.text.toString(); // setText(); // this.startTime = to.startTime; // this.endTime = to.endTime; // } // // // public void setVals(TimeView other) { // text = other.getTimeText().toString(); // setText(); // startTime = other.getStartTime(); // endTime = other.getEndTime(); // } // // /** // * sets the TextView texts by splitting the text into two // */ // protected void setText() { // String[] splitTime = text.split(" "); // topView.setText(splitTime[0]); // bottomView.setText(splitTime[1]); // } // // // public String getTimeText() { // return text; // } // // // public long getStartTime() { // return startTime; // } // // // public long getEndTime() { // return endTime; // } // // public boolean isOutOfBounds() { // return isOutOfBounds; // } // // public void setOutOfBounds(boolean outOfBounds) { // if (outOfBounds && !isOutOfBounds) { // topView.setTextColor(0x44666666); // bottomView.setTextColor(0x44666666); // } // else if (!outOfBounds && isOutOfBounds) { // topView.setTextColor(0xFF666666); // bottomView.setTextColor(0xFF666666); // } // isOutOfBounds = outOfBounds; // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/labeler/MonthYearLabeler.java import android.content.Context; import com.googlecode.android.widgets.DateSlider.timeview.TimeLayoutView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView; package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays months using TimeLayoutViews. */ public class MonthYearLabeler extends MonthLabeler { /** * The format string that specifies how to display the month. Since this class * uses a TimeLayoutView, the format string should consist of two strings * separated by a space. * * @param formatString */ public MonthYearLabeler(String formatString) { super(formatString); } @Override public TimeView createView(Context context, boolean isCenterView) {
return new TimeLayoutView(context, isCenterView, 25, 8, 0.95f);
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/labeler/YearLabeler.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // }
import java.util.Calendar; import com.googlecode.android.widgets.DateSlider.TimeObject;
package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays months */ public class YearLabeler extends Labeler { private final String mFormatString; public YearLabeler(String formatString) { super(200, 60); mFormatString = formatString; } @Override
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/labeler/YearLabeler.java import java.util.Calendar; import com.googlecode.android.widgets.DateSlider.TimeObject; package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays months */ public class YearLabeler extends Labeler { private final String mFormatString; public YearLabeler(String formatString) { super(200, 60); mFormatString = formatString; } @Override
public TimeObject add(long time, int val) {
andreynovikov/Androzic
src/main/java/com/androzic/ActionsReceiver.java
// Path: src/main/java/com/androzic/waypoint/CoordinatesReceived.java // public class CoordinatesReceived extends DialogFragment // { // private double lat, lon; // // @NonNull // @SuppressLint("InflateParams") // @Override // public Dialog onCreateDialog(Bundle savedInstanceState) // { // AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // builder.setTitle(getString(R.string.information_name)); // View view = getActivity().getLayoutInflater().inflate(R.layout.dlg_coordinates_received, null); // builder.setView(view); // builder.setPositiveButton(R.string.menu_visible, new DialogInterface.OnClickListener() { // public void onClick(DialogInterface dialog, int whichButton) // { // Androzic application = Androzic.getApplication(); // application.ensureVisible(lat, lon); // CoordinatesReceived.this.dismiss(); // } // }); // // Bundle args = getArguments(); // // String title = args.getString("title"); // String sender = args.getString("sender"); // lat = args.getDouble("lat"); // lon = args.getDouble("lon"); // // if (! "".equals(title)) // builder.setTitle(title); // else // builder.setTitle(R.string.coordinates_name); // // Androzic application = Androzic.getApplication(); // double[] ll = application.getLocation(); // // ((TextView) view.findViewById(R.id.message)).setText(getString(R.string.new_coordinates, sender)); // // String coords = StringFormatter.coordinates(" ", lat, lon); // ((TextView) view.findViewById(R.id.coordinates)).setText(coords); // // double dist = Geo.distance(ll[0], ll[1], lat, lon); // double bearing = Geo.bearing(ll[0], ll[1], lat, lon); // bearing = application.fixDeclination(bearing); // String distance = StringFormatter.distanceH(dist)+" "+StringFormatter.angleH(bearing); // ((TextView) view.findViewById(R.id.distance)).setText(distance); // // return builder.create(); // } // }
import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; import com.androzic.waypoint.CoordinatesReceived;
/* * Androzic - android navigation client that uses OziExplorer maps (ozf2, ozfx3). * Copyright (C) 2010-2012 Andrey Novikov <http://andreynovikov.info/> * * This file is part of Androzic application. * * Androzic is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * Androzic is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with Androzic. If not, see <http://www.gnu.org/licenses/>. */ package com.androzic; public class ActionsReceiver extends BroadcastReceiver { private static final String TAG = "ActionsReceiver"; @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); Log.i(TAG, "Action received: " + action); Intent activity = new Intent(context, MainActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); if (action.equals("com.androzic.COORDINATES_RECEIVED")) { activity.putExtras(intent);
// Path: src/main/java/com/androzic/waypoint/CoordinatesReceived.java // public class CoordinatesReceived extends DialogFragment // { // private double lat, lon; // // @NonNull // @SuppressLint("InflateParams") // @Override // public Dialog onCreateDialog(Bundle savedInstanceState) // { // AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // builder.setTitle(getString(R.string.information_name)); // View view = getActivity().getLayoutInflater().inflate(R.layout.dlg_coordinates_received, null); // builder.setView(view); // builder.setPositiveButton(R.string.menu_visible, new DialogInterface.OnClickListener() { // public void onClick(DialogInterface dialog, int whichButton) // { // Androzic application = Androzic.getApplication(); // application.ensureVisible(lat, lon); // CoordinatesReceived.this.dismiss(); // } // }); // // Bundle args = getArguments(); // // String title = args.getString("title"); // String sender = args.getString("sender"); // lat = args.getDouble("lat"); // lon = args.getDouble("lon"); // // if (! "".equals(title)) // builder.setTitle(title); // else // builder.setTitle(R.string.coordinates_name); // // Androzic application = Androzic.getApplication(); // double[] ll = application.getLocation(); // // ((TextView) view.findViewById(R.id.message)).setText(getString(R.string.new_coordinates, sender)); // // String coords = StringFormatter.coordinates(" ", lat, lon); // ((TextView) view.findViewById(R.id.coordinates)).setText(coords); // // double dist = Geo.distance(ll[0], ll[1], lat, lon); // double bearing = Geo.bearing(ll[0], ll[1], lat, lon); // bearing = application.fixDeclination(bearing); // String distance = StringFormatter.distanceH(dist)+" "+StringFormatter.angleH(bearing); // ((TextView) view.findViewById(R.id.distance)).setText(distance); // // return builder.create(); // } // } // Path: src/main/java/com/androzic/ActionsReceiver.java import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; import com.androzic.waypoint.CoordinatesReceived; /* * Androzic - android navigation client that uses OziExplorer maps (ozf2, ozfx3). * Copyright (C) 2010-2012 Andrey Novikov <http://andreynovikov.info/> * * This file is part of Androzic application. * * Androzic is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * Androzic is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with Androzic. If not, see <http://www.gnu.org/licenses/>. */ package com.androzic; public class ActionsReceiver extends BroadcastReceiver { private static final String TAG = "ActionsReceiver"; @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); Log.i(TAG, "Action received: " + action); Intent activity = new Intent(context, MainActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); if (action.equals("com.androzic.COORDINATES_RECEIVED")) { activity.putExtras(intent);
activity.putExtra(MainActivity.SHOW_FRAGMENT, CoordinatesReceived.class);
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/timeview/DayTimeLayoutView.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // }
import java.util.Calendar; import android.content.Context; import com.googlecode.android.widgets.DateSlider.TimeObject;
package com.googlecode.android.widgets.DateSlider.timeview; /** * This is a subclass of the TimeLayoutView that represents a day. It uses * a different color to distinguish Sundays from other days. */ public class DayTimeLayoutView extends TimeLayoutView { protected boolean isSunday=false; /** * Constructor * @param context * @param isCenterView true if the element is the centered view in the ScrollLayout * @param topTextSize text size of the top TextView in dps * @param bottomTextSize text size of the bottom TextView in dps * @param lineHeight LineHeight of the top TextView */ public DayTimeLayoutView(Context context, boolean isCenterView, int topTextSize, int bottomTextSize, float lineHeight) { super(context, isCenterView, topTextSize, bottomTextSize, lineHeight); } @Override
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/DayTimeLayoutView.java import java.util.Calendar; import android.content.Context; import com.googlecode.android.widgets.DateSlider.TimeObject; package com.googlecode.android.widgets.DateSlider.timeview; /** * This is a subclass of the TimeLayoutView that represents a day. It uses * a different color to distinguish Sundays from other days. */ public class DayTimeLayoutView extends TimeLayoutView { protected boolean isSunday=false; /** * Constructor * @param context * @param isCenterView true if the element is the centered view in the ScrollLayout * @param topTextSize text size of the top TextView in dps * @param bottomTextSize text size of the bottom TextView in dps * @param lineHeight LineHeight of the top TextView */ public DayTimeLayoutView(Context context, boolean isCenterView, int topTextSize, int bottomTextSize, float lineHeight) { super(context, isCenterView, topTextSize, bottomTextSize, lineHeight); } @Override
public void setVals(TimeObject to) {
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/labeler/Util.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // }
import java.util.Calendar; import com.googlecode.android.widgets.DateSlider.TimeObject;
package com.googlecode.android.widgets.DateSlider.labeler; /** * A bunch of static helpers for manipulating dates and times. There are two * types of methods -- add*() methods that add a number of units to a time * and return the result as a Calendar, and get*() objects that take a * Calendar object and a format string and produce the appropriate TimeObject. */ class Util { public static Calendar addYears(long time, int years) { return add(time, years, Calendar.YEAR); } public static Calendar addMonths(long time, int months) { return add(time, months, Calendar.MONTH); } public static Calendar addWeeks(long time, int days) { return add(time, days, Calendar.WEEK_OF_YEAR); } public static Calendar addDays(long time, int days) { return add(time, days, Calendar.DAY_OF_MONTH); } public static Calendar addHours(long time, int hours) { return add(time, hours, Calendar.HOUR_OF_DAY); } public static Calendar addMinutes(long time, int minutes) { return add(time, minutes, Calendar.MINUTE); } public static Calendar addMinutes(long time, int minutes, int minInterval) { return add(time, minutes*minInterval, Calendar.MINUTE); }
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/labeler/Util.java import java.util.Calendar; import com.googlecode.android.widgets.DateSlider.TimeObject; package com.googlecode.android.widgets.DateSlider.labeler; /** * A bunch of static helpers for manipulating dates and times. There are two * types of methods -- add*() methods that add a number of units to a time * and return the result as a Calendar, and get*() objects that take a * Calendar object and a format string and produce the appropriate TimeObject. */ class Util { public static Calendar addYears(long time, int years) { return add(time, years, Calendar.YEAR); } public static Calendar addMonths(long time, int months) { return add(time, months, Calendar.MONTH); } public static Calendar addWeeks(long time, int days) { return add(time, days, Calendar.WEEK_OF_YEAR); } public static Calendar addDays(long time, int days) { return add(time, days, Calendar.DAY_OF_MONTH); } public static Calendar addHours(long time, int hours) { return add(time, hours, Calendar.HOUR_OF_DAY); } public static Calendar addMinutes(long time, int minutes) { return add(time, minutes, Calendar.MINUTE); } public static Calendar addMinutes(long time, int minutes, int minInterval) { return add(time, minutes*minInterval, Calendar.MINUTE); }
public static TimeObject getYear(Calendar c, String formatString) {
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/labeler/DayDateLabeler.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/DayTimeLayoutView.java // public class DayTimeLayoutView extends TimeLayoutView { // // protected boolean isSunday=false; // // /** // * Constructor // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param topTextSize text size of the top TextView in dps // * @param bottomTextSize text size of the bottom TextView in dps // * @param lineHeight LineHeight of the top TextView // */ // public DayTimeLayoutView(Context context, boolean isCenterView, // int topTextSize, int bottomTextSize, float lineHeight) { // super(context, isCenterView, topTextSize, bottomTextSize, lineHeight); // } // // @Override // public void setVals(TimeObject to) { // super.setVals(to); // Calendar c = Calendar.getInstance(); // c.setTimeInMillis(to.endTime); // if (c.get(Calendar.DAY_OF_WEEK)==Calendar.SUNDAY && !isSunday) { // isSunday=true; // colorMeSunday(); // } else if (isSunday && c.get(Calendar.DAY_OF_WEEK)!=Calendar.SUNDAY) { // isSunday=false; // colorMeWorkday(); // } // } // // /** // * this method is called when the current View takes a Sunday as time unit // */ // protected void colorMeSunday() { // if (isOutOfBounds) return; // if (isCenter) { // bottomView.setTextColor(0xFF773333); // topView.setTextColor(0xFF553333); // } // else { // bottomView.setTextColor(0xFF442222); // topView.setTextColor(0xFF553333); // } // } // // // /** // * this method is called when the current View takes no Sunday as time unit // */ // protected void colorMeWorkday() { // if (isOutOfBounds) return; // if (isCenter) { // topView.setTextColor(0xFF333333); // bottomView.setTextColor(0xFF444444); // } else { // topView.setTextColor(0xFF666666); // bottomView.setTextColor(0xFF666666); // } // } // // @Override // public void setVals(TimeView other) { // super.setVals(other); // DayTimeLayoutView otherDay = (DayTimeLayoutView) other; // if (otherDay.isSunday && !isSunday) { // isSunday = true; // colorMeSunday(); // } else if (isSunday && !otherDay.isSunday) { // isSunday = false; // colorMeWorkday(); // } // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // }
import android.content.Context; import com.googlecode.android.widgets.DateSlider.timeview.DayTimeLayoutView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView;
package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays days using DayTimeLayoutViews. */ public class DayDateLabeler extends DayLabeler { /** * The format string that specifies how to display the day. Since this class * uses a DayTimeLayoutView, the format string should consist of two strings * separated by a space. * * @param formatString */ public DayDateLabeler(String formatString) { super(formatString); } @Override
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/DayTimeLayoutView.java // public class DayTimeLayoutView extends TimeLayoutView { // // protected boolean isSunday=false; // // /** // * Constructor // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param topTextSize text size of the top TextView in dps // * @param bottomTextSize text size of the bottom TextView in dps // * @param lineHeight LineHeight of the top TextView // */ // public DayTimeLayoutView(Context context, boolean isCenterView, // int topTextSize, int bottomTextSize, float lineHeight) { // super(context, isCenterView, topTextSize, bottomTextSize, lineHeight); // } // // @Override // public void setVals(TimeObject to) { // super.setVals(to); // Calendar c = Calendar.getInstance(); // c.setTimeInMillis(to.endTime); // if (c.get(Calendar.DAY_OF_WEEK)==Calendar.SUNDAY && !isSunday) { // isSunday=true; // colorMeSunday(); // } else if (isSunday && c.get(Calendar.DAY_OF_WEEK)!=Calendar.SUNDAY) { // isSunday=false; // colorMeWorkday(); // } // } // // /** // * this method is called when the current View takes a Sunday as time unit // */ // protected void colorMeSunday() { // if (isOutOfBounds) return; // if (isCenter) { // bottomView.setTextColor(0xFF773333); // topView.setTextColor(0xFF553333); // } // else { // bottomView.setTextColor(0xFF442222); // topView.setTextColor(0xFF553333); // } // } // // // /** // * this method is called when the current View takes no Sunday as time unit // */ // protected void colorMeWorkday() { // if (isOutOfBounds) return; // if (isCenter) { // topView.setTextColor(0xFF333333); // bottomView.setTextColor(0xFF444444); // } else { // topView.setTextColor(0xFF666666); // bottomView.setTextColor(0xFF666666); // } // } // // @Override // public void setVals(TimeView other) { // super.setVals(other); // DayTimeLayoutView otherDay = (DayTimeLayoutView) other; // if (otherDay.isSunday && !isSunday) { // isSunday = true; // colorMeSunday(); // } else if (isSunday && !otherDay.isSunday) { // isSunday = false; // colorMeWorkday(); // } // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/labeler/DayDateLabeler.java import android.content.Context; import com.googlecode.android.widgets.DateSlider.timeview.DayTimeLayoutView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView; package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays days using DayTimeLayoutViews. */ public class DayDateLabeler extends DayLabeler { /** * The format string that specifies how to display the day. Since this class * uses a DayTimeLayoutView, the format string should consist of two strings * separated by a space. * * @param formatString */ public DayDateLabeler(String formatString) { super(formatString); } @Override
public TimeView createView(Context context, boolean isCenterView) {
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/labeler/DayDateLabeler.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/DayTimeLayoutView.java // public class DayTimeLayoutView extends TimeLayoutView { // // protected boolean isSunday=false; // // /** // * Constructor // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param topTextSize text size of the top TextView in dps // * @param bottomTextSize text size of the bottom TextView in dps // * @param lineHeight LineHeight of the top TextView // */ // public DayTimeLayoutView(Context context, boolean isCenterView, // int topTextSize, int bottomTextSize, float lineHeight) { // super(context, isCenterView, topTextSize, bottomTextSize, lineHeight); // } // // @Override // public void setVals(TimeObject to) { // super.setVals(to); // Calendar c = Calendar.getInstance(); // c.setTimeInMillis(to.endTime); // if (c.get(Calendar.DAY_OF_WEEK)==Calendar.SUNDAY && !isSunday) { // isSunday=true; // colorMeSunday(); // } else if (isSunday && c.get(Calendar.DAY_OF_WEEK)!=Calendar.SUNDAY) { // isSunday=false; // colorMeWorkday(); // } // } // // /** // * this method is called when the current View takes a Sunday as time unit // */ // protected void colorMeSunday() { // if (isOutOfBounds) return; // if (isCenter) { // bottomView.setTextColor(0xFF773333); // topView.setTextColor(0xFF553333); // } // else { // bottomView.setTextColor(0xFF442222); // topView.setTextColor(0xFF553333); // } // } // // // /** // * this method is called when the current View takes no Sunday as time unit // */ // protected void colorMeWorkday() { // if (isOutOfBounds) return; // if (isCenter) { // topView.setTextColor(0xFF333333); // bottomView.setTextColor(0xFF444444); // } else { // topView.setTextColor(0xFF666666); // bottomView.setTextColor(0xFF666666); // } // } // // @Override // public void setVals(TimeView other) { // super.setVals(other); // DayTimeLayoutView otherDay = (DayTimeLayoutView) other; // if (otherDay.isSunday && !isSunday) { // isSunday = true; // colorMeSunday(); // } else if (isSunday && !otherDay.isSunday) { // isSunday = false; // colorMeWorkday(); // } // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // }
import android.content.Context; import com.googlecode.android.widgets.DateSlider.timeview.DayTimeLayoutView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView;
package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays days using DayTimeLayoutViews. */ public class DayDateLabeler extends DayLabeler { /** * The format string that specifies how to display the day. Since this class * uses a DayTimeLayoutView, the format string should consist of two strings * separated by a space. * * @param formatString */ public DayDateLabeler(String formatString) { super(formatString); } @Override public TimeView createView(Context context, boolean isCenterView) {
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/DayTimeLayoutView.java // public class DayTimeLayoutView extends TimeLayoutView { // // protected boolean isSunday=false; // // /** // * Constructor // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param topTextSize text size of the top TextView in dps // * @param bottomTextSize text size of the bottom TextView in dps // * @param lineHeight LineHeight of the top TextView // */ // public DayTimeLayoutView(Context context, boolean isCenterView, // int topTextSize, int bottomTextSize, float lineHeight) { // super(context, isCenterView, topTextSize, bottomTextSize, lineHeight); // } // // @Override // public void setVals(TimeObject to) { // super.setVals(to); // Calendar c = Calendar.getInstance(); // c.setTimeInMillis(to.endTime); // if (c.get(Calendar.DAY_OF_WEEK)==Calendar.SUNDAY && !isSunday) { // isSunday=true; // colorMeSunday(); // } else if (isSunday && c.get(Calendar.DAY_OF_WEEK)!=Calendar.SUNDAY) { // isSunday=false; // colorMeWorkday(); // } // } // // /** // * this method is called when the current View takes a Sunday as time unit // */ // protected void colorMeSunday() { // if (isOutOfBounds) return; // if (isCenter) { // bottomView.setTextColor(0xFF773333); // topView.setTextColor(0xFF553333); // } // else { // bottomView.setTextColor(0xFF442222); // topView.setTextColor(0xFF553333); // } // } // // // /** // * this method is called when the current View takes no Sunday as time unit // */ // protected void colorMeWorkday() { // if (isOutOfBounds) return; // if (isCenter) { // topView.setTextColor(0xFF333333); // bottomView.setTextColor(0xFF444444); // } else { // topView.setTextColor(0xFF666666); // bottomView.setTextColor(0xFF666666); // } // } // // @Override // public void setVals(TimeView other) { // super.setVals(other); // DayTimeLayoutView otherDay = (DayTimeLayoutView) other; // if (otherDay.isSunday && !isSunday) { // isSunday = true; // colorMeSunday(); // } else if (isSunday && !otherDay.isSunday) { // isSunday = false; // colorMeWorkday(); // } // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/labeler/DayDateLabeler.java import android.content.Context; import com.googlecode.android.widgets.DateSlider.timeview.DayTimeLayoutView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView; package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays days using DayTimeLayoutViews. */ public class DayDateLabeler extends DayLabeler { /** * The format string that specifies how to display the day. Since this class * uses a DayTimeLayoutView, the format string should consist of two strings * separated by a space. * * @param formatString */ public DayDateLabeler(String formatString) { super(formatString); } @Override public TimeView createView(Context context, boolean isCenterView) {
return new DayTimeLayoutView(context, isCenterView,30,8,0.8f);
EuregJUG-Maas-Rhine/site
src/test/java/eu/euregjug/site/posts/PostApiControllerTest.java
// Path: src/test/java/eu/euregjug/site/config/SecurityTestConfig.java // @Configuration // @Profile("test") // public class SecurityTestConfig extends WebSecurityConfigurerAdapter { // // @Override // protected void configure(HttpSecurity http) throws Exception { // http.csrf().disable(); // } // } // // Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Format { // // asciidoc, markdown // } // // Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Status { // // draft, published, hidden // }
import eu.euregjug.site.config.SecurityTestConfig; import com.fasterxml.jackson.databind.ObjectMapper; import eu.euregjug.site.posts.PostEntity.Format; import eu.euregjug.site.posts.PostEntity.Status; import java.util.Arrays; import java.util.Date; import java.util.Locale; import java.util.Optional; import org.joor.Reflect; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.json.JacksonTester; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import org.springframework.data.web.config.EnableSpringDataWebSupport; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasSize; import static org.mockito.Matchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; import static org.springframework.http.MediaType.APPLICATION_JSON; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest; import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
/* * Copyright 2016 EuregJUG. * * Licensed 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 eu.euregjug.site.posts; /** * @author Michael J. Simons, 2016-07-13 */ @RunWith(SpringRunner.class) @ActiveProfiles("test") @WebMvcTest(PostApiController.class) @EnableSpringDataWebSupport // Needed to enable resolving of Pageable and other parameters
// Path: src/test/java/eu/euregjug/site/config/SecurityTestConfig.java // @Configuration // @Profile("test") // public class SecurityTestConfig extends WebSecurityConfigurerAdapter { // // @Override // protected void configure(HttpSecurity http) throws Exception { // http.csrf().disable(); // } // } // // Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Format { // // asciidoc, markdown // } // // Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Status { // // draft, published, hidden // } // Path: src/test/java/eu/euregjug/site/posts/PostApiControllerTest.java import eu.euregjug.site.config.SecurityTestConfig; import com.fasterxml.jackson.databind.ObjectMapper; import eu.euregjug.site.posts.PostEntity.Format; import eu.euregjug.site.posts.PostEntity.Status; import java.util.Arrays; import java.util.Date; import java.util.Locale; import java.util.Optional; import org.joor.Reflect; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.json.JacksonTester; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import org.springframework.data.web.config.EnableSpringDataWebSupport; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasSize; import static org.mockito.Matchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; import static org.springframework.http.MediaType.APPLICATION_JSON; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest; import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; /* * Copyright 2016 EuregJUG. * * Licensed 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 eu.euregjug.site.posts; /** * @author Michael J. Simons, 2016-07-13 */ @RunWith(SpringRunner.class) @ActiveProfiles("test") @WebMvcTest(PostApiController.class) @EnableSpringDataWebSupport // Needed to enable resolving of Pageable and other parameters
@Import(SecurityTestConfig.class) // Needed to get rid of default CSRF protection
EuregJUG-Maas-Rhine/site
src/test/java/eu/euregjug/site/posts/PostApiControllerTest.java
// Path: src/test/java/eu/euregjug/site/config/SecurityTestConfig.java // @Configuration // @Profile("test") // public class SecurityTestConfig extends WebSecurityConfigurerAdapter { // // @Override // protected void configure(HttpSecurity http) throws Exception { // http.csrf().disable(); // } // } // // Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Format { // // asciidoc, markdown // } // // Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Status { // // draft, published, hidden // }
import eu.euregjug.site.config.SecurityTestConfig; import com.fasterxml.jackson.databind.ObjectMapper; import eu.euregjug.site.posts.PostEntity.Format; import eu.euregjug.site.posts.PostEntity.Status; import java.util.Arrays; import java.util.Date; import java.util.Locale; import java.util.Optional; import org.joor.Reflect; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.json.JacksonTester; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import org.springframework.data.web.config.EnableSpringDataWebSupport; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasSize; import static org.mockito.Matchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; import static org.springframework.http.MediaType.APPLICATION_JSON; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest; import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
/* * Copyright 2016 EuregJUG. * * Licensed 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 eu.euregjug.site.posts; /** * @author Michael J. Simons, 2016-07-13 */ @RunWith(SpringRunner.class) @ActiveProfiles("test") @WebMvcTest(PostApiController.class) @EnableSpringDataWebSupport // Needed to enable resolving of Pageable and other parameters @Import(SecurityTestConfig.class) // Needed to get rid of default CSRF protection @AutoConfigureRestDocs( outputDir = "target/generated-snippets", uriHost = "euregjug.eu", uriPort = 80 ) public class PostApiControllerTest { @Autowired private MockMvc mvc; @MockBean private PostRepository postRepository; @MockBean private PostIndexService postIndexService; @Autowired private ObjectMapper objectMapper; private JacksonTester<PostEntity> json; @Before public void setup() { JacksonTester.initFields(this, objectMapper); } @Test public void createShouldWork() throws Exception { final PostEntity postEntity1 = new PostEntity(new Date(), "new-site-is-live1", "New site is live", "Welcome to the new EuregJUG website. We have switched off the old static pages and replaced it with a little application based on Hibernate, Spring Data JPA, Spring Boot and Thymeleaf."); postEntity1.setLocale(new Locale("de", "DE"));
// Path: src/test/java/eu/euregjug/site/config/SecurityTestConfig.java // @Configuration // @Profile("test") // public class SecurityTestConfig extends WebSecurityConfigurerAdapter { // // @Override // protected void configure(HttpSecurity http) throws Exception { // http.csrf().disable(); // } // } // // Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Format { // // asciidoc, markdown // } // // Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Status { // // draft, published, hidden // } // Path: src/test/java/eu/euregjug/site/posts/PostApiControllerTest.java import eu.euregjug.site.config.SecurityTestConfig; import com.fasterxml.jackson.databind.ObjectMapper; import eu.euregjug.site.posts.PostEntity.Format; import eu.euregjug.site.posts.PostEntity.Status; import java.util.Arrays; import java.util.Date; import java.util.Locale; import java.util.Optional; import org.joor.Reflect; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.json.JacksonTester; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import org.springframework.data.web.config.EnableSpringDataWebSupport; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasSize; import static org.mockito.Matchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; import static org.springframework.http.MediaType.APPLICATION_JSON; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest; import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; /* * Copyright 2016 EuregJUG. * * Licensed 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 eu.euregjug.site.posts; /** * @author Michael J. Simons, 2016-07-13 */ @RunWith(SpringRunner.class) @ActiveProfiles("test") @WebMvcTest(PostApiController.class) @EnableSpringDataWebSupport // Needed to enable resolving of Pageable and other parameters @Import(SecurityTestConfig.class) // Needed to get rid of default CSRF protection @AutoConfigureRestDocs( outputDir = "target/generated-snippets", uriHost = "euregjug.eu", uriPort = 80 ) public class PostApiControllerTest { @Autowired private MockMvc mvc; @MockBean private PostRepository postRepository; @MockBean private PostIndexService postIndexService; @Autowired private ObjectMapper objectMapper; private JacksonTester<PostEntity> json; @Before public void setup() { JacksonTester.initFields(this, objectMapper); } @Test public void createShouldWork() throws Exception { final PostEntity postEntity1 = new PostEntity(new Date(), "new-site-is-live1", "New site is live", "Welcome to the new EuregJUG website. We have switched off the old static pages and replaced it with a little application based on Hibernate, Spring Data JPA, Spring Boot and Thymeleaf."); postEntity1.setLocale(new Locale("de", "DE"));
postEntity1.setStatus(Status.published);
EuregJUG-Maas-Rhine/site
src/test/java/eu/euregjug/site/posts/PostApiControllerTest.java
// Path: src/test/java/eu/euregjug/site/config/SecurityTestConfig.java // @Configuration // @Profile("test") // public class SecurityTestConfig extends WebSecurityConfigurerAdapter { // // @Override // protected void configure(HttpSecurity http) throws Exception { // http.csrf().disable(); // } // } // // Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Format { // // asciidoc, markdown // } // // Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Status { // // draft, published, hidden // }
import eu.euregjug.site.config.SecurityTestConfig; import com.fasterxml.jackson.databind.ObjectMapper; import eu.euregjug.site.posts.PostEntity.Format; import eu.euregjug.site.posts.PostEntity.Status; import java.util.Arrays; import java.util.Date; import java.util.Locale; import java.util.Optional; import org.joor.Reflect; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.json.JacksonTester; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import org.springframework.data.web.config.EnableSpringDataWebSupport; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasSize; import static org.mockito.Matchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; import static org.springframework.http.MediaType.APPLICATION_JSON; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest; import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
@Test public void searchShouldWork() throws Exception { final PostEntity p1 = Reflect.on( new PostEntity(new Date(), "new-site-is-live", "New site is live", "Welcome to the new EuregJUG website. We have switched off the old static pages and replaced it with a little application based on Hibernate, Spring Data JPA, Spring Boot and Thymeleaf.") ).call("updateUpdatedAt").set("id", 23).get(); when(this.postRepository.searchByKeyword("website")).thenReturn(Arrays.asList(p1)); this.mvc .perform( get("/api/posts/search") .param("q", "website") .principal(() -> "euregjug") ) .andExpect(status().isOk()) .andExpect(jsonPath("$", hasSize(1))) .andExpect(jsonPath("$[0].slug", equalTo("new-site-is-live"))) .andDo(document("api/posts/search", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()) )); verify(this.postRepository).searchByKeyword("website"); verifyNoMoreInteractions(this.postRepository); } @Test public void updateShouldShouldWork() throws Exception { final PostEntity updateEntity = new PostEntity(new Date(), "newslug", "newtitle", "newcontent");
// Path: src/test/java/eu/euregjug/site/config/SecurityTestConfig.java // @Configuration // @Profile("test") // public class SecurityTestConfig extends WebSecurityConfigurerAdapter { // // @Override // protected void configure(HttpSecurity http) throws Exception { // http.csrf().disable(); // } // } // // Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Format { // // asciidoc, markdown // } // // Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Status { // // draft, published, hidden // } // Path: src/test/java/eu/euregjug/site/posts/PostApiControllerTest.java import eu.euregjug.site.config.SecurityTestConfig; import com.fasterxml.jackson.databind.ObjectMapper; import eu.euregjug.site.posts.PostEntity.Format; import eu.euregjug.site.posts.PostEntity.Status; import java.util.Arrays; import java.util.Date; import java.util.Locale; import java.util.Optional; import org.joor.Reflect; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.json.JacksonTester; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import org.springframework.data.web.config.EnableSpringDataWebSupport; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasSize; import static org.mockito.Matchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; import static org.springframework.http.MediaType.APPLICATION_JSON; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest; import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; @Test public void searchShouldWork() throws Exception { final PostEntity p1 = Reflect.on( new PostEntity(new Date(), "new-site-is-live", "New site is live", "Welcome to the new EuregJUG website. We have switched off the old static pages and replaced it with a little application based on Hibernate, Spring Data JPA, Spring Boot and Thymeleaf.") ).call("updateUpdatedAt").set("id", 23).get(); when(this.postRepository.searchByKeyword("website")).thenReturn(Arrays.asList(p1)); this.mvc .perform( get("/api/posts/search") .param("q", "website") .principal(() -> "euregjug") ) .andExpect(status().isOk()) .andExpect(jsonPath("$", hasSize(1))) .andExpect(jsonPath("$[0].slug", equalTo("new-site-is-live"))) .andDo(document("api/posts/search", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()) )); verify(this.postRepository).searchByKeyword("website"); verifyNoMoreInteractions(this.postRepository); } @Test public void updateShouldShouldWork() throws Exception { final PostEntity updateEntity = new PostEntity(new Date(), "newslug", "newtitle", "newcontent");
updateEntity.setFormat(Format.markdown);
EuregJUG-Maas-Rhine/site
src/main/java/eu/euregjug/site/posts/PostRepository.java
// Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Status { // // draft, published, hidden // }
import eu.euregjug.site.posts.PostEntity.Status; import java.util.Date; import java.util.List; import java.util.Optional; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.data.repository.Repository; import org.springframework.transaction.annotation.Transactional;
/* * Copyright 2015-2016 EuregJUG. * * Licensed 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 eu.euregjug.site.posts; /** * @author Michael J. Simons, 2015-12-28 */ public interface PostRepository extends Repository<PostEntity, Integer>, PostRepositoryExt { /** * Saves the given post. * * @param entity * @return Persisted post */ PostEntity save(PostEntity entity); /** * @param id * @return Post with the given Id or an empty optional */ @Transactional(readOnly = true) Optional<PostEntity> findOne(Integer id); /** * Selects a post by date and slug. * * @param publishedOn * @param slug * @return */ @Transactional(readOnly = true) Optional<PostEntity> findByPublishedOnAndSlug(Date publishedOn, String slug); /** * Selects a "page" of posts with a given status. * * @param status status as selection criteria * @param pageable * @return */ @Transactional(readOnly = true)
// Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Status { // // draft, published, hidden // } // Path: src/main/java/eu/euregjug/site/posts/PostRepository.java import eu.euregjug.site.posts.PostEntity.Status; import java.util.Date; import java.util.List; import java.util.Optional; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.data.repository.Repository; import org.springframework.transaction.annotation.Transactional; /* * Copyright 2015-2016 EuregJUG. * * Licensed 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 eu.euregjug.site.posts; /** * @author Michael J. Simons, 2015-12-28 */ public interface PostRepository extends Repository<PostEntity, Integer>, PostRepositoryExt { /** * Saves the given post. * * @param entity * @return Persisted post */ PostEntity save(PostEntity entity); /** * @param id * @return Post with the given Id or an empty optional */ @Transactional(readOnly = true) Optional<PostEntity> findOne(Integer id); /** * Selects a post by date and slug. * * @param publishedOn * @param slug * @return */ @Transactional(readOnly = true) Optional<PostEntity> findByPublishedOnAndSlug(Date publishedOn, String slug); /** * Selects a "page" of posts with a given status. * * @param status status as selection criteria * @param pageable * @return */ @Transactional(readOnly = true)
Page<PostEntity> findAllByStatus(Status status, Pageable pageable);
EuregJUG-Maas-Rhine/site
src/main/java/eu/euregjug/site/posts/PostRenderingService.java
// Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Format { // // asciidoc, markdown // }
import eu.euregjug.site.posts.PostEntity.Format; import lombok.extern.slf4j.Slf4j; import org.asciidoctor.Asciidoctor; import org.asciidoctor.Options; import org.asciidoctor.OptionsBuilder; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service;
/* * Copyright 2015-2016 EuregJUG. * * Licensed 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 eu.euregjug.site.posts; /** * A post rendering service that supports only AsciiDoc at the moment. * * @author Michael J. Simons, 2015-12-28 */ @Service @Slf4j public class PostRenderingService { @FunctionalInterface interface Renderer { String render(String content); } static class AsciiDocRenderer implements Renderer { private final Asciidoctor asciidoctor = Asciidoctor.Factory.create(); private final Options options = OptionsBuilder.options().inPlace(false).get(); @Override public String render(final String content) { String rv; try { rv = asciidoctor.render(content, options); } catch (Exception e) { log.error("Could not render AsciiDoc content!", e); rv = "<strong>Could not render content.</strong>"; } return rv; } } private final Renderer renderer = new AsciiDocRenderer(); @Cacheable(cacheNames = "renderedPosts", key = "#post.id") public Post render(final PostEntity post) { String renderedContent;
// Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Format { // // asciidoc, markdown // } // Path: src/main/java/eu/euregjug/site/posts/PostRenderingService.java import eu.euregjug.site.posts.PostEntity.Format; import lombok.extern.slf4j.Slf4j; import org.asciidoctor.Asciidoctor; import org.asciidoctor.Options; import org.asciidoctor.OptionsBuilder; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; /* * Copyright 2015-2016 EuregJUG. * * Licensed 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 eu.euregjug.site.posts; /** * A post rendering service that supports only AsciiDoc at the moment. * * @author Michael J. Simons, 2015-12-28 */ @Service @Slf4j public class PostRenderingService { @FunctionalInterface interface Renderer { String render(String content); } static class AsciiDocRenderer implements Renderer { private final Asciidoctor asciidoctor = Asciidoctor.Factory.create(); private final Options options = OptionsBuilder.options().inPlace(false).get(); @Override public String render(final String content) { String rv; try { rv = asciidoctor.render(content, options); } catch (Exception e) { log.error("Could not render AsciiDoc content!", e); rv = "<strong>Could not render content.</strong>"; } return rv; } } private final Renderer renderer = new AsciiDocRenderer(); @Cacheable(cacheNames = "renderedPosts", key = "#post.id") public Post render(final PostEntity post) { String renderedContent;
if (post.getFormat() != Format.asciidoc) {
EuregJUG-Maas-Rhine/site
src/main/java/eu/euregjug/site/support/thymeleaf/EuregJUGDialect.java
// Path: src/main/java/eu/euregjug/site/support/thymeleaf/expressions/Temporals.java // public final class Temporals { // // /** // * Locale of this instance // */ // private final Locale locale; // // /** // * Creates a new instance of a {@code Temporals} object bound to the given // * {@link #locale}. // * // * @param locale The locale of this instance // */ // public Temporals(final Locale locale) { // this.locale = locale; // } // // /** // * Formats both date and time of the given {@code temporal} with one of the // * predefined {@link FormatStyle}s. // * // * @param temporal The temporal object to be formatted // * @param dateStyle The chosen date style // * @param timeStyle The chosen time style // * @return Formatted object // */ // public String formatDateTime(final TemporalAccessor temporal, final FormatStyle dateStyle, final FormatStyle timeStyle) { // return DateTimeFormatter.ofLocalizedDateTime(dateStyle, timeStyle).withLocale(this.locale).format(temporal); // } // // /** // * Formats the date part of the given {@code temporal} with one of the // * predefined {@link FormatStyle}s. // * // * @param temporal The temporal object to be formatted // * @param dateStyle The chosen date style // * @return Formatted object // */ // public String formatDate(final TemporalAccessor temporal, final FormatStyle dateStyle) { // return DateTimeFormatter.ofLocalizedDate(dateStyle).withLocale(this.locale).format(temporal); // } // // /** // * Formats a temporal accessor according to the given {@code pattern}. // * // * @param temporal An arbitrary temporal thing // * @param pattern The pattern to format the year-mont // * @return Formatted object // */ // public String format(final TemporalAccessor temporal, final String pattern) { // return DateTimeFormatter.ofPattern(pattern, locale).format(temporal); // } // }
import eu.euregjug.site.support.thymeleaf.expressions.Temporals; import java.util.HashMap; import java.util.Map; import org.thymeleaf.context.IProcessingContext; import org.thymeleaf.dialect.AbstractDialect; import org.thymeleaf.dialect.IExpressionEnhancingDialect;
/* * Copyright 2015-2016 EuregJUG. * * Licensed 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 eu.euregjug.site.support.thymeleaf; /** * This is a custom dialect for the thymeleaf templates. It contains among * others serveral methods for formatting modern {@code java.time} instances. * * @author Michael J. Simons, 2015-01-04 */ public final class EuregJUGDialect extends AbstractDialect implements IExpressionEnhancingDialect { @Override public String getPrefix() { return "eur"; } @Override public Map<String, Object> getAdditionalExpressionObjects(final IProcessingContext processingContext) { final Map<String, Object> expressionObjects = new HashMap<>();
// Path: src/main/java/eu/euregjug/site/support/thymeleaf/expressions/Temporals.java // public final class Temporals { // // /** // * Locale of this instance // */ // private final Locale locale; // // /** // * Creates a new instance of a {@code Temporals} object bound to the given // * {@link #locale}. // * // * @param locale The locale of this instance // */ // public Temporals(final Locale locale) { // this.locale = locale; // } // // /** // * Formats both date and time of the given {@code temporal} with one of the // * predefined {@link FormatStyle}s. // * // * @param temporal The temporal object to be formatted // * @param dateStyle The chosen date style // * @param timeStyle The chosen time style // * @return Formatted object // */ // public String formatDateTime(final TemporalAccessor temporal, final FormatStyle dateStyle, final FormatStyle timeStyle) { // return DateTimeFormatter.ofLocalizedDateTime(dateStyle, timeStyle).withLocale(this.locale).format(temporal); // } // // /** // * Formats the date part of the given {@code temporal} with one of the // * predefined {@link FormatStyle}s. // * // * @param temporal The temporal object to be formatted // * @param dateStyle The chosen date style // * @return Formatted object // */ // public String formatDate(final TemporalAccessor temporal, final FormatStyle dateStyle) { // return DateTimeFormatter.ofLocalizedDate(dateStyle).withLocale(this.locale).format(temporal); // } // // /** // * Formats a temporal accessor according to the given {@code pattern}. // * // * @param temporal An arbitrary temporal thing // * @param pattern The pattern to format the year-mont // * @return Formatted object // */ // public String format(final TemporalAccessor temporal, final String pattern) { // return DateTimeFormatter.ofPattern(pattern, locale).format(temporal); // } // } // Path: src/main/java/eu/euregjug/site/support/thymeleaf/EuregJUGDialect.java import eu.euregjug.site.support.thymeleaf.expressions.Temporals; import java.util.HashMap; import java.util.Map; import org.thymeleaf.context.IProcessingContext; import org.thymeleaf.dialect.AbstractDialect; import org.thymeleaf.dialect.IExpressionEnhancingDialect; /* * Copyright 2015-2016 EuregJUG. * * Licensed 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 eu.euregjug.site.support.thymeleaf; /** * This is a custom dialect for the thymeleaf templates. It contains among * others serveral methods for formatting modern {@code java.time} instances. * * @author Michael J. Simons, 2015-01-04 */ public final class EuregJUGDialect extends AbstractDialect implements IExpressionEnhancingDialect { @Override public String getPrefix() { return "eur"; } @Override public Map<String, Object> getAdditionalExpressionObjects(final IProcessingContext processingContext) { final Map<String, Object> expressionObjects = new HashMap<>();
expressionObjects.put("temporals", new Temporals(processingContext.getContext().getLocale()));
EuregJUG-Maas-Rhine/site
src/main/java/eu/euregjug/site/config/WebConfig.java
// Path: src/main/java/eu/euregjug/site/support/thymeleaf/EuregJUGDialect.java // public final class EuregJUGDialect extends AbstractDialect implements IExpressionEnhancingDialect { // // @Override // public String getPrefix() { // return "eur"; // } // // @Override // public Map<String, Object> getAdditionalExpressionObjects(final IProcessingContext processingContext) { // final Map<String, Object> expressionObjects = new HashMap<>(); // expressionObjects.put("temporals", new Temporals(processingContext.getContext().getLocale())); // return expressionObjects; // } // }
import eu.euregjug.site.support.thymeleaf.EuregJUGDialect; import java.time.Duration; import java.util.Locale; import java.util.TimeZone; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.LocaleResolver; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.i18n.CookieLocaleResolver; import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
/* * Copyright 2015-2018 EuregJUG. * * Licensed 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 eu.euregjug.site.config; /** * @author Michael J. Simons, 2015-12-27 */ @Configuration public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addViewControllers(final ViewControllerRegistry registry) { registry.addViewController("/about").setViewName("about"); registry.addViewController("/imprint").setViewName("imprint"); } @Bean
// Path: src/main/java/eu/euregjug/site/support/thymeleaf/EuregJUGDialect.java // public final class EuregJUGDialect extends AbstractDialect implements IExpressionEnhancingDialect { // // @Override // public String getPrefix() { // return "eur"; // } // // @Override // public Map<String, Object> getAdditionalExpressionObjects(final IProcessingContext processingContext) { // final Map<String, Object> expressionObjects = new HashMap<>(); // expressionObjects.put("temporals", new Temporals(processingContext.getContext().getLocale())); // return expressionObjects; // } // } // Path: src/main/java/eu/euregjug/site/config/WebConfig.java import eu.euregjug.site.support.thymeleaf.EuregJUGDialect; import java.time.Duration; import java.util.Locale; import java.util.TimeZone; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.LocaleResolver; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.i18n.CookieLocaleResolver; import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; /* * Copyright 2015-2018 EuregJUG. * * Licensed 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 eu.euregjug.site.config; /** * @author Michael J. Simons, 2015-12-27 */ @Configuration public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addViewControllers(final ViewControllerRegistry registry) { registry.addViewController("/about").setViewName("about"); registry.addViewController("/imprint").setViewName("imprint"); } @Bean
public EuregJUGDialect enSupplyDialect() {
EuregJUG-Maas-Rhine/site
src/test/java/eu/euregjug/site/assets/AssetApiControllerTest.java
// Path: src/test/java/eu/euregjug/site/config/SecurityTestConfig.java // @Configuration // @Profile("test") // public class SecurityTestConfig extends WebSecurityConfigurerAdapter { // // @Override // protected void configure(HttpSecurity http) throws Exception { // http.csrf().disable(); // } // }
import com.mongodb.gridfs.GridFSDBFile; import eu.euregjug.site.config.SecurityTestConfig; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.charset.StandardCharsets; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatterBuilder; import java.time.format.SignStyle; import java.time.format.TextStyle; import static java.time.temporal.ChronoField.DAY_OF_MONTH; import static java.time.temporal.ChronoField.DAY_OF_WEEK; import static java.time.temporal.ChronoField.MONTH_OF_YEAR; import java.util.Locale; import org.apache.tika.Tika; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; import org.joor.Reflect; import org.junit.Test; import org.junit.runner.RunWith; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.gridfs.GridFsTemplate; import org.springframework.data.web.config.EnableSpringDataWebSupport; import org.springframework.mock.web.MockMultipartFile; import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest; import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse; import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Matchers.isNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.fileUpload; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
/* * Copyright 2016 EuregJUG. * * Licensed 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 eu.euregjug.site.assets; /** * @author Michael J. Simons, 2016-07-15 */ @RunWith(SpringRunner.class) @ActiveProfiles("test") @WebMvcTest(AssetApiController.class) @EnableSpringDataWebSupport // Needed to enable resolving of Pageable and other parameters
// Path: src/test/java/eu/euregjug/site/config/SecurityTestConfig.java // @Configuration // @Profile("test") // public class SecurityTestConfig extends WebSecurityConfigurerAdapter { // // @Override // protected void configure(HttpSecurity http) throws Exception { // http.csrf().disable(); // } // } // Path: src/test/java/eu/euregjug/site/assets/AssetApiControllerTest.java import com.mongodb.gridfs.GridFSDBFile; import eu.euregjug.site.config.SecurityTestConfig; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.charset.StandardCharsets; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatterBuilder; import java.time.format.SignStyle; import java.time.format.TextStyle; import static java.time.temporal.ChronoField.DAY_OF_MONTH; import static java.time.temporal.ChronoField.DAY_OF_WEEK; import static java.time.temporal.ChronoField.MONTH_OF_YEAR; import java.util.Locale; import org.apache.tika.Tika; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; import org.joor.Reflect; import org.junit.Test; import org.junit.runner.RunWith; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.gridfs.GridFsTemplate; import org.springframework.data.web.config.EnableSpringDataWebSupport; import org.springframework.mock.web.MockMultipartFile; import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest; import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse; import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Matchers.isNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.fileUpload; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; /* * Copyright 2016 EuregJUG. * * Licensed 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 eu.euregjug.site.assets; /** * @author Michael J. Simons, 2016-07-15 */ @RunWith(SpringRunner.class) @ActiveProfiles("test") @WebMvcTest(AssetApiController.class) @EnableSpringDataWebSupport // Needed to enable resolving of Pageable and other parameters
@Import(SecurityTestConfig.class) // Needed to get rid of default CSRF protection
EuregJUG-Maas-Rhine/site
src/test/java/eu/euregjug/site/events/EventEntityTest.java
// Path: src/main/java/eu/euregjug/site/events/EventEntity.java // public enum Status { // // open, closed // }
import eu.euregjug.site.events.EventEntity.Status; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Calendar; import java.util.GregorianCalendar; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; import org.junit.Test;
/* * Copyright 2016-2017 EuregJUG. * * Licensed 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 eu.euregjug.site.events; /** * @author Michael J. Simons, 2016-08-16 */ public class EventEntityTest { @Test public void getDisplayNameShouldWork() { final EventEntity event = new EventEntity(Calendar.getInstance(), "test", "test"); assertThat(event.getDisplayName(), is("test")); event.setSpeaker(" \t "); assertThat(event.getDisplayName(), is("test")); event.setSpeaker("test"); assertThat(event.getDisplayName(), is("test - test")); } @Test public void isOpenForRegistrationShouldWork() { EventEntity event; event = new EventEntity(GregorianCalendar.from(LocalDateTime.now().plusDays(1).atZone(ZoneId.systemDefault())), "test", "test"); assertThat(event.isOpenForRegistration(), is(true));
// Path: src/main/java/eu/euregjug/site/events/EventEntity.java // public enum Status { // // open, closed // } // Path: src/test/java/eu/euregjug/site/events/EventEntityTest.java import eu.euregjug.site.events.EventEntity.Status; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Calendar; import java.util.GregorianCalendar; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; import org.junit.Test; /* * Copyright 2016-2017 EuregJUG. * * Licensed 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 eu.euregjug.site.events; /** * @author Michael J. Simons, 2016-08-16 */ public class EventEntityTest { @Test public void getDisplayNameShouldWork() { final EventEntity event = new EventEntity(Calendar.getInstance(), "test", "test"); assertThat(event.getDisplayName(), is("test")); event.setSpeaker(" \t "); assertThat(event.getDisplayName(), is("test")); event.setSpeaker("test"); assertThat(event.getDisplayName(), is("test - test")); } @Test public void isOpenForRegistrationShouldWork() { EventEntity event; event = new EventEntity(GregorianCalendar.from(LocalDateTime.now().plusDays(1).atZone(ZoneId.systemDefault())), "test", "test"); assertThat(event.isOpenForRegistration(), is(true));
event.setStatus(Status.closed);
EuregJUG-Maas-Rhine/site
src/main/java/eu/euregjug/site/web/IndexRssView.java
// Path: src/main/java/eu/euregjug/site/posts/Post.java // @Getter // public final class Post implements Serializable { // // private static final long serialVersionUID = 5598037121835514804L; // // private final LocalDate publishedOn; // // private final String slug; // // private final String title; // // private final String content; // // public Post(final Date publishedOn, final String slug, final String title, final String content) { // this.publishedOn = publishedOn instanceof java.sql.Date ? ((java.sql.Date) publishedOn).toLocalDate() : publishedOn.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); // this.slug = slug; // this.title = title; // this.content = content; // } // // /** // * Maps an entity to a post without rendering the content. // * // * @param postEntity // */ // public Post(final PostEntity postEntity) { // this(postEntity.getPublishedOn(), postEntity.getSlug(), postEntity.getTitle(), null); // } // }
import ac.simons.syndication.utils.SyndicationGuid; import ac.simons.syndication.utils.SyndicationLink; import com.rometools.modules.atom.modules.AtomLinkModuleImpl; import com.rometools.rome.feed.atom.Link; import com.rometools.rome.feed.rss.Channel; import com.rometools.rome.feed.rss.Content; import com.rometools.rome.feed.rss.Item; import eu.euregjug.site.posts.Post; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.context.MessageSource; import org.springframework.data.domain.Page; import org.springframework.stereotype.Component; import org.springframework.web.servlet.view.feed.AbstractRssFeedView;
/* * Copyright 2015-2016 EuregJUG. * * Licensed 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 eu.euregjug.site.web; /** * @author Michael J. Simons, 2015-12-30 */ @Component("index.rss") @SuppressWarnings({"squid:MaximumInheritanceDepth"}) // Cannot change this... class IndexRssView extends AbstractRssFeedView { private static final ZoneId UTC = ZoneId.of("UTC"); private final MessageSource messageSource; private final DateTimeFormatter permalinkDateFormatter; IndexRssView(final MessageSource messageSource) { this.messageSource = messageSource; this.permalinkDateFormatter = DateTimeFormatter.ofPattern("/y/M/d", Locale.ENGLISH); } String getAbsoluteUrl(final HttpServletRequest request, final String relativeUrl) { final int port = request.getServerPort(); final String hostWithPort = String.format("%s://%s%s", request.isSecure() ? "https" : "http", request.getServerName(), Arrays.asList(80, 443).contains(port) ? "" : String.format(":%d", port) ); return String.format("%s%s%s", hostWithPort, request.getContextPath(), relativeUrl); } @Override protected void buildFeedMetadata(final Map<String, Object> model, final Channel feed, final HttpServletRequest request) {
// Path: src/main/java/eu/euregjug/site/posts/Post.java // @Getter // public final class Post implements Serializable { // // private static final long serialVersionUID = 5598037121835514804L; // // private final LocalDate publishedOn; // // private final String slug; // // private final String title; // // private final String content; // // public Post(final Date publishedOn, final String slug, final String title, final String content) { // this.publishedOn = publishedOn instanceof java.sql.Date ? ((java.sql.Date) publishedOn).toLocalDate() : publishedOn.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); // this.slug = slug; // this.title = title; // this.content = content; // } // // /** // * Maps an entity to a post without rendering the content. // * // * @param postEntity // */ // public Post(final PostEntity postEntity) { // this(postEntity.getPublishedOn(), postEntity.getSlug(), postEntity.getTitle(), null); // } // } // Path: src/main/java/eu/euregjug/site/web/IndexRssView.java import ac.simons.syndication.utils.SyndicationGuid; import ac.simons.syndication.utils.SyndicationLink; import com.rometools.modules.atom.modules.AtomLinkModuleImpl; import com.rometools.rome.feed.atom.Link; import com.rometools.rome.feed.rss.Channel; import com.rometools.rome.feed.rss.Content; import com.rometools.rome.feed.rss.Item; import eu.euregjug.site.posts.Post; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.context.MessageSource; import org.springframework.data.domain.Page; import org.springframework.stereotype.Component; import org.springframework.web.servlet.view.feed.AbstractRssFeedView; /* * Copyright 2015-2016 EuregJUG. * * Licensed 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 eu.euregjug.site.web; /** * @author Michael J. Simons, 2015-12-30 */ @Component("index.rss") @SuppressWarnings({"squid:MaximumInheritanceDepth"}) // Cannot change this... class IndexRssView extends AbstractRssFeedView { private static final ZoneId UTC = ZoneId.of("UTC"); private final MessageSource messageSource; private final DateTimeFormatter permalinkDateFormatter; IndexRssView(final MessageSource messageSource) { this.messageSource = messageSource; this.permalinkDateFormatter = DateTimeFormatter.ofPattern("/y/M/d", Locale.ENGLISH); } String getAbsoluteUrl(final HttpServletRequest request, final String relativeUrl) { final int port = request.getServerPort(); final String hostWithPort = String.format("%s://%s%s", request.isSecure() ? "https" : "http", request.getServerName(), Arrays.asList(80, 443).contains(port) ? "" : String.format(":%d", port) ); return String.format("%s%s%s", hostWithPort, request.getContextPath(), relativeUrl); } @Override protected void buildFeedMetadata(final Map<String, Object> model, final Channel feed, final HttpServletRequest request) {
final Page<Post> posts = (Page<Post>) model.get("posts");
EuregJUG-Maas-Rhine/site
src/main/java/eu/euregjug/site/posts/PostApiController.java
// Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Status { // // draft, published, hidden // } // // Path: src/main/java/eu/euregjug/site/support/ResourceNotFoundException.java // @ResponseStatus(HttpStatus.NOT_FOUND) // public class ResourceNotFoundException extends RuntimeException { // // private static final long serialVersionUID = -4819169062859178748L; // }
import eu.euregjug.site.posts.PostEntity.Status; import eu.euregjug.site.support.ResourceNotFoundException; import java.util.List; import java.util.Locale; import java.util.Optional; import javax.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.cache.annotation.CacheEvict; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.web.bind.annotation.RequestMethod.GET; import static org.springframework.web.bind.annotation.RequestMethod.POST; import static org.springframework.web.bind.annotation.RequestMethod.PUT; import org.springframework.web.bind.annotation.RequestParam;
/* * Copyright 2015-2016 EuregJUG. * * Licensed 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 eu.euregjug.site.posts; /** * @author Michael J. Simons, 2015-12-28 */ @RestController @RequiredArgsConstructor @RequestMapping("/api/posts") class PostApiController { private final PostRepository postRepository; private final PostIndexService postIndexService; @RequestMapping(method = POST) @PreAuthorize("isAuthenticated()") @ResponseStatus(CREATED) public PostEntity create(@Valid @RequestBody final PostEntity newPost) { newPost.setLocale(Optional.ofNullable(newPost.getLocale()).orElseGet(() -> new Locale("en", "US")));
// Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Status { // // draft, published, hidden // } // // Path: src/main/java/eu/euregjug/site/support/ResourceNotFoundException.java // @ResponseStatus(HttpStatus.NOT_FOUND) // public class ResourceNotFoundException extends RuntimeException { // // private static final long serialVersionUID = -4819169062859178748L; // } // Path: src/main/java/eu/euregjug/site/posts/PostApiController.java import eu.euregjug.site.posts.PostEntity.Status; import eu.euregjug.site.support.ResourceNotFoundException; import java.util.List; import java.util.Locale; import java.util.Optional; import javax.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.cache.annotation.CacheEvict; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.web.bind.annotation.RequestMethod.GET; import static org.springframework.web.bind.annotation.RequestMethod.POST; import static org.springframework.web.bind.annotation.RequestMethod.PUT; import org.springframework.web.bind.annotation.RequestParam; /* * Copyright 2015-2016 EuregJUG. * * Licensed 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 eu.euregjug.site.posts; /** * @author Michael J. Simons, 2015-12-28 */ @RestController @RequiredArgsConstructor @RequestMapping("/api/posts") class PostApiController { private final PostRepository postRepository; private final PostIndexService postIndexService; @RequestMapping(method = POST) @PreAuthorize("isAuthenticated()") @ResponseStatus(CREATED) public PostEntity create(@Valid @RequestBody final PostEntity newPost) { newPost.setLocale(Optional.ofNullable(newPost.getLocale()).orElseGet(() -> new Locale("en", "US")));
newPost.setStatus(Optional.ofNullable(newPost.getStatus()).orElse(Status.draft));
EuregJUG-Maas-Rhine/site
src/main/java/eu/euregjug/site/posts/PostApiController.java
// Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Status { // // draft, published, hidden // } // // Path: src/main/java/eu/euregjug/site/support/ResourceNotFoundException.java // @ResponseStatus(HttpStatus.NOT_FOUND) // public class ResourceNotFoundException extends RuntimeException { // // private static final long serialVersionUID = -4819169062859178748L; // }
import eu.euregjug.site.posts.PostEntity.Status; import eu.euregjug.site.support.ResourceNotFoundException; import java.util.List; import java.util.Locale; import java.util.Optional; import javax.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.cache.annotation.CacheEvict; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.web.bind.annotation.RequestMethod.GET; import static org.springframework.web.bind.annotation.RequestMethod.POST; import static org.springframework.web.bind.annotation.RequestMethod.PUT; import org.springframework.web.bind.annotation.RequestParam;
/* * Copyright 2015-2016 EuregJUG. * * Licensed 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 eu.euregjug.site.posts; /** * @author Michael J. Simons, 2015-12-28 */ @RestController @RequiredArgsConstructor @RequestMapping("/api/posts") class PostApiController { private final PostRepository postRepository; private final PostIndexService postIndexService; @RequestMapping(method = POST) @PreAuthorize("isAuthenticated()") @ResponseStatus(CREATED) public PostEntity create(@Valid @RequestBody final PostEntity newPost) { newPost.setLocale(Optional.ofNullable(newPost.getLocale()).orElseGet(() -> new Locale("en", "US"))); newPost.setStatus(Optional.ofNullable(newPost.getStatus()).orElse(Status.draft)); return this.postRepository.save(newPost); } @RequestMapping(method = GET) public Page<PostEntity> get(final Pageable pageable) { return this.postRepository.findAll(pageable); } @RequestMapping(path = "/search", method = GET) public List<PostEntity> get(@RequestParam final String q) { return this.postRepository.searchByKeyword(q); } @RequestMapping(path = "/{id:\\d+}", method = PUT) @PreAuthorize("isAuthenticated()") @Transactional @CacheEvict(cacheNames = "renderedPosts", key = "#id") public PostEntity update(@PathVariable final Integer id, @Valid @RequestBody final PostEntity updatedPost) {
// Path: src/main/java/eu/euregjug/site/posts/PostEntity.java // public enum Status { // // draft, published, hidden // } // // Path: src/main/java/eu/euregjug/site/support/ResourceNotFoundException.java // @ResponseStatus(HttpStatus.NOT_FOUND) // public class ResourceNotFoundException extends RuntimeException { // // private static final long serialVersionUID = -4819169062859178748L; // } // Path: src/main/java/eu/euregjug/site/posts/PostApiController.java import eu.euregjug.site.posts.PostEntity.Status; import eu.euregjug.site.support.ResourceNotFoundException; import java.util.List; import java.util.Locale; import java.util.Optional; import javax.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.cache.annotation.CacheEvict; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.web.bind.annotation.RequestMethod.GET; import static org.springframework.web.bind.annotation.RequestMethod.POST; import static org.springframework.web.bind.annotation.RequestMethod.PUT; import org.springframework.web.bind.annotation.RequestParam; /* * Copyright 2015-2016 EuregJUG. * * Licensed 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 eu.euregjug.site.posts; /** * @author Michael J. Simons, 2015-12-28 */ @RestController @RequiredArgsConstructor @RequestMapping("/api/posts") class PostApiController { private final PostRepository postRepository; private final PostIndexService postIndexService; @RequestMapping(method = POST) @PreAuthorize("isAuthenticated()") @ResponseStatus(CREATED) public PostEntity create(@Valid @RequestBody final PostEntity newPost) { newPost.setLocale(Optional.ofNullable(newPost.getLocale()).orElseGet(() -> new Locale("en", "US"))); newPost.setStatus(Optional.ofNullable(newPost.getStatus()).orElse(Status.draft)); return this.postRepository.save(newPost); } @RequestMapping(method = GET) public Page<PostEntity> get(final Pageable pageable) { return this.postRepository.findAll(pageable); } @RequestMapping(path = "/search", method = GET) public List<PostEntity> get(@RequestParam final String q) { return this.postRepository.searchByKeyword(q); } @RequestMapping(path = "/{id:\\d+}", method = PUT) @PreAuthorize("isAuthenticated()") @Transactional @CacheEvict(cacheNames = "renderedPosts", key = "#id") public PostEntity update(@PathVariable final Integer id, @Valid @RequestBody final PostEntity updatedPost) {
final PostEntity postEntity = this.postRepository.findOne(id).orElseThrow(ResourceNotFoundException::new);
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableMonitorWaitedEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.MonitorWaitedEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable monitor waited event. * * @author Adrian Herrera * @see MonitorWaitedEvent */ public class VisitableMonitorWaitedEvent implements Visitable { private final MonitorWaitedEvent event; public VisitableMonitorWaitedEvent(MonitorWaitedEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableMonitorWaitedEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.MonitorWaitedEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable monitor waited event. * * @author Adrian Herrera * @see MonitorWaitedEvent */ public class VisitableMonitorWaitedEvent implements Visitable { private final MonitorWaitedEvent event; public VisitableMonitorWaitedEvent(MonitorWaitedEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/Debugger.java
// Path: src/main/java/org/jdivisitor/debugger/request/EventRequestor.java // public interface EventRequestor { // // /** // * Request specific JDI events to be sent to the debugger. // * // * @param erm Event request manager // */ // public void requestEvents(EventRequestManager erm); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import com.sun.jdi.VirtualMachine; import org.apache.commons.lang3.Validate; import org.jdivisitor.debugger.request.EventRequestor;
/* * JDIVisitor * Copyright (C) 2014 Jason Fager, Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger; /** * The front end debugger that interacts with the back end over JDI. A typical * workflow would involve the following: * * <ul> * <li>Instantiate a new {@code Debugger} object * <li>Call {@code requestEvents} to request specific events that should be sent * to the debugger * <li>Call {@code run} to start the debugger. An optional {@code EventVisitor} * object can be used to interact with the debugger * <ul> * * @author Jason Fager * @author Adrian Herrera */ public final class Debugger { /** * The running virtual machine. */ private final VirtualMachine vm; /** * Create a new debugger for the given virtual machine. * * @param vm Virtual machine */ public Debugger(VirtualMachine vm) { this.vm = Validate.notNull(vm); } /** * Get the underlying virtual machine. * * @return The underlying virtual machine */ public VirtualMachine vm() { return vm; } /** * Request JDI events to be sent to the debugger. * * @param eventRequestor Requests JDI events */
// Path: src/main/java/org/jdivisitor/debugger/request/EventRequestor.java // public interface EventRequestor { // // /** // * Request specific JDI events to be sent to the debugger. // * // * @param erm Event request manager // */ // public void requestEvents(EventRequestManager erm); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // Path: src/main/java/org/jdivisitor/debugger/Debugger.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import com.sun.jdi.VirtualMachine; import org.apache.commons.lang3.Validate; import org.jdivisitor.debugger.request.EventRequestor; /* * JDIVisitor * Copyright (C) 2014 Jason Fager, Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger; /** * The front end debugger that interacts with the back end over JDI. A typical * workflow would involve the following: * * <ul> * <li>Instantiate a new {@code Debugger} object * <li>Call {@code requestEvents} to request specific events that should be sent * to the debugger * <li>Call {@code run} to start the debugger. An optional {@code EventVisitor} * object can be used to interact with the debugger * <ul> * * @author Jason Fager * @author Adrian Herrera */ public final class Debugger { /** * The running virtual machine. */ private final VirtualMachine vm; /** * Create a new debugger for the given virtual machine. * * @param vm Virtual machine */ public Debugger(VirtualMachine vm) { this.vm = Validate.notNull(vm); } /** * Get the underlying virtual machine. * * @return The underlying virtual machine */ public VirtualMachine vm() { return vm; } /** * Request JDI events to be sent to the debugger. * * @param eventRequestor Requests JDI events */
public void requestEvents(EventRequestor eventRequestor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/Debugger.java
// Path: src/main/java/org/jdivisitor/debugger/request/EventRequestor.java // public interface EventRequestor { // // /** // * Request specific JDI events to be sent to the debugger. // * // * @param erm Event request manager // */ // public void requestEvents(EventRequestManager erm); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import com.sun.jdi.VirtualMachine; import org.apache.commons.lang3.Validate; import org.jdivisitor.debugger.request.EventRequestor;
/* * JDIVisitor * Copyright (C) 2014 Jason Fager, Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger; /** * The front end debugger that interacts with the back end over JDI. A typical * workflow would involve the following: * * <ul> * <li>Instantiate a new {@code Debugger} object * <li>Call {@code requestEvents} to request specific events that should be sent * to the debugger * <li>Call {@code run} to start the debugger. An optional {@code EventVisitor} * object can be used to interact with the debugger * <ul> * * @author Jason Fager * @author Adrian Herrera */ public final class Debugger { /** * The running virtual machine. */ private final VirtualMachine vm; /** * Create a new debugger for the given virtual machine. * * @param vm Virtual machine */ public Debugger(VirtualMachine vm) { this.vm = Validate.notNull(vm); } /** * Get the underlying virtual machine. * * @return The underlying virtual machine */ public VirtualMachine vm() { return vm; } /** * Request JDI events to be sent to the debugger. * * @param eventRequestor Requests JDI events */ public void requestEvents(EventRequestor eventRequestor) { eventRequestor.requestEvents(vm.eventRequestManager()); } /** * Run the underlying virtual machine with no event visitor and no timeout. */ public void run() { run(0); } /** * Run the underlying virtual machine with no event visitor and a given * timeout (in milliseconds). * * @param milliseconds Timeout in milliseconds */ public void run(long milliseconds) { run(null, milliseconds); } /** * Run the underlying virtual machine with the given event visitor and no * timeout. * * @param visitor Event visitor to handle events */
// Path: src/main/java/org/jdivisitor/debugger/request/EventRequestor.java // public interface EventRequestor { // // /** // * Request specific JDI events to be sent to the debugger. // * // * @param erm Event request manager // */ // public void requestEvents(EventRequestManager erm); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // Path: src/main/java/org/jdivisitor/debugger/Debugger.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import com.sun.jdi.VirtualMachine; import org.apache.commons.lang3.Validate; import org.jdivisitor.debugger.request.EventRequestor; /* * JDIVisitor * Copyright (C) 2014 Jason Fager, Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger; /** * The front end debugger that interacts with the back end over JDI. A typical * workflow would involve the following: * * <ul> * <li>Instantiate a new {@code Debugger} object * <li>Call {@code requestEvents} to request specific events that should be sent * to the debugger * <li>Call {@code run} to start the debugger. An optional {@code EventVisitor} * object can be used to interact with the debugger * <ul> * * @author Jason Fager * @author Adrian Herrera */ public final class Debugger { /** * The running virtual machine. */ private final VirtualMachine vm; /** * Create a new debugger for the given virtual machine. * * @param vm Virtual machine */ public Debugger(VirtualMachine vm) { this.vm = Validate.notNull(vm); } /** * Get the underlying virtual machine. * * @return The underlying virtual machine */ public VirtualMachine vm() { return vm; } /** * Request JDI events to be sent to the debugger. * * @param eventRequestor Requests JDI events */ public void requestEvents(EventRequestor eventRequestor) { eventRequestor.requestEvents(vm.eventRequestManager()); } /** * Run the underlying virtual machine with no event visitor and no timeout. */ public void run() { run(0); } /** * Run the underlying virtual machine with no event visitor and a given * timeout (in milliseconds). * * @param milliseconds Timeout in milliseconds */ public void run(long milliseconds) { run(null, milliseconds); } /** * Run the underlying virtual machine with the given event visitor and no * timeout. * * @param visitor Event visitor to handle events */
public void run(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableWatchpointEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.WatchpointEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable Watchpoint event. * * @author Adrian Herrera * @see WatchpointEvent */ public class VisitableWatchpointEvent implements Visitable { private final WatchpointEvent event; public VisitableWatchpointEvent(WatchpointEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableWatchpointEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.WatchpointEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable Watchpoint event. * * @author Adrian Herrera * @see WatchpointEvent */ public class VisitableWatchpointEvent implements Visitable { private final WatchpointEvent event; public VisitableWatchpointEvent(WatchpointEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableThreadDeathEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.ThreadDeathEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable thread death event. * * @author Adrian Herrera * @see ThreadDeathEvent */ public class VisitableThreadDeathEvent implements Visitable { private final ThreadDeathEvent event; public VisitableThreadDeathEvent(ThreadDeathEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableThreadDeathEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.ThreadDeathEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable thread death event. * * @author Adrian Herrera * @see ThreadDeathEvent */ public class VisitableThreadDeathEvent implements Visitable { private final ThreadDeathEvent event; public VisitableThreadDeathEvent(ThreadDeathEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableLocatableEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.LocatableEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable locatable event. * * @author Adrian Herrera * @see LocatableEvent */ public class VisitableLocatableEvent implements Visitable { private final LocatableEvent event; public VisitableLocatableEvent(LocatableEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableLocatableEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.LocatableEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable locatable event. * * @author Adrian Herrera * @see LocatableEvent */ public class VisitableLocatableEvent implements Visitable { private final LocatableEvent event; public VisitableLocatableEvent(LocatableEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableMonitorContendedEnteredEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.MonitorContendedEnteredEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable monitor contended entered event. * * @author Adrian Herrera * @see MonitorContendedEnteredEvent */ public class VisitableMonitorContendedEnteredEvent implements Visitable { private final MonitorContendedEnteredEvent event; public VisitableMonitorContendedEnteredEvent( MonitorContendedEnteredEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableMonitorContendedEnteredEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.MonitorContendedEnteredEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable monitor contended entered event. * * @author Adrian Herrera * @see MonitorContendedEnteredEvent */ public class VisitableMonitorContendedEnteredEvent implements Visitable { private final MonitorContendedEnteredEvent event; public VisitableMonitorContendedEnteredEvent( MonitorContendedEnteredEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableBreakpointEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.BreakpointEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable breakpoint event. * * @author Adrian Herrera * @see BreakpointEvent */ public class VisitableBreakpointEvent implements Visitable { private final BreakpointEvent event; public VisitableBreakpointEvent(BreakpointEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableBreakpointEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.BreakpointEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable breakpoint event. * * @author Adrian Herrera * @see BreakpointEvent */ public class VisitableBreakpointEvent implements Visitable { private final BreakpointEvent event; public VisitableBreakpointEvent(BreakpointEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableClassUnloadEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.ClassUnloadEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable class unload event. * * @author Adrian Herrera * @see ClassUnloadEvent */ public class VisitableClassUnloadEvent implements Visitable { private final ClassUnloadEvent event; public VisitableClassUnloadEvent(ClassUnloadEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableClassUnloadEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.ClassUnloadEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable class unload event. * * @author Adrian Herrera * @see ClassUnloadEvent */ public class VisitableClassUnloadEvent implements Visitable { private final ClassUnloadEvent event; public VisitableClassUnloadEvent(ClassUnloadEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableVMStartEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.VMStartEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable VM start event. * * @author Adrian Herrera * @see VMStartEvent */ public class VisitableVMStartEvent implements Visitable { private final VMStartEvent event; public VisitableVMStartEvent(VMStartEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableVMStartEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.VMStartEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable VM start event. * * @author Adrian Herrera * @see VMStartEvent */ public class VisitableVMStartEvent implements Visitable { private final VMStartEvent event; public VisitableVMStartEvent(VMStartEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableModificationWatchpointEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.ModificationWatchpointEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable modification watchpoint event. * * @author Adrian Herrera * @see ModificationWatchpointEvent */ public class VisitableModificationWatchpointEvent implements Visitable { private final ModificationWatchpointEvent event; public VisitableModificationWatchpointEvent( ModificationWatchpointEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableModificationWatchpointEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.ModificationWatchpointEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable modification watchpoint event. * * @author Adrian Herrera * @see ModificationWatchpointEvent */ public class VisitableModificationWatchpointEvent implements Visitable { private final ModificationWatchpointEvent event; public VisitableModificationWatchpointEvent( ModificationWatchpointEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableStepEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.StepEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable step event. * * @author Adrian Herrera * @see StepEvent */ public class VisitableStepEvent implements Visitable { private final StepEvent event; public VisitableStepEvent(StepEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableStepEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.StepEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable step event. * * @author Adrian Herrera * @see StepEvent */ public class VisitableStepEvent implements Visitable { private final StepEvent event; public VisitableStepEvent(StepEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableVMDisconnectEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.VMDisconnectEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable VM disconnect event. * * @author Adrian Herrera * @see VMDisconnectEvent */ public class VisitableVMDisconnectEvent implements Visitable { private final VMDisconnectEvent event; public VisitableVMDisconnectEvent(VMDisconnectEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableVMDisconnectEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.VMDisconnectEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable VM disconnect event. * * @author Adrian Herrera * @see VMDisconnectEvent */ public class VisitableVMDisconnectEvent implements Visitable { private final VMDisconnectEvent event; public VisitableVMDisconnectEvent(VMDisconnectEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableAccessWatchpointEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.AccessWatchpointEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable access watchpoint event. * * @author Adrian Herrera * @see AccessWatchpointEvent */ public class VisitableAccessWatchpointEvent implements Visitable { private final AccessWatchpointEvent event; public VisitableAccessWatchpointEvent(AccessWatchpointEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableAccessWatchpointEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.AccessWatchpointEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable access watchpoint event. * * @author Adrian Herrera * @see AccessWatchpointEvent */ public class VisitableAccessWatchpointEvent implements Visitable { private final AccessWatchpointEvent event; public VisitableAccessWatchpointEvent(AccessWatchpointEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableExceptionEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.ExceptionEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable exception event. * * @author Adrian Herrera * @see ExceptionEvent */ public class VisitableExceptionEvent implements Visitable { private final ExceptionEvent event; public VisitableExceptionEvent(ExceptionEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableExceptionEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.ExceptionEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable exception event. * * @author Adrian Herrera * @see ExceptionEvent */ public class VisitableExceptionEvent implements Visitable { private final ExceptionEvent event; public VisitableExceptionEvent(ExceptionEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableMonitorWaitEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.MonitorWaitEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable monitor wait event. * * @author Adrian Herrera * @see MonitorWaitEvent */ public class VisitableMonitorWaitEvent implements Visitable { private final MonitorWaitEvent event; public VisitableMonitorWaitEvent(MonitorWaitEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableMonitorWaitEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.MonitorWaitEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable monitor wait event. * * @author Adrian Herrera * @see MonitorWaitEvent */ public class VisitableMonitorWaitEvent implements Visitable { private final MonitorWaitEvent event; public VisitableMonitorWaitEvent(MonitorWaitEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableMethodExitEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.MethodExitEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable method exit event. * * @author Adrian Herrera * @see MethodExitEvent */ public class VisitableMethodExitEvent implements Visitable { private final MethodExitEvent event; public VisitableMethodExitEvent(MethodExitEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableMethodExitEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.MethodExitEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable method exit event. * * @author Adrian Herrera * @see MethodExitEvent */ public class VisitableMethodExitEvent implements Visitable { private final MethodExitEvent event; public VisitableMethodExitEvent(MethodExitEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableClassPrepareEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.ClassPrepareEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable class prepare event. * * @author Adrian Herrera * @see ClassPrepareEvent */ public class VisitableClassPrepareEvent implements Visitable { private final ClassPrepareEvent event; public VisitableClassPrepareEvent(ClassPrepareEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableClassPrepareEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.ClassPrepareEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable class prepare event. * * @author Adrian Herrera * @see ClassPrepareEvent */ public class VisitableClassPrepareEvent implements Visitable { private final ClassPrepareEvent event; public VisitableClassPrepareEvent(ClassPrepareEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableVMDeathEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.VMDeathEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable VM death event. * * @author Adrian Herrera * @see VMDeathEvent */ public class VisitableVMDeathEvent implements Visitable { private final VMDeathEvent event; public VisitableVMDeathEvent(VMDeathEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableVMDeathEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.VMDeathEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable VM death event. * * @author Adrian Herrera * @see VMDeathEvent */ public class VisitableVMDeathEvent implements Visitable { private final VMDeathEvent event; public VisitableVMDeathEvent(VMDeathEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableMethodEntryEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.MethodEntryEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable method entry event. * * @author Adrian Herrera * @see MethodEntryEvent */ public class VisitableMethodEntryEvent implements Visitable { private final MethodEntryEvent event; public VisitableMethodEntryEvent(MethodEntryEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableMethodEntryEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.MethodEntryEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable method entry event. * * @author Adrian Herrera * @see MethodEntryEvent */ public class VisitableMethodEntryEvent implements Visitable { private final MethodEntryEvent event; public VisitableMethodEntryEvent(MethodEntryEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableMonitorContendedEnterEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.MonitorContendedEnterEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable monitor contended enter event. * * @author Adrian Herrera * @see MonitorContendedEnterEvent */ public class VisitableMonitorContendedEnterEvent implements Visitable { private final MonitorContendedEnterEvent event; public VisitableMonitorContendedEnterEvent(MonitorContendedEnterEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableMonitorContendedEnterEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.MonitorContendedEnterEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable monitor contended enter event. * * @author Adrian Herrera * @see MonitorContendedEnterEvent */ public class VisitableMonitorContendedEnterEvent implements Visitable { private final MonitorContendedEnterEvent event; public VisitableMonitorContendedEnterEvent(MonitorContendedEnterEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
adrianherrera/jdivisitor
src/main/java/org/jdivisitor/debugger/event/VisitableThreadStartEvent.java
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // }
import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.ThreadStartEvent;
/* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable thread start event. * * @author Adrian Herrera * @see ThreadStartEvent */ public class VisitableThreadStartEvent implements Visitable { private final ThreadStartEvent event; public VisitableThreadStartEvent(ThreadStartEvent event) { this.event = event; } @Override
// Path: src/main/java/org/jdivisitor/debugger/event/visitor/EventVisitor.java // public interface EventVisitor { // // /** // * Visit an {@code AccessWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(AccessWatchpointEvent event); // // /** // * Visit a {@code BreakpointEvent}. // * // * @param event Event to visit // */ // void visit(BreakpointEvent event); // // /** // * Visit a {@code ClassPrepareEvent}. // * // * @param event Event to visit // */ // void visit(ClassPrepareEvent event); // // /** // * Visit a {@code ClassUnloadEvent}. // * // * @param event Event to visit // */ // void visit(ClassUnloadEvent event); // // /** // * Visit a {@code ExceptionEvent}. // * // * @param event Event to visit // */ // void visit(ExceptionEvent event); // // /** // * Visit a {@code LocatableEvent}. // * // * @param event Event to visit // */ // void visit(LocatableEvent event); // // /** // * Visit a {@code MethodEntryEvent}. // * // * @param event Event to visit // */ // void visit(MethodEntryEvent event); // // /** // * Visit a {@code MethodExitEvent}. // * // * @param event Event to visit // */ // void visit(MethodExitEvent event); // // /** // * Visit a {@code ModificationWatchpointEvent}. // * // * @param event Event to visit // */ // void visit(ModificationWatchpointEvent event); // // /** // * Visit a {@code MonitorContendedEnteredEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnteredEvent event); // // /** // * Visit a {@code MonitorContendedEnterEvent}. // * // * @param event Event to visit // */ // void visit(MonitorContendedEnterEvent event); // // /** // * Visit a {@code MonitorWaitedEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitedEvent event); // // /** // * Visit a {@code MonitorWaitEvent}. // * // * @param event Event to visit // */ // void visit(MonitorWaitEvent event); // // /** // * Visit a {@code StepEvent}. // * // * @param event Event to visit // */ // void visit(StepEvent event); // // /** // * Visit a {@code ThreadDeathEvent}. // * // * @param event Event to visit // */ // void visit(ThreadDeathEvent event); // // /** // * Visit a {@code ThreadStartEvent}. // * // * @param event Event to visit // */ // void visit(ThreadStartEvent event); // // /** // * Visit a {@code VMDeathEvent}. // * // * @param event Event to visit // */ // void visit(VMDeathEvent event); // // /** // * Visit a {@code VMDisconnectEvent}. // * // * @param event Event to visit // */ // void visit(VMDisconnectEvent event); // // /** // * Visit a {@code VMStartEvent}. // * // * @param event Event to visit // */ // void visit(VMStartEvent event); // // /** // * Visit a {@code WatchpointEvent}. // * // * @param event Event to visit // */ // void visit(WatchpointEvent event); // } // // Path: src/main/java/org/jdivisitor/debugger/event/visitor/Visitable.java // public interface Visitable extends Serializable { // // /** // * Method to accept a visitor. This method usually doesn't do more than // * {@code visitor.visit(this)}. // * // * @param visitor The visitor // */ // void accept(EventVisitor visitor); // } // Path: src/main/java/org/jdivisitor/debugger/event/VisitableThreadStartEvent.java import org.jdivisitor.debugger.event.visitor.EventVisitor; import org.jdivisitor.debugger.event.visitor.Visitable; import com.sun.jdi.event.ThreadStartEvent; /* * JDIVisitor * Copyright (C) 2014 Adrian Herrera * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jdivisitor.debugger.event; /** * Visitable thread start event. * * @author Adrian Herrera * @see ThreadStartEvent */ public class VisitableThreadStartEvent implements Visitable { private final ThreadStartEvent event; public VisitableThreadStartEvent(ThreadStartEvent event) { this.event = event; } @Override
public void accept(EventVisitor visitor) {
saladinkzn/spring-data-tarantool
src/integration/java/ru/shadam/tarantool/repository/RepositoryIntegrationTests.java
// Path: src/main/java/ru/shadam/tarantool/core/SimpleSocketChannelProvider.java // public class SimpleSocketChannelProvider implements SocketChannelProvider { // private static final Logger logger = LoggerFactory.getLogger(SimpleSocketChannelProvider.class); // // private final String host; // private final int port; // // public SimpleSocketChannelProvider(String host, int port) { // this.host = host; // this.port = port; // } // // @Override // public SocketChannel get(int retryNumber, Throwable lastError) { // if(lastError != null) { // logger.error(lastError.getMessage(), lastError); // } // try { // return SocketChannel.open(new InetSocketAddress(host, port)); // } catch (IOException e) { // throw new IllegalStateException(e.getMessage(), e); // } // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/Address.java // public class Address { // @Id // @Tuple(index =0) // private Long id; // // @Tuple(index = 1) // private String city; // // @Tuple(index = 2) // private String street; // // @Tuple(index = 3) // private String number; // // protected Address() {} // // public Address(String city, String street, String number) { // this.city = city; // this.street = street; // this.number = number; // } // // public Address(long id, String city, String street, String number) { // this.id = id; // this.city = city; // this.street = street; // this.number = number; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getCity() { // return city; // } // // public void setCity(String city) { // this.city = city; // } // // public String getStreet() { // return street; // } // // public void setStreet(String street) { // this.street = street; // } // // public String getNumber() { // return number; // } // // public void setNumber(String number) { // this.number = number; // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/LogEntry.java // @KeySpace("log_entry") // public class LogEntry { // @Id // @Tuple(index = 0) // private String uid; // // private String text; // // protected LogEntry() { // } // // public LogEntry(String uid, String text) { // this.uid = uid; // this.text = text; // } // // public String getUid() { // return uid; // } // // public void setUid(String uid) { // this.uid = uid; // } // // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/User.java // public class User { // @Tuple(index = 0) // public long id; // @Tuple(index = 1) // @Index("name_index") // public String name; // // public User() { // } // }
import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.palantir.docker.compose.DockerComposeRule; import com.palantir.docker.compose.connection.DockerPort; import com.palantir.docker.compose.connection.waiting.HealthChecks; import org.apache.commons.io.IOUtils; import org.junit.Assert; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.env.MapPropertySource; import org.springframework.data.repository.CrudRepository; import org.tarantool.*; import ru.shadam.tarantool.core.SimpleSocketChannelProvider; import ru.shadam.tarantool.repository.configuration.EnableTarantoolRepositories; import ru.shadam.tarantool.repository.entity.Address; import ru.shadam.tarantool.repository.entity.LogEntry; import ru.shadam.tarantool.repository.entity.User; import java.io.IOException; import java.util.Arrays; import java.util.List;
applicationContext.register(TarantoolConfiguration.class); DockerPort dockerPort = docker.containers() .container("tarantool") .port(3301); ImmutableMap<String, Object> env = ImmutableMap.of("tarantoolPort", dockerPort.getExternalPort()); applicationContext.getEnvironment().getPropertySources() .addFirst(new MapPropertySource("rule", env)); applicationContext.refresh(); TarantoolClientOps bean = (TarantoolClientOps) applicationContext.getBean("tarantoolSyncOps"); String eval = IOUtils.toString(RepositoryIntegrationTests.class.getResource("/init.lua")); bean.eval(eval); // userRepository = applicationContext.getBean(UserRepository.class); userRepository.deleteAll(); logEntryRepository = applicationContext.getBean(LogEntryRepository.class); logEntryRepository.deleteAll(); addressRepository = applicationContext.getBean(AddressRepository.class); addressRepository.deleteAll(); } @Test public void testFindOne() { Assert.assertNull(userRepository.findOne(1L)); } @Test public void testInsertAndFetch() {
// Path: src/main/java/ru/shadam/tarantool/core/SimpleSocketChannelProvider.java // public class SimpleSocketChannelProvider implements SocketChannelProvider { // private static final Logger logger = LoggerFactory.getLogger(SimpleSocketChannelProvider.class); // // private final String host; // private final int port; // // public SimpleSocketChannelProvider(String host, int port) { // this.host = host; // this.port = port; // } // // @Override // public SocketChannel get(int retryNumber, Throwable lastError) { // if(lastError != null) { // logger.error(lastError.getMessage(), lastError); // } // try { // return SocketChannel.open(new InetSocketAddress(host, port)); // } catch (IOException e) { // throw new IllegalStateException(e.getMessage(), e); // } // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/Address.java // public class Address { // @Id // @Tuple(index =0) // private Long id; // // @Tuple(index = 1) // private String city; // // @Tuple(index = 2) // private String street; // // @Tuple(index = 3) // private String number; // // protected Address() {} // // public Address(String city, String street, String number) { // this.city = city; // this.street = street; // this.number = number; // } // // public Address(long id, String city, String street, String number) { // this.id = id; // this.city = city; // this.street = street; // this.number = number; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getCity() { // return city; // } // // public void setCity(String city) { // this.city = city; // } // // public String getStreet() { // return street; // } // // public void setStreet(String street) { // this.street = street; // } // // public String getNumber() { // return number; // } // // public void setNumber(String number) { // this.number = number; // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/LogEntry.java // @KeySpace("log_entry") // public class LogEntry { // @Id // @Tuple(index = 0) // private String uid; // // private String text; // // protected LogEntry() { // } // // public LogEntry(String uid, String text) { // this.uid = uid; // this.text = text; // } // // public String getUid() { // return uid; // } // // public void setUid(String uid) { // this.uid = uid; // } // // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/User.java // public class User { // @Tuple(index = 0) // public long id; // @Tuple(index = 1) // @Index("name_index") // public String name; // // public User() { // } // } // Path: src/integration/java/ru/shadam/tarantool/repository/RepositoryIntegrationTests.java import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.palantir.docker.compose.DockerComposeRule; import com.palantir.docker.compose.connection.DockerPort; import com.palantir.docker.compose.connection.waiting.HealthChecks; import org.apache.commons.io.IOUtils; import org.junit.Assert; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.env.MapPropertySource; import org.springframework.data.repository.CrudRepository; import org.tarantool.*; import ru.shadam.tarantool.core.SimpleSocketChannelProvider; import ru.shadam.tarantool.repository.configuration.EnableTarantoolRepositories; import ru.shadam.tarantool.repository.entity.Address; import ru.shadam.tarantool.repository.entity.LogEntry; import ru.shadam.tarantool.repository.entity.User; import java.io.IOException; import java.util.Arrays; import java.util.List; applicationContext.register(TarantoolConfiguration.class); DockerPort dockerPort = docker.containers() .container("tarantool") .port(3301); ImmutableMap<String, Object> env = ImmutableMap.of("tarantoolPort", dockerPort.getExternalPort()); applicationContext.getEnvironment().getPropertySources() .addFirst(new MapPropertySource("rule", env)); applicationContext.refresh(); TarantoolClientOps bean = (TarantoolClientOps) applicationContext.getBean("tarantoolSyncOps"); String eval = IOUtils.toString(RepositoryIntegrationTests.class.getResource("/init.lua")); bean.eval(eval); // userRepository = applicationContext.getBean(UserRepository.class); userRepository.deleteAll(); logEntryRepository = applicationContext.getBean(LogEntryRepository.class); logEntryRepository.deleteAll(); addressRepository = applicationContext.getBean(AddressRepository.class); addressRepository.deleteAll(); } @Test public void testFindOne() { Assert.assertNull(userRepository.findOne(1L)); } @Test public void testInsertAndFetch() {
final User user = new User();
saladinkzn/spring-data-tarantool
src/integration/java/ru/shadam/tarantool/repository/RepositoryIntegrationTests.java
// Path: src/main/java/ru/shadam/tarantool/core/SimpleSocketChannelProvider.java // public class SimpleSocketChannelProvider implements SocketChannelProvider { // private static final Logger logger = LoggerFactory.getLogger(SimpleSocketChannelProvider.class); // // private final String host; // private final int port; // // public SimpleSocketChannelProvider(String host, int port) { // this.host = host; // this.port = port; // } // // @Override // public SocketChannel get(int retryNumber, Throwable lastError) { // if(lastError != null) { // logger.error(lastError.getMessage(), lastError); // } // try { // return SocketChannel.open(new InetSocketAddress(host, port)); // } catch (IOException e) { // throw new IllegalStateException(e.getMessage(), e); // } // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/Address.java // public class Address { // @Id // @Tuple(index =0) // private Long id; // // @Tuple(index = 1) // private String city; // // @Tuple(index = 2) // private String street; // // @Tuple(index = 3) // private String number; // // protected Address() {} // // public Address(String city, String street, String number) { // this.city = city; // this.street = street; // this.number = number; // } // // public Address(long id, String city, String street, String number) { // this.id = id; // this.city = city; // this.street = street; // this.number = number; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getCity() { // return city; // } // // public void setCity(String city) { // this.city = city; // } // // public String getStreet() { // return street; // } // // public void setStreet(String street) { // this.street = street; // } // // public String getNumber() { // return number; // } // // public void setNumber(String number) { // this.number = number; // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/LogEntry.java // @KeySpace("log_entry") // public class LogEntry { // @Id // @Tuple(index = 0) // private String uid; // // private String text; // // protected LogEntry() { // } // // public LogEntry(String uid, String text) { // this.uid = uid; // this.text = text; // } // // public String getUid() { // return uid; // } // // public void setUid(String uid) { // this.uid = uid; // } // // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/User.java // public class User { // @Tuple(index = 0) // public long id; // @Tuple(index = 1) // @Index("name_index") // public String name; // // public User() { // } // }
import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.palantir.docker.compose.DockerComposeRule; import com.palantir.docker.compose.connection.DockerPort; import com.palantir.docker.compose.connection.waiting.HealthChecks; import org.apache.commons.io.IOUtils; import org.junit.Assert; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.env.MapPropertySource; import org.springframework.data.repository.CrudRepository; import org.tarantool.*; import ru.shadam.tarantool.core.SimpleSocketChannelProvider; import ru.shadam.tarantool.repository.configuration.EnableTarantoolRepositories; import ru.shadam.tarantool.repository.entity.Address; import ru.shadam.tarantool.repository.entity.LogEntry; import ru.shadam.tarantool.repository.entity.User; import java.io.IOException; import java.util.Arrays; import java.util.List;
Assert.assertEquals(2, userRepository.count()); } @Test public void testInsertAndDeleteByObject() { final User user = new User(); user.id = 7L; user.name = "John Doe"; userRepository.save(user); userRepository.delete(user); Assert.assertEquals(0, userRepository.count()); } @Test public void testExists() { final User user = new User(); user.id = 8L; user.name = "John Doe"; final User saved = userRepository.save(user); Assert.assertTrue(userRepository.exists(8L)); } @Test public void testBasicCrudForStringKey() {
// Path: src/main/java/ru/shadam/tarantool/core/SimpleSocketChannelProvider.java // public class SimpleSocketChannelProvider implements SocketChannelProvider { // private static final Logger logger = LoggerFactory.getLogger(SimpleSocketChannelProvider.class); // // private final String host; // private final int port; // // public SimpleSocketChannelProvider(String host, int port) { // this.host = host; // this.port = port; // } // // @Override // public SocketChannel get(int retryNumber, Throwable lastError) { // if(lastError != null) { // logger.error(lastError.getMessage(), lastError); // } // try { // return SocketChannel.open(new InetSocketAddress(host, port)); // } catch (IOException e) { // throw new IllegalStateException(e.getMessage(), e); // } // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/Address.java // public class Address { // @Id // @Tuple(index =0) // private Long id; // // @Tuple(index = 1) // private String city; // // @Tuple(index = 2) // private String street; // // @Tuple(index = 3) // private String number; // // protected Address() {} // // public Address(String city, String street, String number) { // this.city = city; // this.street = street; // this.number = number; // } // // public Address(long id, String city, String street, String number) { // this.id = id; // this.city = city; // this.street = street; // this.number = number; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getCity() { // return city; // } // // public void setCity(String city) { // this.city = city; // } // // public String getStreet() { // return street; // } // // public void setStreet(String street) { // this.street = street; // } // // public String getNumber() { // return number; // } // // public void setNumber(String number) { // this.number = number; // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/LogEntry.java // @KeySpace("log_entry") // public class LogEntry { // @Id // @Tuple(index = 0) // private String uid; // // private String text; // // protected LogEntry() { // } // // public LogEntry(String uid, String text) { // this.uid = uid; // this.text = text; // } // // public String getUid() { // return uid; // } // // public void setUid(String uid) { // this.uid = uid; // } // // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/User.java // public class User { // @Tuple(index = 0) // public long id; // @Tuple(index = 1) // @Index("name_index") // public String name; // // public User() { // } // } // Path: src/integration/java/ru/shadam/tarantool/repository/RepositoryIntegrationTests.java import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.palantir.docker.compose.DockerComposeRule; import com.palantir.docker.compose.connection.DockerPort; import com.palantir.docker.compose.connection.waiting.HealthChecks; import org.apache.commons.io.IOUtils; import org.junit.Assert; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.env.MapPropertySource; import org.springframework.data.repository.CrudRepository; import org.tarantool.*; import ru.shadam.tarantool.core.SimpleSocketChannelProvider; import ru.shadam.tarantool.repository.configuration.EnableTarantoolRepositories; import ru.shadam.tarantool.repository.entity.Address; import ru.shadam.tarantool.repository.entity.LogEntry; import ru.shadam.tarantool.repository.entity.User; import java.io.IOException; import java.util.Arrays; import java.util.List; Assert.assertEquals(2, userRepository.count()); } @Test public void testInsertAndDeleteByObject() { final User user = new User(); user.id = 7L; user.name = "John Doe"; userRepository.save(user); userRepository.delete(user); Assert.assertEquals(0, userRepository.count()); } @Test public void testExists() { final User user = new User(); user.id = 8L; user.name = "John Doe"; final User saved = userRepository.save(user); Assert.assertTrue(userRepository.exists(8L)); } @Test public void testBasicCrudForStringKey() {
LogEntry logEntry = new LogEntry("asdasd", "Hello, world");
saladinkzn/spring-data-tarantool
src/integration/java/ru/shadam/tarantool/repository/RepositoryIntegrationTests.java
// Path: src/main/java/ru/shadam/tarantool/core/SimpleSocketChannelProvider.java // public class SimpleSocketChannelProvider implements SocketChannelProvider { // private static final Logger logger = LoggerFactory.getLogger(SimpleSocketChannelProvider.class); // // private final String host; // private final int port; // // public SimpleSocketChannelProvider(String host, int port) { // this.host = host; // this.port = port; // } // // @Override // public SocketChannel get(int retryNumber, Throwable lastError) { // if(lastError != null) { // logger.error(lastError.getMessage(), lastError); // } // try { // return SocketChannel.open(new InetSocketAddress(host, port)); // } catch (IOException e) { // throw new IllegalStateException(e.getMessage(), e); // } // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/Address.java // public class Address { // @Id // @Tuple(index =0) // private Long id; // // @Tuple(index = 1) // private String city; // // @Tuple(index = 2) // private String street; // // @Tuple(index = 3) // private String number; // // protected Address() {} // // public Address(String city, String street, String number) { // this.city = city; // this.street = street; // this.number = number; // } // // public Address(long id, String city, String street, String number) { // this.id = id; // this.city = city; // this.street = street; // this.number = number; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getCity() { // return city; // } // // public void setCity(String city) { // this.city = city; // } // // public String getStreet() { // return street; // } // // public void setStreet(String street) { // this.street = street; // } // // public String getNumber() { // return number; // } // // public void setNumber(String number) { // this.number = number; // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/LogEntry.java // @KeySpace("log_entry") // public class LogEntry { // @Id // @Tuple(index = 0) // private String uid; // // private String text; // // protected LogEntry() { // } // // public LogEntry(String uid, String text) { // this.uid = uid; // this.text = text; // } // // public String getUid() { // return uid; // } // // public void setUid(String uid) { // this.uid = uid; // } // // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/User.java // public class User { // @Tuple(index = 0) // public long id; // @Tuple(index = 1) // @Index("name_index") // public String name; // // public User() { // } // }
import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.palantir.docker.compose.DockerComposeRule; import com.palantir.docker.compose.connection.DockerPort; import com.palantir.docker.compose.connection.waiting.HealthChecks; import org.apache.commons.io.IOUtils; import org.junit.Assert; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.env.MapPropertySource; import org.springframework.data.repository.CrudRepository; import org.tarantool.*; import ru.shadam.tarantool.core.SimpleSocketChannelProvider; import ru.shadam.tarantool.repository.configuration.EnableTarantoolRepositories; import ru.shadam.tarantool.repository.entity.Address; import ru.shadam.tarantool.repository.entity.LogEntry; import ru.shadam.tarantool.repository.entity.User; import java.io.IOException; import java.util.Arrays; import java.util.List;
final User saved = userRepository.save(user); Assert.assertTrue(userRepository.exists(8L)); } @Test public void testBasicCrudForStringKey() { LogEntry logEntry = new LogEntry("asdasd", "Hello, world"); logEntryRepository.save(logEntry); Assert.assertEquals("asdasd", logEntry.getUid()); Assert.assertEquals("Hello, world", logEntry.getText()); logEntryRepository.delete("asdasd"); Assert.assertEquals(0, logEntryRepository.count()); } @Test public void testAutoIdGeneration() { User user = new User(); user.name = "John Doe"; User saved = userRepository.save(user); Assert.assertNotEquals(0L, saved.id); } @Test public void testNullFields() {
// Path: src/main/java/ru/shadam/tarantool/core/SimpleSocketChannelProvider.java // public class SimpleSocketChannelProvider implements SocketChannelProvider { // private static final Logger logger = LoggerFactory.getLogger(SimpleSocketChannelProvider.class); // // private final String host; // private final int port; // // public SimpleSocketChannelProvider(String host, int port) { // this.host = host; // this.port = port; // } // // @Override // public SocketChannel get(int retryNumber, Throwable lastError) { // if(lastError != null) { // logger.error(lastError.getMessage(), lastError); // } // try { // return SocketChannel.open(new InetSocketAddress(host, port)); // } catch (IOException e) { // throw new IllegalStateException(e.getMessage(), e); // } // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/Address.java // public class Address { // @Id // @Tuple(index =0) // private Long id; // // @Tuple(index = 1) // private String city; // // @Tuple(index = 2) // private String street; // // @Tuple(index = 3) // private String number; // // protected Address() {} // // public Address(String city, String street, String number) { // this.city = city; // this.street = street; // this.number = number; // } // // public Address(long id, String city, String street, String number) { // this.id = id; // this.city = city; // this.street = street; // this.number = number; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getCity() { // return city; // } // // public void setCity(String city) { // this.city = city; // } // // public String getStreet() { // return street; // } // // public void setStreet(String street) { // this.street = street; // } // // public String getNumber() { // return number; // } // // public void setNumber(String number) { // this.number = number; // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/LogEntry.java // @KeySpace("log_entry") // public class LogEntry { // @Id // @Tuple(index = 0) // private String uid; // // private String text; // // protected LogEntry() { // } // // public LogEntry(String uid, String text) { // this.uid = uid; // this.text = text; // } // // public String getUid() { // return uid; // } // // public void setUid(String uid) { // this.uid = uid; // } // // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/User.java // public class User { // @Tuple(index = 0) // public long id; // @Tuple(index = 1) // @Index("name_index") // public String name; // // public User() { // } // } // Path: src/integration/java/ru/shadam/tarantool/repository/RepositoryIntegrationTests.java import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.palantir.docker.compose.DockerComposeRule; import com.palantir.docker.compose.connection.DockerPort; import com.palantir.docker.compose.connection.waiting.HealthChecks; import org.apache.commons.io.IOUtils; import org.junit.Assert; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.env.MapPropertySource; import org.springframework.data.repository.CrudRepository; import org.tarantool.*; import ru.shadam.tarantool.core.SimpleSocketChannelProvider; import ru.shadam.tarantool.repository.configuration.EnableTarantoolRepositories; import ru.shadam.tarantool.repository.entity.Address; import ru.shadam.tarantool.repository.entity.LogEntry; import ru.shadam.tarantool.repository.entity.User; import java.io.IOException; import java.util.Arrays; import java.util.List; final User saved = userRepository.save(user); Assert.assertTrue(userRepository.exists(8L)); } @Test public void testBasicCrudForStringKey() { LogEntry logEntry = new LogEntry("asdasd", "Hello, world"); logEntryRepository.save(logEntry); Assert.assertEquals("asdasd", logEntry.getUid()); Assert.assertEquals("Hello, world", logEntry.getText()); logEntryRepository.delete("asdasd"); Assert.assertEquals(0, logEntryRepository.count()); } @Test public void testAutoIdGeneration() { User user = new User(); user.name = "John Doe"; User saved = userRepository.save(user); Assert.assertNotEquals(0L, saved.id); } @Test public void testNullFields() {
Address address = new Address(null, "street", null);
saladinkzn/spring-data-tarantool
src/integration/java/ru/shadam/tarantool/repository/RepositoryIntegrationTests.java
// Path: src/main/java/ru/shadam/tarantool/core/SimpleSocketChannelProvider.java // public class SimpleSocketChannelProvider implements SocketChannelProvider { // private static final Logger logger = LoggerFactory.getLogger(SimpleSocketChannelProvider.class); // // private final String host; // private final int port; // // public SimpleSocketChannelProvider(String host, int port) { // this.host = host; // this.port = port; // } // // @Override // public SocketChannel get(int retryNumber, Throwable lastError) { // if(lastError != null) { // logger.error(lastError.getMessage(), lastError); // } // try { // return SocketChannel.open(new InetSocketAddress(host, port)); // } catch (IOException e) { // throw new IllegalStateException(e.getMessage(), e); // } // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/Address.java // public class Address { // @Id // @Tuple(index =0) // private Long id; // // @Tuple(index = 1) // private String city; // // @Tuple(index = 2) // private String street; // // @Tuple(index = 3) // private String number; // // protected Address() {} // // public Address(String city, String street, String number) { // this.city = city; // this.street = street; // this.number = number; // } // // public Address(long id, String city, String street, String number) { // this.id = id; // this.city = city; // this.street = street; // this.number = number; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getCity() { // return city; // } // // public void setCity(String city) { // this.city = city; // } // // public String getStreet() { // return street; // } // // public void setStreet(String street) { // this.street = street; // } // // public String getNumber() { // return number; // } // // public void setNumber(String number) { // this.number = number; // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/LogEntry.java // @KeySpace("log_entry") // public class LogEntry { // @Id // @Tuple(index = 0) // private String uid; // // private String text; // // protected LogEntry() { // } // // public LogEntry(String uid, String text) { // this.uid = uid; // this.text = text; // } // // public String getUid() { // return uid; // } // // public void setUid(String uid) { // this.uid = uid; // } // // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/User.java // public class User { // @Tuple(index = 0) // public long id; // @Tuple(index = 1) // @Index("name_index") // public String name; // // public User() { // } // }
import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.palantir.docker.compose.DockerComposeRule; import com.palantir.docker.compose.connection.DockerPort; import com.palantir.docker.compose.connection.waiting.HealthChecks; import org.apache.commons.io.IOUtils; import org.junit.Assert; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.env.MapPropertySource; import org.springframework.data.repository.CrudRepository; import org.tarantool.*; import ru.shadam.tarantool.core.SimpleSocketChannelProvider; import ru.shadam.tarantool.repository.configuration.EnableTarantoolRepositories; import ru.shadam.tarantool.repository.entity.Address; import ru.shadam.tarantool.repository.entity.LogEntry; import ru.shadam.tarantool.repository.entity.User; import java.io.IOException; import java.util.Arrays; import java.util.List;
} @EnableTarantoolRepositories(basePackages = {"ru.shadam.tarantool"}, considerNestedRepositories = true) @Configuration public static class TarantoolConfiguration { @Bean private static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); } @Bean @Autowired public TarantoolClient tarantoolClient( SocketChannelProvider socketChannelProvider ) { final TarantoolClientConfig config = new TarantoolClientConfig(); config.username = "test"; config.password = "test"; config.initTimeoutMillis = 5000; config.writeTimeoutMillis = 5000; return new TarantoolClientImpl(socketChannelProvider, config); } @Bean public SocketChannelProvider socketChannelProvider( @Value("${DOCKER_HOST_IP:localhost}") String DOCKER_HOST_IP, @Value("${tarantoolPort}") int tarantoolPort ) { System.out.println("DOCKER_HOST_IP: " + DOCKER_HOST_IP);
// Path: src/main/java/ru/shadam/tarantool/core/SimpleSocketChannelProvider.java // public class SimpleSocketChannelProvider implements SocketChannelProvider { // private static final Logger logger = LoggerFactory.getLogger(SimpleSocketChannelProvider.class); // // private final String host; // private final int port; // // public SimpleSocketChannelProvider(String host, int port) { // this.host = host; // this.port = port; // } // // @Override // public SocketChannel get(int retryNumber, Throwable lastError) { // if(lastError != null) { // logger.error(lastError.getMessage(), lastError); // } // try { // return SocketChannel.open(new InetSocketAddress(host, port)); // } catch (IOException e) { // throw new IllegalStateException(e.getMessage(), e); // } // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/Address.java // public class Address { // @Id // @Tuple(index =0) // private Long id; // // @Tuple(index = 1) // private String city; // // @Tuple(index = 2) // private String street; // // @Tuple(index = 3) // private String number; // // protected Address() {} // // public Address(String city, String street, String number) { // this.city = city; // this.street = street; // this.number = number; // } // // public Address(long id, String city, String street, String number) { // this.id = id; // this.city = city; // this.street = street; // this.number = number; // } // // public Long getId() { // return id; // } // // public void setId(Long id) { // this.id = id; // } // // public String getCity() { // return city; // } // // public void setCity(String city) { // this.city = city; // } // // public String getStreet() { // return street; // } // // public void setStreet(String street) { // this.street = street; // } // // public String getNumber() { // return number; // } // // public void setNumber(String number) { // this.number = number; // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/LogEntry.java // @KeySpace("log_entry") // public class LogEntry { // @Id // @Tuple(index = 0) // private String uid; // // private String text; // // protected LogEntry() { // } // // public LogEntry(String uid, String text) { // this.uid = uid; // this.text = text; // } // // public String getUid() { // return uid; // } // // public void setUid(String uid) { // this.uid = uid; // } // // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // } // // Path: src/integration/java/ru/shadam/tarantool/repository/entity/User.java // public class User { // @Tuple(index = 0) // public long id; // @Tuple(index = 1) // @Index("name_index") // public String name; // // public User() { // } // } // Path: src/integration/java/ru/shadam/tarantool/repository/RepositoryIntegrationTests.java import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.palantir.docker.compose.DockerComposeRule; import com.palantir.docker.compose.connection.DockerPort; import com.palantir.docker.compose.connection.waiting.HealthChecks; import org.apache.commons.io.IOUtils; import org.junit.Assert; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.env.MapPropertySource; import org.springframework.data.repository.CrudRepository; import org.tarantool.*; import ru.shadam.tarantool.core.SimpleSocketChannelProvider; import ru.shadam.tarantool.repository.configuration.EnableTarantoolRepositories; import ru.shadam.tarantool.repository.entity.Address; import ru.shadam.tarantool.repository.entity.LogEntry; import ru.shadam.tarantool.repository.entity.User; import java.io.IOException; import java.util.Arrays; import java.util.List; } @EnableTarantoolRepositories(basePackages = {"ru.shadam.tarantool"}, considerNestedRepositories = true) @Configuration public static class TarantoolConfiguration { @Bean private static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); } @Bean @Autowired public TarantoolClient tarantoolClient( SocketChannelProvider socketChannelProvider ) { final TarantoolClientConfig config = new TarantoolClientConfig(); config.username = "test"; config.password = "test"; config.initTimeoutMillis = 5000; config.writeTimeoutMillis = 5000; return new TarantoolClientImpl(socketChannelProvider, config); } @Bean public SocketChannelProvider socketChannelProvider( @Value("${DOCKER_HOST_IP:localhost}") String DOCKER_HOST_IP, @Value("${tarantoolPort}") int tarantoolPort ) { System.out.println("DOCKER_HOST_IP: " + DOCKER_HOST_IP);
return new SimpleSocketChannelProvider(DOCKER_HOST_IP, tarantoolPort);
saladinkzn/spring-data-tarantool
src/test/java/ru/shadam/tarantool/repository/core/MappingTarantoolEntityInformationUnitTests.java
// Path: src/test/java/ru/shadam/tarantool/core/convert/ConversionTestEntities.java // public class ConversionTestEntities { // interface Indexes { // interface Person { // int ID = 0; // int FIRSTNAME = 1; // int GENDER = 2; // int NICKNAMES = 3; // int COWORKERS = 4; // int AGE = 5; // int ALIVE = 6; // int BIRTHDAY = 7; // int ADDRESS = 8; // } // // interface Address { // int CITY = 0; // int COUNTRY = 1; // int ID = 2; // } // } // // /** // * @author sala // */ // public static class Person { // @Id // @Tuple(index = ID) // long id; // @Tuple(index = FIRSTNAME) // String firstname; // @Tuple(index = GENDER) // Gender gender; // // @Tuple(index = NICKNAMES) // List<String> nicknames; // @Tuple(index = COWORKERS) // List<Person> coworkers; // @Tuple(index = AGE) // Integer age; // @Tuple(index = ALIVE) // Boolean alive; // @Tuple(index = BIRTHDAY) // Date birthday; // // @Tuple(index = ADDRESS) // Address address; // // // @Override // public String toString() { // return "Person{" + // "id=" + id + // ", firstname='" + firstname + '\'' + // ", gender=" + gender + // ", nicknames=" + nicknames + // ", coworkers=" + coworkers + // ", age=" + age + // ", alive=" + alive + // ", birthday=" + birthday + // ", address=" + address + // '}'; // } // } // // /** // * @author sala // */ // public static class Address { // @Tuple(index = CITY) // String city; // @Tuple(index = COUNTRY) // String country; // } // // public static class AddressWithId extends Address { // @Id // @Tuple(index = Indexes.Address.ID) // String id; // } // // public static enum Gender { // MALE, FEMALE // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // }
import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.springframework.data.mapping.model.MappingException; import ru.shadam.tarantool.core.convert.ConversionTestEntities; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import java.io.Serializable; import static org.mockito.Mockito.when;
package ru.shadam.tarantool.repository.core; /** * @author sala */ /** * @author Christoph Strobl */ @RunWith(MockitoJUnitRunner.class) public class MappingTarantoolEntityInformationUnitTests<T> { @Mock
// Path: src/test/java/ru/shadam/tarantool/core/convert/ConversionTestEntities.java // public class ConversionTestEntities { // interface Indexes { // interface Person { // int ID = 0; // int FIRSTNAME = 1; // int GENDER = 2; // int NICKNAMES = 3; // int COWORKERS = 4; // int AGE = 5; // int ALIVE = 6; // int BIRTHDAY = 7; // int ADDRESS = 8; // } // // interface Address { // int CITY = 0; // int COUNTRY = 1; // int ID = 2; // } // } // // /** // * @author sala // */ // public static class Person { // @Id // @Tuple(index = ID) // long id; // @Tuple(index = FIRSTNAME) // String firstname; // @Tuple(index = GENDER) // Gender gender; // // @Tuple(index = NICKNAMES) // List<String> nicknames; // @Tuple(index = COWORKERS) // List<Person> coworkers; // @Tuple(index = AGE) // Integer age; // @Tuple(index = ALIVE) // Boolean alive; // @Tuple(index = BIRTHDAY) // Date birthday; // // @Tuple(index = ADDRESS) // Address address; // // // @Override // public String toString() { // return "Person{" + // "id=" + id + // ", firstname='" + firstname + '\'' + // ", gender=" + gender + // ", nicknames=" + nicknames + // ", coworkers=" + coworkers + // ", age=" + age + // ", alive=" + alive + // ", birthday=" + birthday + // ", address=" + address + // '}'; // } // } // // /** // * @author sala // */ // public static class Address { // @Tuple(index = CITY) // String city; // @Tuple(index = COUNTRY) // String country; // } // // public static class AddressWithId extends Address { // @Id // @Tuple(index = Indexes.Address.ID) // String id; // } // // public static enum Gender { // MALE, FEMALE // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // Path: src/test/java/ru/shadam/tarantool/repository/core/MappingTarantoolEntityInformationUnitTests.java import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.springframework.data.mapping.model.MappingException; import ru.shadam.tarantool.core.convert.ConversionTestEntities; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import java.io.Serializable; import static org.mockito.Mockito.when; package ru.shadam.tarantool.repository.core; /** * @author sala */ /** * @author Christoph Strobl */ @RunWith(MockitoJUnitRunner.class) public class MappingTarantoolEntityInformationUnitTests<T> { @Mock
TarantoolPersistentEntity<T> entity;
saladinkzn/spring-data-tarantool
src/test/java/ru/shadam/tarantool/repository/core/MappingTarantoolEntityInformationUnitTests.java
// Path: src/test/java/ru/shadam/tarantool/core/convert/ConversionTestEntities.java // public class ConversionTestEntities { // interface Indexes { // interface Person { // int ID = 0; // int FIRSTNAME = 1; // int GENDER = 2; // int NICKNAMES = 3; // int COWORKERS = 4; // int AGE = 5; // int ALIVE = 6; // int BIRTHDAY = 7; // int ADDRESS = 8; // } // // interface Address { // int CITY = 0; // int COUNTRY = 1; // int ID = 2; // } // } // // /** // * @author sala // */ // public static class Person { // @Id // @Tuple(index = ID) // long id; // @Tuple(index = FIRSTNAME) // String firstname; // @Tuple(index = GENDER) // Gender gender; // // @Tuple(index = NICKNAMES) // List<String> nicknames; // @Tuple(index = COWORKERS) // List<Person> coworkers; // @Tuple(index = AGE) // Integer age; // @Tuple(index = ALIVE) // Boolean alive; // @Tuple(index = BIRTHDAY) // Date birthday; // // @Tuple(index = ADDRESS) // Address address; // // // @Override // public String toString() { // return "Person{" + // "id=" + id + // ", firstname='" + firstname + '\'' + // ", gender=" + gender + // ", nicknames=" + nicknames + // ", coworkers=" + coworkers + // ", age=" + age + // ", alive=" + alive + // ", birthday=" + birthday + // ", address=" + address + // '}'; // } // } // // /** // * @author sala // */ // public static class Address { // @Tuple(index = CITY) // String city; // @Tuple(index = COUNTRY) // String country; // } // // public static class AddressWithId extends Address { // @Id // @Tuple(index = Indexes.Address.ID) // String id; // } // // public static enum Gender { // MALE, FEMALE // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // }
import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.springframework.data.mapping.model.MappingException; import ru.shadam.tarantool.core.convert.ConversionTestEntities; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import java.io.Serializable; import static org.mockito.Mockito.when;
package ru.shadam.tarantool.repository.core; /** * @author sala */ /** * @author Christoph Strobl */ @RunWith(MockitoJUnitRunner.class) public class MappingTarantoolEntityInformationUnitTests<T> { @Mock TarantoolPersistentEntity<T> entity; /** * @see DATAREDIS-425 */ @Test(expected = MappingException.class) @SuppressWarnings("unchecked") public void throwsMappingExceptionWhenNoIdPropertyPresent() { when(entity.hasIdProperty()).thenReturn(false);
// Path: src/test/java/ru/shadam/tarantool/core/convert/ConversionTestEntities.java // public class ConversionTestEntities { // interface Indexes { // interface Person { // int ID = 0; // int FIRSTNAME = 1; // int GENDER = 2; // int NICKNAMES = 3; // int COWORKERS = 4; // int AGE = 5; // int ALIVE = 6; // int BIRTHDAY = 7; // int ADDRESS = 8; // } // // interface Address { // int CITY = 0; // int COUNTRY = 1; // int ID = 2; // } // } // // /** // * @author sala // */ // public static class Person { // @Id // @Tuple(index = ID) // long id; // @Tuple(index = FIRSTNAME) // String firstname; // @Tuple(index = GENDER) // Gender gender; // // @Tuple(index = NICKNAMES) // List<String> nicknames; // @Tuple(index = COWORKERS) // List<Person> coworkers; // @Tuple(index = AGE) // Integer age; // @Tuple(index = ALIVE) // Boolean alive; // @Tuple(index = BIRTHDAY) // Date birthday; // // @Tuple(index = ADDRESS) // Address address; // // // @Override // public String toString() { // return "Person{" + // "id=" + id + // ", firstname='" + firstname + '\'' + // ", gender=" + gender + // ", nicknames=" + nicknames + // ", coworkers=" + coworkers + // ", age=" + age + // ", alive=" + alive + // ", birthday=" + birthday + // ", address=" + address + // '}'; // } // } // // /** // * @author sala // */ // public static class Address { // @Tuple(index = CITY) // String city; // @Tuple(index = COUNTRY) // String country; // } // // public static class AddressWithId extends Address { // @Id // @Tuple(index = Indexes.Address.ID) // String id; // } // // public static enum Gender { // MALE, FEMALE // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // Path: src/test/java/ru/shadam/tarantool/repository/core/MappingTarantoolEntityInformationUnitTests.java import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.springframework.data.mapping.model.MappingException; import ru.shadam.tarantool.core.convert.ConversionTestEntities; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import java.io.Serializable; import static org.mockito.Mockito.when; package ru.shadam.tarantool.repository.core; /** * @author sala */ /** * @author Christoph Strobl */ @RunWith(MockitoJUnitRunner.class) public class MappingTarantoolEntityInformationUnitTests<T> { @Mock TarantoolPersistentEntity<T> entity; /** * @see DATAREDIS-425 */ @Test(expected = MappingException.class) @SuppressWarnings("unchecked") public void throwsMappingExceptionWhenNoIdPropertyPresent() { when(entity.hasIdProperty()).thenReturn(false);
when(entity.getType()).thenReturn((Class<T>) ConversionTestEntities.Person.class);
saladinkzn/spring-data-tarantool
src/main/java/ru/shadam/tarantool/core/TarantoolOpsImpl.java
// Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolData.java // public class TarantoolData { // private Object id; // // private Tuple tuple; // // public TarantoolData() { // this.tuple = new Tuple(); // } // // public TarantoolData(Tuple tuple) { // this.tuple = tuple; // } // // public Object getId() { // return id; // } // // public void setId(Object id) { // this.id = id; // } // // // @Override // public String toString() { // return "TarantoolData{" + // ", id=" + id + // ", tuple=" + tuple + // '}'; // } // // public Tuple getTuple() { // return tuple; // } // } // // Path: src/main/java/ru/shadam/tarantool/core/convert/Tuple.java // public class Tuple { // private final List<Object> inner; // // public Tuple() { // this.inner = new ArrayList<>(); // } // // public Tuple(List<Object> inner) { // this.inner = inner; // } // // public Object get(Path path) { // return getInternal(inner, path.getIndexes()); // } // // @SuppressWarnings("unchecked") // private static Object getInternal(List<Object> inner, List<Integer> indexes) { // if(indexes.isEmpty()) { // return inner; // } // final Integer headIndex = indexes.get(0); // if(indexes.size() == 1) { // if(inner.size() <= headIndex) { // return null; // } // return inner.get(headIndex); // } // final List<Integer> tailIndexes = indexes.subList(1, indexes.size()); // final List<Object> tuple = (List<Object>) inner.get(headIndex); // return getInternal(tuple, tailIndexes); // } // // public void set(Path path, Object value) { // setInternal(inner, path.getIndexes(), value); // } // // @SuppressWarnings("unchecked") // private static void setInternal(List<Object> inner, List<Integer> indexes, Object value) { // if(indexes.isEmpty()) { // throw new IllegalArgumentException("indexes should not be empty"); // } // final Integer index = indexes.get(0); // ensureCapacity(inner, index); // if(indexes.size() == 1) { // inner.set(index, value); // return; // } // final List<Object> tuple; // if(inner.get(index) == null) { // tuple = new ArrayList<>(); // inner.set(index, tuple); // } else { // tuple = (List<Object>) inner.get(index); // } // setInternal(tuple, indexes.subList(1, indexes.size()), value); // } // // private static void ensureCapacity(List<Object> inner, int size) { // int startSize = inner.size(); // for(int i = startSize; i <= size; i++) { // inner.add(null); // } // } // // public int size() { // return inner.size(); // } // // public boolean isEmpty() { // return inner.isEmpty(); // } // // public Tuple extract(Path currentPath) { // final Object value = get(currentPath); // final Tuple tuple = new Tuple(); // tuple.set(currentPath, value); // return tuple; // } // // public List<Object> getRaw() { // return inner; // } // // public List<Path> extractAllKeysFor(Path path) { // final List<Object> internal = (List<Object>) get(path); // if(internal == null) { // return Collections.emptyList(); // } // return IntStream.range(0, internal.size()) // .mapToObj(i -> Path.concat(path, i)) // .collect(Collectors.toList()); // } // // // @Override // public String toString() { // return "Tuple{" + // "inner=" + inner + // '}'; // } // } // // Path: src/main/java/ru/shadam/tarantool/core/util/TarantoolSpaceUtils.java // public abstract class TarantoolSpaceUtils { // public TarantoolSpaceUtils() { // throw new UnsupportedOperationException("unsupported"); // } // // public static String createSpaceFunction(String space, TarantoolSpaceOperation operation) { // return "box.space." + space + ":" + operation.getOperationName(); // } // // public static String createSpaceIndexFunction(String space, String index, TarantoolIndexOperation operation) { // return "box.space." + space + ".index." + index + ":" + operation.getOperationName(); // } // }
import org.tarantool.TarantoolClientOps; import ru.shadam.tarantool.core.convert.TarantoolData; import ru.shadam.tarantool.core.convert.Tuple; import ru.shadam.tarantool.core.util.TarantoolSpaceUtils; import java.io.Serializable; import java.util.*;
package ru.shadam.tarantool.core; /** * @author sala */ public class TarantoolOpsImpl implements TarantoolOps { private final TarantoolClientOps<Integer, List<?>, Object, List<?>> syncOps; public TarantoolOpsImpl(TarantoolClientOps<Integer, List<?>, Object, List<?>> syncOps) { this.syncOps = syncOps; } @Override public boolean contains(String space, Serializable id) {
// Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolData.java // public class TarantoolData { // private Object id; // // private Tuple tuple; // // public TarantoolData() { // this.tuple = new Tuple(); // } // // public TarantoolData(Tuple tuple) { // this.tuple = tuple; // } // // public Object getId() { // return id; // } // // public void setId(Object id) { // this.id = id; // } // // // @Override // public String toString() { // return "TarantoolData{" + // ", id=" + id + // ", tuple=" + tuple + // '}'; // } // // public Tuple getTuple() { // return tuple; // } // } // // Path: src/main/java/ru/shadam/tarantool/core/convert/Tuple.java // public class Tuple { // private final List<Object> inner; // // public Tuple() { // this.inner = new ArrayList<>(); // } // // public Tuple(List<Object> inner) { // this.inner = inner; // } // // public Object get(Path path) { // return getInternal(inner, path.getIndexes()); // } // // @SuppressWarnings("unchecked") // private static Object getInternal(List<Object> inner, List<Integer> indexes) { // if(indexes.isEmpty()) { // return inner; // } // final Integer headIndex = indexes.get(0); // if(indexes.size() == 1) { // if(inner.size() <= headIndex) { // return null; // } // return inner.get(headIndex); // } // final List<Integer> tailIndexes = indexes.subList(1, indexes.size()); // final List<Object> tuple = (List<Object>) inner.get(headIndex); // return getInternal(tuple, tailIndexes); // } // // public void set(Path path, Object value) { // setInternal(inner, path.getIndexes(), value); // } // // @SuppressWarnings("unchecked") // private static void setInternal(List<Object> inner, List<Integer> indexes, Object value) { // if(indexes.isEmpty()) { // throw new IllegalArgumentException("indexes should not be empty"); // } // final Integer index = indexes.get(0); // ensureCapacity(inner, index); // if(indexes.size() == 1) { // inner.set(index, value); // return; // } // final List<Object> tuple; // if(inner.get(index) == null) { // tuple = new ArrayList<>(); // inner.set(index, tuple); // } else { // tuple = (List<Object>) inner.get(index); // } // setInternal(tuple, indexes.subList(1, indexes.size()), value); // } // // private static void ensureCapacity(List<Object> inner, int size) { // int startSize = inner.size(); // for(int i = startSize; i <= size; i++) { // inner.add(null); // } // } // // public int size() { // return inner.size(); // } // // public boolean isEmpty() { // return inner.isEmpty(); // } // // public Tuple extract(Path currentPath) { // final Object value = get(currentPath); // final Tuple tuple = new Tuple(); // tuple.set(currentPath, value); // return tuple; // } // // public List<Object> getRaw() { // return inner; // } // // public List<Path> extractAllKeysFor(Path path) { // final List<Object> internal = (List<Object>) get(path); // if(internal == null) { // return Collections.emptyList(); // } // return IntStream.range(0, internal.size()) // .mapToObj(i -> Path.concat(path, i)) // .collect(Collectors.toList()); // } // // // @Override // public String toString() { // return "Tuple{" + // "inner=" + inner + // '}'; // } // } // // Path: src/main/java/ru/shadam/tarantool/core/util/TarantoolSpaceUtils.java // public abstract class TarantoolSpaceUtils { // public TarantoolSpaceUtils() { // throw new UnsupportedOperationException("unsupported"); // } // // public static String createSpaceFunction(String space, TarantoolSpaceOperation operation) { // return "box.space." + space + ":" + operation.getOperationName(); // } // // public static String createSpaceIndexFunction(String space, String index, TarantoolIndexOperation operation) { // return "box.space." + space + ".index." + index + ":" + operation.getOperationName(); // } // } // Path: src/main/java/ru/shadam/tarantool/core/TarantoolOpsImpl.java import org.tarantool.TarantoolClientOps; import ru.shadam.tarantool.core.convert.TarantoolData; import ru.shadam.tarantool.core.convert.Tuple; import ru.shadam.tarantool.core.util.TarantoolSpaceUtils; import java.io.Serializable; import java.util.*; package ru.shadam.tarantool.core; /** * @author sala */ public class TarantoolOpsImpl implements TarantoolOps { private final TarantoolClientOps<Integer, List<?>, Object, List<?>> syncOps; public TarantoolOpsImpl(TarantoolClientOps<Integer, List<?>, Object, List<?>> syncOps) { this.syncOps = syncOps; } @Override public boolean contains(String space, Serializable id) {
String spaceFunction = TarantoolSpaceUtils.createSpaceFunction(space, TarantoolSpaceOperation.SELECT);
saladinkzn/spring-data-tarantool
src/main/java/ru/shadam/tarantool/core/util/TarantoolSpaceUtils.java
// Path: src/main/java/ru/shadam/tarantool/core/TarantoolIndexOperation.java // public enum TarantoolIndexOperation { // SELECT("select"), // UPDATE("update"), // COUNT("count"); // // TarantoolIndexOperation(String operationName) { // this.operationName = operationName; // } // // private final String operationName; // // public String getOperationName() { // return operationName; // } // } // // Path: src/main/java/ru/shadam/tarantool/core/TarantoolSpaceOperation.java // public enum TarantoolSpaceOperation { // SELECT("select"), // INSERT("replace"), // REPLACE("replace"), // UPDATE("update"), // UPSERT("upsert"), // DELETE("delete"), // TRUNCATE("truncate"), // COUNT("count"), // AUTO_INCREMENT("auto_increment"); // // private final String operationName; // // TarantoolSpaceOperation(String operationName) { // this.operationName = operationName; // } // // public String getOperationName() { // return operationName; // } // }
import ru.shadam.tarantool.core.TarantoolIndexOperation; import ru.shadam.tarantool.core.TarantoolSpaceOperation;
package ru.shadam.tarantool.core.util; /** * @author sala */ public abstract class TarantoolSpaceUtils { public TarantoolSpaceUtils() { throw new UnsupportedOperationException("unsupported"); }
// Path: src/main/java/ru/shadam/tarantool/core/TarantoolIndexOperation.java // public enum TarantoolIndexOperation { // SELECT("select"), // UPDATE("update"), // COUNT("count"); // // TarantoolIndexOperation(String operationName) { // this.operationName = operationName; // } // // private final String operationName; // // public String getOperationName() { // return operationName; // } // } // // Path: src/main/java/ru/shadam/tarantool/core/TarantoolSpaceOperation.java // public enum TarantoolSpaceOperation { // SELECT("select"), // INSERT("replace"), // REPLACE("replace"), // UPDATE("update"), // UPSERT("upsert"), // DELETE("delete"), // TRUNCATE("truncate"), // COUNT("count"), // AUTO_INCREMENT("auto_increment"); // // private final String operationName; // // TarantoolSpaceOperation(String operationName) { // this.operationName = operationName; // } // // public String getOperationName() { // return operationName; // } // } // Path: src/main/java/ru/shadam/tarantool/core/util/TarantoolSpaceUtils.java import ru.shadam.tarantool.core.TarantoolIndexOperation; import ru.shadam.tarantool.core.TarantoolSpaceOperation; package ru.shadam.tarantool.core.util; /** * @author sala */ public abstract class TarantoolSpaceUtils { public TarantoolSpaceUtils() { throw new UnsupportedOperationException("unsupported"); }
public static String createSpaceFunction(String space, TarantoolSpaceOperation operation) {
saladinkzn/spring-data-tarantool
src/main/java/ru/shadam/tarantool/core/util/TarantoolSpaceUtils.java
// Path: src/main/java/ru/shadam/tarantool/core/TarantoolIndexOperation.java // public enum TarantoolIndexOperation { // SELECT("select"), // UPDATE("update"), // COUNT("count"); // // TarantoolIndexOperation(String operationName) { // this.operationName = operationName; // } // // private final String operationName; // // public String getOperationName() { // return operationName; // } // } // // Path: src/main/java/ru/shadam/tarantool/core/TarantoolSpaceOperation.java // public enum TarantoolSpaceOperation { // SELECT("select"), // INSERT("replace"), // REPLACE("replace"), // UPDATE("update"), // UPSERT("upsert"), // DELETE("delete"), // TRUNCATE("truncate"), // COUNT("count"), // AUTO_INCREMENT("auto_increment"); // // private final String operationName; // // TarantoolSpaceOperation(String operationName) { // this.operationName = operationName; // } // // public String getOperationName() { // return operationName; // } // }
import ru.shadam.tarantool.core.TarantoolIndexOperation; import ru.shadam.tarantool.core.TarantoolSpaceOperation;
package ru.shadam.tarantool.core.util; /** * @author sala */ public abstract class TarantoolSpaceUtils { public TarantoolSpaceUtils() { throw new UnsupportedOperationException("unsupported"); } public static String createSpaceFunction(String space, TarantoolSpaceOperation operation) { return "box.space." + space + ":" + operation.getOperationName(); }
// Path: src/main/java/ru/shadam/tarantool/core/TarantoolIndexOperation.java // public enum TarantoolIndexOperation { // SELECT("select"), // UPDATE("update"), // COUNT("count"); // // TarantoolIndexOperation(String operationName) { // this.operationName = operationName; // } // // private final String operationName; // // public String getOperationName() { // return operationName; // } // } // // Path: src/main/java/ru/shadam/tarantool/core/TarantoolSpaceOperation.java // public enum TarantoolSpaceOperation { // SELECT("select"), // INSERT("replace"), // REPLACE("replace"), // UPDATE("update"), // UPSERT("upsert"), // DELETE("delete"), // TRUNCATE("truncate"), // COUNT("count"), // AUTO_INCREMENT("auto_increment"); // // private final String operationName; // // TarantoolSpaceOperation(String operationName) { // this.operationName = operationName; // } // // public String getOperationName() { // return operationName; // } // } // Path: src/main/java/ru/shadam/tarantool/core/util/TarantoolSpaceUtils.java import ru.shadam.tarantool.core.TarantoolIndexOperation; import ru.shadam.tarantool.core.TarantoolSpaceOperation; package ru.shadam.tarantool.core.util; /** * @author sala */ public abstract class TarantoolSpaceUtils { public TarantoolSpaceUtils() { throw new UnsupportedOperationException("unsupported"); } public static String createSpaceFunction(String space, TarantoolSpaceOperation operation) { return "box.space." + space + ":" + operation.getOperationName(); }
public static String createSpaceIndexFunction(String space, String index, TarantoolIndexOperation operation) {
saladinkzn/spring-data-tarantool
src/integration/java/ru/shadam/tarantool/util/TarantoolConfiguration.java
// Path: src/main/java/ru/shadam/tarantool/core/SimpleSocketChannelProvider.java // public class SimpleSocketChannelProvider implements SocketChannelProvider { // private static final Logger logger = LoggerFactory.getLogger(SimpleSocketChannelProvider.class); // // private final String host; // private final int port; // // public SimpleSocketChannelProvider(String host, int port) { // this.host = host; // this.port = port; // } // // @Override // public SocketChannel get(int retryNumber, Throwable lastError) { // if(lastError != null) { // logger.error(lastError.getMessage(), lastError); // } // try { // return SocketChannel.open(new InetSocketAddress(host, port)); // } catch (IOException e) { // throw new IllegalStateException(e.getMessage(), e); // } // } // }
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.env.Environment; import org.tarantool.*; import ru.shadam.tarantool.core.SimpleSocketChannelProvider; import ru.shadam.tarantool.repository.configuration.EnableTarantoolRepositories; import java.util.List;
package ru.shadam.tarantool.util; /** * @author sala */ @EnableTarantoolRepositories(basePackages = {"ru.shadam.tarantool"}) @Configuration public class TarantoolConfiguration { @Bean private static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer(Environment environment) { PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer(); propertySourcesPlaceholderConfigurer.setEnvironment(environment); return propertySourcesPlaceholderConfigurer; } @Bean @Autowired public TarantoolClient tarantoolClient( SocketChannelProvider socketChannelProvider ) { final TarantoolClientConfig config = new TarantoolClientConfig(); config.username = "test"; config.password = "test"; config.initTimeoutMillis = 5000; config.writeTimeoutMillis = 5000; return new TarantoolClientImpl(socketChannelProvider, config); } @Bean public SocketChannelProvider socketChannelProvider( @Value("${DOCKER_HOST_IP:localhost}") String DOCKER_HOST_IP, @Value("${tarantool.3301}") int tarantoolPort ) { System.out.println("DOCKER_HOST_IP: " + DOCKER_HOST_IP);
// Path: src/main/java/ru/shadam/tarantool/core/SimpleSocketChannelProvider.java // public class SimpleSocketChannelProvider implements SocketChannelProvider { // private static final Logger logger = LoggerFactory.getLogger(SimpleSocketChannelProvider.class); // // private final String host; // private final int port; // // public SimpleSocketChannelProvider(String host, int port) { // this.host = host; // this.port = port; // } // // @Override // public SocketChannel get(int retryNumber, Throwable lastError) { // if(lastError != null) { // logger.error(lastError.getMessage(), lastError); // } // try { // return SocketChannel.open(new InetSocketAddress(host, port)); // } catch (IOException e) { // throw new IllegalStateException(e.getMessage(), e); // } // } // } // Path: src/integration/java/ru/shadam/tarantool/util/TarantoolConfiguration.java import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.env.Environment; import org.tarantool.*; import ru.shadam.tarantool.core.SimpleSocketChannelProvider; import ru.shadam.tarantool.repository.configuration.EnableTarantoolRepositories; import java.util.List; package ru.shadam.tarantool.util; /** * @author sala */ @EnableTarantoolRepositories(basePackages = {"ru.shadam.tarantool"}) @Configuration public class TarantoolConfiguration { @Bean private static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer(Environment environment) { PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer(); propertySourcesPlaceholderConfigurer.setEnvironment(environment); return propertySourcesPlaceholderConfigurer; } @Bean @Autowired public TarantoolClient tarantoolClient( SocketChannelProvider socketChannelProvider ) { final TarantoolClientConfig config = new TarantoolClientConfig(); config.username = "test"; config.password = "test"; config.initTimeoutMillis = 5000; config.writeTimeoutMillis = 5000; return new TarantoolClientImpl(socketChannelProvider, config); } @Bean public SocketChannelProvider socketChannelProvider( @Value("${DOCKER_HOST_IP:localhost}") String DOCKER_HOST_IP, @Value("${tarantool.3301}") int tarantoolPort ) { System.out.println("DOCKER_HOST_IP: " + DOCKER_HOST_IP);
return new SimpleSocketChannelProvider(DOCKER_HOST_IP, tarantoolPort);
saladinkzn/spring-data-tarantool
src/main/java/ru/shadam/tarantool/core/convert/MappingTarantoolConverter.java
// Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolMappingContext.java // public class TarantoolMappingContext extends AbstractMappingContext<TarantoolPersistentEntity<?>, TarantoolPersistentProperty> { // private KeySpaceResolver fallbackKeySpaceResolver; // // public void setFallbackKeySpaceResolver(KeySpaceResolver fallbackKeySpaceResolver) { // this.fallbackKeySpaceResolver = fallbackKeySpaceResolver; // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(Class<?> type) { // return super.getPersistentEntity(type); // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(TypeInformation<?> type) { // return super.getPersistentEntity(type); // // } // // @Override // protected <T> TarantoolPersistentEntity<T> createPersistentEntity(TypeInformation<T> typeInformation) { // return new BasicTarantoolPersistentEntity<>(typeInformation, fallbackKeySpaceResolver); // } // // @Override // protected TarantoolPersistentPropertyImpl createPersistentProperty(Field field, // PropertyDescriptor descriptor, // TarantoolPersistentEntity<?> owner, // SimpleTypeHolder simpleTypeHolder) { // return new TarantoolPersistentPropertyImpl(field, descriptor, owner, simpleTypeHolder); // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentProperty.java // public interface TarantoolPersistentProperty extends PersistentProperty<TarantoolPersistentProperty> { // OptionalInt getTupleIndex(); // // Optional<String> getSpaceIndexName(); // }
import org.springframework.beans.factory.InitializingBean; import org.springframework.core.CollectionFactory; import org.springframework.core.convert.ConversionService; import org.springframework.data.convert.*; import org.springframework.data.mapping.PersistentPropertyAccessor; import org.springframework.data.mapping.PreferredConstructor; import org.springframework.data.mapping.PropertyHandler; import org.springframework.data.mapping.model.MappingException; import org.springframework.data.mapping.model.PersistentEntityParameterValueProvider; import org.springframework.data.mapping.model.PropertyValueProvider; import org.springframework.data.util.ClassTypeInformation; import org.springframework.data.util.TypeInformation; import org.springframework.util.ClassUtils; import org.springframework.util.CollectionUtils; import ru.shadam.tarantool.core.mapping.TarantoolMappingContext; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.core.mapping.TarantoolPersistentProperty; import java.lang.reflect.Array; import java.util.*;
package ru.shadam.tarantool.core.convert; /** * @author sala */ public class MappingTarantoolConverter implements TarantoolConverter, InitializingBean { private static final int TYPE_HINT_INDEX = 0; private final EntityInstantiators entityInstantiators;
// Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolMappingContext.java // public class TarantoolMappingContext extends AbstractMappingContext<TarantoolPersistentEntity<?>, TarantoolPersistentProperty> { // private KeySpaceResolver fallbackKeySpaceResolver; // // public void setFallbackKeySpaceResolver(KeySpaceResolver fallbackKeySpaceResolver) { // this.fallbackKeySpaceResolver = fallbackKeySpaceResolver; // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(Class<?> type) { // return super.getPersistentEntity(type); // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(TypeInformation<?> type) { // return super.getPersistentEntity(type); // // } // // @Override // protected <T> TarantoolPersistentEntity<T> createPersistentEntity(TypeInformation<T> typeInformation) { // return new BasicTarantoolPersistentEntity<>(typeInformation, fallbackKeySpaceResolver); // } // // @Override // protected TarantoolPersistentPropertyImpl createPersistentProperty(Field field, // PropertyDescriptor descriptor, // TarantoolPersistentEntity<?> owner, // SimpleTypeHolder simpleTypeHolder) { // return new TarantoolPersistentPropertyImpl(field, descriptor, owner, simpleTypeHolder); // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentProperty.java // public interface TarantoolPersistentProperty extends PersistentProperty<TarantoolPersistentProperty> { // OptionalInt getTupleIndex(); // // Optional<String> getSpaceIndexName(); // } // Path: src/main/java/ru/shadam/tarantool/core/convert/MappingTarantoolConverter.java import org.springframework.beans.factory.InitializingBean; import org.springframework.core.CollectionFactory; import org.springframework.core.convert.ConversionService; import org.springframework.data.convert.*; import org.springframework.data.mapping.PersistentPropertyAccessor; import org.springframework.data.mapping.PreferredConstructor; import org.springframework.data.mapping.PropertyHandler; import org.springframework.data.mapping.model.MappingException; import org.springframework.data.mapping.model.PersistentEntityParameterValueProvider; import org.springframework.data.mapping.model.PropertyValueProvider; import org.springframework.data.util.ClassTypeInformation; import org.springframework.data.util.TypeInformation; import org.springframework.util.ClassUtils; import org.springframework.util.CollectionUtils; import ru.shadam.tarantool.core.mapping.TarantoolMappingContext; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.core.mapping.TarantoolPersistentProperty; import java.lang.reflect.Array; import java.util.*; package ru.shadam.tarantool.core.convert; /** * @author sala */ public class MappingTarantoolConverter implements TarantoolConverter, InitializingBean { private static final int TYPE_HINT_INDEX = 0; private final EntityInstantiators entityInstantiators;
private final TarantoolMappingContext mappingContext;
saladinkzn/spring-data-tarantool
src/main/java/ru/shadam/tarantool/core/convert/MappingTarantoolConverter.java
// Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolMappingContext.java // public class TarantoolMappingContext extends AbstractMappingContext<TarantoolPersistentEntity<?>, TarantoolPersistentProperty> { // private KeySpaceResolver fallbackKeySpaceResolver; // // public void setFallbackKeySpaceResolver(KeySpaceResolver fallbackKeySpaceResolver) { // this.fallbackKeySpaceResolver = fallbackKeySpaceResolver; // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(Class<?> type) { // return super.getPersistentEntity(type); // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(TypeInformation<?> type) { // return super.getPersistentEntity(type); // // } // // @Override // protected <T> TarantoolPersistentEntity<T> createPersistentEntity(TypeInformation<T> typeInformation) { // return new BasicTarantoolPersistentEntity<>(typeInformation, fallbackKeySpaceResolver); // } // // @Override // protected TarantoolPersistentPropertyImpl createPersistentProperty(Field field, // PropertyDescriptor descriptor, // TarantoolPersistentEntity<?> owner, // SimpleTypeHolder simpleTypeHolder) { // return new TarantoolPersistentPropertyImpl(field, descriptor, owner, simpleTypeHolder); // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentProperty.java // public interface TarantoolPersistentProperty extends PersistentProperty<TarantoolPersistentProperty> { // OptionalInt getTupleIndex(); // // Optional<String> getSpaceIndexName(); // }
import org.springframework.beans.factory.InitializingBean; import org.springframework.core.CollectionFactory; import org.springframework.core.convert.ConversionService; import org.springframework.data.convert.*; import org.springframework.data.mapping.PersistentPropertyAccessor; import org.springframework.data.mapping.PreferredConstructor; import org.springframework.data.mapping.PropertyHandler; import org.springframework.data.mapping.model.MappingException; import org.springframework.data.mapping.model.PersistentEntityParameterValueProvider; import org.springframework.data.mapping.model.PropertyValueProvider; import org.springframework.data.util.ClassTypeInformation; import org.springframework.data.util.TypeInformation; import org.springframework.util.ClassUtils; import org.springframework.util.CollectionUtils; import ru.shadam.tarantool.core.mapping.TarantoolMappingContext; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.core.mapping.TarantoolPersistentProperty; import java.lang.reflect.Array; import java.util.*;
this.customConversions = new CustomConversions(); this.entityInstantiators = new EntityInstantiators(); this.typeMapper = new DefaultTypeMapper<>(new TarantoolTypeAliasAccessor(conversionService)); } @Override public TarantoolMappingContext getMappingContext() { return mappingContext; } @Override public ConversionService getConversionService() { return conversionService; } @Override public <R> R read(Class<R> type, TarantoolData source) { return readInternal(Path.empty(), type, source); } @SuppressWarnings("unchecked") private <R> R readInternal(Path path, Class<R> type, TarantoolData source) { // first item in tuple is class information. if (source.getTuple() == null || source.getTuple().isEmpty()) { return null; } TypeInformation<?> readType = typeMapper.readType(source); TypeInformation<?> typeToUse = readType != null ? readType : ClassTypeInformation.from(type);
// Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolMappingContext.java // public class TarantoolMappingContext extends AbstractMappingContext<TarantoolPersistentEntity<?>, TarantoolPersistentProperty> { // private KeySpaceResolver fallbackKeySpaceResolver; // // public void setFallbackKeySpaceResolver(KeySpaceResolver fallbackKeySpaceResolver) { // this.fallbackKeySpaceResolver = fallbackKeySpaceResolver; // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(Class<?> type) { // return super.getPersistentEntity(type); // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(TypeInformation<?> type) { // return super.getPersistentEntity(type); // // } // // @Override // protected <T> TarantoolPersistentEntity<T> createPersistentEntity(TypeInformation<T> typeInformation) { // return new BasicTarantoolPersistentEntity<>(typeInformation, fallbackKeySpaceResolver); // } // // @Override // protected TarantoolPersistentPropertyImpl createPersistentProperty(Field field, // PropertyDescriptor descriptor, // TarantoolPersistentEntity<?> owner, // SimpleTypeHolder simpleTypeHolder) { // return new TarantoolPersistentPropertyImpl(field, descriptor, owner, simpleTypeHolder); // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentProperty.java // public interface TarantoolPersistentProperty extends PersistentProperty<TarantoolPersistentProperty> { // OptionalInt getTupleIndex(); // // Optional<String> getSpaceIndexName(); // } // Path: src/main/java/ru/shadam/tarantool/core/convert/MappingTarantoolConverter.java import org.springframework.beans.factory.InitializingBean; import org.springframework.core.CollectionFactory; import org.springframework.core.convert.ConversionService; import org.springframework.data.convert.*; import org.springframework.data.mapping.PersistentPropertyAccessor; import org.springframework.data.mapping.PreferredConstructor; import org.springframework.data.mapping.PropertyHandler; import org.springframework.data.mapping.model.MappingException; import org.springframework.data.mapping.model.PersistentEntityParameterValueProvider; import org.springframework.data.mapping.model.PropertyValueProvider; import org.springframework.data.util.ClassTypeInformation; import org.springframework.data.util.TypeInformation; import org.springframework.util.ClassUtils; import org.springframework.util.CollectionUtils; import ru.shadam.tarantool.core.mapping.TarantoolMappingContext; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.core.mapping.TarantoolPersistentProperty; import java.lang.reflect.Array; import java.util.*; this.customConversions = new CustomConversions(); this.entityInstantiators = new EntityInstantiators(); this.typeMapper = new DefaultTypeMapper<>(new TarantoolTypeAliasAccessor(conversionService)); } @Override public TarantoolMappingContext getMappingContext() { return mappingContext; } @Override public ConversionService getConversionService() { return conversionService; } @Override public <R> R read(Class<R> type, TarantoolData source) { return readInternal(Path.empty(), type, source); } @SuppressWarnings("unchecked") private <R> R readInternal(Path path, Class<R> type, TarantoolData source) { // first item in tuple is class information. if (source.getTuple() == null || source.getTuple().isEmpty()) { return null; } TypeInformation<?> readType = typeMapper.readType(source); TypeInformation<?> typeToUse = readType != null ? readType : ClassTypeInformation.from(type);
final TarantoolPersistentEntity<?> entity = mappingContext.getPersistentEntity(typeToUse);
saladinkzn/spring-data-tarantool
src/main/java/ru/shadam/tarantool/core/convert/MappingTarantoolConverter.java
// Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolMappingContext.java // public class TarantoolMappingContext extends AbstractMappingContext<TarantoolPersistentEntity<?>, TarantoolPersistentProperty> { // private KeySpaceResolver fallbackKeySpaceResolver; // // public void setFallbackKeySpaceResolver(KeySpaceResolver fallbackKeySpaceResolver) { // this.fallbackKeySpaceResolver = fallbackKeySpaceResolver; // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(Class<?> type) { // return super.getPersistentEntity(type); // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(TypeInformation<?> type) { // return super.getPersistentEntity(type); // // } // // @Override // protected <T> TarantoolPersistentEntity<T> createPersistentEntity(TypeInformation<T> typeInformation) { // return new BasicTarantoolPersistentEntity<>(typeInformation, fallbackKeySpaceResolver); // } // // @Override // protected TarantoolPersistentPropertyImpl createPersistentProperty(Field field, // PropertyDescriptor descriptor, // TarantoolPersistentEntity<?> owner, // SimpleTypeHolder simpleTypeHolder) { // return new TarantoolPersistentPropertyImpl(field, descriptor, owner, simpleTypeHolder); // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentProperty.java // public interface TarantoolPersistentProperty extends PersistentProperty<TarantoolPersistentProperty> { // OptionalInt getTupleIndex(); // // Optional<String> getSpaceIndexName(); // }
import org.springframework.beans.factory.InitializingBean; import org.springframework.core.CollectionFactory; import org.springframework.core.convert.ConversionService; import org.springframework.data.convert.*; import org.springframework.data.mapping.PersistentPropertyAccessor; import org.springframework.data.mapping.PreferredConstructor; import org.springframework.data.mapping.PropertyHandler; import org.springframework.data.mapping.model.MappingException; import org.springframework.data.mapping.model.PersistentEntityParameterValueProvider; import org.springframework.data.mapping.model.PropertyValueProvider; import org.springframework.data.util.ClassTypeInformation; import org.springframework.data.util.TypeInformation; import org.springframework.util.ClassUtils; import org.springframework.util.CollectionUtils; import ru.shadam.tarantool.core.mapping.TarantoolMappingContext; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.core.mapping.TarantoolPersistentProperty; import java.lang.reflect.Array; import java.util.*;
} @Override public <R> R read(Class<R> type, TarantoolData source) { return readInternal(Path.empty(), type, source); } @SuppressWarnings("unchecked") private <R> R readInternal(Path path, Class<R> type, TarantoolData source) { // first item in tuple is class information. if (source.getTuple() == null || source.getTuple().isEmpty()) { return null; } TypeInformation<?> readType = typeMapper.readType(source); TypeInformation<?> typeToUse = readType != null ? readType : ClassTypeInformation.from(type); final TarantoolPersistentEntity<?> entity = mappingContext.getPersistentEntity(typeToUse); if (conversionService.canConvert(Tuple.class, typeToUse.getType())) { return ((R) conversionService.convert(source.getTuple(), typeToUse.getType())); } final EntityInstantiator instantiator = entityInstantiators.getInstantiatorFor(entity); final Object instance = instantiator.createInstance(entity, new PersistentEntityParameterValueProvider<>(entity, new ConverterAwareParameterValueProvider(source, conversionService), null)); final PersistentPropertyAccessor accessor = entity.getPropertyAccessor(instance);
// Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolMappingContext.java // public class TarantoolMappingContext extends AbstractMappingContext<TarantoolPersistentEntity<?>, TarantoolPersistentProperty> { // private KeySpaceResolver fallbackKeySpaceResolver; // // public void setFallbackKeySpaceResolver(KeySpaceResolver fallbackKeySpaceResolver) { // this.fallbackKeySpaceResolver = fallbackKeySpaceResolver; // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(Class<?> type) { // return super.getPersistentEntity(type); // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(TypeInformation<?> type) { // return super.getPersistentEntity(type); // // } // // @Override // protected <T> TarantoolPersistentEntity<T> createPersistentEntity(TypeInformation<T> typeInformation) { // return new BasicTarantoolPersistentEntity<>(typeInformation, fallbackKeySpaceResolver); // } // // @Override // protected TarantoolPersistentPropertyImpl createPersistentProperty(Field field, // PropertyDescriptor descriptor, // TarantoolPersistentEntity<?> owner, // SimpleTypeHolder simpleTypeHolder) { // return new TarantoolPersistentPropertyImpl(field, descriptor, owner, simpleTypeHolder); // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentProperty.java // public interface TarantoolPersistentProperty extends PersistentProperty<TarantoolPersistentProperty> { // OptionalInt getTupleIndex(); // // Optional<String> getSpaceIndexName(); // } // Path: src/main/java/ru/shadam/tarantool/core/convert/MappingTarantoolConverter.java import org.springframework.beans.factory.InitializingBean; import org.springframework.core.CollectionFactory; import org.springframework.core.convert.ConversionService; import org.springframework.data.convert.*; import org.springframework.data.mapping.PersistentPropertyAccessor; import org.springframework.data.mapping.PreferredConstructor; import org.springframework.data.mapping.PropertyHandler; import org.springframework.data.mapping.model.MappingException; import org.springframework.data.mapping.model.PersistentEntityParameterValueProvider; import org.springframework.data.mapping.model.PropertyValueProvider; import org.springframework.data.util.ClassTypeInformation; import org.springframework.data.util.TypeInformation; import org.springframework.util.ClassUtils; import org.springframework.util.CollectionUtils; import ru.shadam.tarantool.core.mapping.TarantoolMappingContext; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.core.mapping.TarantoolPersistentProperty; import java.lang.reflect.Array; import java.util.*; } @Override public <R> R read(Class<R> type, TarantoolData source) { return readInternal(Path.empty(), type, source); } @SuppressWarnings("unchecked") private <R> R readInternal(Path path, Class<R> type, TarantoolData source) { // first item in tuple is class information. if (source.getTuple() == null || source.getTuple().isEmpty()) { return null; } TypeInformation<?> readType = typeMapper.readType(source); TypeInformation<?> typeToUse = readType != null ? readType : ClassTypeInformation.from(type); final TarantoolPersistentEntity<?> entity = mappingContext.getPersistentEntity(typeToUse); if (conversionService.canConvert(Tuple.class, typeToUse.getType())) { return ((R) conversionService.convert(source.getTuple(), typeToUse.getType())); } final EntityInstantiator instantiator = entityInstantiators.getInstantiatorFor(entity); final Object instance = instantiator.createInstance(entity, new PersistentEntityParameterValueProvider<>(entity, new ConverterAwareParameterValueProvider(source, conversionService), null)); final PersistentPropertyAccessor accessor = entity.getPropertyAccessor(instance);
entity.doWithProperties(new PropertyHandler<TarantoolPersistentProperty>() {
saladinkzn/spring-data-tarantool
src/test/java/ru/shadam/tarantool/core/convert/ConversionTestEntities.java
// Path: src/test/java/ru/shadam/tarantool/core/convert/ConversionTestEntities.java // interface Person { // int ID = 0; // int FIRSTNAME = 1; // int GENDER = 2; // int NICKNAMES = 3; // int COWORKERS = 4; // int AGE = 5; // int ALIVE = 6; // int BIRTHDAY = 7; // int ADDRESS = 8; // }
import org.springframework.data.annotation.Id; import ru.shadam.tarantool.annotation.Tuple; import java.util.Date; import java.util.List; import static ru.shadam.tarantool.core.convert.ConversionTestEntities.Indexes.Address.CITY; import static ru.shadam.tarantool.core.convert.ConversionTestEntities.Indexes.Address.COUNTRY; import static ru.shadam.tarantool.core.convert.ConversionTestEntities.Indexes.Person.*;
package ru.shadam.tarantool.core.convert; /** * @author sala */ public class ConversionTestEntities { interface Indexes {
// Path: src/test/java/ru/shadam/tarantool/core/convert/ConversionTestEntities.java // interface Person { // int ID = 0; // int FIRSTNAME = 1; // int GENDER = 2; // int NICKNAMES = 3; // int COWORKERS = 4; // int AGE = 5; // int ALIVE = 6; // int BIRTHDAY = 7; // int ADDRESS = 8; // } // Path: src/test/java/ru/shadam/tarantool/core/convert/ConversionTestEntities.java import org.springframework.data.annotation.Id; import ru.shadam.tarantool.annotation.Tuple; import java.util.Date; import java.util.List; import static ru.shadam.tarantool.core.convert.ConversionTestEntities.Indexes.Address.CITY; import static ru.shadam.tarantool.core.convert.ConversionTestEntities.Indexes.Address.COUNTRY; import static ru.shadam.tarantool.core.convert.ConversionTestEntities.Indexes.Person.*; package ru.shadam.tarantool.core.convert; /** * @author sala */ public class ConversionTestEntities { interface Indexes {
interface Person {
saladinkzn/spring-data-tarantool
src/main/java/ru/shadam/tarantool/repository/support/TarantoolRepositoryFactory.java
// Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/repository/core/MappingTarantoolEntityInformation.java // public class MappingTarantoolEntityInformation<T> extends PersistentEntityInformation<T, Serializable> { // // public MappingTarantoolEntityInformation(TarantoolPersistentEntity<T> entity) { // super(entity); // // if(!entity.hasIdProperty()) { // // throw new MappingException( // String.format("Entity %s requires to have an explicit id field. Did you forget to provide one using @Id?", // entity.getName()) // ); // } // } // } // // Path: src/main/java/ru/shadam/tarantool/repository/query/TarantoolQueryCreator.java // public class TarantoolQueryCreator extends AbstractQueryCreator<KeyValueQuery<TarantoolQuery>, TarantoolQuery> { // // public TarantoolQueryCreator(PartTree tree, ParameterAccessor parameters) { // super(tree, parameters); // } // // @Override // protected TarantoolQuery create(Part part, Iterator<Object> iterator) { // switch (part.getType()) { // case SIMPLE_PROPERTY: // return new TarantoolQuery(part.getProperty().toDotPath(), iterator.next()); // default: // throw new IllegalArgumentException(part.getType() + "is not supported for redis query derivation"); // } // } // // @Override // protected TarantoolQuery and(Part part, TarantoolQuery base, Iterator<Object> iterator) { // throw new UnsupportedOperationException("and is not supported"); // } // // @Override // protected TarantoolQuery or(TarantoolQuery base, TarantoolQuery criteria) { // throw new UnsupportedOperationException("or is not supported"); // } // // @Override // protected KeyValueQuery<TarantoolQuery> complete(TarantoolQuery criteria, Sort sort) { // final KeyValueQuery<TarantoolQuery> tarantoolQueryKeyValueQuery = new KeyValueQuery<>(criteria); // tarantoolQueryKeyValueQuery.setSort(sort); // return tarantoolQueryKeyValueQuery; // } // }
import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.repository.query.KeyValuePartTreeQuery; import org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactory; import org.springframework.data.repository.core.EntityInformation; import org.springframework.data.repository.query.RepositoryQuery; import org.springframework.data.repository.query.parser.AbstractQueryCreator; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.repository.core.MappingTarantoolEntityInformation; import ru.shadam.tarantool.repository.query.TarantoolQueryCreator; import java.io.Serializable;
package ru.shadam.tarantool.repository.support; /** * @author sala */ public class TarantoolRepositoryFactory extends KeyValueRepositoryFactory { private final KeyValueOperations keyValueOperations; /** * @param keyValueOperations * @see KeyValueRepositoryFactory#KeyValueRepositoryFactory(KeyValueOperations) */ public TarantoolRepositoryFactory(KeyValueOperations keyValueOperations) {
// Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/repository/core/MappingTarantoolEntityInformation.java // public class MappingTarantoolEntityInformation<T> extends PersistentEntityInformation<T, Serializable> { // // public MappingTarantoolEntityInformation(TarantoolPersistentEntity<T> entity) { // super(entity); // // if(!entity.hasIdProperty()) { // // throw new MappingException( // String.format("Entity %s requires to have an explicit id field. Did you forget to provide one using @Id?", // entity.getName()) // ); // } // } // } // // Path: src/main/java/ru/shadam/tarantool/repository/query/TarantoolQueryCreator.java // public class TarantoolQueryCreator extends AbstractQueryCreator<KeyValueQuery<TarantoolQuery>, TarantoolQuery> { // // public TarantoolQueryCreator(PartTree tree, ParameterAccessor parameters) { // super(tree, parameters); // } // // @Override // protected TarantoolQuery create(Part part, Iterator<Object> iterator) { // switch (part.getType()) { // case SIMPLE_PROPERTY: // return new TarantoolQuery(part.getProperty().toDotPath(), iterator.next()); // default: // throw new IllegalArgumentException(part.getType() + "is not supported for redis query derivation"); // } // } // // @Override // protected TarantoolQuery and(Part part, TarantoolQuery base, Iterator<Object> iterator) { // throw new UnsupportedOperationException("and is not supported"); // } // // @Override // protected TarantoolQuery or(TarantoolQuery base, TarantoolQuery criteria) { // throw new UnsupportedOperationException("or is not supported"); // } // // @Override // protected KeyValueQuery<TarantoolQuery> complete(TarantoolQuery criteria, Sort sort) { // final KeyValueQuery<TarantoolQuery> tarantoolQueryKeyValueQuery = new KeyValueQuery<>(criteria); // tarantoolQueryKeyValueQuery.setSort(sort); // return tarantoolQueryKeyValueQuery; // } // } // Path: src/main/java/ru/shadam/tarantool/repository/support/TarantoolRepositoryFactory.java import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.repository.query.KeyValuePartTreeQuery; import org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactory; import org.springframework.data.repository.core.EntityInformation; import org.springframework.data.repository.query.RepositoryQuery; import org.springframework.data.repository.query.parser.AbstractQueryCreator; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.repository.core.MappingTarantoolEntityInformation; import ru.shadam.tarantool.repository.query.TarantoolQueryCreator; import java.io.Serializable; package ru.shadam.tarantool.repository.support; /** * @author sala */ public class TarantoolRepositoryFactory extends KeyValueRepositoryFactory { private final KeyValueOperations keyValueOperations; /** * @param keyValueOperations * @see KeyValueRepositoryFactory#KeyValueRepositoryFactory(KeyValueOperations) */ public TarantoolRepositoryFactory(KeyValueOperations keyValueOperations) {
this(keyValueOperations, TarantoolQueryCreator.class);
saladinkzn/spring-data-tarantool
src/main/java/ru/shadam/tarantool/repository/support/TarantoolRepositoryFactory.java
// Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/repository/core/MappingTarantoolEntityInformation.java // public class MappingTarantoolEntityInformation<T> extends PersistentEntityInformation<T, Serializable> { // // public MappingTarantoolEntityInformation(TarantoolPersistentEntity<T> entity) { // super(entity); // // if(!entity.hasIdProperty()) { // // throw new MappingException( // String.format("Entity %s requires to have an explicit id field. Did you forget to provide one using @Id?", // entity.getName()) // ); // } // } // } // // Path: src/main/java/ru/shadam/tarantool/repository/query/TarantoolQueryCreator.java // public class TarantoolQueryCreator extends AbstractQueryCreator<KeyValueQuery<TarantoolQuery>, TarantoolQuery> { // // public TarantoolQueryCreator(PartTree tree, ParameterAccessor parameters) { // super(tree, parameters); // } // // @Override // protected TarantoolQuery create(Part part, Iterator<Object> iterator) { // switch (part.getType()) { // case SIMPLE_PROPERTY: // return new TarantoolQuery(part.getProperty().toDotPath(), iterator.next()); // default: // throw new IllegalArgumentException(part.getType() + "is not supported for redis query derivation"); // } // } // // @Override // protected TarantoolQuery and(Part part, TarantoolQuery base, Iterator<Object> iterator) { // throw new UnsupportedOperationException("and is not supported"); // } // // @Override // protected TarantoolQuery or(TarantoolQuery base, TarantoolQuery criteria) { // throw new UnsupportedOperationException("or is not supported"); // } // // @Override // protected KeyValueQuery<TarantoolQuery> complete(TarantoolQuery criteria, Sort sort) { // final KeyValueQuery<TarantoolQuery> tarantoolQueryKeyValueQuery = new KeyValueQuery<>(criteria); // tarantoolQueryKeyValueQuery.setSort(sort); // return tarantoolQueryKeyValueQuery; // } // }
import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.repository.query.KeyValuePartTreeQuery; import org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactory; import org.springframework.data.repository.core.EntityInformation; import org.springframework.data.repository.query.RepositoryQuery; import org.springframework.data.repository.query.parser.AbstractQueryCreator; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.repository.core.MappingTarantoolEntityInformation; import ru.shadam.tarantool.repository.query.TarantoolQueryCreator; import java.io.Serializable;
package ru.shadam.tarantool.repository.support; /** * @author sala */ public class TarantoolRepositoryFactory extends KeyValueRepositoryFactory { private final KeyValueOperations keyValueOperations; /** * @param keyValueOperations * @see KeyValueRepositoryFactory#KeyValueRepositoryFactory(KeyValueOperations) */ public TarantoolRepositoryFactory(KeyValueOperations keyValueOperations) { this(keyValueOperations, TarantoolQueryCreator.class); } public TarantoolRepositoryFactory( KeyValueOperations keyValueOperations, Class<? extends AbstractQueryCreator<?, ?>> queryCreator ) { this(keyValueOperations, queryCreator, KeyValuePartTreeQuery.class); } public TarantoolRepositoryFactory( KeyValueOperations keyValueOperations, Class<? extends AbstractQueryCreator<?, ?>> queryCreator, Class<? extends RepositoryQuery> repositoryQueryType ) { super(keyValueOperations, queryCreator, repositoryQueryType); this.keyValueOperations = keyValueOperations; } @Override public <T, ID extends Serializable> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {
// Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/repository/core/MappingTarantoolEntityInformation.java // public class MappingTarantoolEntityInformation<T> extends PersistentEntityInformation<T, Serializable> { // // public MappingTarantoolEntityInformation(TarantoolPersistentEntity<T> entity) { // super(entity); // // if(!entity.hasIdProperty()) { // // throw new MappingException( // String.format("Entity %s requires to have an explicit id field. Did you forget to provide one using @Id?", // entity.getName()) // ); // } // } // } // // Path: src/main/java/ru/shadam/tarantool/repository/query/TarantoolQueryCreator.java // public class TarantoolQueryCreator extends AbstractQueryCreator<KeyValueQuery<TarantoolQuery>, TarantoolQuery> { // // public TarantoolQueryCreator(PartTree tree, ParameterAccessor parameters) { // super(tree, parameters); // } // // @Override // protected TarantoolQuery create(Part part, Iterator<Object> iterator) { // switch (part.getType()) { // case SIMPLE_PROPERTY: // return new TarantoolQuery(part.getProperty().toDotPath(), iterator.next()); // default: // throw new IllegalArgumentException(part.getType() + "is not supported for redis query derivation"); // } // } // // @Override // protected TarantoolQuery and(Part part, TarantoolQuery base, Iterator<Object> iterator) { // throw new UnsupportedOperationException("and is not supported"); // } // // @Override // protected TarantoolQuery or(TarantoolQuery base, TarantoolQuery criteria) { // throw new UnsupportedOperationException("or is not supported"); // } // // @Override // protected KeyValueQuery<TarantoolQuery> complete(TarantoolQuery criteria, Sort sort) { // final KeyValueQuery<TarantoolQuery> tarantoolQueryKeyValueQuery = new KeyValueQuery<>(criteria); // tarantoolQueryKeyValueQuery.setSort(sort); // return tarantoolQueryKeyValueQuery; // } // } // Path: src/main/java/ru/shadam/tarantool/repository/support/TarantoolRepositoryFactory.java import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.repository.query.KeyValuePartTreeQuery; import org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactory; import org.springframework.data.repository.core.EntityInformation; import org.springframework.data.repository.query.RepositoryQuery; import org.springframework.data.repository.query.parser.AbstractQueryCreator; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.repository.core.MappingTarantoolEntityInformation; import ru.shadam.tarantool.repository.query.TarantoolQueryCreator; import java.io.Serializable; package ru.shadam.tarantool.repository.support; /** * @author sala */ public class TarantoolRepositoryFactory extends KeyValueRepositoryFactory { private final KeyValueOperations keyValueOperations; /** * @param keyValueOperations * @see KeyValueRepositoryFactory#KeyValueRepositoryFactory(KeyValueOperations) */ public TarantoolRepositoryFactory(KeyValueOperations keyValueOperations) { this(keyValueOperations, TarantoolQueryCreator.class); } public TarantoolRepositoryFactory( KeyValueOperations keyValueOperations, Class<? extends AbstractQueryCreator<?, ?>> queryCreator ) { this(keyValueOperations, queryCreator, KeyValuePartTreeQuery.class); } public TarantoolRepositoryFactory( KeyValueOperations keyValueOperations, Class<? extends AbstractQueryCreator<?, ?>> queryCreator, Class<? extends RepositoryQuery> repositoryQueryType ) { super(keyValueOperations, queryCreator, repositoryQueryType); this.keyValueOperations = keyValueOperations; } @Override public <T, ID extends Serializable> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {
TarantoolPersistentEntity<T> entity = ((TarantoolPersistentEntity<T>) keyValueOperations
saladinkzn/spring-data-tarantool
src/main/java/ru/shadam/tarantool/repository/support/TarantoolRepositoryFactory.java
// Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/repository/core/MappingTarantoolEntityInformation.java // public class MappingTarantoolEntityInformation<T> extends PersistentEntityInformation<T, Serializable> { // // public MappingTarantoolEntityInformation(TarantoolPersistentEntity<T> entity) { // super(entity); // // if(!entity.hasIdProperty()) { // // throw new MappingException( // String.format("Entity %s requires to have an explicit id field. Did you forget to provide one using @Id?", // entity.getName()) // ); // } // } // } // // Path: src/main/java/ru/shadam/tarantool/repository/query/TarantoolQueryCreator.java // public class TarantoolQueryCreator extends AbstractQueryCreator<KeyValueQuery<TarantoolQuery>, TarantoolQuery> { // // public TarantoolQueryCreator(PartTree tree, ParameterAccessor parameters) { // super(tree, parameters); // } // // @Override // protected TarantoolQuery create(Part part, Iterator<Object> iterator) { // switch (part.getType()) { // case SIMPLE_PROPERTY: // return new TarantoolQuery(part.getProperty().toDotPath(), iterator.next()); // default: // throw new IllegalArgumentException(part.getType() + "is not supported for redis query derivation"); // } // } // // @Override // protected TarantoolQuery and(Part part, TarantoolQuery base, Iterator<Object> iterator) { // throw new UnsupportedOperationException("and is not supported"); // } // // @Override // protected TarantoolQuery or(TarantoolQuery base, TarantoolQuery criteria) { // throw new UnsupportedOperationException("or is not supported"); // } // // @Override // protected KeyValueQuery<TarantoolQuery> complete(TarantoolQuery criteria, Sort sort) { // final KeyValueQuery<TarantoolQuery> tarantoolQueryKeyValueQuery = new KeyValueQuery<>(criteria); // tarantoolQueryKeyValueQuery.setSort(sort); // return tarantoolQueryKeyValueQuery; // } // }
import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.repository.query.KeyValuePartTreeQuery; import org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactory; import org.springframework.data.repository.core.EntityInformation; import org.springframework.data.repository.query.RepositoryQuery; import org.springframework.data.repository.query.parser.AbstractQueryCreator; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.repository.core.MappingTarantoolEntityInformation; import ru.shadam.tarantool.repository.query.TarantoolQueryCreator; import java.io.Serializable;
package ru.shadam.tarantool.repository.support; /** * @author sala */ public class TarantoolRepositoryFactory extends KeyValueRepositoryFactory { private final KeyValueOperations keyValueOperations; /** * @param keyValueOperations * @see KeyValueRepositoryFactory#KeyValueRepositoryFactory(KeyValueOperations) */ public TarantoolRepositoryFactory(KeyValueOperations keyValueOperations) { this(keyValueOperations, TarantoolQueryCreator.class); } public TarantoolRepositoryFactory( KeyValueOperations keyValueOperations, Class<? extends AbstractQueryCreator<?, ?>> queryCreator ) { this(keyValueOperations, queryCreator, KeyValuePartTreeQuery.class); } public TarantoolRepositoryFactory( KeyValueOperations keyValueOperations, Class<? extends AbstractQueryCreator<?, ?>> queryCreator, Class<? extends RepositoryQuery> repositoryQueryType ) { super(keyValueOperations, queryCreator, repositoryQueryType); this.keyValueOperations = keyValueOperations; } @Override public <T, ID extends Serializable> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass) { TarantoolPersistentEntity<T> entity = ((TarantoolPersistentEntity<T>) keyValueOperations .getMappingContext() .getPersistentEntity(domainClass));
// Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/repository/core/MappingTarantoolEntityInformation.java // public class MappingTarantoolEntityInformation<T> extends PersistentEntityInformation<T, Serializable> { // // public MappingTarantoolEntityInformation(TarantoolPersistentEntity<T> entity) { // super(entity); // // if(!entity.hasIdProperty()) { // // throw new MappingException( // String.format("Entity %s requires to have an explicit id field. Did you forget to provide one using @Id?", // entity.getName()) // ); // } // } // } // // Path: src/main/java/ru/shadam/tarantool/repository/query/TarantoolQueryCreator.java // public class TarantoolQueryCreator extends AbstractQueryCreator<KeyValueQuery<TarantoolQuery>, TarantoolQuery> { // // public TarantoolQueryCreator(PartTree tree, ParameterAccessor parameters) { // super(tree, parameters); // } // // @Override // protected TarantoolQuery create(Part part, Iterator<Object> iterator) { // switch (part.getType()) { // case SIMPLE_PROPERTY: // return new TarantoolQuery(part.getProperty().toDotPath(), iterator.next()); // default: // throw new IllegalArgumentException(part.getType() + "is not supported for redis query derivation"); // } // } // // @Override // protected TarantoolQuery and(Part part, TarantoolQuery base, Iterator<Object> iterator) { // throw new UnsupportedOperationException("and is not supported"); // } // // @Override // protected TarantoolQuery or(TarantoolQuery base, TarantoolQuery criteria) { // throw new UnsupportedOperationException("or is not supported"); // } // // @Override // protected KeyValueQuery<TarantoolQuery> complete(TarantoolQuery criteria, Sort sort) { // final KeyValueQuery<TarantoolQuery> tarantoolQueryKeyValueQuery = new KeyValueQuery<>(criteria); // tarantoolQueryKeyValueQuery.setSort(sort); // return tarantoolQueryKeyValueQuery; // } // } // Path: src/main/java/ru/shadam/tarantool/repository/support/TarantoolRepositoryFactory.java import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.repository.query.KeyValuePartTreeQuery; import org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactory; import org.springframework.data.repository.core.EntityInformation; import org.springframework.data.repository.query.RepositoryQuery; import org.springframework.data.repository.query.parser.AbstractQueryCreator; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.repository.core.MappingTarantoolEntityInformation; import ru.shadam.tarantool.repository.query.TarantoolQueryCreator; import java.io.Serializable; package ru.shadam.tarantool.repository.support; /** * @author sala */ public class TarantoolRepositoryFactory extends KeyValueRepositoryFactory { private final KeyValueOperations keyValueOperations; /** * @param keyValueOperations * @see KeyValueRepositoryFactory#KeyValueRepositoryFactory(KeyValueOperations) */ public TarantoolRepositoryFactory(KeyValueOperations keyValueOperations) { this(keyValueOperations, TarantoolQueryCreator.class); } public TarantoolRepositoryFactory( KeyValueOperations keyValueOperations, Class<? extends AbstractQueryCreator<?, ?>> queryCreator ) { this(keyValueOperations, queryCreator, KeyValuePartTreeQuery.class); } public TarantoolRepositoryFactory( KeyValueOperations keyValueOperations, Class<? extends AbstractQueryCreator<?, ?>> queryCreator, Class<? extends RepositoryQuery> repositoryQueryType ) { super(keyValueOperations, queryCreator, repositoryQueryType); this.keyValueOperations = keyValueOperations; } @Override public <T, ID extends Serializable> EntityInformation<T, ID> getEntityInformation(Class<T> domainClass) { TarantoolPersistentEntity<T> entity = ((TarantoolPersistentEntity<T>) keyValueOperations .getMappingContext() .getPersistentEntity(domainClass));
EntityInformation<T, ID> entityInformation = (EntityInformation<T, ID>) new MappingTarantoolEntityInformation<T>(entity);
saladinkzn/spring-data-tarantool
src/test/java/ru/shadam/tarantool/repository/query/TarantoolQueryCreatorTest.java
// Path: src/test/java/ru/shadam/tarantool/core/convert/ConversionTestEntities.java // public static class Person { // @Id // @Tuple(index = ID) // long id; // @Tuple(index = FIRSTNAME) // String firstname; // @Tuple(index = GENDER) // Gender gender; // // @Tuple(index = NICKNAMES) // List<String> nicknames; // @Tuple(index = COWORKERS) // List<Person> coworkers; // @Tuple(index = AGE) // Integer age; // @Tuple(index = ALIVE) // Boolean alive; // @Tuple(index = BIRTHDAY) // Date birthday; // // @Tuple(index = ADDRESS) // Address address; // // // @Override // public String toString() { // return "Person{" + // "id=" + id + // ", firstname='" + firstname + '\'' + // ", gender=" + gender + // ", nicknames=" + nicknames + // ", coworkers=" + coworkers + // ", age=" + age + // ", alive=" + alive + // ", birthday=" + birthday + // ", address=" + address + // '}'; // } // }
import org.junit.Assert; import org.junit.Test; import org.springframework.data.keyvalue.core.query.KeyValueQuery; import org.springframework.data.repository.Repository; import org.springframework.data.repository.query.DefaultParameters; import org.springframework.data.repository.query.ParametersParameterAccessor; import org.springframework.data.repository.query.parser.PartTree; import ru.shadam.tarantool.core.convert.ConversionTestEntities.Person; import java.lang.reflect.Method;
package ru.shadam.tarantool.repository.query; /** * @author sala */ public class TarantoolQueryCreatorTest { @Test public void findBySingleSimpleRepository() throws NoSuchMethodException { TarantoolQueryCreator creator = createQueryCreatorForMethodWithArgs( SampleRepository.class.getMethod("findByFirstname", String.class), new Object[]{ "eddard" } ); final KeyValueQuery<TarantoolQuery> query = creator.createQuery(); Assert.assertEquals(new TarantoolQuery("firstname", "eddard"), query.getCritieria()); } private TarantoolQueryCreator createQueryCreatorForMethodWithArgs(Method method, Object[] args) { PartTree partTree = new PartTree(method.getName(), method.getReturnType()); TarantoolQueryCreator creator = new TarantoolQueryCreator(partTree, new ParametersParameterAccessor(new DefaultParameters( method), args)); return creator; }
// Path: src/test/java/ru/shadam/tarantool/core/convert/ConversionTestEntities.java // public static class Person { // @Id // @Tuple(index = ID) // long id; // @Tuple(index = FIRSTNAME) // String firstname; // @Tuple(index = GENDER) // Gender gender; // // @Tuple(index = NICKNAMES) // List<String> nicknames; // @Tuple(index = COWORKERS) // List<Person> coworkers; // @Tuple(index = AGE) // Integer age; // @Tuple(index = ALIVE) // Boolean alive; // @Tuple(index = BIRTHDAY) // Date birthday; // // @Tuple(index = ADDRESS) // Address address; // // // @Override // public String toString() { // return "Person{" + // "id=" + id + // ", firstname='" + firstname + '\'' + // ", gender=" + gender + // ", nicknames=" + nicknames + // ", coworkers=" + coworkers + // ", age=" + age + // ", alive=" + alive + // ", birthday=" + birthday + // ", address=" + address + // '}'; // } // } // Path: src/test/java/ru/shadam/tarantool/repository/query/TarantoolQueryCreatorTest.java import org.junit.Assert; import org.junit.Test; import org.springframework.data.keyvalue.core.query.KeyValueQuery; import org.springframework.data.repository.Repository; import org.springframework.data.repository.query.DefaultParameters; import org.springframework.data.repository.query.ParametersParameterAccessor; import org.springframework.data.repository.query.parser.PartTree; import ru.shadam.tarantool.core.convert.ConversionTestEntities.Person; import java.lang.reflect.Method; package ru.shadam.tarantool.repository.query; /** * @author sala */ public class TarantoolQueryCreatorTest { @Test public void findBySingleSimpleRepository() throws NoSuchMethodException { TarantoolQueryCreator creator = createQueryCreatorForMethodWithArgs( SampleRepository.class.getMethod("findByFirstname", String.class), new Object[]{ "eddard" } ); final KeyValueQuery<TarantoolQuery> query = creator.createQuery(); Assert.assertEquals(new TarantoolQuery("firstname", "eddard"), query.getCritieria()); } private TarantoolQueryCreator createQueryCreatorForMethodWithArgs(Method method, Object[] args) { PartTree partTree = new PartTree(method.getName(), method.getReturnType()); TarantoolQueryCreator creator = new TarantoolQueryCreator(partTree, new ParametersParameterAccessor(new DefaultParameters( method), args)); return creator; }
private interface SampleRepository extends Repository<Person, Long> {
saladinkzn/spring-data-tarantool
src/main/java/ru/shadam/tarantool/core/TarantoolOperations.java
// Path: src/main/java/ru/shadam/tarantool/core/update/Operation.java // public abstract class Operation<TOperator extends Operator> { // protected final TOperator operator; // protected final int fieldNumber; // // public Operation(TOperator operator, int fieldNumber) { // this.operator = operator; // this.fieldNumber = fieldNumber; // } // // public abstract List toTuple(); // // }
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import ru.shadam.tarantool.core.update.Operation; import java.util.Collections; import java.util.List;
* @param iterator {@link Iterator} to use * @return List of intities */ List<V> select(String space, String index, K key, Pageable pageable, Iterator iterator); /** * Insert entity into space * @param space name of space to replace to * @param value value to replace * @return inserted value */ V insert(String space, K key, V value); /** * Insert entity into space if key doesn't exists or replace by * @param space * @param key * @param value * @return */ V replace(String space, K key, V value); /** * Apply single operation to entity selected by key * @param space name of space to select entities from * @param index name of index to use * @param key key to use * @param operation {@link Operation} to apply * @return result of operation */
// Path: src/main/java/ru/shadam/tarantool/core/update/Operation.java // public abstract class Operation<TOperator extends Operator> { // protected final TOperator operator; // protected final int fieldNumber; // // public Operation(TOperator operator, int fieldNumber) { // this.operator = operator; // this.fieldNumber = fieldNumber; // } // // public abstract List toTuple(); // // } // Path: src/main/java/ru/shadam/tarantool/core/TarantoolOperations.java import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import ru.shadam.tarantool.core.update.Operation; import java.util.Collections; import java.util.List; * @param iterator {@link Iterator} to use * @return List of intities */ List<V> select(String space, String index, K key, Pageable pageable, Iterator iterator); /** * Insert entity into space * @param space name of space to replace to * @param value value to replace * @return inserted value */ V insert(String space, K key, V value); /** * Insert entity into space if key doesn't exists or replace by * @param space * @param key * @param value * @return */ V replace(String space, K key, V value); /** * Apply single operation to entity selected by key * @param space name of space to select entities from * @param index name of index to use * @param key key to use * @param operation {@link Operation} to apply * @return result of operation */
default V update(String space, String index, K key, Operation operation) {
saladinkzn/spring-data-tarantool
src/main/java/ru/shadam/tarantool/repository/configuration/EnableTarantoolRepositories.java
// Path: src/main/java/ru/shadam/tarantool/repository/query/TarantoolQueryCreator.java // public class TarantoolQueryCreator extends AbstractQueryCreator<KeyValueQuery<TarantoolQuery>, TarantoolQuery> { // // public TarantoolQueryCreator(PartTree tree, ParameterAccessor parameters) { // super(tree, parameters); // } // // @Override // protected TarantoolQuery create(Part part, Iterator<Object> iterator) { // switch (part.getType()) { // case SIMPLE_PROPERTY: // return new TarantoolQuery(part.getProperty().toDotPath(), iterator.next()); // default: // throw new IllegalArgumentException(part.getType() + "is not supported for redis query derivation"); // } // } // // @Override // protected TarantoolQuery and(Part part, TarantoolQuery base, Iterator<Object> iterator) { // throw new UnsupportedOperationException("and is not supported"); // } // // @Override // protected TarantoolQuery or(TarantoolQuery base, TarantoolQuery criteria) { // throw new UnsupportedOperationException("or is not supported"); // } // // @Override // protected KeyValueQuery<TarantoolQuery> complete(TarantoolQuery criteria, Sort sort) { // final KeyValueQuery<TarantoolQuery> tarantoolQueryKeyValueQuery = new KeyValueQuery<>(criteria); // tarantoolQueryKeyValueQuery.setSort(sort); // return tarantoolQueryKeyValueQuery; // } // } // // Path: src/main/java/ru/shadam/tarantool/repository/support/TarantoolRepositoryFactoryBean.java // public class TarantoolRepositoryFactoryBean<T extends Repository<S, ID>, S, ID extends Serializable> // extends KeyValueRepositoryFactoryBean<T, S, ID> { // // /* // * (non-Javadoc) // * @see org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactoryBean#createRepositoryFactory(org.springframework.data.keyvalue.core.KeyValueOperations, java.lang.Class, java.lang.Class) // */ // @Override // protected TarantoolRepositoryFactory createRepositoryFactory( // KeyValueOperations operations, // Class<? extends AbstractQueryCreator<?, ?>> queryCreator, // Class<? extends RepositoryQuery> repositoryQueryType // ) { // return new TarantoolRepositoryFactory(operations, queryCreator, repositoryQueryType); // } // }
import org.springframework.beans.factory.FactoryBean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Import; import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.repository.config.QueryCreatorType; import ru.shadam.tarantool.repository.query.TarantoolQueryCreator; import ru.shadam.tarantool.repository.support.TarantoolRepositoryFactoryBean; import java.lang.annotation.*;
package ru.shadam.tarantool.repository.configuration; /** * @author sala */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited @Import(TarantoolRepositoriesRegistrar.class)
// Path: src/main/java/ru/shadam/tarantool/repository/query/TarantoolQueryCreator.java // public class TarantoolQueryCreator extends AbstractQueryCreator<KeyValueQuery<TarantoolQuery>, TarantoolQuery> { // // public TarantoolQueryCreator(PartTree tree, ParameterAccessor parameters) { // super(tree, parameters); // } // // @Override // protected TarantoolQuery create(Part part, Iterator<Object> iterator) { // switch (part.getType()) { // case SIMPLE_PROPERTY: // return new TarantoolQuery(part.getProperty().toDotPath(), iterator.next()); // default: // throw new IllegalArgumentException(part.getType() + "is not supported for redis query derivation"); // } // } // // @Override // protected TarantoolQuery and(Part part, TarantoolQuery base, Iterator<Object> iterator) { // throw new UnsupportedOperationException("and is not supported"); // } // // @Override // protected TarantoolQuery or(TarantoolQuery base, TarantoolQuery criteria) { // throw new UnsupportedOperationException("or is not supported"); // } // // @Override // protected KeyValueQuery<TarantoolQuery> complete(TarantoolQuery criteria, Sort sort) { // final KeyValueQuery<TarantoolQuery> tarantoolQueryKeyValueQuery = new KeyValueQuery<>(criteria); // tarantoolQueryKeyValueQuery.setSort(sort); // return tarantoolQueryKeyValueQuery; // } // } // // Path: src/main/java/ru/shadam/tarantool/repository/support/TarantoolRepositoryFactoryBean.java // public class TarantoolRepositoryFactoryBean<T extends Repository<S, ID>, S, ID extends Serializable> // extends KeyValueRepositoryFactoryBean<T, S, ID> { // // /* // * (non-Javadoc) // * @see org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactoryBean#createRepositoryFactory(org.springframework.data.keyvalue.core.KeyValueOperations, java.lang.Class, java.lang.Class) // */ // @Override // protected TarantoolRepositoryFactory createRepositoryFactory( // KeyValueOperations operations, // Class<? extends AbstractQueryCreator<?, ?>> queryCreator, // Class<? extends RepositoryQuery> repositoryQueryType // ) { // return new TarantoolRepositoryFactory(operations, queryCreator, repositoryQueryType); // } // } // Path: src/main/java/ru/shadam/tarantool/repository/configuration/EnableTarantoolRepositories.java import org.springframework.beans.factory.FactoryBean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Import; import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.repository.config.QueryCreatorType; import ru.shadam.tarantool.repository.query.TarantoolQueryCreator; import ru.shadam.tarantool.repository.support.TarantoolRepositoryFactoryBean; import java.lang.annotation.*; package ru.shadam.tarantool.repository.configuration; /** * @author sala */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited @Import(TarantoolRepositoriesRegistrar.class)
@QueryCreatorType(TarantoolQueryCreator.class)
saladinkzn/spring-data-tarantool
src/main/java/ru/shadam/tarantool/repository/configuration/EnableTarantoolRepositories.java
// Path: src/main/java/ru/shadam/tarantool/repository/query/TarantoolQueryCreator.java // public class TarantoolQueryCreator extends AbstractQueryCreator<KeyValueQuery<TarantoolQuery>, TarantoolQuery> { // // public TarantoolQueryCreator(PartTree tree, ParameterAccessor parameters) { // super(tree, parameters); // } // // @Override // protected TarantoolQuery create(Part part, Iterator<Object> iterator) { // switch (part.getType()) { // case SIMPLE_PROPERTY: // return new TarantoolQuery(part.getProperty().toDotPath(), iterator.next()); // default: // throw new IllegalArgumentException(part.getType() + "is not supported for redis query derivation"); // } // } // // @Override // protected TarantoolQuery and(Part part, TarantoolQuery base, Iterator<Object> iterator) { // throw new UnsupportedOperationException("and is not supported"); // } // // @Override // protected TarantoolQuery or(TarantoolQuery base, TarantoolQuery criteria) { // throw new UnsupportedOperationException("or is not supported"); // } // // @Override // protected KeyValueQuery<TarantoolQuery> complete(TarantoolQuery criteria, Sort sort) { // final KeyValueQuery<TarantoolQuery> tarantoolQueryKeyValueQuery = new KeyValueQuery<>(criteria); // tarantoolQueryKeyValueQuery.setSort(sort); // return tarantoolQueryKeyValueQuery; // } // } // // Path: src/main/java/ru/shadam/tarantool/repository/support/TarantoolRepositoryFactoryBean.java // public class TarantoolRepositoryFactoryBean<T extends Repository<S, ID>, S, ID extends Serializable> // extends KeyValueRepositoryFactoryBean<T, S, ID> { // // /* // * (non-Javadoc) // * @see org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactoryBean#createRepositoryFactory(org.springframework.data.keyvalue.core.KeyValueOperations, java.lang.Class, java.lang.Class) // */ // @Override // protected TarantoolRepositoryFactory createRepositoryFactory( // KeyValueOperations operations, // Class<? extends AbstractQueryCreator<?, ?>> queryCreator, // Class<? extends RepositoryQuery> repositoryQueryType // ) { // return new TarantoolRepositoryFactory(operations, queryCreator, repositoryQueryType); // } // }
import org.springframework.beans.factory.FactoryBean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Import; import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.repository.config.QueryCreatorType; import ru.shadam.tarantool.repository.query.TarantoolQueryCreator; import ru.shadam.tarantool.repository.support.TarantoolRepositoryFactoryBean; import java.lang.annotation.*;
package ru.shadam.tarantool.repository.configuration; /** * @author sala */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited @Import(TarantoolRepositoriesRegistrar.class) @QueryCreatorType(TarantoolQueryCreator.class) public @interface EnableTarantoolRepositories { /** * Alias for the {@link #basePackages()} attribute. Allows for more concise annotation declarations e.g.: * {@code @EnableRedisRepositories("org.my.pkg")} instead of * {@code @EnableRedisRepositories(basePackages="org.my.pkg")}. */ String[] value() default {}; /** * Base packages to scan for annotated components. {@link #value()} is an alias for (and mutually exclusive with) this * attribute. Use {@link #basePackageClasses()} for a type-safe alternative to String-based package names. */ String[] basePackages() default {}; /** * Type-safe alternative to {@link #basePackages()} for specifying the packages to scan for annotated components. The * package of each class specified will be scanned. Consider creating a special no-op marker class or interface in * each package that serves no purpose other than being referenced by this attribute. */ Class<?>[] basePackageClasses() default {}; /** * Specifies which types are not eligible for component scanning. */ ComponentScan.Filter[] excludeFilters() default {}; /** * Specifies which types are eligible for component scanning. Further narrows the set of candidate components from * everything in {@link #basePackages()} to everything in the base packages that matches the given filter or filters. */ ComponentScan.Filter[] includeFilters() default {}; /** * Returns the {@link FactoryBean} class to be used for each repository instance. Defaults to * {@link TarantoolRepositoryFactoryBean}. * * @return */
// Path: src/main/java/ru/shadam/tarantool/repository/query/TarantoolQueryCreator.java // public class TarantoolQueryCreator extends AbstractQueryCreator<KeyValueQuery<TarantoolQuery>, TarantoolQuery> { // // public TarantoolQueryCreator(PartTree tree, ParameterAccessor parameters) { // super(tree, parameters); // } // // @Override // protected TarantoolQuery create(Part part, Iterator<Object> iterator) { // switch (part.getType()) { // case SIMPLE_PROPERTY: // return new TarantoolQuery(part.getProperty().toDotPath(), iterator.next()); // default: // throw new IllegalArgumentException(part.getType() + "is not supported for redis query derivation"); // } // } // // @Override // protected TarantoolQuery and(Part part, TarantoolQuery base, Iterator<Object> iterator) { // throw new UnsupportedOperationException("and is not supported"); // } // // @Override // protected TarantoolQuery or(TarantoolQuery base, TarantoolQuery criteria) { // throw new UnsupportedOperationException("or is not supported"); // } // // @Override // protected KeyValueQuery<TarantoolQuery> complete(TarantoolQuery criteria, Sort sort) { // final KeyValueQuery<TarantoolQuery> tarantoolQueryKeyValueQuery = new KeyValueQuery<>(criteria); // tarantoolQueryKeyValueQuery.setSort(sort); // return tarantoolQueryKeyValueQuery; // } // } // // Path: src/main/java/ru/shadam/tarantool/repository/support/TarantoolRepositoryFactoryBean.java // public class TarantoolRepositoryFactoryBean<T extends Repository<S, ID>, S, ID extends Serializable> // extends KeyValueRepositoryFactoryBean<T, S, ID> { // // /* // * (non-Javadoc) // * @see org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactoryBean#createRepositoryFactory(org.springframework.data.keyvalue.core.KeyValueOperations, java.lang.Class, java.lang.Class) // */ // @Override // protected TarantoolRepositoryFactory createRepositoryFactory( // KeyValueOperations operations, // Class<? extends AbstractQueryCreator<?, ?>> queryCreator, // Class<? extends RepositoryQuery> repositoryQueryType // ) { // return new TarantoolRepositoryFactory(operations, queryCreator, repositoryQueryType); // } // } // Path: src/main/java/ru/shadam/tarantool/repository/configuration/EnableTarantoolRepositories.java import org.springframework.beans.factory.FactoryBean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Import; import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.repository.config.QueryCreatorType; import ru.shadam.tarantool.repository.query.TarantoolQueryCreator; import ru.shadam.tarantool.repository.support.TarantoolRepositoryFactoryBean; import java.lang.annotation.*; package ru.shadam.tarantool.repository.configuration; /** * @author sala */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited @Import(TarantoolRepositoriesRegistrar.class) @QueryCreatorType(TarantoolQueryCreator.class) public @interface EnableTarantoolRepositories { /** * Alias for the {@link #basePackages()} attribute. Allows for more concise annotation declarations e.g.: * {@code @EnableRedisRepositories("org.my.pkg")} instead of * {@code @EnableRedisRepositories(basePackages="org.my.pkg")}. */ String[] value() default {}; /** * Base packages to scan for annotated components. {@link #value()} is an alias for (and mutually exclusive with) this * attribute. Use {@link #basePackageClasses()} for a type-safe alternative to String-based package names. */ String[] basePackages() default {}; /** * Type-safe alternative to {@link #basePackages()} for specifying the packages to scan for annotated components. The * package of each class specified will be scanned. Consider creating a special no-op marker class or interface in * each package that serves no purpose other than being referenced by this attribute. */ Class<?>[] basePackageClasses() default {}; /** * Specifies which types are not eligible for component scanning. */ ComponentScan.Filter[] excludeFilters() default {}; /** * Specifies which types are eligible for component scanning. Further narrows the set of candidate components from * everything in {@link #basePackages()} to everything in the base packages that matches the given filter or filters. */ ComponentScan.Filter[] includeFilters() default {}; /** * Returns the {@link FactoryBean} class to be used for each repository instance. Defaults to * {@link TarantoolRepositoryFactoryBean}. * * @return */
Class<?> repositoryFactoryBeanClass() default TarantoolRepositoryFactoryBean.class;
saladinkzn/spring-data-tarantool
src/main/java/ru/shadam/tarantool/core/TarantoolOps.java
// Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolData.java // public class TarantoolData { // private Object id; // // private Tuple tuple; // // public TarantoolData() { // this.tuple = new Tuple(); // } // // public TarantoolData(Tuple tuple) { // this.tuple = tuple; // } // // public Object getId() { // return id; // } // // public void setId(Object id) { // this.id = id; // } // // // @Override // public String toString() { // return "TarantoolData{" + // ", id=" + id + // ", tuple=" + tuple + // '}'; // } // // public Tuple getTuple() { // return tuple; // } // }
import ru.shadam.tarantool.core.convert.TarantoolData; import java.io.Serializable; import java.util.List;
package ru.shadam.tarantool.core; /** * @author sala */ public interface TarantoolOps { boolean contains(String space, Serializable id); long count(String space); long countByIndex(String keyspace, String index, Serializable id);
// Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolData.java // public class TarantoolData { // private Object id; // // private Tuple tuple; // // public TarantoolData() { // this.tuple = new Tuple(); // } // // public TarantoolData(Tuple tuple) { // this.tuple = tuple; // } // // public Object getId() { // return id; // } // // public void setId(Object id) { // this.id = id; // } // // // @Override // public String toString() { // return "TarantoolData{" + // ", id=" + id + // ", tuple=" + tuple + // '}'; // } // // public Tuple getTuple() { // return tuple; // } // } // Path: src/main/java/ru/shadam/tarantool/core/TarantoolOps.java import ru.shadam.tarantool.core.convert.TarantoolData; import java.io.Serializable; import java.util.List; package ru.shadam.tarantool.core; /** * @author sala */ public interface TarantoolOps { boolean contains(String space, Serializable id); long count(String space); long countByIndex(String keyspace, String index, Serializable id);
TarantoolData delete(String space, Serializable id);
saladinkzn/spring-data-tarantool
src/main/java/ru/shadam/tarantool/core/TarantoolKeyValueTemplate.java
// Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolConverter.java // public interface TarantoolConverter // extends EntityConverter<TarantoolPersistentEntity<?>, TarantoolPersistentProperty, Object, TarantoolData> { // // void removePrimaryKey(Object source, TarantoolData sink); // } // // Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolData.java // public class TarantoolData { // private Object id; // // private Tuple tuple; // // public TarantoolData() { // this.tuple = new Tuple(); // } // // public TarantoolData(Tuple tuple) { // this.tuple = tuple; // } // // public Object getId() { // return id; // } // // public void setId(Object id) { // this.id = id; // } // // // @Override // public String toString() { // return "TarantoolData{" + // ", id=" + id + // ", tuple=" + tuple + // '}'; // } // // public Tuple getTuple() { // return tuple; // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolMappingContext.java // public class TarantoolMappingContext extends AbstractMappingContext<TarantoolPersistentEntity<?>, TarantoolPersistentProperty> { // private KeySpaceResolver fallbackKeySpaceResolver; // // public void setFallbackKeySpaceResolver(KeySpaceResolver fallbackKeySpaceResolver) { // this.fallbackKeySpaceResolver = fallbackKeySpaceResolver; // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(Class<?> type) { // return super.getPersistentEntity(type); // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(TypeInformation<?> type) { // return super.getPersistentEntity(type); // // } // // @Override // protected <T> TarantoolPersistentEntity<T> createPersistentEntity(TypeInformation<T> typeInformation) { // return new BasicTarantoolPersistentEntity<>(typeInformation, fallbackKeySpaceResolver); // } // // @Override // protected TarantoolPersistentPropertyImpl createPersistentProperty(Field field, // PropertyDescriptor descriptor, // TarantoolPersistentEntity<?> owner, // SimpleTypeHolder simpleTypeHolder) { // return new TarantoolPersistentPropertyImpl(field, descriptor, owner, simpleTypeHolder); // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentProperty.java // public interface TarantoolPersistentProperty extends PersistentProperty<TarantoolPersistentProperty> { // OptionalInt getTupleIndex(); // // Optional<String> getSpaceIndexName(); // } // // Path: src/main/java/ru/shadam/tarantool/repository/query/TarantoolQuery.java // public class TarantoolQuery { // private String key; // private Object value; // // public TarantoolQuery(String key, Object value) { // this.key = key; // this.value = value; // } // // public String getKey() { // return key; // } // // public Object getValue() { // return value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // final TarantoolQuery that = (TarantoolQuery) o; // // if (key != null ? !key.equals(that.key) : that.key != null) return false; // return value != null ? value.equals(that.value) : that.value == null; // } // // @Override // public int hashCode() { // int result = key != null ? key.hashCode() : 0; // result = 31 * result + (value != null ? value.hashCode() : 0); // return result; // } // // // @Override // public String toString() { // return "TarantoolQuery{" + // "key='" + key + '\'' + // ", value=" + value + // '}'; // } // }
import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.domain.Sort; import org.springframework.data.keyvalue.core.KeyValueCallback; import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.core.query.KeyValueQuery; import org.springframework.data.mapping.PersistentEntity; import org.springframework.data.mapping.PersistentProperty; import org.springframework.data.mapping.context.MappingContext; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import ru.shadam.tarantool.core.convert.TarantoolConverter; import ru.shadam.tarantool.core.convert.TarantoolData; import ru.shadam.tarantool.core.mapping.TarantoolMappingContext; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.core.mapping.TarantoolPersistentProperty; import ru.shadam.tarantool.repository.query.TarantoolQuery; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Optional;
package ru.shadam.tarantool.core; /** * @author sala */ public class TarantoolKeyValueTemplate implements KeyValueOperations { // for exception translation private final TarantoolOps tarantoolOps;
// Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolConverter.java // public interface TarantoolConverter // extends EntityConverter<TarantoolPersistentEntity<?>, TarantoolPersistentProperty, Object, TarantoolData> { // // void removePrimaryKey(Object source, TarantoolData sink); // } // // Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolData.java // public class TarantoolData { // private Object id; // // private Tuple tuple; // // public TarantoolData() { // this.tuple = new Tuple(); // } // // public TarantoolData(Tuple tuple) { // this.tuple = tuple; // } // // public Object getId() { // return id; // } // // public void setId(Object id) { // this.id = id; // } // // // @Override // public String toString() { // return "TarantoolData{" + // ", id=" + id + // ", tuple=" + tuple + // '}'; // } // // public Tuple getTuple() { // return tuple; // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolMappingContext.java // public class TarantoolMappingContext extends AbstractMappingContext<TarantoolPersistentEntity<?>, TarantoolPersistentProperty> { // private KeySpaceResolver fallbackKeySpaceResolver; // // public void setFallbackKeySpaceResolver(KeySpaceResolver fallbackKeySpaceResolver) { // this.fallbackKeySpaceResolver = fallbackKeySpaceResolver; // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(Class<?> type) { // return super.getPersistentEntity(type); // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(TypeInformation<?> type) { // return super.getPersistentEntity(type); // // } // // @Override // protected <T> TarantoolPersistentEntity<T> createPersistentEntity(TypeInformation<T> typeInformation) { // return new BasicTarantoolPersistentEntity<>(typeInformation, fallbackKeySpaceResolver); // } // // @Override // protected TarantoolPersistentPropertyImpl createPersistentProperty(Field field, // PropertyDescriptor descriptor, // TarantoolPersistentEntity<?> owner, // SimpleTypeHolder simpleTypeHolder) { // return new TarantoolPersistentPropertyImpl(field, descriptor, owner, simpleTypeHolder); // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentProperty.java // public interface TarantoolPersistentProperty extends PersistentProperty<TarantoolPersistentProperty> { // OptionalInt getTupleIndex(); // // Optional<String> getSpaceIndexName(); // } // // Path: src/main/java/ru/shadam/tarantool/repository/query/TarantoolQuery.java // public class TarantoolQuery { // private String key; // private Object value; // // public TarantoolQuery(String key, Object value) { // this.key = key; // this.value = value; // } // // public String getKey() { // return key; // } // // public Object getValue() { // return value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // final TarantoolQuery that = (TarantoolQuery) o; // // if (key != null ? !key.equals(that.key) : that.key != null) return false; // return value != null ? value.equals(that.value) : that.value == null; // } // // @Override // public int hashCode() { // int result = key != null ? key.hashCode() : 0; // result = 31 * result + (value != null ? value.hashCode() : 0); // return result; // } // // // @Override // public String toString() { // return "TarantoolQuery{" + // "key='" + key + '\'' + // ", value=" + value + // '}'; // } // } // Path: src/main/java/ru/shadam/tarantool/core/TarantoolKeyValueTemplate.java import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.domain.Sort; import org.springframework.data.keyvalue.core.KeyValueCallback; import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.core.query.KeyValueQuery; import org.springframework.data.mapping.PersistentEntity; import org.springframework.data.mapping.PersistentProperty; import org.springframework.data.mapping.context.MappingContext; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import ru.shadam.tarantool.core.convert.TarantoolConverter; import ru.shadam.tarantool.core.convert.TarantoolData; import ru.shadam.tarantool.core.mapping.TarantoolMappingContext; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.core.mapping.TarantoolPersistentProperty; import ru.shadam.tarantool.repository.query.TarantoolQuery; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Optional; package ru.shadam.tarantool.core; /** * @author sala */ public class TarantoolKeyValueTemplate implements KeyValueOperations { // for exception translation private final TarantoolOps tarantoolOps;
private final TarantoolMappingContext mappingContext;
saladinkzn/spring-data-tarantool
src/main/java/ru/shadam/tarantool/core/TarantoolKeyValueTemplate.java
// Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolConverter.java // public interface TarantoolConverter // extends EntityConverter<TarantoolPersistentEntity<?>, TarantoolPersistentProperty, Object, TarantoolData> { // // void removePrimaryKey(Object source, TarantoolData sink); // } // // Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolData.java // public class TarantoolData { // private Object id; // // private Tuple tuple; // // public TarantoolData() { // this.tuple = new Tuple(); // } // // public TarantoolData(Tuple tuple) { // this.tuple = tuple; // } // // public Object getId() { // return id; // } // // public void setId(Object id) { // this.id = id; // } // // // @Override // public String toString() { // return "TarantoolData{" + // ", id=" + id + // ", tuple=" + tuple + // '}'; // } // // public Tuple getTuple() { // return tuple; // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolMappingContext.java // public class TarantoolMappingContext extends AbstractMappingContext<TarantoolPersistentEntity<?>, TarantoolPersistentProperty> { // private KeySpaceResolver fallbackKeySpaceResolver; // // public void setFallbackKeySpaceResolver(KeySpaceResolver fallbackKeySpaceResolver) { // this.fallbackKeySpaceResolver = fallbackKeySpaceResolver; // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(Class<?> type) { // return super.getPersistentEntity(type); // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(TypeInformation<?> type) { // return super.getPersistentEntity(type); // // } // // @Override // protected <T> TarantoolPersistentEntity<T> createPersistentEntity(TypeInformation<T> typeInformation) { // return new BasicTarantoolPersistentEntity<>(typeInformation, fallbackKeySpaceResolver); // } // // @Override // protected TarantoolPersistentPropertyImpl createPersistentProperty(Field field, // PropertyDescriptor descriptor, // TarantoolPersistentEntity<?> owner, // SimpleTypeHolder simpleTypeHolder) { // return new TarantoolPersistentPropertyImpl(field, descriptor, owner, simpleTypeHolder); // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentProperty.java // public interface TarantoolPersistentProperty extends PersistentProperty<TarantoolPersistentProperty> { // OptionalInt getTupleIndex(); // // Optional<String> getSpaceIndexName(); // } // // Path: src/main/java/ru/shadam/tarantool/repository/query/TarantoolQuery.java // public class TarantoolQuery { // private String key; // private Object value; // // public TarantoolQuery(String key, Object value) { // this.key = key; // this.value = value; // } // // public String getKey() { // return key; // } // // public Object getValue() { // return value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // final TarantoolQuery that = (TarantoolQuery) o; // // if (key != null ? !key.equals(that.key) : that.key != null) return false; // return value != null ? value.equals(that.value) : that.value == null; // } // // @Override // public int hashCode() { // int result = key != null ? key.hashCode() : 0; // result = 31 * result + (value != null ? value.hashCode() : 0); // return result; // } // // // @Override // public String toString() { // return "TarantoolQuery{" + // "key='" + key + '\'' + // ", value=" + value + // '}'; // } // }
import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.domain.Sort; import org.springframework.data.keyvalue.core.KeyValueCallback; import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.core.query.KeyValueQuery; import org.springframework.data.mapping.PersistentEntity; import org.springframework.data.mapping.PersistentProperty; import org.springframework.data.mapping.context.MappingContext; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import ru.shadam.tarantool.core.convert.TarantoolConverter; import ru.shadam.tarantool.core.convert.TarantoolData; import ru.shadam.tarantool.core.mapping.TarantoolMappingContext; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.core.mapping.TarantoolPersistentProperty; import ru.shadam.tarantool.repository.query.TarantoolQuery; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Optional;
package ru.shadam.tarantool.core; /** * @author sala */ public class TarantoolKeyValueTemplate implements KeyValueOperations { // for exception translation private final TarantoolOps tarantoolOps; private final TarantoolMappingContext mappingContext;
// Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolConverter.java // public interface TarantoolConverter // extends EntityConverter<TarantoolPersistentEntity<?>, TarantoolPersistentProperty, Object, TarantoolData> { // // void removePrimaryKey(Object source, TarantoolData sink); // } // // Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolData.java // public class TarantoolData { // private Object id; // // private Tuple tuple; // // public TarantoolData() { // this.tuple = new Tuple(); // } // // public TarantoolData(Tuple tuple) { // this.tuple = tuple; // } // // public Object getId() { // return id; // } // // public void setId(Object id) { // this.id = id; // } // // // @Override // public String toString() { // return "TarantoolData{" + // ", id=" + id + // ", tuple=" + tuple + // '}'; // } // // public Tuple getTuple() { // return tuple; // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolMappingContext.java // public class TarantoolMappingContext extends AbstractMappingContext<TarantoolPersistentEntity<?>, TarantoolPersistentProperty> { // private KeySpaceResolver fallbackKeySpaceResolver; // // public void setFallbackKeySpaceResolver(KeySpaceResolver fallbackKeySpaceResolver) { // this.fallbackKeySpaceResolver = fallbackKeySpaceResolver; // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(Class<?> type) { // return super.getPersistentEntity(type); // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(TypeInformation<?> type) { // return super.getPersistentEntity(type); // // } // // @Override // protected <T> TarantoolPersistentEntity<T> createPersistentEntity(TypeInformation<T> typeInformation) { // return new BasicTarantoolPersistentEntity<>(typeInformation, fallbackKeySpaceResolver); // } // // @Override // protected TarantoolPersistentPropertyImpl createPersistentProperty(Field field, // PropertyDescriptor descriptor, // TarantoolPersistentEntity<?> owner, // SimpleTypeHolder simpleTypeHolder) { // return new TarantoolPersistentPropertyImpl(field, descriptor, owner, simpleTypeHolder); // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentProperty.java // public interface TarantoolPersistentProperty extends PersistentProperty<TarantoolPersistentProperty> { // OptionalInt getTupleIndex(); // // Optional<String> getSpaceIndexName(); // } // // Path: src/main/java/ru/shadam/tarantool/repository/query/TarantoolQuery.java // public class TarantoolQuery { // private String key; // private Object value; // // public TarantoolQuery(String key, Object value) { // this.key = key; // this.value = value; // } // // public String getKey() { // return key; // } // // public Object getValue() { // return value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // final TarantoolQuery that = (TarantoolQuery) o; // // if (key != null ? !key.equals(that.key) : that.key != null) return false; // return value != null ? value.equals(that.value) : that.value == null; // } // // @Override // public int hashCode() { // int result = key != null ? key.hashCode() : 0; // result = 31 * result + (value != null ? value.hashCode() : 0); // return result; // } // // // @Override // public String toString() { // return "TarantoolQuery{" + // "key='" + key + '\'' + // ", value=" + value + // '}'; // } // } // Path: src/main/java/ru/shadam/tarantool/core/TarantoolKeyValueTemplate.java import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.domain.Sort; import org.springframework.data.keyvalue.core.KeyValueCallback; import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.core.query.KeyValueQuery; import org.springframework.data.mapping.PersistentEntity; import org.springframework.data.mapping.PersistentProperty; import org.springframework.data.mapping.context.MappingContext; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import ru.shadam.tarantool.core.convert.TarantoolConverter; import ru.shadam.tarantool.core.convert.TarantoolData; import ru.shadam.tarantool.core.mapping.TarantoolMappingContext; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.core.mapping.TarantoolPersistentProperty; import ru.shadam.tarantool.repository.query.TarantoolQuery; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Optional; package ru.shadam.tarantool.core; /** * @author sala */ public class TarantoolKeyValueTemplate implements KeyValueOperations { // for exception translation private final TarantoolOps tarantoolOps; private final TarantoolMappingContext mappingContext;
private final TarantoolConverter converter;
saladinkzn/spring-data-tarantool
src/main/java/ru/shadam/tarantool/core/TarantoolKeyValueTemplate.java
// Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolConverter.java // public interface TarantoolConverter // extends EntityConverter<TarantoolPersistentEntity<?>, TarantoolPersistentProperty, Object, TarantoolData> { // // void removePrimaryKey(Object source, TarantoolData sink); // } // // Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolData.java // public class TarantoolData { // private Object id; // // private Tuple tuple; // // public TarantoolData() { // this.tuple = new Tuple(); // } // // public TarantoolData(Tuple tuple) { // this.tuple = tuple; // } // // public Object getId() { // return id; // } // // public void setId(Object id) { // this.id = id; // } // // // @Override // public String toString() { // return "TarantoolData{" + // ", id=" + id + // ", tuple=" + tuple + // '}'; // } // // public Tuple getTuple() { // return tuple; // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolMappingContext.java // public class TarantoolMappingContext extends AbstractMappingContext<TarantoolPersistentEntity<?>, TarantoolPersistentProperty> { // private KeySpaceResolver fallbackKeySpaceResolver; // // public void setFallbackKeySpaceResolver(KeySpaceResolver fallbackKeySpaceResolver) { // this.fallbackKeySpaceResolver = fallbackKeySpaceResolver; // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(Class<?> type) { // return super.getPersistentEntity(type); // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(TypeInformation<?> type) { // return super.getPersistentEntity(type); // // } // // @Override // protected <T> TarantoolPersistentEntity<T> createPersistentEntity(TypeInformation<T> typeInformation) { // return new BasicTarantoolPersistentEntity<>(typeInformation, fallbackKeySpaceResolver); // } // // @Override // protected TarantoolPersistentPropertyImpl createPersistentProperty(Field field, // PropertyDescriptor descriptor, // TarantoolPersistentEntity<?> owner, // SimpleTypeHolder simpleTypeHolder) { // return new TarantoolPersistentPropertyImpl(field, descriptor, owner, simpleTypeHolder); // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentProperty.java // public interface TarantoolPersistentProperty extends PersistentProperty<TarantoolPersistentProperty> { // OptionalInt getTupleIndex(); // // Optional<String> getSpaceIndexName(); // } // // Path: src/main/java/ru/shadam/tarantool/repository/query/TarantoolQuery.java // public class TarantoolQuery { // private String key; // private Object value; // // public TarantoolQuery(String key, Object value) { // this.key = key; // this.value = value; // } // // public String getKey() { // return key; // } // // public Object getValue() { // return value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // final TarantoolQuery that = (TarantoolQuery) o; // // if (key != null ? !key.equals(that.key) : that.key != null) return false; // return value != null ? value.equals(that.value) : that.value == null; // } // // @Override // public int hashCode() { // int result = key != null ? key.hashCode() : 0; // result = 31 * result + (value != null ? value.hashCode() : 0); // return result; // } // // // @Override // public String toString() { // return "TarantoolQuery{" + // "key='" + key + '\'' + // ", value=" + value + // '}'; // } // }
import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.domain.Sort; import org.springframework.data.keyvalue.core.KeyValueCallback; import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.core.query.KeyValueQuery; import org.springframework.data.mapping.PersistentEntity; import org.springframework.data.mapping.PersistentProperty; import org.springframework.data.mapping.context.MappingContext; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import ru.shadam.tarantool.core.convert.TarantoolConverter; import ru.shadam.tarantool.core.convert.TarantoolData; import ru.shadam.tarantool.core.mapping.TarantoolMappingContext; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.core.mapping.TarantoolPersistentProperty; import ru.shadam.tarantool.repository.query.TarantoolQuery; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Optional;
package ru.shadam.tarantool.core; /** * @author sala */ public class TarantoolKeyValueTemplate implements KeyValueOperations { // for exception translation private final TarantoolOps tarantoolOps; private final TarantoolMappingContext mappingContext; private final TarantoolConverter converter; // private final QueryEngine<? extends KeyValueAdapter, ?, ?> engine; public TarantoolKeyValueTemplate(TarantoolOps tarantoolOps, TarantoolMappingContext mappingContext, TarantoolConverter converter) { this.tarantoolOps = tarantoolOps; this.mappingContext = mappingContext; this.converter = converter; } @Override public <T> T insert(T objectToInsert) { Assert.notNull(objectToInsert, "Object to be inserted must not be null!"); Class<?> objectClass = objectToInsert.getClass(); String keyspace = resolveKeySpace(objectClass);
// Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolConverter.java // public interface TarantoolConverter // extends EntityConverter<TarantoolPersistentEntity<?>, TarantoolPersistentProperty, Object, TarantoolData> { // // void removePrimaryKey(Object source, TarantoolData sink); // } // // Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolData.java // public class TarantoolData { // private Object id; // // private Tuple tuple; // // public TarantoolData() { // this.tuple = new Tuple(); // } // // public TarantoolData(Tuple tuple) { // this.tuple = tuple; // } // // public Object getId() { // return id; // } // // public void setId(Object id) { // this.id = id; // } // // // @Override // public String toString() { // return "TarantoolData{" + // ", id=" + id + // ", tuple=" + tuple + // '}'; // } // // public Tuple getTuple() { // return tuple; // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolMappingContext.java // public class TarantoolMappingContext extends AbstractMappingContext<TarantoolPersistentEntity<?>, TarantoolPersistentProperty> { // private KeySpaceResolver fallbackKeySpaceResolver; // // public void setFallbackKeySpaceResolver(KeySpaceResolver fallbackKeySpaceResolver) { // this.fallbackKeySpaceResolver = fallbackKeySpaceResolver; // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(Class<?> type) { // return super.getPersistentEntity(type); // } // // @Override // public TarantoolPersistentEntity<?> getPersistentEntity(TypeInformation<?> type) { // return super.getPersistentEntity(type); // // } // // @Override // protected <T> TarantoolPersistentEntity<T> createPersistentEntity(TypeInformation<T> typeInformation) { // return new BasicTarantoolPersistentEntity<>(typeInformation, fallbackKeySpaceResolver); // } // // @Override // protected TarantoolPersistentPropertyImpl createPersistentProperty(Field field, // PropertyDescriptor descriptor, // TarantoolPersistentEntity<?> owner, // SimpleTypeHolder simpleTypeHolder) { // return new TarantoolPersistentPropertyImpl(field, descriptor, owner, simpleTypeHolder); // } // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentEntity.java // public interface TarantoolPersistentEntity<T> extends MutablePersistentEntity<T, TarantoolPersistentProperty> { // String getSpaceName(); // } // // Path: src/main/java/ru/shadam/tarantool/core/mapping/TarantoolPersistentProperty.java // public interface TarantoolPersistentProperty extends PersistentProperty<TarantoolPersistentProperty> { // OptionalInt getTupleIndex(); // // Optional<String> getSpaceIndexName(); // } // // Path: src/main/java/ru/shadam/tarantool/repository/query/TarantoolQuery.java // public class TarantoolQuery { // private String key; // private Object value; // // public TarantoolQuery(String key, Object value) { // this.key = key; // this.value = value; // } // // public String getKey() { // return key; // } // // public Object getValue() { // return value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // final TarantoolQuery that = (TarantoolQuery) o; // // if (key != null ? !key.equals(that.key) : that.key != null) return false; // return value != null ? value.equals(that.value) : that.value == null; // } // // @Override // public int hashCode() { // int result = key != null ? key.hashCode() : 0; // result = 31 * result + (value != null ? value.hashCode() : 0); // return result; // } // // // @Override // public String toString() { // return "TarantoolQuery{" + // "key='" + key + '\'' + // ", value=" + value + // '}'; // } // } // Path: src/main/java/ru/shadam/tarantool/core/TarantoolKeyValueTemplate.java import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.domain.Sort; import org.springframework.data.keyvalue.core.KeyValueCallback; import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.core.query.KeyValueQuery; import org.springframework.data.mapping.PersistentEntity; import org.springframework.data.mapping.PersistentProperty; import org.springframework.data.mapping.context.MappingContext; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import ru.shadam.tarantool.core.convert.TarantoolConverter; import ru.shadam.tarantool.core.convert.TarantoolData; import ru.shadam.tarantool.core.mapping.TarantoolMappingContext; import ru.shadam.tarantool.core.mapping.TarantoolPersistentEntity; import ru.shadam.tarantool.core.mapping.TarantoolPersistentProperty; import ru.shadam.tarantool.repository.query.TarantoolQuery; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Optional; package ru.shadam.tarantool.core; /** * @author sala */ public class TarantoolKeyValueTemplate implements KeyValueOperations { // for exception translation private final TarantoolOps tarantoolOps; private final TarantoolMappingContext mappingContext; private final TarantoolConverter converter; // private final QueryEngine<? extends KeyValueAdapter, ?, ?> engine; public TarantoolKeyValueTemplate(TarantoolOps tarantoolOps, TarantoolMappingContext mappingContext, TarantoolConverter converter) { this.tarantoolOps = tarantoolOps; this.mappingContext = mappingContext; this.converter = converter; } @Override public <T> T insert(T objectToInsert) { Assert.notNull(objectToInsert, "Object to be inserted must not be null!"); Class<?> objectClass = objectToInsert.getClass(); String keyspace = resolveKeySpace(objectClass);
TarantoolData tdo = maybeConvert(objectToInsert);
saladinkzn/spring-data-tarantool
src/main/java/ru/shadam/tarantool/serializer/PlainTarantoolSerializer.java
// Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolDefaultConversionService.java // public class TarantoolDefaultConversionService extends DefaultConversionService { // public TarantoolDefaultConversionService() { // super(); // // removeConvertible(Collection.class, Object.class); // removeConvertible(Object.class, Collection.class); // } // // }
import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.support.ConfigurableConversionService; import ru.shadam.tarantool.core.convert.TarantoolDefaultConversionService; import java.lang.reflect.Array; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Map;
package ru.shadam.tarantool.serializer; /** * @author sala */ public class PlainTarantoolSerializer<T> implements TarantoolSerializer<T> { private static final Class<?>[] NATIVE_TYPES = new Class<?>[] { Boolean.class, Number.class, String.class, byte[].class }; private final Class<T> desiredClass; private final ConfigurableConversionService conversionService; public PlainTarantoolSerializer(Class<T> desiredClass) {
// Path: src/main/java/ru/shadam/tarantool/core/convert/TarantoolDefaultConversionService.java // public class TarantoolDefaultConversionService extends DefaultConversionService { // public TarantoolDefaultConversionService() { // super(); // // removeConvertible(Collection.class, Object.class); // removeConvertible(Object.class, Collection.class); // } // // } // Path: src/main/java/ru/shadam/tarantool/serializer/PlainTarantoolSerializer.java import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.support.ConfigurableConversionService; import ru.shadam.tarantool.core.convert.TarantoolDefaultConversionService; import java.lang.reflect.Array; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Map; package ru.shadam.tarantool.serializer; /** * @author sala */ public class PlainTarantoolSerializer<T> implements TarantoolSerializer<T> { private static final Class<?>[] NATIVE_TYPES = new Class<?>[] { Boolean.class, Number.class, String.class, byte[].class }; private final Class<T> desiredClass; private final ConfigurableConversionService conversionService; public PlainTarantoolSerializer(Class<T> desiredClass) {
this(desiredClass, new TarantoolDefaultConversionService());
xuxueli/xxl-conf
xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/IndexController.java
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/service/impl/LoginService.java // @Configuration // public class LoginService { // // public static final String LOGIN_IDENTITY = "XXL_CONF_LOGIN_IDENTITY"; // // @Resource // private XxlConfUserDao xxlConfUserDao; // // private String makeToken(XxlConfUser xxlConfUser){ // String tokenJson = JacksonUtil.writeValueAsString(xxlConfUser); // String tokenHex = new BigInteger(tokenJson.getBytes()).toString(16); // return tokenHex; // } // private XxlConfUser parseToken(String tokenHex){ // XxlConfUser xxlConfUser = null; // if (tokenHex != null) { // String tokenJson = new String(new BigInteger(tokenHex, 16).toByteArray()); // username_password(md5) // xxlConfUser = JacksonUtil.readValue(tokenJson, XxlConfUser.class); // } // return xxlConfUser; // } // // /** // * login // * // * @param response // * @param usernameParam // * @param passwordParam // * @param ifRemember // * @return // */ // public ReturnT<String> login(HttpServletResponse response, String usernameParam, String passwordParam, boolean ifRemember){ // // XxlConfUser xxlConfUser = xxlConfUserDao.load(usernameParam); // if (xxlConfUser == null) { // return new ReturnT<String>(500, "账号或密码错误"); // } // // String passwordParamMd5 = DigestUtils.md5DigestAsHex(passwordParam.getBytes()); // if (!xxlConfUser.getPassword().equals(passwordParamMd5)) { // return new ReturnT<String>(500, "账号或密码错误"); // } // // String loginToken = makeToken(xxlConfUser); // // // do login // CookieUtil.set(response, LOGIN_IDENTITY, loginToken, ifRemember); // return ReturnT.SUCCESS; // } // // /** // * logout // * // * @param request // * @param response // */ // public void logout(HttpServletRequest request, HttpServletResponse response){ // CookieUtil.remove(request, response, LOGIN_IDENTITY); // } // // /** // * logout // * // * @param request // * @return // */ // public XxlConfUser ifLogin(HttpServletRequest request){ // String cookieToken = CookieUtil.getValue(request, LOGIN_IDENTITY); // if (cookieToken != null) { // XxlConfUser cookieUser = parseToken(cookieToken); // if (cookieUser != null) { // XxlConfUser dbUser = xxlConfUserDao.load(cookieUser.getUsername()); // if (dbUser != null) { // if (cookieUser.getPassword().equals(dbUser.getPassword())) { // return dbUser; // } // } // } // } // return null; // } // // }
import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.service.impl.LoginService; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
package com.xxl.conf.admin.controller; /** * Created by xuxueli on 16/7/30. */ @Controller public class IndexController { private static Logger logger = LoggerFactory.getLogger(IndexController.class.getName()); @Resource
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/service/impl/LoginService.java // @Configuration // public class LoginService { // // public static final String LOGIN_IDENTITY = "XXL_CONF_LOGIN_IDENTITY"; // // @Resource // private XxlConfUserDao xxlConfUserDao; // // private String makeToken(XxlConfUser xxlConfUser){ // String tokenJson = JacksonUtil.writeValueAsString(xxlConfUser); // String tokenHex = new BigInteger(tokenJson.getBytes()).toString(16); // return tokenHex; // } // private XxlConfUser parseToken(String tokenHex){ // XxlConfUser xxlConfUser = null; // if (tokenHex != null) { // String tokenJson = new String(new BigInteger(tokenHex, 16).toByteArray()); // username_password(md5) // xxlConfUser = JacksonUtil.readValue(tokenJson, XxlConfUser.class); // } // return xxlConfUser; // } // // /** // * login // * // * @param response // * @param usernameParam // * @param passwordParam // * @param ifRemember // * @return // */ // public ReturnT<String> login(HttpServletResponse response, String usernameParam, String passwordParam, boolean ifRemember){ // // XxlConfUser xxlConfUser = xxlConfUserDao.load(usernameParam); // if (xxlConfUser == null) { // return new ReturnT<String>(500, "账号或密码错误"); // } // // String passwordParamMd5 = DigestUtils.md5DigestAsHex(passwordParam.getBytes()); // if (!xxlConfUser.getPassword().equals(passwordParamMd5)) { // return new ReturnT<String>(500, "账号或密码错误"); // } // // String loginToken = makeToken(xxlConfUser); // // // do login // CookieUtil.set(response, LOGIN_IDENTITY, loginToken, ifRemember); // return ReturnT.SUCCESS; // } // // /** // * logout // * // * @param request // * @param response // */ // public void logout(HttpServletRequest request, HttpServletResponse response){ // CookieUtil.remove(request, response, LOGIN_IDENTITY); // } // // /** // * logout // * // * @param request // * @return // */ // public XxlConfUser ifLogin(HttpServletRequest request){ // String cookieToken = CookieUtil.getValue(request, LOGIN_IDENTITY); // if (cookieToken != null) { // XxlConfUser cookieUser = parseToken(cookieToken); // if (cookieUser != null) { // XxlConfUser dbUser = xxlConfUserDao.load(cookieUser.getUsername()); // if (dbUser != null) { // if (cookieUser.getPassword().equals(dbUser.getPassword())) { // return dbUser; // } // } // } // } // return null; // } // // } // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/IndexController.java import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.service.impl.LoginService; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; package com.xxl.conf.admin.controller; /** * Created by xuxueli on 16/7/30. */ @Controller public class IndexController { private static Logger logger = LoggerFactory.getLogger(IndexController.class.getName()); @Resource
private LoginService loginService;
xuxueli/xxl-conf
xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/IndexController.java
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/service/impl/LoginService.java // @Configuration // public class LoginService { // // public static final String LOGIN_IDENTITY = "XXL_CONF_LOGIN_IDENTITY"; // // @Resource // private XxlConfUserDao xxlConfUserDao; // // private String makeToken(XxlConfUser xxlConfUser){ // String tokenJson = JacksonUtil.writeValueAsString(xxlConfUser); // String tokenHex = new BigInteger(tokenJson.getBytes()).toString(16); // return tokenHex; // } // private XxlConfUser parseToken(String tokenHex){ // XxlConfUser xxlConfUser = null; // if (tokenHex != null) { // String tokenJson = new String(new BigInteger(tokenHex, 16).toByteArray()); // username_password(md5) // xxlConfUser = JacksonUtil.readValue(tokenJson, XxlConfUser.class); // } // return xxlConfUser; // } // // /** // * login // * // * @param response // * @param usernameParam // * @param passwordParam // * @param ifRemember // * @return // */ // public ReturnT<String> login(HttpServletResponse response, String usernameParam, String passwordParam, boolean ifRemember){ // // XxlConfUser xxlConfUser = xxlConfUserDao.load(usernameParam); // if (xxlConfUser == null) { // return new ReturnT<String>(500, "账号或密码错误"); // } // // String passwordParamMd5 = DigestUtils.md5DigestAsHex(passwordParam.getBytes()); // if (!xxlConfUser.getPassword().equals(passwordParamMd5)) { // return new ReturnT<String>(500, "账号或密码错误"); // } // // String loginToken = makeToken(xxlConfUser); // // // do login // CookieUtil.set(response, LOGIN_IDENTITY, loginToken, ifRemember); // return ReturnT.SUCCESS; // } // // /** // * logout // * // * @param request // * @param response // */ // public void logout(HttpServletRequest request, HttpServletResponse response){ // CookieUtil.remove(request, response, LOGIN_IDENTITY); // } // // /** // * logout // * // * @param request // * @return // */ // public XxlConfUser ifLogin(HttpServletRequest request){ // String cookieToken = CookieUtil.getValue(request, LOGIN_IDENTITY); // if (cookieToken != null) { // XxlConfUser cookieUser = parseToken(cookieToken); // if (cookieUser != null) { // XxlConfUser dbUser = xxlConfUserDao.load(cookieUser.getUsername()); // if (dbUser != null) { // if (cookieUser.getPassword().equals(dbUser.getPassword())) { // return dbUser; // } // } // } // } // return null; // } // // }
import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.service.impl.LoginService; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
package com.xxl.conf.admin.controller; /** * Created by xuxueli on 16/7/30. */ @Controller public class IndexController { private static Logger logger = LoggerFactory.getLogger(IndexController.class.getName()); @Resource private LoginService loginService; @RequestMapping("/") public String index(Model model, HttpServletRequest request) { return "redirect:/conf"; } @RequestMapping("/toLogin") @PermessionLimit(limit=false) public String toLogin(Model model, HttpServletRequest request) { if (loginService.ifLogin(request) != null) { return "redirect:/"; } return "login"; } @RequestMapping(value="login", method= RequestMethod.POST) @ResponseBody @PermessionLimit(limit=false)
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/service/impl/LoginService.java // @Configuration // public class LoginService { // // public static final String LOGIN_IDENTITY = "XXL_CONF_LOGIN_IDENTITY"; // // @Resource // private XxlConfUserDao xxlConfUserDao; // // private String makeToken(XxlConfUser xxlConfUser){ // String tokenJson = JacksonUtil.writeValueAsString(xxlConfUser); // String tokenHex = new BigInteger(tokenJson.getBytes()).toString(16); // return tokenHex; // } // private XxlConfUser parseToken(String tokenHex){ // XxlConfUser xxlConfUser = null; // if (tokenHex != null) { // String tokenJson = new String(new BigInteger(tokenHex, 16).toByteArray()); // username_password(md5) // xxlConfUser = JacksonUtil.readValue(tokenJson, XxlConfUser.class); // } // return xxlConfUser; // } // // /** // * login // * // * @param response // * @param usernameParam // * @param passwordParam // * @param ifRemember // * @return // */ // public ReturnT<String> login(HttpServletResponse response, String usernameParam, String passwordParam, boolean ifRemember){ // // XxlConfUser xxlConfUser = xxlConfUserDao.load(usernameParam); // if (xxlConfUser == null) { // return new ReturnT<String>(500, "账号或密码错误"); // } // // String passwordParamMd5 = DigestUtils.md5DigestAsHex(passwordParam.getBytes()); // if (!xxlConfUser.getPassword().equals(passwordParamMd5)) { // return new ReturnT<String>(500, "账号或密码错误"); // } // // String loginToken = makeToken(xxlConfUser); // // // do login // CookieUtil.set(response, LOGIN_IDENTITY, loginToken, ifRemember); // return ReturnT.SUCCESS; // } // // /** // * logout // * // * @param request // * @param response // */ // public void logout(HttpServletRequest request, HttpServletResponse response){ // CookieUtil.remove(request, response, LOGIN_IDENTITY); // } // // /** // * logout // * // * @param request // * @return // */ // public XxlConfUser ifLogin(HttpServletRequest request){ // String cookieToken = CookieUtil.getValue(request, LOGIN_IDENTITY); // if (cookieToken != null) { // XxlConfUser cookieUser = parseToken(cookieToken); // if (cookieUser != null) { // XxlConfUser dbUser = xxlConfUserDao.load(cookieUser.getUsername()); // if (dbUser != null) { // if (cookieUser.getPassword().equals(dbUser.getPassword())) { // return dbUser; // } // } // } // } // return null; // } // // } // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/IndexController.java import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.service.impl.LoginService; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; package com.xxl.conf.admin.controller; /** * Created by xuxueli on 16/7/30. */ @Controller public class IndexController { private static Logger logger = LoggerFactory.getLogger(IndexController.class.getName()); @Resource private LoginService loginService; @RequestMapping("/") public String index(Model model, HttpServletRequest request) { return "redirect:/conf"; } @RequestMapping("/toLogin") @PermessionLimit(limit=false) public String toLogin(Model model, HttpServletRequest request) { if (loginService.ifLogin(request) != null) { return "redirect:/"; } return "login"; } @RequestMapping(value="login", method= RequestMethod.POST) @ResponseBody @PermessionLimit(limit=false)
public ReturnT<String> loginDo(HttpServletRequest request, HttpServletResponse response, String userName, String password, String ifRemember){
xuxueli/xxl-conf
xxl-conf-admin/src/main/java/com/xxl/conf/admin/service/IXxlConfNodeService.java
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfNode.java // public class XxlConfNode { // // private String env; // private String key; // 配置Key // private String appname; // 所属项目AppName // private String title; // 配置描述 // private String value; // 配置Value // // // plugin // /*private String zkValue; // ZK中配置Value // TODO, delete*/ // private List<XxlConfNodeLog> logList; // 配置变更Log // // public String getEnv() { // return env; // } // // public void setEnv(String env) { // this.env = env; // } // // public String getKey() { // return key; // } // // public void setKey(String key) { // this.key = key; // } // // public String getAppname() { // return appname; // } // // public void setAppname(String appname) { // this.appname = appname; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public String getValue() { // return value; // } // // public void setValue(String value) { // this.value = value; // } // // /*public String getZkValue() { // return zkValue; // } // // public void setZkValue(String zkValue) { // this.zkValue = zkValue; // }*/ // // public List<XxlConfNodeLog> getLogList() { // return logList; // } // // public void setLogList(List<XxlConfNodeLog> logList) { // this.logList = logList; // } // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfUser.java // public class XxlConfUser { // // private String username; // private String password; // private int permission; // 权限:0-普通用户、1-管理员 // private String permissionData; // 权限配置数据, 格式 "appname#env,appname#env02" // // public String getUsername() { // return username; // } // // public void setUsername(String username) { // this.username = username; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public int getPermission() { // return permission; // } // // public void setPermission(int permission) { // this.permission = permission; // } // // public String getPermissionData() { // return permissionData; // } // // public void setPermissionData(String permissionData) { // this.permissionData = permissionData; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // }
import com.xxl.conf.admin.core.model.XxlConfNode; import com.xxl.conf.admin.core.model.XxlConfUser; import com.xxl.conf.admin.core.util.ReturnT; import org.springframework.web.context.request.async.DeferredResult; import java.util.List; import java.util.Map;
package com.xxl.conf.admin.service; /** * @author xuxueli 2015-9-4 18:19:52 */ public interface IXxlConfNodeService { public boolean ifHasProjectPermission(XxlConfUser loginUser, String loginEnv, String appname); public Map<String,Object> pageList(int offset, int pagesize, String appname, String key, XxlConfUser loginUser, String loginEnv);
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfNode.java // public class XxlConfNode { // // private String env; // private String key; // 配置Key // private String appname; // 所属项目AppName // private String title; // 配置描述 // private String value; // 配置Value // // // plugin // /*private String zkValue; // ZK中配置Value // TODO, delete*/ // private List<XxlConfNodeLog> logList; // 配置变更Log // // public String getEnv() { // return env; // } // // public void setEnv(String env) { // this.env = env; // } // // public String getKey() { // return key; // } // // public void setKey(String key) { // this.key = key; // } // // public String getAppname() { // return appname; // } // // public void setAppname(String appname) { // this.appname = appname; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public String getValue() { // return value; // } // // public void setValue(String value) { // this.value = value; // } // // /*public String getZkValue() { // return zkValue; // } // // public void setZkValue(String zkValue) { // this.zkValue = zkValue; // }*/ // // public List<XxlConfNodeLog> getLogList() { // return logList; // } // // public void setLogList(List<XxlConfNodeLog> logList) { // this.logList = logList; // } // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfUser.java // public class XxlConfUser { // // private String username; // private String password; // private int permission; // 权限:0-普通用户、1-管理员 // private String permissionData; // 权限配置数据, 格式 "appname#env,appname#env02" // // public String getUsername() { // return username; // } // // public void setUsername(String username) { // this.username = username; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public int getPermission() { // return permission; // } // // public void setPermission(int permission) { // this.permission = permission; // } // // public String getPermissionData() { // return permissionData; // } // // public void setPermissionData(String permissionData) { // this.permissionData = permissionData; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/service/IXxlConfNodeService.java import com.xxl.conf.admin.core.model.XxlConfNode; import com.xxl.conf.admin.core.model.XxlConfUser; import com.xxl.conf.admin.core.util.ReturnT; import org.springframework.web.context.request.async.DeferredResult; import java.util.List; import java.util.Map; package com.xxl.conf.admin.service; /** * @author xuxueli 2015-9-4 18:19:52 */ public interface IXxlConfNodeService { public boolean ifHasProjectPermission(XxlConfUser loginUser, String loginEnv, String appname); public Map<String,Object> pageList(int offset, int pagesize, String appname, String key, XxlConfUser loginUser, String loginEnv);
public ReturnT<String> delete(String key, XxlConfUser loginUser, String loginEnv);
xuxueli/xxl-conf
xxl-conf-admin/src/main/java/com/xxl/conf/admin/service/IXxlConfNodeService.java
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfNode.java // public class XxlConfNode { // // private String env; // private String key; // 配置Key // private String appname; // 所属项目AppName // private String title; // 配置描述 // private String value; // 配置Value // // // plugin // /*private String zkValue; // ZK中配置Value // TODO, delete*/ // private List<XxlConfNodeLog> logList; // 配置变更Log // // public String getEnv() { // return env; // } // // public void setEnv(String env) { // this.env = env; // } // // public String getKey() { // return key; // } // // public void setKey(String key) { // this.key = key; // } // // public String getAppname() { // return appname; // } // // public void setAppname(String appname) { // this.appname = appname; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public String getValue() { // return value; // } // // public void setValue(String value) { // this.value = value; // } // // /*public String getZkValue() { // return zkValue; // } // // public void setZkValue(String zkValue) { // this.zkValue = zkValue; // }*/ // // public List<XxlConfNodeLog> getLogList() { // return logList; // } // // public void setLogList(List<XxlConfNodeLog> logList) { // this.logList = logList; // } // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfUser.java // public class XxlConfUser { // // private String username; // private String password; // private int permission; // 权限:0-普通用户、1-管理员 // private String permissionData; // 权限配置数据, 格式 "appname#env,appname#env02" // // public String getUsername() { // return username; // } // // public void setUsername(String username) { // this.username = username; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public int getPermission() { // return permission; // } // // public void setPermission(int permission) { // this.permission = permission; // } // // public String getPermissionData() { // return permissionData; // } // // public void setPermissionData(String permissionData) { // this.permissionData = permissionData; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // }
import com.xxl.conf.admin.core.model.XxlConfNode; import com.xxl.conf.admin.core.model.XxlConfUser; import com.xxl.conf.admin.core.util.ReturnT; import org.springframework.web.context.request.async.DeferredResult; import java.util.List; import java.util.Map;
package com.xxl.conf.admin.service; /** * @author xuxueli 2015-9-4 18:19:52 */ public interface IXxlConfNodeService { public boolean ifHasProjectPermission(XxlConfUser loginUser, String loginEnv, String appname); public Map<String,Object> pageList(int offset, int pagesize, String appname, String key, XxlConfUser loginUser, String loginEnv); public ReturnT<String> delete(String key, XxlConfUser loginUser, String loginEnv);
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfNode.java // public class XxlConfNode { // // private String env; // private String key; // 配置Key // private String appname; // 所属项目AppName // private String title; // 配置描述 // private String value; // 配置Value // // // plugin // /*private String zkValue; // ZK中配置Value // TODO, delete*/ // private List<XxlConfNodeLog> logList; // 配置变更Log // // public String getEnv() { // return env; // } // // public void setEnv(String env) { // this.env = env; // } // // public String getKey() { // return key; // } // // public void setKey(String key) { // this.key = key; // } // // public String getAppname() { // return appname; // } // // public void setAppname(String appname) { // this.appname = appname; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public String getValue() { // return value; // } // // public void setValue(String value) { // this.value = value; // } // // /*public String getZkValue() { // return zkValue; // } // // public void setZkValue(String zkValue) { // this.zkValue = zkValue; // }*/ // // public List<XxlConfNodeLog> getLogList() { // return logList; // } // // public void setLogList(List<XxlConfNodeLog> logList) { // this.logList = logList; // } // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfUser.java // public class XxlConfUser { // // private String username; // private String password; // private int permission; // 权限:0-普通用户、1-管理员 // private String permissionData; // 权限配置数据, 格式 "appname#env,appname#env02" // // public String getUsername() { // return username; // } // // public void setUsername(String username) { // this.username = username; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public int getPermission() { // return permission; // } // // public void setPermission(int permission) { // this.permission = permission; // } // // public String getPermissionData() { // return permissionData; // } // // public void setPermissionData(String permissionData) { // this.permissionData = permissionData; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/service/IXxlConfNodeService.java import com.xxl.conf.admin.core.model.XxlConfNode; import com.xxl.conf.admin.core.model.XxlConfUser; import com.xxl.conf.admin.core.util.ReturnT; import org.springframework.web.context.request.async.DeferredResult; import java.util.List; import java.util.Map; package com.xxl.conf.admin.service; /** * @author xuxueli 2015-9-4 18:19:52 */ public interface IXxlConfNodeService { public boolean ifHasProjectPermission(XxlConfUser loginUser, String loginEnv, String appname); public Map<String,Object> pageList(int offset, int pagesize, String appname, String key, XxlConfUser loginUser, String loginEnv); public ReturnT<String> delete(String key, XxlConfUser loginUser, String loginEnv);
public ReturnT<String> add(XxlConfNode xxlConfNode, XxlConfUser loginUser, String loginEnv);
xuxueli/xxl-conf
xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/ProjectController.java
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfProject.java // public class XxlConfProject { // // private String appname; // 项目AppName // private String title; // 项目名称 // // public String getAppname() { // return appname; // } // // public void setAppname(String appname) { // this.appname = appname; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java // @Mapper // public interface XxlConfNodeDao { // // public List<XxlConfNode> pageList(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // public int pageListCount(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // // public int delete(@Param("env") String env, @Param("key") String key); // // public void insert(XxlConfNode xxlConfNode); // // public XxlConfNode load(@Param("env") String env, @Param("key") String key); // // public int update(XxlConfNode xxlConfNode); // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfProjectDao.java // @Mapper // public interface XxlConfProjectDao { // // public List<XxlConfProject> findAll(); // // public int save(XxlConfProject xxlConfProject); // // public int update(XxlConfProject xxlConfProject); // // public int delete(@Param("appname") String appname); // // public XxlConfProject load(@Param("appname") String appname); // // }
import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.model.XxlConfProject; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.dao.XxlConfNodeDao; import com.xxl.conf.admin.dao.XxlConfProjectDao; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List;
package com.xxl.conf.admin.controller; /** * 项目管理 * * @author xuxueli 2016-10-02 20:52:56 */ @Controller @RequestMapping("/project") public class ProjectController { @Resource
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfProject.java // public class XxlConfProject { // // private String appname; // 项目AppName // private String title; // 项目名称 // // public String getAppname() { // return appname; // } // // public void setAppname(String appname) { // this.appname = appname; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java // @Mapper // public interface XxlConfNodeDao { // // public List<XxlConfNode> pageList(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // public int pageListCount(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // // public int delete(@Param("env") String env, @Param("key") String key); // // public void insert(XxlConfNode xxlConfNode); // // public XxlConfNode load(@Param("env") String env, @Param("key") String key); // // public int update(XxlConfNode xxlConfNode); // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfProjectDao.java // @Mapper // public interface XxlConfProjectDao { // // public List<XxlConfProject> findAll(); // // public int save(XxlConfProject xxlConfProject); // // public int update(XxlConfProject xxlConfProject); // // public int delete(@Param("appname") String appname); // // public XxlConfProject load(@Param("appname") String appname); // // } // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/ProjectController.java import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.model.XxlConfProject; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.dao.XxlConfNodeDao; import com.xxl.conf.admin.dao.XxlConfProjectDao; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List; package com.xxl.conf.admin.controller; /** * 项目管理 * * @author xuxueli 2016-10-02 20:52:56 */ @Controller @RequestMapping("/project") public class ProjectController { @Resource
private XxlConfProjectDao xxlConfProjectDao;
xuxueli/xxl-conf
xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/ProjectController.java
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfProject.java // public class XxlConfProject { // // private String appname; // 项目AppName // private String title; // 项目名称 // // public String getAppname() { // return appname; // } // // public void setAppname(String appname) { // this.appname = appname; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java // @Mapper // public interface XxlConfNodeDao { // // public List<XxlConfNode> pageList(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // public int pageListCount(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // // public int delete(@Param("env") String env, @Param("key") String key); // // public void insert(XxlConfNode xxlConfNode); // // public XxlConfNode load(@Param("env") String env, @Param("key") String key); // // public int update(XxlConfNode xxlConfNode); // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfProjectDao.java // @Mapper // public interface XxlConfProjectDao { // // public List<XxlConfProject> findAll(); // // public int save(XxlConfProject xxlConfProject); // // public int update(XxlConfProject xxlConfProject); // // public int delete(@Param("appname") String appname); // // public XxlConfProject load(@Param("appname") String appname); // // }
import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.model.XxlConfProject; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.dao.XxlConfNodeDao; import com.xxl.conf.admin.dao.XxlConfProjectDao; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List;
package com.xxl.conf.admin.controller; /** * 项目管理 * * @author xuxueli 2016-10-02 20:52:56 */ @Controller @RequestMapping("/project") public class ProjectController { @Resource private XxlConfProjectDao xxlConfProjectDao; @Resource
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfProject.java // public class XxlConfProject { // // private String appname; // 项目AppName // private String title; // 项目名称 // // public String getAppname() { // return appname; // } // // public void setAppname(String appname) { // this.appname = appname; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java // @Mapper // public interface XxlConfNodeDao { // // public List<XxlConfNode> pageList(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // public int pageListCount(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // // public int delete(@Param("env") String env, @Param("key") String key); // // public void insert(XxlConfNode xxlConfNode); // // public XxlConfNode load(@Param("env") String env, @Param("key") String key); // // public int update(XxlConfNode xxlConfNode); // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfProjectDao.java // @Mapper // public interface XxlConfProjectDao { // // public List<XxlConfProject> findAll(); // // public int save(XxlConfProject xxlConfProject); // // public int update(XxlConfProject xxlConfProject); // // public int delete(@Param("appname") String appname); // // public XxlConfProject load(@Param("appname") String appname); // // } // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/ProjectController.java import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.model.XxlConfProject; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.dao.XxlConfNodeDao; import com.xxl.conf.admin.dao.XxlConfProjectDao; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List; package com.xxl.conf.admin.controller; /** * 项目管理 * * @author xuxueli 2016-10-02 20:52:56 */ @Controller @RequestMapping("/project") public class ProjectController { @Resource private XxlConfProjectDao xxlConfProjectDao; @Resource
private XxlConfNodeDao xxlConfNodeDao;
xuxueli/xxl-conf
xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/ProjectController.java
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfProject.java // public class XxlConfProject { // // private String appname; // 项目AppName // private String title; // 项目名称 // // public String getAppname() { // return appname; // } // // public void setAppname(String appname) { // this.appname = appname; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java // @Mapper // public interface XxlConfNodeDao { // // public List<XxlConfNode> pageList(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // public int pageListCount(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // // public int delete(@Param("env") String env, @Param("key") String key); // // public void insert(XxlConfNode xxlConfNode); // // public XxlConfNode load(@Param("env") String env, @Param("key") String key); // // public int update(XxlConfNode xxlConfNode); // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfProjectDao.java // @Mapper // public interface XxlConfProjectDao { // // public List<XxlConfProject> findAll(); // // public int save(XxlConfProject xxlConfProject); // // public int update(XxlConfProject xxlConfProject); // // public int delete(@Param("appname") String appname); // // public XxlConfProject load(@Param("appname") String appname); // // }
import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.model.XxlConfProject; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.dao.XxlConfNodeDao; import com.xxl.conf.admin.dao.XxlConfProjectDao; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List;
package com.xxl.conf.admin.controller; /** * 项目管理 * * @author xuxueli 2016-10-02 20:52:56 */ @Controller @RequestMapping("/project") public class ProjectController { @Resource private XxlConfProjectDao xxlConfProjectDao; @Resource private XxlConfNodeDao xxlConfNodeDao; @RequestMapping @PermessionLimit(adminuser = true) public String index(Model model) {
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfProject.java // public class XxlConfProject { // // private String appname; // 项目AppName // private String title; // 项目名称 // // public String getAppname() { // return appname; // } // // public void setAppname(String appname) { // this.appname = appname; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java // @Mapper // public interface XxlConfNodeDao { // // public List<XxlConfNode> pageList(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // public int pageListCount(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // // public int delete(@Param("env") String env, @Param("key") String key); // // public void insert(XxlConfNode xxlConfNode); // // public XxlConfNode load(@Param("env") String env, @Param("key") String key); // // public int update(XxlConfNode xxlConfNode); // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfProjectDao.java // @Mapper // public interface XxlConfProjectDao { // // public List<XxlConfProject> findAll(); // // public int save(XxlConfProject xxlConfProject); // // public int update(XxlConfProject xxlConfProject); // // public int delete(@Param("appname") String appname); // // public XxlConfProject load(@Param("appname") String appname); // // } // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/ProjectController.java import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.model.XxlConfProject; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.dao.XxlConfNodeDao; import com.xxl.conf.admin.dao.XxlConfProjectDao; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List; package com.xxl.conf.admin.controller; /** * 项目管理 * * @author xuxueli 2016-10-02 20:52:56 */ @Controller @RequestMapping("/project") public class ProjectController { @Resource private XxlConfProjectDao xxlConfProjectDao; @Resource private XxlConfNodeDao xxlConfNodeDao; @RequestMapping @PermessionLimit(adminuser = true) public String index(Model model) {
List<XxlConfProject> list = xxlConfProjectDao.findAll();
xuxueli/xxl-conf
xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/ProjectController.java
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfProject.java // public class XxlConfProject { // // private String appname; // 项目AppName // private String title; // 项目名称 // // public String getAppname() { // return appname; // } // // public void setAppname(String appname) { // this.appname = appname; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java // @Mapper // public interface XxlConfNodeDao { // // public List<XxlConfNode> pageList(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // public int pageListCount(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // // public int delete(@Param("env") String env, @Param("key") String key); // // public void insert(XxlConfNode xxlConfNode); // // public XxlConfNode load(@Param("env") String env, @Param("key") String key); // // public int update(XxlConfNode xxlConfNode); // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfProjectDao.java // @Mapper // public interface XxlConfProjectDao { // // public List<XxlConfProject> findAll(); // // public int save(XxlConfProject xxlConfProject); // // public int update(XxlConfProject xxlConfProject); // // public int delete(@Param("appname") String appname); // // public XxlConfProject load(@Param("appname") String appname); // // }
import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.model.XxlConfProject; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.dao.XxlConfNodeDao; import com.xxl.conf.admin.dao.XxlConfProjectDao; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List;
package com.xxl.conf.admin.controller; /** * 项目管理 * * @author xuxueli 2016-10-02 20:52:56 */ @Controller @RequestMapping("/project") public class ProjectController { @Resource private XxlConfProjectDao xxlConfProjectDao; @Resource private XxlConfNodeDao xxlConfNodeDao; @RequestMapping @PermessionLimit(adminuser = true) public String index(Model model) { List<XxlConfProject> list = xxlConfProjectDao.findAll(); model.addAttribute("list", list); return "project/project.index"; } @RequestMapping("/save") @PermessionLimit(adminuser = true) @ResponseBody
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfProject.java // public class XxlConfProject { // // private String appname; // 项目AppName // private String title; // 项目名称 // // public String getAppname() { // return appname; // } // // public void setAppname(String appname) { // this.appname = appname; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java // @Mapper // public interface XxlConfNodeDao { // // public List<XxlConfNode> pageList(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // public int pageListCount(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // // public int delete(@Param("env") String env, @Param("key") String key); // // public void insert(XxlConfNode xxlConfNode); // // public XxlConfNode load(@Param("env") String env, @Param("key") String key); // // public int update(XxlConfNode xxlConfNode); // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfProjectDao.java // @Mapper // public interface XxlConfProjectDao { // // public List<XxlConfProject> findAll(); // // public int save(XxlConfProject xxlConfProject); // // public int update(XxlConfProject xxlConfProject); // // public int delete(@Param("appname") String appname); // // public XxlConfProject load(@Param("appname") String appname); // // } // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/ProjectController.java import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.model.XxlConfProject; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.dao.XxlConfNodeDao; import com.xxl.conf.admin.dao.XxlConfProjectDao; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List; package com.xxl.conf.admin.controller; /** * 项目管理 * * @author xuxueli 2016-10-02 20:52:56 */ @Controller @RequestMapping("/project") public class ProjectController { @Resource private XxlConfProjectDao xxlConfProjectDao; @Resource private XxlConfNodeDao xxlConfNodeDao; @RequestMapping @PermessionLimit(adminuser = true) public String index(Model model) { List<XxlConfProject> list = xxlConfProjectDao.findAll(); model.addAttribute("list", list); return "project/project.index"; } @RequestMapping("/save") @PermessionLimit(adminuser = true) @ResponseBody
public ReturnT<String> save(XxlConfProject xxlConfProject){
xuxueli/xxl-conf
xxl-conf-samples/xxl-conf-sample-jfinal/src/main/java/com/xxl/conf/sample/jfinal/controller/IndexController.java
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListener.java // public interface XxlConfListener { // // /** // * invoke when first-use or conf-change // * // * @param key // */ // public void onChange(String key, String value) throws Exception; // // }
import com.jfinal.core.Controller; import com.xxl.conf.core.XxlConfClient; import com.xxl.conf.core.listener.XxlConfListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
package com.xxl.conf.sample.jfinal.controller; /** * @author xuxueli 2018-05-24 */ public class IndexController extends Controller { private static Logger logger = LoggerFactory.getLogger(IndexController.class); static { /** * 配置变更监听示例:可开发Listener逻辑,监听配置变更事件;可据此实现动态刷新JDBC连接池等高级功能; */
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListener.java // public interface XxlConfListener { // // /** // * invoke when first-use or conf-change // * // * @param key // */ // public void onChange(String key, String value) throws Exception; // // } // Path: xxl-conf-samples/xxl-conf-sample-jfinal/src/main/java/com/xxl/conf/sample/jfinal/controller/IndexController.java import com.jfinal.core.Controller; import com.xxl.conf.core.XxlConfClient; import com.xxl.conf.core.listener.XxlConfListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; package com.xxl.conf.sample.jfinal.controller; /** * @author xuxueli 2018-05-24 */ public class IndexController extends Controller { private static Logger logger = LoggerFactory.getLogger(IndexController.class); static { /** * 配置变更监听示例:可开发Listener逻辑,监听配置变更事件;可据此实现动态刷新JDBC连接池等高级功能; */
XxlConfClient.addListener("default.key01", new XxlConfListener(){
xuxueli/xxl-conf
xxl-conf-samples/xxl-conf-sample-jfinal/src/main/java/com/xxl/conf/sample/jfinal/controller/IndexController.java
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListener.java // public interface XxlConfListener { // // /** // * invoke when first-use or conf-change // * // * @param key // */ // public void onChange(String key, String value) throws Exception; // // }
import com.jfinal.core.Controller; import com.xxl.conf.core.XxlConfClient; import com.xxl.conf.core.listener.XxlConfListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
package com.xxl.conf.sample.jfinal.controller; /** * @author xuxueli 2018-05-24 */ public class IndexController extends Controller { private static Logger logger = LoggerFactory.getLogger(IndexController.class); static { /** * 配置变更监听示例:可开发Listener逻辑,监听配置变更事件;可据此实现动态刷新JDBC连接池等高级功能; */
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListener.java // public interface XxlConfListener { // // /** // * invoke when first-use or conf-change // * // * @param key // */ // public void onChange(String key, String value) throws Exception; // // } // Path: xxl-conf-samples/xxl-conf-sample-jfinal/src/main/java/com/xxl/conf/sample/jfinal/controller/IndexController.java import com.jfinal.core.Controller; import com.xxl.conf.core.XxlConfClient; import com.xxl.conf.core.listener.XxlConfListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; package com.xxl.conf.sample.jfinal.controller; /** * @author xuxueli 2018-05-24 */ public class IndexController extends Controller { private static Logger logger = LoggerFactory.getLogger(IndexController.class); static { /** * 配置变更监听示例:可开发Listener逻辑,监听配置变更事件;可据此实现动态刷新JDBC连接池等高级功能; */
XxlConfClient.addListener("default.key01", new XxlConfListener(){
xuxueli/xxl-conf
xxl-conf-samples/xxl-conf-sample-springboot/src/main/java/com/xxl/conf/sample/controller/IndexController.java
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListener.java // public interface XxlConfListener { // // /** // * invoke when first-use or conf-change // * // * @param key // */ // public void onChange(String key, String value) throws Exception; // // } // // Path: xxl-conf-samples/xxl-conf-sample-spring/src/main/java/com/xxl/conf/sample/demo/DemoConf.java // public class DemoConf { // // /** // * XXL-CONF:@XxlConf 注解方式 // */ // @XxlConf("default.key02") // public String paramByAnno; // // // /** // * XXL-CONF:$XxlConf{default.key03} XML占位符方式 // */ // public String paramByXml; // // public void setParamByXml(String paramByXml) { // this.paramByXml = paramByXml; // } // // }
import com.xxl.conf.core.XxlConfClient; import com.xxl.conf.core.listener.XxlConfListener; import com.xxl.conf.sample.demo.DemoConf; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.LinkedList; import java.util.List;
package com.xxl.conf.sample.controller; /** * @author xuxueli 2018-02-04 01:27:30 */ @Controller public class IndexController { private static Logger logger = LoggerFactory.getLogger(IndexController.class); static { /** * 配置变更监听示例:可开发Listener逻辑,监听配置变更事件;可据此实现动态刷新JDBC连接池等高级功能; */
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListener.java // public interface XxlConfListener { // // /** // * invoke when first-use or conf-change // * // * @param key // */ // public void onChange(String key, String value) throws Exception; // // } // // Path: xxl-conf-samples/xxl-conf-sample-spring/src/main/java/com/xxl/conf/sample/demo/DemoConf.java // public class DemoConf { // // /** // * XXL-CONF:@XxlConf 注解方式 // */ // @XxlConf("default.key02") // public String paramByAnno; // // // /** // * XXL-CONF:$XxlConf{default.key03} XML占位符方式 // */ // public String paramByXml; // // public void setParamByXml(String paramByXml) { // this.paramByXml = paramByXml; // } // // } // Path: xxl-conf-samples/xxl-conf-sample-springboot/src/main/java/com/xxl/conf/sample/controller/IndexController.java import com.xxl.conf.core.XxlConfClient; import com.xxl.conf.core.listener.XxlConfListener; import com.xxl.conf.sample.demo.DemoConf; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.LinkedList; import java.util.List; package com.xxl.conf.sample.controller; /** * @author xuxueli 2018-02-04 01:27:30 */ @Controller public class IndexController { private static Logger logger = LoggerFactory.getLogger(IndexController.class); static { /** * 配置变更监听示例:可开发Listener逻辑,监听配置变更事件;可据此实现动态刷新JDBC连接池等高级功能; */
XxlConfClient.addListener("default.key01", new XxlConfListener(){
xuxueli/xxl-conf
xxl-conf-samples/xxl-conf-sample-springboot/src/main/java/com/xxl/conf/sample/controller/IndexController.java
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListener.java // public interface XxlConfListener { // // /** // * invoke when first-use or conf-change // * // * @param key // */ // public void onChange(String key, String value) throws Exception; // // } // // Path: xxl-conf-samples/xxl-conf-sample-spring/src/main/java/com/xxl/conf/sample/demo/DemoConf.java // public class DemoConf { // // /** // * XXL-CONF:@XxlConf 注解方式 // */ // @XxlConf("default.key02") // public String paramByAnno; // // // /** // * XXL-CONF:$XxlConf{default.key03} XML占位符方式 // */ // public String paramByXml; // // public void setParamByXml(String paramByXml) { // this.paramByXml = paramByXml; // } // // }
import com.xxl.conf.core.XxlConfClient; import com.xxl.conf.core.listener.XxlConfListener; import com.xxl.conf.sample.demo.DemoConf; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.LinkedList; import java.util.List;
package com.xxl.conf.sample.controller; /** * @author xuxueli 2018-02-04 01:27:30 */ @Controller public class IndexController { private static Logger logger = LoggerFactory.getLogger(IndexController.class); static { /** * 配置变更监听示例:可开发Listener逻辑,监听配置变更事件;可据此实现动态刷新JDBC连接池等高级功能; */
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListener.java // public interface XxlConfListener { // // /** // * invoke when first-use or conf-change // * // * @param key // */ // public void onChange(String key, String value) throws Exception; // // } // // Path: xxl-conf-samples/xxl-conf-sample-spring/src/main/java/com/xxl/conf/sample/demo/DemoConf.java // public class DemoConf { // // /** // * XXL-CONF:@XxlConf 注解方式 // */ // @XxlConf("default.key02") // public String paramByAnno; // // // /** // * XXL-CONF:$XxlConf{default.key03} XML占位符方式 // */ // public String paramByXml; // // public void setParamByXml(String paramByXml) { // this.paramByXml = paramByXml; // } // // } // Path: xxl-conf-samples/xxl-conf-sample-springboot/src/main/java/com/xxl/conf/sample/controller/IndexController.java import com.xxl.conf.core.XxlConfClient; import com.xxl.conf.core.listener.XxlConfListener; import com.xxl.conf.sample.demo.DemoConf; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.LinkedList; import java.util.List; package com.xxl.conf.sample.controller; /** * @author xuxueli 2018-02-04 01:27:30 */ @Controller public class IndexController { private static Logger logger = LoggerFactory.getLogger(IndexController.class); static { /** * 配置变更监听示例:可开发Listener逻辑,监听配置变更事件;可据此实现动态刷新JDBC连接池等高级功能; */
XxlConfClient.addListener("default.key01", new XxlConfListener(){
xuxueli/xxl-conf
xxl-conf-samples/xxl-conf-sample-springboot/src/main/java/com/xxl/conf/sample/controller/IndexController.java
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListener.java // public interface XxlConfListener { // // /** // * invoke when first-use or conf-change // * // * @param key // */ // public void onChange(String key, String value) throws Exception; // // } // // Path: xxl-conf-samples/xxl-conf-sample-spring/src/main/java/com/xxl/conf/sample/demo/DemoConf.java // public class DemoConf { // // /** // * XXL-CONF:@XxlConf 注解方式 // */ // @XxlConf("default.key02") // public String paramByAnno; // // // /** // * XXL-CONF:$XxlConf{default.key03} XML占位符方式 // */ // public String paramByXml; // // public void setParamByXml(String paramByXml) { // this.paramByXml = paramByXml; // } // // }
import com.xxl.conf.core.XxlConfClient; import com.xxl.conf.core.listener.XxlConfListener; import com.xxl.conf.sample.demo.DemoConf; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.LinkedList; import java.util.List;
package com.xxl.conf.sample.controller; /** * @author xuxueli 2018-02-04 01:27:30 */ @Controller public class IndexController { private static Logger logger = LoggerFactory.getLogger(IndexController.class); static { /** * 配置变更监听示例:可开发Listener逻辑,监听配置变更事件;可据此实现动态刷新JDBC连接池等高级功能; */ XxlConfClient.addListener("default.key01", new XxlConfListener(){ @Override public void onChange(String key, String value) throws Exception { logger.info("配置变更事件通知:{}={}", key, value); } }); } @Resource
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListener.java // public interface XxlConfListener { // // /** // * invoke when first-use or conf-change // * // * @param key // */ // public void onChange(String key, String value) throws Exception; // // } // // Path: xxl-conf-samples/xxl-conf-sample-spring/src/main/java/com/xxl/conf/sample/demo/DemoConf.java // public class DemoConf { // // /** // * XXL-CONF:@XxlConf 注解方式 // */ // @XxlConf("default.key02") // public String paramByAnno; // // // /** // * XXL-CONF:$XxlConf{default.key03} XML占位符方式 // */ // public String paramByXml; // // public void setParamByXml(String paramByXml) { // this.paramByXml = paramByXml; // } // // } // Path: xxl-conf-samples/xxl-conf-sample-springboot/src/main/java/com/xxl/conf/sample/controller/IndexController.java import com.xxl.conf.core.XxlConfClient; import com.xxl.conf.core.listener.XxlConfListener; import com.xxl.conf.sample.demo.DemoConf; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.LinkedList; import java.util.List; package com.xxl.conf.sample.controller; /** * @author xuxueli 2018-02-04 01:27:30 */ @Controller public class IndexController { private static Logger logger = LoggerFactory.getLogger(IndexController.class); static { /** * 配置变更监听示例:可开发Listener逻辑,监听配置变更事件;可据此实现动态刷新JDBC连接池等高级功能; */ XxlConfClient.addListener("default.key01", new XxlConfListener(){ @Override public void onChange(String key, String value) throws Exception { logger.info("配置变更事件通知:{}={}", key, value); } }); } @Resource
private DemoConf demoConf;
xuxueli/xxl-conf
xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/EnvController.java
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfEnv.java // public class XxlConfEnv { // // private String env; // Env // private String title; // 环境名称 // private int order; // // public String getEnv() { // return env; // } // // public void setEnv(String env) { // this.env = env; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public int getOrder() { // return order; // } // // public void setOrder(int order) { // this.order = order; // } // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfEnvDao.java // @Mapper // public interface XxlConfEnvDao { // // public List<XxlConfEnv> findAll(); // // public int save(XxlConfEnv xxlConfEnv); // // public int update(XxlConfEnv xxlConfEnv); // // public int delete(@Param("env") String env); // // public XxlConfEnv load(@Param("env") String env); // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java // @Mapper // public interface XxlConfNodeDao { // // public List<XxlConfNode> pageList(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // public int pageListCount(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // // public int delete(@Param("env") String env, @Param("key") String key); // // public void insert(XxlConfNode xxlConfNode); // // public XxlConfNode load(@Param("env") String env, @Param("key") String key); // // public int update(XxlConfNode xxlConfNode); // // }
import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.model.XxlConfEnv; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.dao.XxlConfEnvDao; import com.xxl.conf.admin.dao.XxlConfNodeDao; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List;
package com.xxl.conf.admin.controller; /** * 环境管理 * * @author xuxueli 2018-05-30 */ @Controller @RequestMapping("/env") public class EnvController { @Resource
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfEnv.java // public class XxlConfEnv { // // private String env; // Env // private String title; // 环境名称 // private int order; // // public String getEnv() { // return env; // } // // public void setEnv(String env) { // this.env = env; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public int getOrder() { // return order; // } // // public void setOrder(int order) { // this.order = order; // } // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfEnvDao.java // @Mapper // public interface XxlConfEnvDao { // // public List<XxlConfEnv> findAll(); // // public int save(XxlConfEnv xxlConfEnv); // // public int update(XxlConfEnv xxlConfEnv); // // public int delete(@Param("env") String env); // // public XxlConfEnv load(@Param("env") String env); // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java // @Mapper // public interface XxlConfNodeDao { // // public List<XxlConfNode> pageList(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // public int pageListCount(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // // public int delete(@Param("env") String env, @Param("key") String key); // // public void insert(XxlConfNode xxlConfNode); // // public XxlConfNode load(@Param("env") String env, @Param("key") String key); // // public int update(XxlConfNode xxlConfNode); // // } // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/EnvController.java import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.model.XxlConfEnv; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.dao.XxlConfEnvDao; import com.xxl.conf.admin.dao.XxlConfNodeDao; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List; package com.xxl.conf.admin.controller; /** * 环境管理 * * @author xuxueli 2018-05-30 */ @Controller @RequestMapping("/env") public class EnvController { @Resource
private XxlConfEnvDao xxlConfEnvDao;
xuxueli/xxl-conf
xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/EnvController.java
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfEnv.java // public class XxlConfEnv { // // private String env; // Env // private String title; // 环境名称 // private int order; // // public String getEnv() { // return env; // } // // public void setEnv(String env) { // this.env = env; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public int getOrder() { // return order; // } // // public void setOrder(int order) { // this.order = order; // } // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfEnvDao.java // @Mapper // public interface XxlConfEnvDao { // // public List<XxlConfEnv> findAll(); // // public int save(XxlConfEnv xxlConfEnv); // // public int update(XxlConfEnv xxlConfEnv); // // public int delete(@Param("env") String env); // // public XxlConfEnv load(@Param("env") String env); // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java // @Mapper // public interface XxlConfNodeDao { // // public List<XxlConfNode> pageList(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // public int pageListCount(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // // public int delete(@Param("env") String env, @Param("key") String key); // // public void insert(XxlConfNode xxlConfNode); // // public XxlConfNode load(@Param("env") String env, @Param("key") String key); // // public int update(XxlConfNode xxlConfNode); // // }
import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.model.XxlConfEnv; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.dao.XxlConfEnvDao; import com.xxl.conf.admin.dao.XxlConfNodeDao; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List;
package com.xxl.conf.admin.controller; /** * 环境管理 * * @author xuxueli 2018-05-30 */ @Controller @RequestMapping("/env") public class EnvController { @Resource private XxlConfEnvDao xxlConfEnvDao; @Resource
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfEnv.java // public class XxlConfEnv { // // private String env; // Env // private String title; // 环境名称 // private int order; // // public String getEnv() { // return env; // } // // public void setEnv(String env) { // this.env = env; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public int getOrder() { // return order; // } // // public void setOrder(int order) { // this.order = order; // } // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfEnvDao.java // @Mapper // public interface XxlConfEnvDao { // // public List<XxlConfEnv> findAll(); // // public int save(XxlConfEnv xxlConfEnv); // // public int update(XxlConfEnv xxlConfEnv); // // public int delete(@Param("env") String env); // // public XxlConfEnv load(@Param("env") String env); // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java // @Mapper // public interface XxlConfNodeDao { // // public List<XxlConfNode> pageList(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // public int pageListCount(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // // public int delete(@Param("env") String env, @Param("key") String key); // // public void insert(XxlConfNode xxlConfNode); // // public XxlConfNode load(@Param("env") String env, @Param("key") String key); // // public int update(XxlConfNode xxlConfNode); // // } // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/EnvController.java import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.model.XxlConfEnv; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.dao.XxlConfEnvDao; import com.xxl.conf.admin.dao.XxlConfNodeDao; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List; package com.xxl.conf.admin.controller; /** * 环境管理 * * @author xuxueli 2018-05-30 */ @Controller @RequestMapping("/env") public class EnvController { @Resource private XxlConfEnvDao xxlConfEnvDao; @Resource
private XxlConfNodeDao xxlConfNodeDao;
xuxueli/xxl-conf
xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/EnvController.java
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfEnv.java // public class XxlConfEnv { // // private String env; // Env // private String title; // 环境名称 // private int order; // // public String getEnv() { // return env; // } // // public void setEnv(String env) { // this.env = env; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public int getOrder() { // return order; // } // // public void setOrder(int order) { // this.order = order; // } // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfEnvDao.java // @Mapper // public interface XxlConfEnvDao { // // public List<XxlConfEnv> findAll(); // // public int save(XxlConfEnv xxlConfEnv); // // public int update(XxlConfEnv xxlConfEnv); // // public int delete(@Param("env") String env); // // public XxlConfEnv load(@Param("env") String env); // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java // @Mapper // public interface XxlConfNodeDao { // // public List<XxlConfNode> pageList(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // public int pageListCount(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // // public int delete(@Param("env") String env, @Param("key") String key); // // public void insert(XxlConfNode xxlConfNode); // // public XxlConfNode load(@Param("env") String env, @Param("key") String key); // // public int update(XxlConfNode xxlConfNode); // // }
import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.model.XxlConfEnv; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.dao.XxlConfEnvDao; import com.xxl.conf.admin.dao.XxlConfNodeDao; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List;
package com.xxl.conf.admin.controller; /** * 环境管理 * * @author xuxueli 2018-05-30 */ @Controller @RequestMapping("/env") public class EnvController { @Resource private XxlConfEnvDao xxlConfEnvDao; @Resource private XxlConfNodeDao xxlConfNodeDao; @RequestMapping @PermessionLimit(adminuser = true) public String index(Model model) {
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfEnv.java // public class XxlConfEnv { // // private String env; // Env // private String title; // 环境名称 // private int order; // // public String getEnv() { // return env; // } // // public void setEnv(String env) { // this.env = env; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public int getOrder() { // return order; // } // // public void setOrder(int order) { // this.order = order; // } // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfEnvDao.java // @Mapper // public interface XxlConfEnvDao { // // public List<XxlConfEnv> findAll(); // // public int save(XxlConfEnv xxlConfEnv); // // public int update(XxlConfEnv xxlConfEnv); // // public int delete(@Param("env") String env); // // public XxlConfEnv load(@Param("env") String env); // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java // @Mapper // public interface XxlConfNodeDao { // // public List<XxlConfNode> pageList(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // public int pageListCount(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // // public int delete(@Param("env") String env, @Param("key") String key); // // public void insert(XxlConfNode xxlConfNode); // // public XxlConfNode load(@Param("env") String env, @Param("key") String key); // // public int update(XxlConfNode xxlConfNode); // // } // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/EnvController.java import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.model.XxlConfEnv; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.dao.XxlConfEnvDao; import com.xxl.conf.admin.dao.XxlConfNodeDao; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List; package com.xxl.conf.admin.controller; /** * 环境管理 * * @author xuxueli 2018-05-30 */ @Controller @RequestMapping("/env") public class EnvController { @Resource private XxlConfEnvDao xxlConfEnvDao; @Resource private XxlConfNodeDao xxlConfNodeDao; @RequestMapping @PermessionLimit(adminuser = true) public String index(Model model) {
List<XxlConfEnv> list = xxlConfEnvDao.findAll();
xuxueli/xxl-conf
xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/EnvController.java
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfEnv.java // public class XxlConfEnv { // // private String env; // Env // private String title; // 环境名称 // private int order; // // public String getEnv() { // return env; // } // // public void setEnv(String env) { // this.env = env; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public int getOrder() { // return order; // } // // public void setOrder(int order) { // this.order = order; // } // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfEnvDao.java // @Mapper // public interface XxlConfEnvDao { // // public List<XxlConfEnv> findAll(); // // public int save(XxlConfEnv xxlConfEnv); // // public int update(XxlConfEnv xxlConfEnv); // // public int delete(@Param("env") String env); // // public XxlConfEnv load(@Param("env") String env); // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java // @Mapper // public interface XxlConfNodeDao { // // public List<XxlConfNode> pageList(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // public int pageListCount(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // // public int delete(@Param("env") String env, @Param("key") String key); // // public void insert(XxlConfNode xxlConfNode); // // public XxlConfNode load(@Param("env") String env, @Param("key") String key); // // public int update(XxlConfNode xxlConfNode); // // }
import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.model.XxlConfEnv; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.dao.XxlConfEnvDao; import com.xxl.conf.admin.dao.XxlConfNodeDao; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List;
package com.xxl.conf.admin.controller; /** * 环境管理 * * @author xuxueli 2018-05-30 */ @Controller @RequestMapping("/env") public class EnvController { @Resource private XxlConfEnvDao xxlConfEnvDao; @Resource private XxlConfNodeDao xxlConfNodeDao; @RequestMapping @PermessionLimit(adminuser = true) public String index(Model model) { List<XxlConfEnv> list = xxlConfEnvDao.findAll(); model.addAttribute("list", list); return "env/env.index"; } @RequestMapping("/save") @PermessionLimit(adminuser = true) @ResponseBody
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfEnv.java // public class XxlConfEnv { // // private String env; // Env // private String title; // 环境名称 // private int order; // // public String getEnv() { // return env; // } // // public void setEnv(String env) { // this.env = env; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public int getOrder() { // return order; // } // // public void setOrder(int order) { // this.order = order; // } // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfEnvDao.java // @Mapper // public interface XxlConfEnvDao { // // public List<XxlConfEnv> findAll(); // // public int save(XxlConfEnv xxlConfEnv); // // public int update(XxlConfEnv xxlConfEnv); // // public int delete(@Param("env") String env); // // public XxlConfEnv load(@Param("env") String env); // // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java // @Mapper // public interface XxlConfNodeDao { // // public List<XxlConfNode> pageList(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // public int pageListCount(@Param("offset") int offset, // @Param("pagesize") int pagesize, // @Param("env") String env, // @Param("appname") String appname, // @Param("key") String key); // // public int delete(@Param("env") String env, @Param("key") String key); // // public void insert(XxlConfNode xxlConfNode); // // public XxlConfNode load(@Param("env") String env, @Param("key") String key); // // public int update(XxlConfNode xxlConfNode); // // } // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/EnvController.java import com.xxl.conf.admin.controller.annotation.PermessionLimit; import com.xxl.conf.admin.core.model.XxlConfEnv; import com.xxl.conf.admin.core.util.ReturnT; import com.xxl.conf.admin.dao.XxlConfEnvDao; import com.xxl.conf.admin.dao.XxlConfNodeDao; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List; package com.xxl.conf.admin.controller; /** * 环境管理 * * @author xuxueli 2018-05-30 */ @Controller @RequestMapping("/env") public class EnvController { @Resource private XxlConfEnvDao xxlConfEnvDao; @Resource private XxlConfNodeDao xxlConfNodeDao; @RequestMapping @PermessionLimit(adminuser = true) public String index(Model model) { List<XxlConfEnv> list = xxlConfEnvDao.findAll(); model.addAttribute("list", list); return "env/env.index"; } @RequestMapping("/save") @PermessionLimit(adminuser = true) @ResponseBody
public ReturnT<String> save(XxlConfEnv xxlConfEnv){
xuxueli/xxl-conf
xxl-conf-core/src/main/java/com/xxl/conf/core/core/XxlConfMirrorConf.java
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/exception/XxlConfException.java // public class XxlConfException extends RuntimeException { // // private static final long serialVersionUID = 42L; // // public XxlConfException(String msg) { // super(msg); // } // // public XxlConfException(String msg, Throwable cause) { // super(msg, cause); // } // // public XxlConfException(Throwable cause) { // super(cause); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/util/PropUtil.java // public class PropUtil { // private static Logger logger = LoggerFactory.getLogger(PropUtil.class); // // /** // * load prop // * // * @param propertyFileName disk path when start with "file:", other classpath // * @return // */ // public static Properties loadProp(String propertyFileName) { // // // disk path // if (propertyFileName.startsWith("file:")) { // propertyFileName = propertyFileName.substring("file:".length()); // return loadFileProp(propertyFileName); // } else { // return loadClassPathProp(propertyFileName); // } // } // // public static Properties loadClassPathProp(String propertyFileName) { // // InputStream in = null; // try { // in = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertyFileName); // if (in == null) { // return null; // } // // Properties prop = new Properties(); // prop.load(new InputStreamReader(in, "utf-8")); // return prop; // } catch (IOException e) { // logger.error(e.getMessage(), e); // } finally { // if (in != null) { // try { // in.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // return null; // } // // // public static Properties loadFileProp(String propertyFileName) { // InputStream in = null; // try { // // load file location, disk // File file = new File(propertyFileName); // if (!file.exists()) { // return null; // } // // URL url = new File(propertyFileName).toURI().toURL(); // in = new FileInputStream(url.getPath()); // if (in == null) { // return null; // } // // Properties prop = new Properties(); // prop.load(new InputStreamReader(in, "utf-8")); // return prop; // } catch (IOException e) { // logger.error(e.getMessage(), e); // } finally { // if (in != null) { // try { // in.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // return null; // } // // // /** // * write prop to disk // * // * @param properties // * @param filePathName // * @return // */ // public static boolean writeFileProp(Properties properties, String filePathName){ // FileOutputStream fileOutputStream = null; // try { // // // mk file // File file = new File(filePathName); // if (!file.exists()) { // file.getParentFile().mkdirs(); // } // // // write data // fileOutputStream = new FileOutputStream(file, false); // properties.store(new OutputStreamWriter(fileOutputStream, "utf-8"), null); // //properties.store(new FileWriter(filePathName), null); // return true; // } catch (IOException e) { // logger.error(e.getMessage(), e); // return false; // } finally { // if (fileOutputStream != null) { // try { // fileOutputStream.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // } // // }
import com.xxl.conf.core.exception.XxlConfException; import com.xxl.conf.core.util.PropUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.Map; import java.util.Properties;
package com.xxl.conf.core.core; /** * xxl conf, mirror conf data in local file * * @author xuxueli 2018-06-11 21:38:18 */ public class XxlConfMirrorConf { private static Logger logger = LoggerFactory.getLogger(XxlConfMirrorConf.class); private static String mirrorfile = null; public static void init(String mirrorfileParam){ // valid if (mirrorfileParam==null || mirrorfileParam.trim().length()==0) {
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/exception/XxlConfException.java // public class XxlConfException extends RuntimeException { // // private static final long serialVersionUID = 42L; // // public XxlConfException(String msg) { // super(msg); // } // // public XxlConfException(String msg, Throwable cause) { // super(msg, cause); // } // // public XxlConfException(Throwable cause) { // super(cause); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/util/PropUtil.java // public class PropUtil { // private static Logger logger = LoggerFactory.getLogger(PropUtil.class); // // /** // * load prop // * // * @param propertyFileName disk path when start with "file:", other classpath // * @return // */ // public static Properties loadProp(String propertyFileName) { // // // disk path // if (propertyFileName.startsWith("file:")) { // propertyFileName = propertyFileName.substring("file:".length()); // return loadFileProp(propertyFileName); // } else { // return loadClassPathProp(propertyFileName); // } // } // // public static Properties loadClassPathProp(String propertyFileName) { // // InputStream in = null; // try { // in = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertyFileName); // if (in == null) { // return null; // } // // Properties prop = new Properties(); // prop.load(new InputStreamReader(in, "utf-8")); // return prop; // } catch (IOException e) { // logger.error(e.getMessage(), e); // } finally { // if (in != null) { // try { // in.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // return null; // } // // // public static Properties loadFileProp(String propertyFileName) { // InputStream in = null; // try { // // load file location, disk // File file = new File(propertyFileName); // if (!file.exists()) { // return null; // } // // URL url = new File(propertyFileName).toURI().toURL(); // in = new FileInputStream(url.getPath()); // if (in == null) { // return null; // } // // Properties prop = new Properties(); // prop.load(new InputStreamReader(in, "utf-8")); // return prop; // } catch (IOException e) { // logger.error(e.getMessage(), e); // } finally { // if (in != null) { // try { // in.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // return null; // } // // // /** // * write prop to disk // * // * @param properties // * @param filePathName // * @return // */ // public static boolean writeFileProp(Properties properties, String filePathName){ // FileOutputStream fileOutputStream = null; // try { // // // mk file // File file = new File(filePathName); // if (!file.exists()) { // file.getParentFile().mkdirs(); // } // // // write data // fileOutputStream = new FileOutputStream(file, false); // properties.store(new OutputStreamWriter(fileOutputStream, "utf-8"), null); // //properties.store(new FileWriter(filePathName), null); // return true; // } catch (IOException e) { // logger.error(e.getMessage(), e); // return false; // } finally { // if (fileOutputStream != null) { // try { // fileOutputStream.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // } // // } // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/core/XxlConfMirrorConf.java import com.xxl.conf.core.exception.XxlConfException; import com.xxl.conf.core.util.PropUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.Map; import java.util.Properties; package com.xxl.conf.core.core; /** * xxl conf, mirror conf data in local file * * @author xuxueli 2018-06-11 21:38:18 */ public class XxlConfMirrorConf { private static Logger logger = LoggerFactory.getLogger(XxlConfMirrorConf.class); private static String mirrorfile = null; public static void init(String mirrorfileParam){ // valid if (mirrorfileParam==null || mirrorfileParam.trim().length()==0) {
throw new XxlConfException("xxl-conf mirrorfileParam can not be empty");
xuxueli/xxl-conf
xxl-conf-core/src/main/java/com/xxl/conf/core/core/XxlConfMirrorConf.java
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/exception/XxlConfException.java // public class XxlConfException extends RuntimeException { // // private static final long serialVersionUID = 42L; // // public XxlConfException(String msg) { // super(msg); // } // // public XxlConfException(String msg, Throwable cause) { // super(msg, cause); // } // // public XxlConfException(Throwable cause) { // super(cause); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/util/PropUtil.java // public class PropUtil { // private static Logger logger = LoggerFactory.getLogger(PropUtil.class); // // /** // * load prop // * // * @param propertyFileName disk path when start with "file:", other classpath // * @return // */ // public static Properties loadProp(String propertyFileName) { // // // disk path // if (propertyFileName.startsWith("file:")) { // propertyFileName = propertyFileName.substring("file:".length()); // return loadFileProp(propertyFileName); // } else { // return loadClassPathProp(propertyFileName); // } // } // // public static Properties loadClassPathProp(String propertyFileName) { // // InputStream in = null; // try { // in = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertyFileName); // if (in == null) { // return null; // } // // Properties prop = new Properties(); // prop.load(new InputStreamReader(in, "utf-8")); // return prop; // } catch (IOException e) { // logger.error(e.getMessage(), e); // } finally { // if (in != null) { // try { // in.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // return null; // } // // // public static Properties loadFileProp(String propertyFileName) { // InputStream in = null; // try { // // load file location, disk // File file = new File(propertyFileName); // if (!file.exists()) { // return null; // } // // URL url = new File(propertyFileName).toURI().toURL(); // in = new FileInputStream(url.getPath()); // if (in == null) { // return null; // } // // Properties prop = new Properties(); // prop.load(new InputStreamReader(in, "utf-8")); // return prop; // } catch (IOException e) { // logger.error(e.getMessage(), e); // } finally { // if (in != null) { // try { // in.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // return null; // } // // // /** // * write prop to disk // * // * @param properties // * @param filePathName // * @return // */ // public static boolean writeFileProp(Properties properties, String filePathName){ // FileOutputStream fileOutputStream = null; // try { // // // mk file // File file = new File(filePathName); // if (!file.exists()) { // file.getParentFile().mkdirs(); // } // // // write data // fileOutputStream = new FileOutputStream(file, false); // properties.store(new OutputStreamWriter(fileOutputStream, "utf-8"), null); // //properties.store(new FileWriter(filePathName), null); // return true; // } catch (IOException e) { // logger.error(e.getMessage(), e); // return false; // } finally { // if (fileOutputStream != null) { // try { // fileOutputStream.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // } // // }
import com.xxl.conf.core.exception.XxlConfException; import com.xxl.conf.core.util.PropUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.Map; import java.util.Properties;
package com.xxl.conf.core.core; /** * xxl conf, mirror conf data in local file * * @author xuxueli 2018-06-11 21:38:18 */ public class XxlConfMirrorConf { private static Logger logger = LoggerFactory.getLogger(XxlConfMirrorConf.class); private static String mirrorfile = null; public static void init(String mirrorfileParam){ // valid if (mirrorfileParam==null || mirrorfileParam.trim().length()==0) { throw new XxlConfException("xxl-conf mirrorfileParam can not be empty"); } mirrorfile = mirrorfileParam; } /** * read mirror conf * * @return */ public static Map<String, String> readConfMirror(){
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/exception/XxlConfException.java // public class XxlConfException extends RuntimeException { // // private static final long serialVersionUID = 42L; // // public XxlConfException(String msg) { // super(msg); // } // // public XxlConfException(String msg, Throwable cause) { // super(msg, cause); // } // // public XxlConfException(Throwable cause) { // super(cause); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/util/PropUtil.java // public class PropUtil { // private static Logger logger = LoggerFactory.getLogger(PropUtil.class); // // /** // * load prop // * // * @param propertyFileName disk path when start with "file:", other classpath // * @return // */ // public static Properties loadProp(String propertyFileName) { // // // disk path // if (propertyFileName.startsWith("file:")) { // propertyFileName = propertyFileName.substring("file:".length()); // return loadFileProp(propertyFileName); // } else { // return loadClassPathProp(propertyFileName); // } // } // // public static Properties loadClassPathProp(String propertyFileName) { // // InputStream in = null; // try { // in = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertyFileName); // if (in == null) { // return null; // } // // Properties prop = new Properties(); // prop.load(new InputStreamReader(in, "utf-8")); // return prop; // } catch (IOException e) { // logger.error(e.getMessage(), e); // } finally { // if (in != null) { // try { // in.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // return null; // } // // // public static Properties loadFileProp(String propertyFileName) { // InputStream in = null; // try { // // load file location, disk // File file = new File(propertyFileName); // if (!file.exists()) { // return null; // } // // URL url = new File(propertyFileName).toURI().toURL(); // in = new FileInputStream(url.getPath()); // if (in == null) { // return null; // } // // Properties prop = new Properties(); // prop.load(new InputStreamReader(in, "utf-8")); // return prop; // } catch (IOException e) { // logger.error(e.getMessage(), e); // } finally { // if (in != null) { // try { // in.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // return null; // } // // // /** // * write prop to disk // * // * @param properties // * @param filePathName // * @return // */ // public static boolean writeFileProp(Properties properties, String filePathName){ // FileOutputStream fileOutputStream = null; // try { // // // mk file // File file = new File(filePathName); // if (!file.exists()) { // file.getParentFile().mkdirs(); // } // // // write data // fileOutputStream = new FileOutputStream(file, false); // properties.store(new OutputStreamWriter(fileOutputStream, "utf-8"), null); // //properties.store(new FileWriter(filePathName), null); // return true; // } catch (IOException e) { // logger.error(e.getMessage(), e); // return false; // } finally { // if (fileOutputStream != null) { // try { // fileOutputStream.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // } // // } // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/core/XxlConfMirrorConf.java import com.xxl.conf.core.exception.XxlConfException; import com.xxl.conf.core.util.PropUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.Map; import java.util.Properties; package com.xxl.conf.core.core; /** * xxl conf, mirror conf data in local file * * @author xuxueli 2018-06-11 21:38:18 */ public class XxlConfMirrorConf { private static Logger logger = LoggerFactory.getLogger(XxlConfMirrorConf.class); private static String mirrorfile = null; public static void init(String mirrorfileParam){ // valid if (mirrorfileParam==null || mirrorfileParam.trim().length()==0) { throw new XxlConfException("xxl-conf mirrorfileParam can not be empty"); } mirrorfile = mirrorfileParam; } /** * read mirror conf * * @return */ public static Map<String, String> readConfMirror(){
Properties mirrorProp = PropUtil.loadFileProp( mirrorfile );
xuxueli/xxl-conf
xxl-conf-samples/xxl-conf-sample-frameless/src/main/java/com.xxl.conf.sample.frameless/FramelessApplication.java
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListener.java // public interface XxlConfListener { // // /** // * invoke when first-use or conf-change // * // * @param key // */ // public void onChange(String key, String value) throws Exception; // // } // // Path: xxl-conf-samples/xxl-conf-sample-frameless/src/main/java/com.xxl.conf.sample.frameless/conf/FrameLessXxlConfConfig.java // public class FrameLessXxlConfConfig { // // /** // * init // */ // public static void init() { // Properties prop = PropUtil.loadProp("xxl-conf.properties"); // // XxlConfBaseFactory.init( // prop.getProperty("xxl.conf.admin.address"), // prop.getProperty("xxl.conf.env"), // prop.getProperty("xxl.conf.access.token"), // prop.getProperty("xxl.conf.mirrorfile")); // } // // /** // * destory // */ // public static void destroy() { // XxlConfBaseFactory.destroy(); // } // // }
import com.xxl.conf.core.XxlConfClient; import com.xxl.conf.core.listener.XxlConfListener; import com.xxl.conf.sample.frameless.conf.FrameLessXxlConfConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.TimeUnit;
package com.xxl.conf.sample.frameless; /** * @author xuxueli 2018-11-10 20:05:33 */ public class FramelessApplication { private static Logger logger = LoggerFactory.getLogger(FramelessApplication.class); public static void main(String[] args) { try { // start
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListener.java // public interface XxlConfListener { // // /** // * invoke when first-use or conf-change // * // * @param key // */ // public void onChange(String key, String value) throws Exception; // // } // // Path: xxl-conf-samples/xxl-conf-sample-frameless/src/main/java/com.xxl.conf.sample.frameless/conf/FrameLessXxlConfConfig.java // public class FrameLessXxlConfConfig { // // /** // * init // */ // public static void init() { // Properties prop = PropUtil.loadProp("xxl-conf.properties"); // // XxlConfBaseFactory.init( // prop.getProperty("xxl.conf.admin.address"), // prop.getProperty("xxl.conf.env"), // prop.getProperty("xxl.conf.access.token"), // prop.getProperty("xxl.conf.mirrorfile")); // } // // /** // * destory // */ // public static void destroy() { // XxlConfBaseFactory.destroy(); // } // // } // Path: xxl-conf-samples/xxl-conf-sample-frameless/src/main/java/com.xxl.conf.sample.frameless/FramelessApplication.java import com.xxl.conf.core.XxlConfClient; import com.xxl.conf.core.listener.XxlConfListener; import com.xxl.conf.sample.frameless.conf.FrameLessXxlConfConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.TimeUnit; package com.xxl.conf.sample.frameless; /** * @author xuxueli 2018-11-10 20:05:33 */ public class FramelessApplication { private static Logger logger = LoggerFactory.getLogger(FramelessApplication.class); public static void main(String[] args) { try { // start
FrameLessXxlConfConfig.init();
xuxueli/xxl-conf
xxl-conf-samples/xxl-conf-sample-frameless/src/main/java/com.xxl.conf.sample.frameless/FramelessApplication.java
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListener.java // public interface XxlConfListener { // // /** // * invoke when first-use or conf-change // * // * @param key // */ // public void onChange(String key, String value) throws Exception; // // } // // Path: xxl-conf-samples/xxl-conf-sample-frameless/src/main/java/com.xxl.conf.sample.frameless/conf/FrameLessXxlConfConfig.java // public class FrameLessXxlConfConfig { // // /** // * init // */ // public static void init() { // Properties prop = PropUtil.loadProp("xxl-conf.properties"); // // XxlConfBaseFactory.init( // prop.getProperty("xxl.conf.admin.address"), // prop.getProperty("xxl.conf.env"), // prop.getProperty("xxl.conf.access.token"), // prop.getProperty("xxl.conf.mirrorfile")); // } // // /** // * destory // */ // public static void destroy() { // XxlConfBaseFactory.destroy(); // } // // }
import com.xxl.conf.core.XxlConfClient; import com.xxl.conf.core.listener.XxlConfListener; import com.xxl.conf.sample.frameless.conf.FrameLessXxlConfConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.TimeUnit;
package com.xxl.conf.sample.frameless; /** * @author xuxueli 2018-11-10 20:05:33 */ public class FramelessApplication { private static Logger logger = LoggerFactory.getLogger(FramelessApplication.class); public static void main(String[] args) { try { // start FrameLessXxlConfConfig.init(); // test listener test
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListener.java // public interface XxlConfListener { // // /** // * invoke when first-use or conf-change // * // * @param key // */ // public void onChange(String key, String value) throws Exception; // // } // // Path: xxl-conf-samples/xxl-conf-sample-frameless/src/main/java/com.xxl.conf.sample.frameless/conf/FrameLessXxlConfConfig.java // public class FrameLessXxlConfConfig { // // /** // * init // */ // public static void init() { // Properties prop = PropUtil.loadProp("xxl-conf.properties"); // // XxlConfBaseFactory.init( // prop.getProperty("xxl.conf.admin.address"), // prop.getProperty("xxl.conf.env"), // prop.getProperty("xxl.conf.access.token"), // prop.getProperty("xxl.conf.mirrorfile")); // } // // /** // * destory // */ // public static void destroy() { // XxlConfBaseFactory.destroy(); // } // // } // Path: xxl-conf-samples/xxl-conf-sample-frameless/src/main/java/com.xxl.conf.sample.frameless/FramelessApplication.java import com.xxl.conf.core.XxlConfClient; import com.xxl.conf.core.listener.XxlConfListener; import com.xxl.conf.sample.frameless.conf.FrameLessXxlConfConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.TimeUnit; package com.xxl.conf.sample.frameless; /** * @author xuxueli 2018-11-10 20:05:33 */ public class FramelessApplication { private static Logger logger = LoggerFactory.getLogger(FramelessApplication.class); public static void main(String[] args) { try { // start FrameLessXxlConfConfig.init(); // test listener test
XxlConfClient.addListener("default.key01", new XxlConfListener(){
xuxueli/xxl-conf
xxl-conf-samples/xxl-conf-sample-frameless/src/main/java/com.xxl.conf.sample.frameless/FramelessApplication.java
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListener.java // public interface XxlConfListener { // // /** // * invoke when first-use or conf-change // * // * @param key // */ // public void onChange(String key, String value) throws Exception; // // } // // Path: xxl-conf-samples/xxl-conf-sample-frameless/src/main/java/com.xxl.conf.sample.frameless/conf/FrameLessXxlConfConfig.java // public class FrameLessXxlConfConfig { // // /** // * init // */ // public static void init() { // Properties prop = PropUtil.loadProp("xxl-conf.properties"); // // XxlConfBaseFactory.init( // prop.getProperty("xxl.conf.admin.address"), // prop.getProperty("xxl.conf.env"), // prop.getProperty("xxl.conf.access.token"), // prop.getProperty("xxl.conf.mirrorfile")); // } // // /** // * destory // */ // public static void destroy() { // XxlConfBaseFactory.destroy(); // } // // }
import com.xxl.conf.core.XxlConfClient; import com.xxl.conf.core.listener.XxlConfListener; import com.xxl.conf.sample.frameless.conf.FrameLessXxlConfConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.TimeUnit;
package com.xxl.conf.sample.frameless; /** * @author xuxueli 2018-11-10 20:05:33 */ public class FramelessApplication { private static Logger logger = LoggerFactory.getLogger(FramelessApplication.class); public static void main(String[] args) { try { // start FrameLessXxlConfConfig.init(); // test listener test
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListener.java // public interface XxlConfListener { // // /** // * invoke when first-use or conf-change // * // * @param key // */ // public void onChange(String key, String value) throws Exception; // // } // // Path: xxl-conf-samples/xxl-conf-sample-frameless/src/main/java/com.xxl.conf.sample.frameless/conf/FrameLessXxlConfConfig.java // public class FrameLessXxlConfConfig { // // /** // * init // */ // public static void init() { // Properties prop = PropUtil.loadProp("xxl-conf.properties"); // // XxlConfBaseFactory.init( // prop.getProperty("xxl.conf.admin.address"), // prop.getProperty("xxl.conf.env"), // prop.getProperty("xxl.conf.access.token"), // prop.getProperty("xxl.conf.mirrorfile")); // } // // /** // * destory // */ // public static void destroy() { // XxlConfBaseFactory.destroy(); // } // // } // Path: xxl-conf-samples/xxl-conf-sample-frameless/src/main/java/com.xxl.conf.sample.frameless/FramelessApplication.java import com.xxl.conf.core.XxlConfClient; import com.xxl.conf.core.listener.XxlConfListener; import com.xxl.conf.sample.frameless.conf.FrameLessXxlConfConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.TimeUnit; package com.xxl.conf.sample.frameless; /** * @author xuxueli 2018-11-10 20:05:33 */ public class FramelessApplication { private static Logger logger = LoggerFactory.getLogger(FramelessApplication.class); public static void main(String[] args) { try { // start FrameLessXxlConfConfig.init(); // test listener test
XxlConfClient.addListener("default.key01", new XxlConfListener(){
xuxueli/xxl-conf
xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListenerFactory.java
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // }
import com.xxl.conf.core.XxlConfClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.concurrent.ConcurrentHashMap;
package com.xxl.conf.core.listener; /** * xxl conf listener * * @author xuxueli 2018-02-04 01:27:30 */ public class XxlConfListenerFactory { private static Logger logger = LoggerFactory.getLogger(XxlConfListenerFactory.class); /** * xxl conf listener repository */ private static ConcurrentHashMap<String, List<XxlConfListener>> keyListenerRepository = new ConcurrentHashMap<>(); private static List<XxlConfListener> noKeyConfListener = Collections.synchronizedList(new ArrayList<XxlConfListener>()); /** * add listener and first invoke + watch * * @param key empty will listener all key * @param xxlConfListener * @return */ public static boolean addListener(String key, XxlConfListener xxlConfListener){ if (xxlConfListener == null) { return false; } if (key==null || key.trim().length()==0) { // listene all key used noKeyConfListener.add(xxlConfListener); return true; } else { // first use, invoke and watch this key try {
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/XxlConfClient.java // public class XxlConfClient { // // public static String get(String key, String defaultVal) { // return XxlConfLocalCacheConf.get(key, defaultVal); // } // // /** // * get conf (string) // * // * @param key // * @return // */ // public static String get(String key) { // return get(key, null); // } // // /** // * get conf (boolean) // * // * @param key // * @return // */ // public static boolean getBoolean(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Boolean.valueOf(value); // } // // /** // * get conf (short) // * // * @param key // * @return // */ // public static short getShort(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Short.valueOf(value); // } // // /** // * get conf (int) // * // * @param key // * @return // */ // public static int getInt(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Integer.valueOf(value); // } // // /** // * get conf (long) // * // * @param key // * @return // */ // public static long getLong(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Long.valueOf(value); // } // // /** // * get conf (float) // * // * @param key // * @return // */ // public static float getFloat(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Float.valueOf(value); // } // // /** // * get conf (double) // * // * @param key // * @return // */ // public static double getDouble(String key) { // String value = get(key, null); // if (value == null) { // throw new XxlConfException("config key [" + key + "] does not exist"); // } // return Double.valueOf(value); // } // // /** // * add listener with xxl conf change // * // * @param key // * @param xxlConfListener // * @return // */ // public static boolean addListener(String key, XxlConfListener xxlConfListener){ // return XxlConfListenerFactory.addListener(key, xxlConfListener); // } // // } // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/listener/XxlConfListenerFactory.java import com.xxl.conf.core.XxlConfClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.concurrent.ConcurrentHashMap; package com.xxl.conf.core.listener; /** * xxl conf listener * * @author xuxueli 2018-02-04 01:27:30 */ public class XxlConfListenerFactory { private static Logger logger = LoggerFactory.getLogger(XxlConfListenerFactory.class); /** * xxl conf listener repository */ private static ConcurrentHashMap<String, List<XxlConfListener>> keyListenerRepository = new ConcurrentHashMap<>(); private static List<XxlConfListener> noKeyConfListener = Collections.synchronizedList(new ArrayList<XxlConfListener>()); /** * add listener and first invoke + watch * * @param key empty will listener all key * @param xxlConfListener * @return */ public static boolean addListener(String key, XxlConfListener xxlConfListener){ if (xxlConfListener == null) { return false; } if (key==null || key.trim().length()==0) { // listene all key used noKeyConfListener.add(xxlConfListener); return true; } else { // first use, invoke and watch this key try {
String value = XxlConfClient.get(key);
xuxueli/xxl-conf
xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfNode.java // public class XxlConfNode { // // private String env; // private String key; // 配置Key // private String appname; // 所属项目AppName // private String title; // 配置描述 // private String value; // 配置Value // // // plugin // /*private String zkValue; // ZK中配置Value // TODO, delete*/ // private List<XxlConfNodeLog> logList; // 配置变更Log // // public String getEnv() { // return env; // } // // public void setEnv(String env) { // this.env = env; // } // // public String getKey() { // return key; // } // // public void setKey(String key) { // this.key = key; // } // // public String getAppname() { // return appname; // } // // public void setAppname(String appname) { // this.appname = appname; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public String getValue() { // return value; // } // // public void setValue(String value) { // this.value = value; // } // // /*public String getZkValue() { // return zkValue; // } // // public void setZkValue(String zkValue) { // this.zkValue = zkValue; // }*/ // // public List<XxlConfNodeLog> getLogList() { // return logList; // } // // public void setLogList(List<XxlConfNodeLog> logList) { // this.logList = logList; // } // }
import com.xxl.conf.admin.core.model.XxlConfNode; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List;
package com.xxl.conf.admin.dao; /** * Created by xuxueli on 16/10/8. */ @Mapper public interface XxlConfNodeDao {
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfNode.java // public class XxlConfNode { // // private String env; // private String key; // 配置Key // private String appname; // 所属项目AppName // private String title; // 配置描述 // private String value; // 配置Value // // // plugin // /*private String zkValue; // ZK中配置Value // TODO, delete*/ // private List<XxlConfNodeLog> logList; // 配置变更Log // // public String getEnv() { // return env; // } // // public void setEnv(String env) { // this.env = env; // } // // public String getKey() { // return key; // } // // public void setKey(String key) { // this.key = key; // } // // public String getAppname() { // return appname; // } // // public void setAppname(String appname) { // this.appname = appname; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public String getValue() { // return value; // } // // public void setValue(String value) { // this.value = value; // } // // /*public String getZkValue() { // return zkValue; // } // // public void setZkValue(String zkValue) { // this.zkValue = zkValue; // }*/ // // public List<XxlConfNodeLog> getLogList() { // return logList; // } // // public void setLogList(List<XxlConfNodeLog> logList) { // this.logList = logList; // } // } // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfNodeDao.java import com.xxl.conf.admin.core.model.XxlConfNode; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; package com.xxl.conf.admin.dao; /** * Created by xuxueli on 16/10/8. */ @Mapper public interface XxlConfNodeDao {
public List<XxlConfNode> pageList(@Param("offset") int offset,
xuxueli/xxl-conf
xxl-conf-core/src/main/java/com/xxl/conf/core/util/FieldReflectionUtil.java
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/exception/XxlConfException.java // public class XxlConfException extends RuntimeException { // // private static final long serialVersionUID = 42L; // // public XxlConfException(String msg) { // super(msg); // } // // public XxlConfException(String msg, Throwable cause) { // super(msg, cause); // } // // public XxlConfException(Throwable cause) { // super(cause); // } // // }
import com.xxl.conf.core.exception.XxlConfException;
package com.xxl.conf.core.util; /** * data type parse * * @author xuxueli 2017-05-26 */ public final class FieldReflectionUtil { private FieldReflectionUtil(){} public static Byte parseByte(String value) { try { value = value.replaceAll(" ", ""); return Byte.valueOf(value); } catch(NumberFormatException e) {
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/exception/XxlConfException.java // public class XxlConfException extends RuntimeException { // // private static final long serialVersionUID = 42L; // // public XxlConfException(String msg) { // super(msg); // } // // public XxlConfException(String msg, Throwable cause) { // super(msg, cause); // } // // public XxlConfException(Throwable cause) { // super(cause); // } // // } // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/util/FieldReflectionUtil.java import com.xxl.conf.core.exception.XxlConfException; package com.xxl.conf.core.util; /** * data type parse * * @author xuxueli 2017-05-26 */ public final class FieldReflectionUtil { private FieldReflectionUtil(){} public static Byte parseByte(String value) { try { value = value.replaceAll(" ", ""); return Byte.valueOf(value); } catch(NumberFormatException e) {
throw new XxlConfException("parseByte but input illegal input=" + value, e);
xuxueli/xxl-conf
xxl-conf-samples/xxl-conf-sample-nutz/src/main/java/com/xxl/conf/sample/nutz/config/NutzSetup.java
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/factory/XxlConfBaseFactory.java // public class XxlConfBaseFactory { // // // /** // * init // * // * @param adminAddress // * @param env // */ // public static void init(String adminAddress, String env, String accessToken, String mirrorfile) { // // init // XxlConfRemoteConf.init(adminAddress, env, accessToken); // init remote util // XxlConfMirrorConf.init(mirrorfile); // init mirror util // XxlConfLocalCacheConf.init(); // init cache + thread, cycle refresh + monitor // // XxlConfListenerFactory.addListener(null, new BeanRefreshXxlConfListener()); // listener all key change // // } // // /** // * destory // */ // public static void destroy() { // XxlConfLocalCacheConf.destroy(); // destroy // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/util/PropUtil.java // public class PropUtil { // private static Logger logger = LoggerFactory.getLogger(PropUtil.class); // // /** // * load prop // * // * @param propertyFileName disk path when start with "file:", other classpath // * @return // */ // public static Properties loadProp(String propertyFileName) { // // // disk path // if (propertyFileName.startsWith("file:")) { // propertyFileName = propertyFileName.substring("file:".length()); // return loadFileProp(propertyFileName); // } else { // return loadClassPathProp(propertyFileName); // } // } // // public static Properties loadClassPathProp(String propertyFileName) { // // InputStream in = null; // try { // in = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertyFileName); // if (in == null) { // return null; // } // // Properties prop = new Properties(); // prop.load(new InputStreamReader(in, "utf-8")); // return prop; // } catch (IOException e) { // logger.error(e.getMessage(), e); // } finally { // if (in != null) { // try { // in.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // return null; // } // // // public static Properties loadFileProp(String propertyFileName) { // InputStream in = null; // try { // // load file location, disk // File file = new File(propertyFileName); // if (!file.exists()) { // return null; // } // // URL url = new File(propertyFileName).toURI().toURL(); // in = new FileInputStream(url.getPath()); // if (in == null) { // return null; // } // // Properties prop = new Properties(); // prop.load(new InputStreamReader(in, "utf-8")); // return prop; // } catch (IOException e) { // logger.error(e.getMessage(), e); // } finally { // if (in != null) { // try { // in.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // return null; // } // // // /** // * write prop to disk // * // * @param properties // * @param filePathName // * @return // */ // public static boolean writeFileProp(Properties properties, String filePathName){ // FileOutputStream fileOutputStream = null; // try { // // // mk file // File file = new File(filePathName); // if (!file.exists()) { // file.getParentFile().mkdirs(); // } // // // write data // fileOutputStream = new FileOutputStream(file, false); // properties.store(new OutputStreamWriter(fileOutputStream, "utf-8"), null); // //properties.store(new FileWriter(filePathName), null); // return true; // } catch (IOException e) { // logger.error(e.getMessage(), e); // return false; // } finally { // if (fileOutputStream != null) { // try { // fileOutputStream.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // } // // }
import com.xxl.conf.core.factory.XxlConfBaseFactory; import com.xxl.conf.core.util.PropUtil; import org.nutz.mvc.NutConfig; import org.nutz.mvc.Setup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Properties;
package com.xxl.conf.sample.nutz.config; /** * nutz setup * * @author xuxueli 2018-05-24 */ public class NutzSetup implements Setup { private Logger logger = LoggerFactory.getLogger(NutzSetup.class); @Override public void init(NutConfig cfg) {
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/factory/XxlConfBaseFactory.java // public class XxlConfBaseFactory { // // // /** // * init // * // * @param adminAddress // * @param env // */ // public static void init(String adminAddress, String env, String accessToken, String mirrorfile) { // // init // XxlConfRemoteConf.init(adminAddress, env, accessToken); // init remote util // XxlConfMirrorConf.init(mirrorfile); // init mirror util // XxlConfLocalCacheConf.init(); // init cache + thread, cycle refresh + monitor // // XxlConfListenerFactory.addListener(null, new BeanRefreshXxlConfListener()); // listener all key change // // } // // /** // * destory // */ // public static void destroy() { // XxlConfLocalCacheConf.destroy(); // destroy // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/util/PropUtil.java // public class PropUtil { // private static Logger logger = LoggerFactory.getLogger(PropUtil.class); // // /** // * load prop // * // * @param propertyFileName disk path when start with "file:", other classpath // * @return // */ // public static Properties loadProp(String propertyFileName) { // // // disk path // if (propertyFileName.startsWith("file:")) { // propertyFileName = propertyFileName.substring("file:".length()); // return loadFileProp(propertyFileName); // } else { // return loadClassPathProp(propertyFileName); // } // } // // public static Properties loadClassPathProp(String propertyFileName) { // // InputStream in = null; // try { // in = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertyFileName); // if (in == null) { // return null; // } // // Properties prop = new Properties(); // prop.load(new InputStreamReader(in, "utf-8")); // return prop; // } catch (IOException e) { // logger.error(e.getMessage(), e); // } finally { // if (in != null) { // try { // in.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // return null; // } // // // public static Properties loadFileProp(String propertyFileName) { // InputStream in = null; // try { // // load file location, disk // File file = new File(propertyFileName); // if (!file.exists()) { // return null; // } // // URL url = new File(propertyFileName).toURI().toURL(); // in = new FileInputStream(url.getPath()); // if (in == null) { // return null; // } // // Properties prop = new Properties(); // prop.load(new InputStreamReader(in, "utf-8")); // return prop; // } catch (IOException e) { // logger.error(e.getMessage(), e); // } finally { // if (in != null) { // try { // in.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // return null; // } // // // /** // * write prop to disk // * // * @param properties // * @param filePathName // * @return // */ // public static boolean writeFileProp(Properties properties, String filePathName){ // FileOutputStream fileOutputStream = null; // try { // // // mk file // File file = new File(filePathName); // if (!file.exists()) { // file.getParentFile().mkdirs(); // } // // // write data // fileOutputStream = new FileOutputStream(file, false); // properties.store(new OutputStreamWriter(fileOutputStream, "utf-8"), null); // //properties.store(new FileWriter(filePathName), null); // return true; // } catch (IOException e) { // logger.error(e.getMessage(), e); // return false; // } finally { // if (fileOutputStream != null) { // try { // fileOutputStream.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // } // // } // Path: xxl-conf-samples/xxl-conf-sample-nutz/src/main/java/com/xxl/conf/sample/nutz/config/NutzSetup.java import com.xxl.conf.core.factory.XxlConfBaseFactory; import com.xxl.conf.core.util.PropUtil; import org.nutz.mvc.NutConfig; import org.nutz.mvc.Setup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Properties; package com.xxl.conf.sample.nutz.config; /** * nutz setup * * @author xuxueli 2018-05-24 */ public class NutzSetup implements Setup { private Logger logger = LoggerFactory.getLogger(NutzSetup.class); @Override public void init(NutConfig cfg) {
Properties prop = PropUtil.loadProp("xxl-conf.properties");
xuxueli/xxl-conf
xxl-conf-samples/xxl-conf-sample-nutz/src/main/java/com/xxl/conf/sample/nutz/config/NutzSetup.java
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/factory/XxlConfBaseFactory.java // public class XxlConfBaseFactory { // // // /** // * init // * // * @param adminAddress // * @param env // */ // public static void init(String adminAddress, String env, String accessToken, String mirrorfile) { // // init // XxlConfRemoteConf.init(adminAddress, env, accessToken); // init remote util // XxlConfMirrorConf.init(mirrorfile); // init mirror util // XxlConfLocalCacheConf.init(); // init cache + thread, cycle refresh + monitor // // XxlConfListenerFactory.addListener(null, new BeanRefreshXxlConfListener()); // listener all key change // // } // // /** // * destory // */ // public static void destroy() { // XxlConfLocalCacheConf.destroy(); // destroy // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/util/PropUtil.java // public class PropUtil { // private static Logger logger = LoggerFactory.getLogger(PropUtil.class); // // /** // * load prop // * // * @param propertyFileName disk path when start with "file:", other classpath // * @return // */ // public static Properties loadProp(String propertyFileName) { // // // disk path // if (propertyFileName.startsWith("file:")) { // propertyFileName = propertyFileName.substring("file:".length()); // return loadFileProp(propertyFileName); // } else { // return loadClassPathProp(propertyFileName); // } // } // // public static Properties loadClassPathProp(String propertyFileName) { // // InputStream in = null; // try { // in = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertyFileName); // if (in == null) { // return null; // } // // Properties prop = new Properties(); // prop.load(new InputStreamReader(in, "utf-8")); // return prop; // } catch (IOException e) { // logger.error(e.getMessage(), e); // } finally { // if (in != null) { // try { // in.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // return null; // } // // // public static Properties loadFileProp(String propertyFileName) { // InputStream in = null; // try { // // load file location, disk // File file = new File(propertyFileName); // if (!file.exists()) { // return null; // } // // URL url = new File(propertyFileName).toURI().toURL(); // in = new FileInputStream(url.getPath()); // if (in == null) { // return null; // } // // Properties prop = new Properties(); // prop.load(new InputStreamReader(in, "utf-8")); // return prop; // } catch (IOException e) { // logger.error(e.getMessage(), e); // } finally { // if (in != null) { // try { // in.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // return null; // } // // // /** // * write prop to disk // * // * @param properties // * @param filePathName // * @return // */ // public static boolean writeFileProp(Properties properties, String filePathName){ // FileOutputStream fileOutputStream = null; // try { // // // mk file // File file = new File(filePathName); // if (!file.exists()) { // file.getParentFile().mkdirs(); // } // // // write data // fileOutputStream = new FileOutputStream(file, false); // properties.store(new OutputStreamWriter(fileOutputStream, "utf-8"), null); // //properties.store(new FileWriter(filePathName), null); // return true; // } catch (IOException e) { // logger.error(e.getMessage(), e); // return false; // } finally { // if (fileOutputStream != null) { // try { // fileOutputStream.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // } // // }
import com.xxl.conf.core.factory.XxlConfBaseFactory; import com.xxl.conf.core.util.PropUtil; import org.nutz.mvc.NutConfig; import org.nutz.mvc.Setup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Properties;
package com.xxl.conf.sample.nutz.config; /** * nutz setup * * @author xuxueli 2018-05-24 */ public class NutzSetup implements Setup { private Logger logger = LoggerFactory.getLogger(NutzSetup.class); @Override public void init(NutConfig cfg) { Properties prop = PropUtil.loadProp("xxl-conf.properties");
// Path: xxl-conf-core/src/main/java/com/xxl/conf/core/factory/XxlConfBaseFactory.java // public class XxlConfBaseFactory { // // // /** // * init // * // * @param adminAddress // * @param env // */ // public static void init(String adminAddress, String env, String accessToken, String mirrorfile) { // // init // XxlConfRemoteConf.init(adminAddress, env, accessToken); // init remote util // XxlConfMirrorConf.init(mirrorfile); // init mirror util // XxlConfLocalCacheConf.init(); // init cache + thread, cycle refresh + monitor // // XxlConfListenerFactory.addListener(null, new BeanRefreshXxlConfListener()); // listener all key change // // } // // /** // * destory // */ // public static void destroy() { // XxlConfLocalCacheConf.destroy(); // destroy // } // // } // // Path: xxl-conf-core/src/main/java/com/xxl/conf/core/util/PropUtil.java // public class PropUtil { // private static Logger logger = LoggerFactory.getLogger(PropUtil.class); // // /** // * load prop // * // * @param propertyFileName disk path when start with "file:", other classpath // * @return // */ // public static Properties loadProp(String propertyFileName) { // // // disk path // if (propertyFileName.startsWith("file:")) { // propertyFileName = propertyFileName.substring("file:".length()); // return loadFileProp(propertyFileName); // } else { // return loadClassPathProp(propertyFileName); // } // } // // public static Properties loadClassPathProp(String propertyFileName) { // // InputStream in = null; // try { // in = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertyFileName); // if (in == null) { // return null; // } // // Properties prop = new Properties(); // prop.load(new InputStreamReader(in, "utf-8")); // return prop; // } catch (IOException e) { // logger.error(e.getMessage(), e); // } finally { // if (in != null) { // try { // in.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // return null; // } // // // public static Properties loadFileProp(String propertyFileName) { // InputStream in = null; // try { // // load file location, disk // File file = new File(propertyFileName); // if (!file.exists()) { // return null; // } // // URL url = new File(propertyFileName).toURI().toURL(); // in = new FileInputStream(url.getPath()); // if (in == null) { // return null; // } // // Properties prop = new Properties(); // prop.load(new InputStreamReader(in, "utf-8")); // return prop; // } catch (IOException e) { // logger.error(e.getMessage(), e); // } finally { // if (in != null) { // try { // in.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // return null; // } // // // /** // * write prop to disk // * // * @param properties // * @param filePathName // * @return // */ // public static boolean writeFileProp(Properties properties, String filePathName){ // FileOutputStream fileOutputStream = null; // try { // // // mk file // File file = new File(filePathName); // if (!file.exists()) { // file.getParentFile().mkdirs(); // } // // // write data // fileOutputStream = new FileOutputStream(file, false); // properties.store(new OutputStreamWriter(fileOutputStream, "utf-8"), null); // //properties.store(new FileWriter(filePathName), null); // return true; // } catch (IOException e) { // logger.error(e.getMessage(), e); // return false; // } finally { // if (fileOutputStream != null) { // try { // fileOutputStream.close(); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // } // } // } // // } // Path: xxl-conf-samples/xxl-conf-sample-nutz/src/main/java/com/xxl/conf/sample/nutz/config/NutzSetup.java import com.xxl.conf.core.factory.XxlConfBaseFactory; import com.xxl.conf.core.util.PropUtil; import org.nutz.mvc.NutConfig; import org.nutz.mvc.Setup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Properties; package com.xxl.conf.sample.nutz.config; /** * nutz setup * * @author xuxueli 2018-05-24 */ public class NutzSetup implements Setup { private Logger logger = LoggerFactory.getLogger(NutzSetup.class); @Override public void init(NutConfig cfg) { Properties prop = PropUtil.loadProp("xxl-conf.properties");
XxlConfBaseFactory.init(
xuxueli/xxl-conf
xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/resolver/WebExceptionResolver.java
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/JacksonUtil.java // public class JacksonUtil { // private static Logger logger = LoggerFactory.getLogger(JacksonUtil.class); // // private final static ObjectMapper objectMapper = new ObjectMapper(); // public static ObjectMapper getInstance() { // return objectMapper; // } // // /** // * bean、array、List、Map --> json // * // * @param obj // * @return json string // * @throws Exception // */ // public static String writeValueAsString(Object obj) { // try { // return getInstance().writeValueAsString(obj); // } catch (JsonGenerationException e) { // logger.error(e.getMessage(), e); // } catch (JsonMappingException e) { // logger.error(e.getMessage(), e); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // return null; // } // // /** // * string --> bean、Map、List(array) // * // * @param jsonStr // * @param clazz // * @return obj // * @throws Exception // */ // public static <T> T readValue(String jsonStr, Class<T> clazz) { // try { // return getInstance().readValue(jsonStr, clazz); // } catch (JsonParseException e) { // logger.error(e.getMessage(), e); // } catch (JsonMappingException e) { // logger.error(e.getMessage(), e); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // return null; // } // public static <T> T readValueRefer(String jsonStr, Class<T> clazz) { // try { // return getInstance().readValue(jsonStr, new TypeReference<T>() { }); // } catch (JsonParseException e) { // logger.error(e.getMessage(), e); // } catch (JsonMappingException e) { // logger.error(e.getMessage(), e); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // return null; // } // // public static void main(String[] args) { // try { // Map<String, String> map = new HashMap<String, String>(); // map.put("aaa", "111"); // map.put("bbb", "222"); // String json = writeValueAsString(map); // System.out.println(json); // System.out.println(readValue(json, Map.class)); // } catch (Exception e) { // logger.error(e.getMessage(), e); // } // } // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // }
import com.xxl.conf.admin.core.util.JacksonUtil; import com.xxl.conf.admin.core.util.ReturnT; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException;
package com.xxl.conf.admin.controller.resolver; /** * common exception resolver * * 1、@ControllerAdvice:扫描所有Controller; * 2、@ControllerAdvice(annotations=RestController.class):扫描指定注解类型的Controller; * 3、@ControllerAdvice(basePackages={"com.aaa","com.bbb"}):扫描指定package下的Controller * * @author xuxueli 2016-1-6 19:22:18 */ @Component public class WebExceptionResolver implements HandlerExceptionResolver { private static transient Logger logger = LoggerFactory.getLogger(WebExceptionResolver.class); @Override public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { logger.error("WebExceptionResolver:{}", ex); // if json boolean isJson = false; HandlerMethod method = (HandlerMethod)handler; ResponseBody responseBody = method.getMethodAnnotation(ResponseBody.class); if (responseBody != null) { isJson = true; } // error result
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/JacksonUtil.java // public class JacksonUtil { // private static Logger logger = LoggerFactory.getLogger(JacksonUtil.class); // // private final static ObjectMapper objectMapper = new ObjectMapper(); // public static ObjectMapper getInstance() { // return objectMapper; // } // // /** // * bean、array、List、Map --> json // * // * @param obj // * @return json string // * @throws Exception // */ // public static String writeValueAsString(Object obj) { // try { // return getInstance().writeValueAsString(obj); // } catch (JsonGenerationException e) { // logger.error(e.getMessage(), e); // } catch (JsonMappingException e) { // logger.error(e.getMessage(), e); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // return null; // } // // /** // * string --> bean、Map、List(array) // * // * @param jsonStr // * @param clazz // * @return obj // * @throws Exception // */ // public static <T> T readValue(String jsonStr, Class<T> clazz) { // try { // return getInstance().readValue(jsonStr, clazz); // } catch (JsonParseException e) { // logger.error(e.getMessage(), e); // } catch (JsonMappingException e) { // logger.error(e.getMessage(), e); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // return null; // } // public static <T> T readValueRefer(String jsonStr, Class<T> clazz) { // try { // return getInstance().readValue(jsonStr, new TypeReference<T>() { }); // } catch (JsonParseException e) { // logger.error(e.getMessage(), e); // } catch (JsonMappingException e) { // logger.error(e.getMessage(), e); // } catch (IOException e) { // logger.error(e.getMessage(), e); // } // return null; // } // // public static void main(String[] args) { // try { // Map<String, String> map = new HashMap<String, String>(); // map.put("aaa", "111"); // map.put("bbb", "222"); // String json = writeValueAsString(map); // System.out.println(json); // System.out.println(readValue(json, Map.class)); // } catch (Exception e) { // logger.error(e.getMessage(), e); // } // } // } // // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/util/ReturnT.java // public class ReturnT<T> { // // public static final int SUCCESS_CODE = 200; // public static final int FAIL_CODE = 500; // // public static final ReturnT<String> SUCCESS = new ReturnT<String>(null); // public static final ReturnT<String> FAIL = new ReturnT<String>(FAIL_CODE, null); // // private int code; // private String msg; // private T data; // // public ReturnT(int code, String msg) { // this.code = code; // this.msg = msg; // } // public ReturnT(T data) { // this.code = SUCCESS_CODE; // this.data = data; // } // // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // // public String getMsg() { // return msg; // } // // public void setMsg(String msg) { // this.msg = msg; // } // // public T getData() { // return data; // } // // public void setData(T data) { // this.data = data; // } // // } // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/controller/resolver/WebExceptionResolver.java import com.xxl.conf.admin.core.util.JacksonUtil; import com.xxl.conf.admin.core.util.ReturnT; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; package com.xxl.conf.admin.controller.resolver; /** * common exception resolver * * 1、@ControllerAdvice:扫描所有Controller; * 2、@ControllerAdvice(annotations=RestController.class):扫描指定注解类型的Controller; * 3、@ControllerAdvice(basePackages={"com.aaa","com.bbb"}):扫描指定package下的Controller * * @author xuxueli 2016-1-6 19:22:18 */ @Component public class WebExceptionResolver implements HandlerExceptionResolver { private static transient Logger logger = LoggerFactory.getLogger(WebExceptionResolver.class); @Override public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { logger.error("WebExceptionResolver:{}", ex); // if json boolean isJson = false; HandlerMethod method = (HandlerMethod)handler; ResponseBody responseBody = method.getMethodAnnotation(ResponseBody.class); if (responseBody != null) { isJson = true; } // error result
ReturnT<String> errorResult = new ReturnT<String>(ReturnT.FAIL.getCode(), ex.toString().replaceAll("\n", "<br/>"));
xuxueli/xxl-conf
xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfProjectDao.java
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfProject.java // public class XxlConfProject { // // private String appname; // 项目AppName // private String title; // 项目名称 // // public String getAppname() { // return appname; // } // // public void setAppname(String appname) { // this.appname = appname; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // }
import com.xxl.conf.admin.core.model.XxlConfProject; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List;
package com.xxl.conf.admin.dao; /** * Created by xuxueli on 16/10/8. */ @Mapper public interface XxlConfProjectDao {
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfProject.java // public class XxlConfProject { // // private String appname; // 项目AppName // private String title; // 项目名称 // // public String getAppname() { // return appname; // } // // public void setAppname(String appname) { // this.appname = appname; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // } // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfProjectDao.java import com.xxl.conf.admin.core.model.XxlConfProject; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; package com.xxl.conf.admin.dao; /** * Created by xuxueli on 16/10/8. */ @Mapper public interface XxlConfProjectDao {
public List<XxlConfProject> findAll();
xuxueli/xxl-conf
xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfEnvDao.java
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfEnv.java // public class XxlConfEnv { // // private String env; // Env // private String title; // 环境名称 // private int order; // // public String getEnv() { // return env; // } // // public void setEnv(String env) { // this.env = env; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public int getOrder() { // return order; // } // // public void setOrder(int order) { // this.order = order; // } // }
import com.xxl.conf.admin.core.model.XxlConfEnv; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List;
package com.xxl.conf.admin.dao; /** * Created by xuxueli on 2018-05-30 */ @Mapper public interface XxlConfEnvDao {
// Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/core/model/XxlConfEnv.java // public class XxlConfEnv { // // private String env; // Env // private String title; // 环境名称 // private int order; // // public String getEnv() { // return env; // } // // public void setEnv(String env) { // this.env = env; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public int getOrder() { // return order; // } // // public void setOrder(int order) { // this.order = order; // } // } // Path: xxl-conf-admin/src/main/java/com/xxl/conf/admin/dao/XxlConfEnvDao.java import com.xxl.conf.admin.core.model.XxlConfEnv; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; package com.xxl.conf.admin.dao; /** * Created by xuxueli on 2018-05-30 */ @Mapper public interface XxlConfEnvDao {
public List<XxlConfEnv> findAll();