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 |
|---|---|---|---|---|---|---|
abicelis/Remindy | app/src/main/java/ve/com/abicelis/remindy/util/FileUtil.java | // Path: app/src/main/java/ve/com/abicelis/remindy/model/attachment/Attachment.java
// public abstract class Attachment implements Serializable {
// private int id;
// private int taskId;
//
// public Attachment() {} //id-less Constructor used when creating Attachments
// public Attachment(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract AttachmentType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
//
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/attachment/AudioAttachment.java
// public class AudioAttachment extends Attachment {
//
// private String audioFilename;
//
// public AudioAttachment() { /* Parameter-less constructor for audio attachment creation */ }
// public AudioAttachment(String audioFilename) {
// this.audioFilename = audioFilename;
// }
// public AudioAttachment(int id, int reminderId, String audioFilename) {
// super(id, reminderId);
// this.audioFilename = audioFilename;
// }
//
// @Override
// public AttachmentType getType() {
// return AttachmentType.AUDIO;
// }
//
// public String getAudioFilename() {
// return audioFilename;
// }
// public void setAudioFilename(String audioFilename) {
// this.audioFilename = audioFilename;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/attachment/ImageAttachment.java
// public class ImageAttachment extends Attachment {
//
// private byte[] thumbnail;
// private String imageFilename;
//
// public ImageAttachment() { /* Parameter-less constructor for image attachment creation */ }
// public ImageAttachment(byte[] thumbnail, String imageFilename) {
// this.thumbnail = thumbnail;
// this.imageFilename = imageFilename;
// }
// public ImageAttachment(int id, int reminderId, byte[] thumbnail, String fullImagePath) {
// super(id, reminderId);
// this.thumbnail = thumbnail;
// this.imageFilename = fullImagePath;
// }
//
// @Override
// public AttachmentType getType() {
// return AttachmentType.IMAGE;
// }
//
//
// public byte[] getThumbnail() {
// return thumbnail;
// }
// public void setThumbnail(byte[] thumbnail) {
// this.thumbnail = thumbnail;
// }
//
// public String getImageFilename() {
// return imageFilename;
// }
// public void setImageFilename(String imageFilename) {
// this.imageFilename = imageFilename;
// }
// }
| import android.app.Activity;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import ve.com.abicelis.remindy.R;
import ve.com.abicelis.remindy.model.attachment.Attachment;
import ve.com.abicelis.remindy.model.attachment.AudioAttachment;
import ve.com.abicelis.remindy.model.attachment.ImageAttachment; | if (directory.mkdirs()){
File nomedia = new File(directory, ".nomedia");
nomedia.createNewFile();
}
}
/**
* Creates an empty file at the specified directory, with the given name if it doesn't already exist
*
*/
public static File createNewFileIfNotExistsInDir(File directory, String fileName) throws IOException {
File file = new File(directory, fileName);
file.createNewFile();
return file;
}
/**
* Deletes the images and audio files from a list of attachments
*/
public static void deleteAttachmentFiles(Activity activity, List<Attachment> attachments) {
for (Attachment attachment : attachments) {
switch (attachment.getType()) {
case AUDIO:
String audioFilename = ((AudioAttachment)attachment).getAudioFilename();
deleteAudioAttachment(activity, audioFilename);
break;
case IMAGE: | // Path: app/src/main/java/ve/com/abicelis/remindy/model/attachment/Attachment.java
// public abstract class Attachment implements Serializable {
// private int id;
// private int taskId;
//
// public Attachment() {} //id-less Constructor used when creating Attachments
// public Attachment(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract AttachmentType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
//
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/attachment/AudioAttachment.java
// public class AudioAttachment extends Attachment {
//
// private String audioFilename;
//
// public AudioAttachment() { /* Parameter-less constructor for audio attachment creation */ }
// public AudioAttachment(String audioFilename) {
// this.audioFilename = audioFilename;
// }
// public AudioAttachment(int id, int reminderId, String audioFilename) {
// super(id, reminderId);
// this.audioFilename = audioFilename;
// }
//
// @Override
// public AttachmentType getType() {
// return AttachmentType.AUDIO;
// }
//
// public String getAudioFilename() {
// return audioFilename;
// }
// public void setAudioFilename(String audioFilename) {
// this.audioFilename = audioFilename;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/attachment/ImageAttachment.java
// public class ImageAttachment extends Attachment {
//
// private byte[] thumbnail;
// private String imageFilename;
//
// public ImageAttachment() { /* Parameter-less constructor for image attachment creation */ }
// public ImageAttachment(byte[] thumbnail, String imageFilename) {
// this.thumbnail = thumbnail;
// this.imageFilename = imageFilename;
// }
// public ImageAttachment(int id, int reminderId, byte[] thumbnail, String fullImagePath) {
// super(id, reminderId);
// this.thumbnail = thumbnail;
// this.imageFilename = fullImagePath;
// }
//
// @Override
// public AttachmentType getType() {
// return AttachmentType.IMAGE;
// }
//
//
// public byte[] getThumbnail() {
// return thumbnail;
// }
// public void setThumbnail(byte[] thumbnail) {
// this.thumbnail = thumbnail;
// }
//
// public String getImageFilename() {
// return imageFilename;
// }
// public void setImageFilename(String imageFilename) {
// this.imageFilename = imageFilename;
// }
// }
// Path: app/src/main/java/ve/com/abicelis/remindy/util/FileUtil.java
import android.app.Activity;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import ve.com.abicelis.remindy.R;
import ve.com.abicelis.remindy.model.attachment.Attachment;
import ve.com.abicelis.remindy.model.attachment.AudioAttachment;
import ve.com.abicelis.remindy.model.attachment.ImageAttachment;
if (directory.mkdirs()){
File nomedia = new File(directory, ".nomedia");
nomedia.createNewFile();
}
}
/**
* Creates an empty file at the specified directory, with the given name if it doesn't already exist
*
*/
public static File createNewFileIfNotExistsInDir(File directory, String fileName) throws IOException {
File file = new File(directory, fileName);
file.createNewFile();
return file;
}
/**
* Deletes the images and audio files from a list of attachments
*/
public static void deleteAttachmentFiles(Activity activity, List<Attachment> attachments) {
for (Attachment attachment : attachments) {
switch (attachment.getType()) {
case AUDIO:
String audioFilename = ((AudioAttachment)attachment).getAudioFilename();
deleteAudioAttachment(activity, audioFilename);
break;
case IMAGE: | String imageFilename = ((ImageAttachment)attachment).getImageFilename(); |
abicelis/Remindy | app/src/main/java/ve/com/abicelis/remindy/model/attachment/ImageAttachment.java | // Path: app/src/main/java/ve/com/abicelis/remindy/enums/AttachmentType.java
// public enum AttachmentType {
// IMAGE,
// LINK,
// TEXT,
// AUDIO,
// LIST
// }
| import ve.com.abicelis.remindy.enums.AttachmentType; | package ve.com.abicelis.remindy.model.attachment;
/**
* Created by abice on 3/3/2017.
*/
public class ImageAttachment extends Attachment {
private byte[] thumbnail;
private String imageFilename;
public ImageAttachment() { /* Parameter-less constructor for image attachment creation */ }
public ImageAttachment(byte[] thumbnail, String imageFilename) {
this.thumbnail = thumbnail;
this.imageFilename = imageFilename;
}
public ImageAttachment(int id, int reminderId, byte[] thumbnail, String fullImagePath) {
super(id, reminderId);
this.thumbnail = thumbnail;
this.imageFilename = fullImagePath;
}
@Override | // Path: app/src/main/java/ve/com/abicelis/remindy/enums/AttachmentType.java
// public enum AttachmentType {
// IMAGE,
// LINK,
// TEXT,
// AUDIO,
// LIST
// }
// Path: app/src/main/java/ve/com/abicelis/remindy/model/attachment/ImageAttachment.java
import ve.com.abicelis.remindy.enums.AttachmentType;
package ve.com.abicelis.remindy.model.attachment;
/**
* Created by abice on 3/3/2017.
*/
public class ImageAttachment extends Attachment {
private byte[] thumbnail;
private String imageFilename;
public ImageAttachment() { /* Parameter-less constructor for image attachment creation */ }
public ImageAttachment(byte[] thumbnail, String imageFilename) {
this.thumbnail = thumbnail;
this.imageFilename = imageFilename;
}
public ImageAttachment(int id, int reminderId, byte[] thumbnail, String fullImagePath) {
super(id, reminderId);
this.thumbnail = thumbnail;
this.imageFilename = fullImagePath;
}
@Override | public AttachmentType getType() { |
abicelis/Remindy | app/src/main/java/ve/com/abicelis/remindy/util/TapTargetSequenceUtil.java | // Path: app/src/main/java/ve/com/abicelis/remindy/enums/TapTargetSequenceType.java
// public enum TapTargetSequenceType {
// EDIT_IMAGE_ATTACHMENT_ACTIVITY,
// PLACE_LIST_ACTIVITY,
// PLACE_ACTIVITY,
// }
| import android.app.Activity;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.Toast;
import com.getkeepsafe.taptargetview.TapTarget;
import com.getkeepsafe.taptargetview.TapTargetSequence;
import java.util.ArrayList;
import java.util.List;
import ve.com.abicelis.remindy.R;
import ve.com.abicelis.remindy.enums.TapTargetSequenceType; | package ve.com.abicelis.remindy.util;
/**
* Created by abice on 13/5/2017.
*/
public class TapTargetSequenceUtil {
private static final int DELAY = 100;
| // Path: app/src/main/java/ve/com/abicelis/remindy/enums/TapTargetSequenceType.java
// public enum TapTargetSequenceType {
// EDIT_IMAGE_ATTACHMENT_ACTIVITY,
// PLACE_LIST_ACTIVITY,
// PLACE_ACTIVITY,
// }
// Path: app/src/main/java/ve/com/abicelis/remindy/util/TapTargetSequenceUtil.java
import android.app.Activity;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.Toast;
import com.getkeepsafe.taptargetview.TapTarget;
import com.getkeepsafe.taptargetview.TapTargetSequence;
import java.util.ArrayList;
import java.util.List;
import ve.com.abicelis.remindy.R;
import ve.com.abicelis.remindy.enums.TapTargetSequenceType;
package ve.com.abicelis.remindy.util;
/**
* Created by abice on 13/5/2017.
*/
public class TapTargetSequenceUtil {
private static final int DELAY = 100;
| public static void showTapTargetSequenceFor(@NonNull final Activity activity, @NonNull TapTargetSequenceType type) { |
abicelis/Remindy | app/src/main/java/ve/com/abicelis/remindy/util/sorting/CalendarPeriod.java | // Path: app/src/main/java/ve/com/abicelis/remindy/util/CalendarUtil.java
// public class CalendarUtil {
//
// public static Calendar getNewInstanceZeroedCalendar() {
// Calendar cal = Calendar.getInstance();
// cal.set(Calendar.HOUR_OF_DAY, 0);
// cal.set(Calendar.MINUTE, 0);
// cal.set(Calendar.SECOND, 0);
// cal.set(Calendar.MILLISECOND, 0);
// return cal;
// }
//
// public static void copyCalendar(Calendar copyFrom, Calendar copyTo) {
// if(copyFrom == null || copyTo == null)
// throw new NullPointerException("copyCalendar(), One of both parameters are null");
//
// copyTo.setTimeZone(copyFrom.getTimeZone());
// copyTo.setTimeInMillis(copyFrom.getTimeInMillis());
// }
//
// public static long getDifferenceMinutesBetween(Calendar a, Calendar b) {
// long differenceMinutes = ( a.getTimeInMillis() - b.getTimeInMillis() ) / 60000; //60 * 1000 toMinutes * toSeconds
// return differenceMinutes;
// }
//
// public static Calendar getCalendarFromDateAndTime(Calendar date, Time time) {
// if(date == null || time == null)
// throw new NullPointerException("getCalendarFromDateAndTime(), One of both parameters are null");
//
// Calendar cal = Calendar.getInstance();
// copyCalendar(date, cal);
//
// cal.set(Calendar.HOUR_OF_DAY, time.getHour());
// cal.set(Calendar.MINUTE, time.getMinute());
//
// return cal;
// }
// }
| import java.util.Calendar;
import ve.com.abicelis.remindy.util.CalendarUtil; | package ve.com.abicelis.remindy.util.sorting;
/**
* Created by abice on 22/4/2017.
*/
public class CalendarPeriod {
private Calendar start;
private Calendar end;
public CalendarPeriod(CalendarPeriodType periodType) {
start = Calendar.getInstance();
//start.add(Calendar.DAY_OF_MONTH, 0);
start.set(Calendar.HOUR_OF_DAY, 0);
start.set(Calendar.MINUTE, 0);
start.set(Calendar.SECOND, 0);
start.set(Calendar.MILLISECOND, 0);
end = Calendar.getInstance();
end.set(Calendar.HOUR_OF_DAY, 23);
end.set(Calendar.MINUTE, 59);
end.set(Calendar.SECOND, 59);
end.set(Calendar.MILLISECOND, 999);
switch (periodType) {
case LAST_YEAR:
start.add(Calendar.YEAR, -1);
start.set(Calendar.MONTH, 0);
start.set(Calendar.DAY_OF_MONTH, 1); | // Path: app/src/main/java/ve/com/abicelis/remindy/util/CalendarUtil.java
// public class CalendarUtil {
//
// public static Calendar getNewInstanceZeroedCalendar() {
// Calendar cal = Calendar.getInstance();
// cal.set(Calendar.HOUR_OF_DAY, 0);
// cal.set(Calendar.MINUTE, 0);
// cal.set(Calendar.SECOND, 0);
// cal.set(Calendar.MILLISECOND, 0);
// return cal;
// }
//
// public static void copyCalendar(Calendar copyFrom, Calendar copyTo) {
// if(copyFrom == null || copyTo == null)
// throw new NullPointerException("copyCalendar(), One of both parameters are null");
//
// copyTo.setTimeZone(copyFrom.getTimeZone());
// copyTo.setTimeInMillis(copyFrom.getTimeInMillis());
// }
//
// public static long getDifferenceMinutesBetween(Calendar a, Calendar b) {
// long differenceMinutes = ( a.getTimeInMillis() - b.getTimeInMillis() ) / 60000; //60 * 1000 toMinutes * toSeconds
// return differenceMinutes;
// }
//
// public static Calendar getCalendarFromDateAndTime(Calendar date, Time time) {
// if(date == null || time == null)
// throw new NullPointerException("getCalendarFromDateAndTime(), One of both parameters are null");
//
// Calendar cal = Calendar.getInstance();
// copyCalendar(date, cal);
//
// cal.set(Calendar.HOUR_OF_DAY, time.getHour());
// cal.set(Calendar.MINUTE, time.getMinute());
//
// return cal;
// }
// }
// Path: app/src/main/java/ve/com/abicelis/remindy/util/sorting/CalendarPeriod.java
import java.util.Calendar;
import ve.com.abicelis.remindy.util.CalendarUtil;
package ve.com.abicelis.remindy.util.sorting;
/**
* Created by abice on 22/4/2017.
*/
public class CalendarPeriod {
private Calendar start;
private Calendar end;
public CalendarPeriod(CalendarPeriodType periodType) {
start = Calendar.getInstance();
//start.add(Calendar.DAY_OF_MONTH, 0);
start.set(Calendar.HOUR_OF_DAY, 0);
start.set(Calendar.MINUTE, 0);
start.set(Calendar.SECOND, 0);
start.set(Calendar.MILLISECOND, 0);
end = Calendar.getInstance();
end.set(Calendar.HOUR_OF_DAY, 23);
end.set(Calendar.MINUTE, 59);
end.set(Calendar.SECOND, 59);
end.set(Calendar.MILLISECOND, 999);
switch (periodType) {
case LAST_YEAR:
start.add(Calendar.YEAR, -1);
start.set(Calendar.MONTH, 0);
start.set(Calendar.DAY_OF_MONTH, 1); | CalendarUtil.copyCalendar(start, end); |
abicelis/Remindy | app/src/main/java/ve/com/abicelis/remindy/model/Task.java | // Path: app/src/main/java/ve/com/abicelis/remindy/enums/ReminderType.java
// public enum ReminderType implements Serializable {
// NONE(R.string.reminder_type_none),
// ONE_TIME(R.string.reminder_type_one_time),
// REPEATING(R.string.reminder_type_repeating),
// LOCATION_BASED(R.string.reminder_type_location_based);
//
// private @StringRes
// int friendlyNameRes;
//
// ReminderType(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (ReminderType rt : values()) {
// friendlyValues.add(context.getResources().getString(rt.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskCategory.java
// public enum TaskCategory {
// BUSINESS(R.string.task_category_business, R.drawable.icon_category_business),
// PERSONAL(R.string.task_category_personal, R.drawable.icon_category_personal),
// HEALTH(R.string.task_category_health, R.drawable.icon_category_health),
// REPAIRS(R.string.task_category_repairs, R.drawable.icon_category_repairs),
// SHOPPING(R.string.task_category_shopping, R.drawable.icon_category_shopping);
//
// private @StringRes int friendlyNameRes;
// private @DrawableRes int iconRes;
//
// TaskCategory(@StringRes int friendlyNameRes, @DrawableRes int iconRes) {
// this.friendlyNameRes = friendlyNameRes;
// this.iconRes = iconRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
// public int getIconRes() {
// return iconRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskCategory tc : values()) {
// friendlyValues.add(context.getResources().getString(tc.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskStatus.java
// public enum TaskStatus implements Serializable {
// UNPROGRAMMED(R.string.task_status_unprogrammed),
// PROGRAMMED(R.string.task_status_programmed),
// DONE(R.string.task_status_done);
//
// private @StringRes
// int friendlyNameRes;
//
// TaskStatus(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskStatus ts : values()) {
// friendlyValues.add(context.getResources().getString(ts.friendlyNameRes));
// }
// return friendlyValues;
// }
//
// /*
// * PROGRAMMED = Tasks UNCOMPLETED by user. TaskStatus.ACTIVE + TaskStatus.OVERDUE
// * UNPROGRAMMED = Tasks UNCOMPLETED by user. Tasks with ReminderType=NONE
// * DONE = Tasks COMPLETED by user. doneDate != null
// * */
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/attachment/Attachment.java
// public abstract class Attachment implements Serializable {
// private int id;
// private int taskId;
//
// public Attachment() {} //id-less Constructor used when creating Attachments
// public Attachment(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract AttachmentType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
//
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/reminder/Reminder.java
// public abstract class Reminder implements Serializable {
//
// private int id;
// private int taskId;
//
// public Reminder(){
// this.id = -1;
// this.taskId = -1;
// }
//
// public Reminder(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract ReminderType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
// }
| import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.Toast;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import ve.com.abicelis.remindy.enums.ReminderType;
import ve.com.abicelis.remindy.enums.TaskCategory;
import ve.com.abicelis.remindy.enums.TaskStatus;
import ve.com.abicelis.remindy.model.attachment.Attachment;
import ve.com.abicelis.remindy.model.reminder.Reminder; | package ve.com.abicelis.remindy.model;
/**
* Created by abice on 3/3/2017.
*/
public class Task implements Serializable {
private int id; | // Path: app/src/main/java/ve/com/abicelis/remindy/enums/ReminderType.java
// public enum ReminderType implements Serializable {
// NONE(R.string.reminder_type_none),
// ONE_TIME(R.string.reminder_type_one_time),
// REPEATING(R.string.reminder_type_repeating),
// LOCATION_BASED(R.string.reminder_type_location_based);
//
// private @StringRes
// int friendlyNameRes;
//
// ReminderType(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (ReminderType rt : values()) {
// friendlyValues.add(context.getResources().getString(rt.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskCategory.java
// public enum TaskCategory {
// BUSINESS(R.string.task_category_business, R.drawable.icon_category_business),
// PERSONAL(R.string.task_category_personal, R.drawable.icon_category_personal),
// HEALTH(R.string.task_category_health, R.drawable.icon_category_health),
// REPAIRS(R.string.task_category_repairs, R.drawable.icon_category_repairs),
// SHOPPING(R.string.task_category_shopping, R.drawable.icon_category_shopping);
//
// private @StringRes int friendlyNameRes;
// private @DrawableRes int iconRes;
//
// TaskCategory(@StringRes int friendlyNameRes, @DrawableRes int iconRes) {
// this.friendlyNameRes = friendlyNameRes;
// this.iconRes = iconRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
// public int getIconRes() {
// return iconRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskCategory tc : values()) {
// friendlyValues.add(context.getResources().getString(tc.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskStatus.java
// public enum TaskStatus implements Serializable {
// UNPROGRAMMED(R.string.task_status_unprogrammed),
// PROGRAMMED(R.string.task_status_programmed),
// DONE(R.string.task_status_done);
//
// private @StringRes
// int friendlyNameRes;
//
// TaskStatus(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskStatus ts : values()) {
// friendlyValues.add(context.getResources().getString(ts.friendlyNameRes));
// }
// return friendlyValues;
// }
//
// /*
// * PROGRAMMED = Tasks UNCOMPLETED by user. TaskStatus.ACTIVE + TaskStatus.OVERDUE
// * UNPROGRAMMED = Tasks UNCOMPLETED by user. Tasks with ReminderType=NONE
// * DONE = Tasks COMPLETED by user. doneDate != null
// * */
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/attachment/Attachment.java
// public abstract class Attachment implements Serializable {
// private int id;
// private int taskId;
//
// public Attachment() {} //id-less Constructor used when creating Attachments
// public Attachment(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract AttachmentType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
//
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/reminder/Reminder.java
// public abstract class Reminder implements Serializable {
//
// private int id;
// private int taskId;
//
// public Reminder(){
// this.id = -1;
// this.taskId = -1;
// }
//
// public Reminder(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract ReminderType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
// }
// Path: app/src/main/java/ve/com/abicelis/remindy/model/Task.java
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.Toast;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import ve.com.abicelis.remindy.enums.ReminderType;
import ve.com.abicelis.remindy.enums.TaskCategory;
import ve.com.abicelis.remindy.enums.TaskStatus;
import ve.com.abicelis.remindy.model.attachment.Attachment;
import ve.com.abicelis.remindy.model.reminder.Reminder;
package ve.com.abicelis.remindy.model;
/**
* Created by abice on 3/3/2017.
*/
public class Task implements Serializable {
private int id; | private TaskStatus status; |
abicelis/Remindy | app/src/main/java/ve/com/abicelis/remindy/model/Task.java | // Path: app/src/main/java/ve/com/abicelis/remindy/enums/ReminderType.java
// public enum ReminderType implements Serializable {
// NONE(R.string.reminder_type_none),
// ONE_TIME(R.string.reminder_type_one_time),
// REPEATING(R.string.reminder_type_repeating),
// LOCATION_BASED(R.string.reminder_type_location_based);
//
// private @StringRes
// int friendlyNameRes;
//
// ReminderType(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (ReminderType rt : values()) {
// friendlyValues.add(context.getResources().getString(rt.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskCategory.java
// public enum TaskCategory {
// BUSINESS(R.string.task_category_business, R.drawable.icon_category_business),
// PERSONAL(R.string.task_category_personal, R.drawable.icon_category_personal),
// HEALTH(R.string.task_category_health, R.drawable.icon_category_health),
// REPAIRS(R.string.task_category_repairs, R.drawable.icon_category_repairs),
// SHOPPING(R.string.task_category_shopping, R.drawable.icon_category_shopping);
//
// private @StringRes int friendlyNameRes;
// private @DrawableRes int iconRes;
//
// TaskCategory(@StringRes int friendlyNameRes, @DrawableRes int iconRes) {
// this.friendlyNameRes = friendlyNameRes;
// this.iconRes = iconRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
// public int getIconRes() {
// return iconRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskCategory tc : values()) {
// friendlyValues.add(context.getResources().getString(tc.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskStatus.java
// public enum TaskStatus implements Serializable {
// UNPROGRAMMED(R.string.task_status_unprogrammed),
// PROGRAMMED(R.string.task_status_programmed),
// DONE(R.string.task_status_done);
//
// private @StringRes
// int friendlyNameRes;
//
// TaskStatus(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskStatus ts : values()) {
// friendlyValues.add(context.getResources().getString(ts.friendlyNameRes));
// }
// return friendlyValues;
// }
//
// /*
// * PROGRAMMED = Tasks UNCOMPLETED by user. TaskStatus.ACTIVE + TaskStatus.OVERDUE
// * UNPROGRAMMED = Tasks UNCOMPLETED by user. Tasks with ReminderType=NONE
// * DONE = Tasks COMPLETED by user. doneDate != null
// * */
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/attachment/Attachment.java
// public abstract class Attachment implements Serializable {
// private int id;
// private int taskId;
//
// public Attachment() {} //id-less Constructor used when creating Attachments
// public Attachment(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract AttachmentType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
//
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/reminder/Reminder.java
// public abstract class Reminder implements Serializable {
//
// private int id;
// private int taskId;
//
// public Reminder(){
// this.id = -1;
// this.taskId = -1;
// }
//
// public Reminder(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract ReminderType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
// }
| import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.Toast;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import ve.com.abicelis.remindy.enums.ReminderType;
import ve.com.abicelis.remindy.enums.TaskCategory;
import ve.com.abicelis.remindy.enums.TaskStatus;
import ve.com.abicelis.remindy.model.attachment.Attachment;
import ve.com.abicelis.remindy.model.reminder.Reminder; | package ve.com.abicelis.remindy.model;
/**
* Created by abice on 3/3/2017.
*/
public class Task implements Serializable {
private int id;
private TaskStatus status;
private String title;
private String description; | // Path: app/src/main/java/ve/com/abicelis/remindy/enums/ReminderType.java
// public enum ReminderType implements Serializable {
// NONE(R.string.reminder_type_none),
// ONE_TIME(R.string.reminder_type_one_time),
// REPEATING(R.string.reminder_type_repeating),
// LOCATION_BASED(R.string.reminder_type_location_based);
//
// private @StringRes
// int friendlyNameRes;
//
// ReminderType(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (ReminderType rt : values()) {
// friendlyValues.add(context.getResources().getString(rt.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskCategory.java
// public enum TaskCategory {
// BUSINESS(R.string.task_category_business, R.drawable.icon_category_business),
// PERSONAL(R.string.task_category_personal, R.drawable.icon_category_personal),
// HEALTH(R.string.task_category_health, R.drawable.icon_category_health),
// REPAIRS(R.string.task_category_repairs, R.drawable.icon_category_repairs),
// SHOPPING(R.string.task_category_shopping, R.drawable.icon_category_shopping);
//
// private @StringRes int friendlyNameRes;
// private @DrawableRes int iconRes;
//
// TaskCategory(@StringRes int friendlyNameRes, @DrawableRes int iconRes) {
// this.friendlyNameRes = friendlyNameRes;
// this.iconRes = iconRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
// public int getIconRes() {
// return iconRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskCategory tc : values()) {
// friendlyValues.add(context.getResources().getString(tc.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskStatus.java
// public enum TaskStatus implements Serializable {
// UNPROGRAMMED(R.string.task_status_unprogrammed),
// PROGRAMMED(R.string.task_status_programmed),
// DONE(R.string.task_status_done);
//
// private @StringRes
// int friendlyNameRes;
//
// TaskStatus(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskStatus ts : values()) {
// friendlyValues.add(context.getResources().getString(ts.friendlyNameRes));
// }
// return friendlyValues;
// }
//
// /*
// * PROGRAMMED = Tasks UNCOMPLETED by user. TaskStatus.ACTIVE + TaskStatus.OVERDUE
// * UNPROGRAMMED = Tasks UNCOMPLETED by user. Tasks with ReminderType=NONE
// * DONE = Tasks COMPLETED by user. doneDate != null
// * */
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/attachment/Attachment.java
// public abstract class Attachment implements Serializable {
// private int id;
// private int taskId;
//
// public Attachment() {} //id-less Constructor used when creating Attachments
// public Attachment(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract AttachmentType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
//
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/reminder/Reminder.java
// public abstract class Reminder implements Serializable {
//
// private int id;
// private int taskId;
//
// public Reminder(){
// this.id = -1;
// this.taskId = -1;
// }
//
// public Reminder(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract ReminderType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
// }
// Path: app/src/main/java/ve/com/abicelis/remindy/model/Task.java
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.Toast;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import ve.com.abicelis.remindy.enums.ReminderType;
import ve.com.abicelis.remindy.enums.TaskCategory;
import ve.com.abicelis.remindy.enums.TaskStatus;
import ve.com.abicelis.remindy.model.attachment.Attachment;
import ve.com.abicelis.remindy.model.reminder.Reminder;
package ve.com.abicelis.remindy.model;
/**
* Created by abice on 3/3/2017.
*/
public class Task implements Serializable {
private int id;
private TaskStatus status;
private String title;
private String description; | private TaskCategory category; |
abicelis/Remindy | app/src/main/java/ve/com/abicelis/remindy/model/Task.java | // Path: app/src/main/java/ve/com/abicelis/remindy/enums/ReminderType.java
// public enum ReminderType implements Serializable {
// NONE(R.string.reminder_type_none),
// ONE_TIME(R.string.reminder_type_one_time),
// REPEATING(R.string.reminder_type_repeating),
// LOCATION_BASED(R.string.reminder_type_location_based);
//
// private @StringRes
// int friendlyNameRes;
//
// ReminderType(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (ReminderType rt : values()) {
// friendlyValues.add(context.getResources().getString(rt.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskCategory.java
// public enum TaskCategory {
// BUSINESS(R.string.task_category_business, R.drawable.icon_category_business),
// PERSONAL(R.string.task_category_personal, R.drawable.icon_category_personal),
// HEALTH(R.string.task_category_health, R.drawable.icon_category_health),
// REPAIRS(R.string.task_category_repairs, R.drawable.icon_category_repairs),
// SHOPPING(R.string.task_category_shopping, R.drawable.icon_category_shopping);
//
// private @StringRes int friendlyNameRes;
// private @DrawableRes int iconRes;
//
// TaskCategory(@StringRes int friendlyNameRes, @DrawableRes int iconRes) {
// this.friendlyNameRes = friendlyNameRes;
// this.iconRes = iconRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
// public int getIconRes() {
// return iconRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskCategory tc : values()) {
// friendlyValues.add(context.getResources().getString(tc.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskStatus.java
// public enum TaskStatus implements Serializable {
// UNPROGRAMMED(R.string.task_status_unprogrammed),
// PROGRAMMED(R.string.task_status_programmed),
// DONE(R.string.task_status_done);
//
// private @StringRes
// int friendlyNameRes;
//
// TaskStatus(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskStatus ts : values()) {
// friendlyValues.add(context.getResources().getString(ts.friendlyNameRes));
// }
// return friendlyValues;
// }
//
// /*
// * PROGRAMMED = Tasks UNCOMPLETED by user. TaskStatus.ACTIVE + TaskStatus.OVERDUE
// * UNPROGRAMMED = Tasks UNCOMPLETED by user. Tasks with ReminderType=NONE
// * DONE = Tasks COMPLETED by user. doneDate != null
// * */
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/attachment/Attachment.java
// public abstract class Attachment implements Serializable {
// private int id;
// private int taskId;
//
// public Attachment() {} //id-less Constructor used when creating Attachments
// public Attachment(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract AttachmentType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
//
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/reminder/Reminder.java
// public abstract class Reminder implements Serializable {
//
// private int id;
// private int taskId;
//
// public Reminder(){
// this.id = -1;
// this.taskId = -1;
// }
//
// public Reminder(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract ReminderType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
// }
| import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.Toast;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import ve.com.abicelis.remindy.enums.ReminderType;
import ve.com.abicelis.remindy.enums.TaskCategory;
import ve.com.abicelis.remindy.enums.TaskStatus;
import ve.com.abicelis.remindy.model.attachment.Attachment;
import ve.com.abicelis.remindy.model.reminder.Reminder; | package ve.com.abicelis.remindy.model;
/**
* Created by abice on 3/3/2017.
*/
public class Task implements Serializable {
private int id;
private TaskStatus status;
private String title;
private String description;
private TaskCategory category; | // Path: app/src/main/java/ve/com/abicelis/remindy/enums/ReminderType.java
// public enum ReminderType implements Serializable {
// NONE(R.string.reminder_type_none),
// ONE_TIME(R.string.reminder_type_one_time),
// REPEATING(R.string.reminder_type_repeating),
// LOCATION_BASED(R.string.reminder_type_location_based);
//
// private @StringRes
// int friendlyNameRes;
//
// ReminderType(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (ReminderType rt : values()) {
// friendlyValues.add(context.getResources().getString(rt.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskCategory.java
// public enum TaskCategory {
// BUSINESS(R.string.task_category_business, R.drawable.icon_category_business),
// PERSONAL(R.string.task_category_personal, R.drawable.icon_category_personal),
// HEALTH(R.string.task_category_health, R.drawable.icon_category_health),
// REPAIRS(R.string.task_category_repairs, R.drawable.icon_category_repairs),
// SHOPPING(R.string.task_category_shopping, R.drawable.icon_category_shopping);
//
// private @StringRes int friendlyNameRes;
// private @DrawableRes int iconRes;
//
// TaskCategory(@StringRes int friendlyNameRes, @DrawableRes int iconRes) {
// this.friendlyNameRes = friendlyNameRes;
// this.iconRes = iconRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
// public int getIconRes() {
// return iconRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskCategory tc : values()) {
// friendlyValues.add(context.getResources().getString(tc.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskStatus.java
// public enum TaskStatus implements Serializable {
// UNPROGRAMMED(R.string.task_status_unprogrammed),
// PROGRAMMED(R.string.task_status_programmed),
// DONE(R.string.task_status_done);
//
// private @StringRes
// int friendlyNameRes;
//
// TaskStatus(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskStatus ts : values()) {
// friendlyValues.add(context.getResources().getString(ts.friendlyNameRes));
// }
// return friendlyValues;
// }
//
// /*
// * PROGRAMMED = Tasks UNCOMPLETED by user. TaskStatus.ACTIVE + TaskStatus.OVERDUE
// * UNPROGRAMMED = Tasks UNCOMPLETED by user. Tasks with ReminderType=NONE
// * DONE = Tasks COMPLETED by user. doneDate != null
// * */
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/attachment/Attachment.java
// public abstract class Attachment implements Serializable {
// private int id;
// private int taskId;
//
// public Attachment() {} //id-less Constructor used when creating Attachments
// public Attachment(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract AttachmentType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
//
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/reminder/Reminder.java
// public abstract class Reminder implements Serializable {
//
// private int id;
// private int taskId;
//
// public Reminder(){
// this.id = -1;
// this.taskId = -1;
// }
//
// public Reminder(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract ReminderType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
// }
// Path: app/src/main/java/ve/com/abicelis/remindy/model/Task.java
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.Toast;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import ve.com.abicelis.remindy.enums.ReminderType;
import ve.com.abicelis.remindy.enums.TaskCategory;
import ve.com.abicelis.remindy.enums.TaskStatus;
import ve.com.abicelis.remindy.model.attachment.Attachment;
import ve.com.abicelis.remindy.model.reminder.Reminder;
package ve.com.abicelis.remindy.model;
/**
* Created by abice on 3/3/2017.
*/
public class Task implements Serializable {
private int id;
private TaskStatus status;
private String title;
private String description;
private TaskCategory category; | private ReminderType reminderType; |
abicelis/Remindy | app/src/main/java/ve/com/abicelis/remindy/model/Task.java | // Path: app/src/main/java/ve/com/abicelis/remindy/enums/ReminderType.java
// public enum ReminderType implements Serializable {
// NONE(R.string.reminder_type_none),
// ONE_TIME(R.string.reminder_type_one_time),
// REPEATING(R.string.reminder_type_repeating),
// LOCATION_BASED(R.string.reminder_type_location_based);
//
// private @StringRes
// int friendlyNameRes;
//
// ReminderType(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (ReminderType rt : values()) {
// friendlyValues.add(context.getResources().getString(rt.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskCategory.java
// public enum TaskCategory {
// BUSINESS(R.string.task_category_business, R.drawable.icon_category_business),
// PERSONAL(R.string.task_category_personal, R.drawable.icon_category_personal),
// HEALTH(R.string.task_category_health, R.drawable.icon_category_health),
// REPAIRS(R.string.task_category_repairs, R.drawable.icon_category_repairs),
// SHOPPING(R.string.task_category_shopping, R.drawable.icon_category_shopping);
//
// private @StringRes int friendlyNameRes;
// private @DrawableRes int iconRes;
//
// TaskCategory(@StringRes int friendlyNameRes, @DrawableRes int iconRes) {
// this.friendlyNameRes = friendlyNameRes;
// this.iconRes = iconRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
// public int getIconRes() {
// return iconRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskCategory tc : values()) {
// friendlyValues.add(context.getResources().getString(tc.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskStatus.java
// public enum TaskStatus implements Serializable {
// UNPROGRAMMED(R.string.task_status_unprogrammed),
// PROGRAMMED(R.string.task_status_programmed),
// DONE(R.string.task_status_done);
//
// private @StringRes
// int friendlyNameRes;
//
// TaskStatus(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskStatus ts : values()) {
// friendlyValues.add(context.getResources().getString(ts.friendlyNameRes));
// }
// return friendlyValues;
// }
//
// /*
// * PROGRAMMED = Tasks UNCOMPLETED by user. TaskStatus.ACTIVE + TaskStatus.OVERDUE
// * UNPROGRAMMED = Tasks UNCOMPLETED by user. Tasks with ReminderType=NONE
// * DONE = Tasks COMPLETED by user. doneDate != null
// * */
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/attachment/Attachment.java
// public abstract class Attachment implements Serializable {
// private int id;
// private int taskId;
//
// public Attachment() {} //id-less Constructor used when creating Attachments
// public Attachment(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract AttachmentType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
//
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/reminder/Reminder.java
// public abstract class Reminder implements Serializable {
//
// private int id;
// private int taskId;
//
// public Reminder(){
// this.id = -1;
// this.taskId = -1;
// }
//
// public Reminder(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract ReminderType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
// }
| import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.Toast;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import ve.com.abicelis.remindy.enums.ReminderType;
import ve.com.abicelis.remindy.enums.TaskCategory;
import ve.com.abicelis.remindy.enums.TaskStatus;
import ve.com.abicelis.remindy.model.attachment.Attachment;
import ve.com.abicelis.remindy.model.reminder.Reminder; | package ve.com.abicelis.remindy.model;
/**
* Created by abice on 3/3/2017.
*/
public class Task implements Serializable {
private int id;
private TaskStatus status;
private String title;
private String description;
private TaskCategory category;
private ReminderType reminderType; | // Path: app/src/main/java/ve/com/abicelis/remindy/enums/ReminderType.java
// public enum ReminderType implements Serializable {
// NONE(R.string.reminder_type_none),
// ONE_TIME(R.string.reminder_type_one_time),
// REPEATING(R.string.reminder_type_repeating),
// LOCATION_BASED(R.string.reminder_type_location_based);
//
// private @StringRes
// int friendlyNameRes;
//
// ReminderType(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (ReminderType rt : values()) {
// friendlyValues.add(context.getResources().getString(rt.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskCategory.java
// public enum TaskCategory {
// BUSINESS(R.string.task_category_business, R.drawable.icon_category_business),
// PERSONAL(R.string.task_category_personal, R.drawable.icon_category_personal),
// HEALTH(R.string.task_category_health, R.drawable.icon_category_health),
// REPAIRS(R.string.task_category_repairs, R.drawable.icon_category_repairs),
// SHOPPING(R.string.task_category_shopping, R.drawable.icon_category_shopping);
//
// private @StringRes int friendlyNameRes;
// private @DrawableRes int iconRes;
//
// TaskCategory(@StringRes int friendlyNameRes, @DrawableRes int iconRes) {
// this.friendlyNameRes = friendlyNameRes;
// this.iconRes = iconRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
// public int getIconRes() {
// return iconRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskCategory tc : values()) {
// friendlyValues.add(context.getResources().getString(tc.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskStatus.java
// public enum TaskStatus implements Serializable {
// UNPROGRAMMED(R.string.task_status_unprogrammed),
// PROGRAMMED(R.string.task_status_programmed),
// DONE(R.string.task_status_done);
//
// private @StringRes
// int friendlyNameRes;
//
// TaskStatus(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskStatus ts : values()) {
// friendlyValues.add(context.getResources().getString(ts.friendlyNameRes));
// }
// return friendlyValues;
// }
//
// /*
// * PROGRAMMED = Tasks UNCOMPLETED by user. TaskStatus.ACTIVE + TaskStatus.OVERDUE
// * UNPROGRAMMED = Tasks UNCOMPLETED by user. Tasks with ReminderType=NONE
// * DONE = Tasks COMPLETED by user. doneDate != null
// * */
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/attachment/Attachment.java
// public abstract class Attachment implements Serializable {
// private int id;
// private int taskId;
//
// public Attachment() {} //id-less Constructor used when creating Attachments
// public Attachment(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract AttachmentType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
//
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/reminder/Reminder.java
// public abstract class Reminder implements Serializable {
//
// private int id;
// private int taskId;
//
// public Reminder(){
// this.id = -1;
// this.taskId = -1;
// }
//
// public Reminder(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract ReminderType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
// }
// Path: app/src/main/java/ve/com/abicelis/remindy/model/Task.java
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.Toast;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import ve.com.abicelis.remindy.enums.ReminderType;
import ve.com.abicelis.remindy.enums.TaskCategory;
import ve.com.abicelis.remindy.enums.TaskStatus;
import ve.com.abicelis.remindy.model.attachment.Attachment;
import ve.com.abicelis.remindy.model.reminder.Reminder;
package ve.com.abicelis.remindy.model;
/**
* Created by abice on 3/3/2017.
*/
public class Task implements Serializable {
private int id;
private TaskStatus status;
private String title;
private String description;
private TaskCategory category;
private ReminderType reminderType; | private Reminder reminder; |
abicelis/Remindy | app/src/main/java/ve/com/abicelis/remindy/model/Task.java | // Path: app/src/main/java/ve/com/abicelis/remindy/enums/ReminderType.java
// public enum ReminderType implements Serializable {
// NONE(R.string.reminder_type_none),
// ONE_TIME(R.string.reminder_type_one_time),
// REPEATING(R.string.reminder_type_repeating),
// LOCATION_BASED(R.string.reminder_type_location_based);
//
// private @StringRes
// int friendlyNameRes;
//
// ReminderType(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (ReminderType rt : values()) {
// friendlyValues.add(context.getResources().getString(rt.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskCategory.java
// public enum TaskCategory {
// BUSINESS(R.string.task_category_business, R.drawable.icon_category_business),
// PERSONAL(R.string.task_category_personal, R.drawable.icon_category_personal),
// HEALTH(R.string.task_category_health, R.drawable.icon_category_health),
// REPAIRS(R.string.task_category_repairs, R.drawable.icon_category_repairs),
// SHOPPING(R.string.task_category_shopping, R.drawable.icon_category_shopping);
//
// private @StringRes int friendlyNameRes;
// private @DrawableRes int iconRes;
//
// TaskCategory(@StringRes int friendlyNameRes, @DrawableRes int iconRes) {
// this.friendlyNameRes = friendlyNameRes;
// this.iconRes = iconRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
// public int getIconRes() {
// return iconRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskCategory tc : values()) {
// friendlyValues.add(context.getResources().getString(tc.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskStatus.java
// public enum TaskStatus implements Serializable {
// UNPROGRAMMED(R.string.task_status_unprogrammed),
// PROGRAMMED(R.string.task_status_programmed),
// DONE(R.string.task_status_done);
//
// private @StringRes
// int friendlyNameRes;
//
// TaskStatus(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskStatus ts : values()) {
// friendlyValues.add(context.getResources().getString(ts.friendlyNameRes));
// }
// return friendlyValues;
// }
//
// /*
// * PROGRAMMED = Tasks UNCOMPLETED by user. TaskStatus.ACTIVE + TaskStatus.OVERDUE
// * UNPROGRAMMED = Tasks UNCOMPLETED by user. Tasks with ReminderType=NONE
// * DONE = Tasks COMPLETED by user. doneDate != null
// * */
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/attachment/Attachment.java
// public abstract class Attachment implements Serializable {
// private int id;
// private int taskId;
//
// public Attachment() {} //id-less Constructor used when creating Attachments
// public Attachment(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract AttachmentType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
//
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/reminder/Reminder.java
// public abstract class Reminder implements Serializable {
//
// private int id;
// private int taskId;
//
// public Reminder(){
// this.id = -1;
// this.taskId = -1;
// }
//
// public Reminder(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract ReminderType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
// }
| import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.Toast;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import ve.com.abicelis.remindy.enums.ReminderType;
import ve.com.abicelis.remindy.enums.TaskCategory;
import ve.com.abicelis.remindy.enums.TaskStatus;
import ve.com.abicelis.remindy.model.attachment.Attachment;
import ve.com.abicelis.remindy.model.reminder.Reminder; | package ve.com.abicelis.remindy.model;
/**
* Created by abice on 3/3/2017.
*/
public class Task implements Serializable {
private int id;
private TaskStatus status;
private String title;
private String description;
private TaskCategory category;
private ReminderType reminderType;
private Reminder reminder;
private Calendar doneDate; | // Path: app/src/main/java/ve/com/abicelis/remindy/enums/ReminderType.java
// public enum ReminderType implements Serializable {
// NONE(R.string.reminder_type_none),
// ONE_TIME(R.string.reminder_type_one_time),
// REPEATING(R.string.reminder_type_repeating),
// LOCATION_BASED(R.string.reminder_type_location_based);
//
// private @StringRes
// int friendlyNameRes;
//
// ReminderType(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (ReminderType rt : values()) {
// friendlyValues.add(context.getResources().getString(rt.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskCategory.java
// public enum TaskCategory {
// BUSINESS(R.string.task_category_business, R.drawable.icon_category_business),
// PERSONAL(R.string.task_category_personal, R.drawable.icon_category_personal),
// HEALTH(R.string.task_category_health, R.drawable.icon_category_health),
// REPAIRS(R.string.task_category_repairs, R.drawable.icon_category_repairs),
// SHOPPING(R.string.task_category_shopping, R.drawable.icon_category_shopping);
//
// private @StringRes int friendlyNameRes;
// private @DrawableRes int iconRes;
//
// TaskCategory(@StringRes int friendlyNameRes, @DrawableRes int iconRes) {
// this.friendlyNameRes = friendlyNameRes;
// this.iconRes = iconRes;
//
// }
//
// public int getFriendlyNameRes() {
// return friendlyNameRes;
// }
// public int getIconRes() {
// return iconRes;
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskCategory tc : values()) {
// friendlyValues.add(context.getResources().getString(tc.friendlyNameRes));
// }
// return friendlyValues;
// }
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/enums/TaskStatus.java
// public enum TaskStatus implements Serializable {
// UNPROGRAMMED(R.string.task_status_unprogrammed),
// PROGRAMMED(R.string.task_status_programmed),
// DONE(R.string.task_status_done);
//
// private @StringRes
// int friendlyNameRes;
//
// TaskStatus(@StringRes int friendlyNameRes) {
// this.friendlyNameRes = friendlyNameRes;
//
// }
//
// public static List<String> getFriendlyValues(Context context) {
// List<String> friendlyValues = new ArrayList<>();
// for (TaskStatus ts : values()) {
// friendlyValues.add(context.getResources().getString(ts.friendlyNameRes));
// }
// return friendlyValues;
// }
//
// /*
// * PROGRAMMED = Tasks UNCOMPLETED by user. TaskStatus.ACTIVE + TaskStatus.OVERDUE
// * UNPROGRAMMED = Tasks UNCOMPLETED by user. Tasks with ReminderType=NONE
// * DONE = Tasks COMPLETED by user. doneDate != null
// * */
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/attachment/Attachment.java
// public abstract class Attachment implements Serializable {
// private int id;
// private int taskId;
//
// public Attachment() {} //id-less Constructor used when creating Attachments
// public Attachment(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract AttachmentType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
//
// }
//
// Path: app/src/main/java/ve/com/abicelis/remindy/model/reminder/Reminder.java
// public abstract class Reminder implements Serializable {
//
// private int id;
// private int taskId;
//
// public Reminder(){
// this.id = -1;
// this.taskId = -1;
// }
//
// public Reminder(int id, int taskId) {
// this.id = id;
// this.taskId = taskId;
// }
//
// public abstract ReminderType getType();
//
// public int getId() {
// return id;
// }
// public void setId(int id) {
// this.id = id;
// }
//
// public int getTaskId() {
// return taskId;
// }
// public void setTaskId(int taskId) {
// this.taskId = taskId;
// }
// }
// Path: app/src/main/java/ve/com/abicelis/remindy/model/Task.java
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.Toast;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import ve.com.abicelis.remindy.enums.ReminderType;
import ve.com.abicelis.remindy.enums.TaskCategory;
import ve.com.abicelis.remindy.enums.TaskStatus;
import ve.com.abicelis.remindy.model.attachment.Attachment;
import ve.com.abicelis.remindy.model.reminder.Reminder;
package ve.com.abicelis.remindy.model;
/**
* Created by abice on 3/3/2017.
*/
public class Task implements Serializable {
private int id;
private TaskStatus status;
private String title;
private String description;
private TaskCategory category;
private ReminderType reminderType;
private Reminder reminder;
private Calendar doneDate; | private ArrayList<Attachment> attachments; |
saveendhiman/XMPPSample_Studio | app/src/main/java/com/xmpp/chat/util/SettingsUtil.java | // Path: app/src/main/java/com/xmpp/chat/dao/EmojiItem.java
// public class EmojiItem {
// public int id;
// public String emojiText;
// public Integer emojiGroup;
// public Drawable emojiDrawable;
// }
| import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import com.xmpp.chat.dao.EmojiItem;
import java.util.ArrayList; | package com.xmpp.chat.util;
public class SettingsUtil {
private static SharedPreferences getPrefs(Context context) {
return PreferenceManager.getDefaultSharedPreferences(context);
}
public static ArrayList<Integer> getHistoryItems(Context context) {
ArrayList<Integer> result = new ArrayList<Integer>();
String emojis = getPrefs(context).getString("emojis", "");
if (emojis.equals("")) {
return result;
}
String[] ids = emojis.split(",");
for (int i = 0; i < ids.length; i++) {
result.add(Integer.parseInt(ids[i]));
}
return result;
}
| // Path: app/src/main/java/com/xmpp/chat/dao/EmojiItem.java
// public class EmojiItem {
// public int id;
// public String emojiText;
// public Integer emojiGroup;
// public Drawable emojiDrawable;
// }
// Path: app/src/main/java/com/xmpp/chat/util/SettingsUtil.java
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import com.xmpp.chat.dao.EmojiItem;
import java.util.ArrayList;
package com.xmpp.chat.util;
public class SettingsUtil {
private static SharedPreferences getPrefs(Context context) {
return PreferenceManager.getDefaultSharedPreferences(context);
}
public static ArrayList<Integer> getHistoryItems(Context context) {
ArrayList<Integer> result = new ArrayList<Integer>();
String emojis = getPrefs(context).getString("emojis", "");
if (emojis.equals("")) {
return result;
}
String[] ids = emojis.split(",");
for (int i = 0; i < ids.length; i++) {
result.add(Integer.parseInt(ids[i]));
}
return result;
}
| public static void setHistoryItems(Context context, ArrayList<EmojiItem> history) { |
saveendhiman/XMPPSample_Studio | app/src/main/java/com/xmpp/chat/data/AppSettings.java | // Path: app/src/main/java/com/xmpp/chat/dao/StatusItem.java
// public class StatusItem {
//
// public String status = "Using Live!";
// public int mood = 0;
//
// public static StatusItem fromJSON(String json) {
// StatusItem result = new StatusItem();
// if (json == null) {
// return result;
// }
// try {
// JSONObject js = new JSONObject(json);
// result.status = js.getString("status");
// result.mood = js.getInt("mood");
// } catch (JSONException e) {
// result.status = json;
// }
// return result;
// }
//
// public String toJSON() {
// JSONObject json = new JSONObject();
// try {
// json.put("status", status);
// json.put("mood", mood);
// } catch (JSONException e) {
// }
// return json.toString();
// }
// }
| import org.json.JSONException;
import org.json.JSONObject;
import com.xmpp.chat.dao.StatusItem;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager; | package com.xmpp.chat.data;
public class AppSettings {
public static String getPassword(Context paramContext) {
return getPrefs(paramContext).getString("password", null);
}
public static void setPassword(Context paramContext, String paramString) {
getPrefs(paramContext).edit().putString("password", paramString).commit();
}
private static SharedPreferences getPrefs(Context paramContext) {
return PreferenceManager.getDefaultSharedPreferences(paramContext);
}
public static String getUser(Context context) {
return getPrefs(context).getString("user", null);
}
public static void setUser(Context context, String paramString) {
getPrefs(context).edit().putString("user", paramString).commit();
}
public static String getUserName(Context context) {
return getPrefs(context).getString("username", null);
}
public static void setUserName(Context context, String paramString) {
getPrefs(context).edit().putString("username", paramString).commit();
}
public static long getGroupLastRead(Context context, String chatItem) {
return getPrefs(context).getLong("grouplastread_" + chatItem, 0);
}
public static void setGroupLastRead(Context context, String chatItem, long lastread) {
getPrefs(context).edit().putLong("grouplastread_" + chatItem, lastread).commit();
}
| // Path: app/src/main/java/com/xmpp/chat/dao/StatusItem.java
// public class StatusItem {
//
// public String status = "Using Live!";
// public int mood = 0;
//
// public static StatusItem fromJSON(String json) {
// StatusItem result = new StatusItem();
// if (json == null) {
// return result;
// }
// try {
// JSONObject js = new JSONObject(json);
// result.status = js.getString("status");
// result.mood = js.getInt("mood");
// } catch (JSONException e) {
// result.status = json;
// }
// return result;
// }
//
// public String toJSON() {
// JSONObject json = new JSONObject();
// try {
// json.put("status", status);
// json.put("mood", mood);
// } catch (JSONException e) {
// }
// return json.toString();
// }
// }
// Path: app/src/main/java/com/xmpp/chat/data/AppSettings.java
import org.json.JSONException;
import org.json.JSONObject;
import com.xmpp.chat.dao.StatusItem;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
package com.xmpp.chat.data;
public class AppSettings {
public static String getPassword(Context paramContext) {
return getPrefs(paramContext).getString("password", null);
}
public static void setPassword(Context paramContext, String paramString) {
getPrefs(paramContext).edit().putString("password", paramString).commit();
}
private static SharedPreferences getPrefs(Context paramContext) {
return PreferenceManager.getDefaultSharedPreferences(paramContext);
}
public static String getUser(Context context) {
return getPrefs(context).getString("user", null);
}
public static void setUser(Context context, String paramString) {
getPrefs(context).edit().putString("user", paramString).commit();
}
public static String getUserName(Context context) {
return getPrefs(context).getString("username", null);
}
public static void setUserName(Context context, String paramString) {
getPrefs(context).edit().putString("username", paramString).commit();
}
public static long getGroupLastRead(Context context, String chatItem) {
return getPrefs(context).getLong("grouplastread_" + chatItem, 0);
}
public static void setGroupLastRead(Context context, String chatItem, long lastread) {
getPrefs(context).edit().putLong("grouplastread_" + chatItem, lastread).commit();
}
| public static StatusItem getStatus(Context context) { |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java | // Path: app/src/main/java/net/liang/androidbaseapplication/data/local/Test1LocalDataSource.java
// public class Test1LocalDataSource implements Test1Api {
//
// @Override
// public List<String> testGet() {
//
// List<String> list = new ArrayList<>();
// list.add("数据源一:1");
// list.add("数据源一:2");
// list.add("数据源一:3");
// list.add("数据源一:4");
// list.add("数据源一:5");
// list.add("数据源一:6");
// list.add("数据源一:7");
// list.add("数据源一:8");
// return list;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/remote/Test1RemoteDataSource.java
// public class Test1RemoteDataSource implements Test1Api {
//
// @Override
// public List<String> testGet() {
// return null;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/network/Test1Api.java
// public interface Test1Api {
// /**
// * 测试接口
// */
// List<String> testGet();
// }
| import net.liang.androidbaseapplication.dagger.scope.Local;
import net.liang.androidbaseapplication.dagger.scope.Remote;
import net.liang.androidbaseapplication.data.local.Test1LocalDataSource;
import net.liang.androidbaseapplication.data.remote.Test1RemoteDataSource;
import net.liang.androidbaseapplication.network.Test1Api;
import java.util.List;
import javax.inject.Inject; | package net.liang.androidbaseapplication.data.repository;
/**
* 数据管理仓库,控制选择使用remote数据还是local数据(SP、数据库、缓存)
*/
public class Test1Repository implements Test1Api {
private final Test1Api mTest1RemoteDataSource;
private final Test1Api mTest1LocalDataSource;
@Inject | // Path: app/src/main/java/net/liang/androidbaseapplication/data/local/Test1LocalDataSource.java
// public class Test1LocalDataSource implements Test1Api {
//
// @Override
// public List<String> testGet() {
//
// List<String> list = new ArrayList<>();
// list.add("数据源一:1");
// list.add("数据源一:2");
// list.add("数据源一:3");
// list.add("数据源一:4");
// list.add("数据源一:5");
// list.add("数据源一:6");
// list.add("数据源一:7");
// list.add("数据源一:8");
// return list;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/remote/Test1RemoteDataSource.java
// public class Test1RemoteDataSource implements Test1Api {
//
// @Override
// public List<String> testGet() {
// return null;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/network/Test1Api.java
// public interface Test1Api {
// /**
// * 测试接口
// */
// List<String> testGet();
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
import net.liang.androidbaseapplication.dagger.scope.Local;
import net.liang.androidbaseapplication.dagger.scope.Remote;
import net.liang.androidbaseapplication.data.local.Test1LocalDataSource;
import net.liang.androidbaseapplication.data.remote.Test1RemoteDataSource;
import net.liang.androidbaseapplication.network.Test1Api;
import java.util.List;
import javax.inject.Inject;
package net.liang.androidbaseapplication.data.repository;
/**
* 数据管理仓库,控制选择使用remote数据还是local数据(SP、数据库、缓存)
*/
public class Test1Repository implements Test1Api {
private final Test1Api mTest1RemoteDataSource;
private final Test1Api mTest1LocalDataSource;
@Inject | public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) { |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java | // Path: app/src/main/java/net/liang/androidbaseapplication/data/local/Test1LocalDataSource.java
// public class Test1LocalDataSource implements Test1Api {
//
// @Override
// public List<String> testGet() {
//
// List<String> list = new ArrayList<>();
// list.add("数据源一:1");
// list.add("数据源一:2");
// list.add("数据源一:3");
// list.add("数据源一:4");
// list.add("数据源一:5");
// list.add("数据源一:6");
// list.add("数据源一:7");
// list.add("数据源一:8");
// return list;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/remote/Test1RemoteDataSource.java
// public class Test1RemoteDataSource implements Test1Api {
//
// @Override
// public List<String> testGet() {
// return null;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/network/Test1Api.java
// public interface Test1Api {
// /**
// * 测试接口
// */
// List<String> testGet();
// }
| import net.liang.androidbaseapplication.dagger.scope.Local;
import net.liang.androidbaseapplication.dagger.scope.Remote;
import net.liang.androidbaseapplication.data.local.Test1LocalDataSource;
import net.liang.androidbaseapplication.data.remote.Test1RemoteDataSource;
import net.liang.androidbaseapplication.network.Test1Api;
import java.util.List;
import javax.inject.Inject; | package net.liang.androidbaseapplication.data.repository;
/**
* 数据管理仓库,控制选择使用remote数据还是local数据(SP、数据库、缓存)
*/
public class Test1Repository implements Test1Api {
private final Test1Api mTest1RemoteDataSource;
private final Test1Api mTest1LocalDataSource;
@Inject | // Path: app/src/main/java/net/liang/androidbaseapplication/data/local/Test1LocalDataSource.java
// public class Test1LocalDataSource implements Test1Api {
//
// @Override
// public List<String> testGet() {
//
// List<String> list = new ArrayList<>();
// list.add("数据源一:1");
// list.add("数据源一:2");
// list.add("数据源一:3");
// list.add("数据源一:4");
// list.add("数据源一:5");
// list.add("数据源一:6");
// list.add("数据源一:7");
// list.add("数据源一:8");
// return list;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/remote/Test1RemoteDataSource.java
// public class Test1RemoteDataSource implements Test1Api {
//
// @Override
// public List<String> testGet() {
// return null;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/network/Test1Api.java
// public interface Test1Api {
// /**
// * 测试接口
// */
// List<String> testGet();
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
import net.liang.androidbaseapplication.dagger.scope.Local;
import net.liang.androidbaseapplication.dagger.scope.Remote;
import net.liang.androidbaseapplication.data.local.Test1LocalDataSource;
import net.liang.androidbaseapplication.data.remote.Test1RemoteDataSource;
import net.liang.androidbaseapplication.network.Test1Api;
import java.util.List;
import javax.inject.Inject;
package net.liang.androidbaseapplication.data.repository;
/**
* 数据管理仓库,控制选择使用remote数据还是local数据(SP、数据库、缓存)
*/
public class Test1Repository implements Test1Api {
private final Test1Api mTest1RemoteDataSource;
private final Test1Api mTest1LocalDataSource;
@Inject | public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) { |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/dagger/PresenterModule.java | // Path: appbase/src/main/java/net/liang/appbaselibrary/base/mvp/MvpView.java
// public interface MvpView {
//
// void showToast(String toast);
// }
| import net.liang.androidbaseapplication.dagger.scope.ActivityScoped;
import net.liang.appbaselibrary.base.mvp.MvpView;
import dagger.Module;
import dagger.Provides; | package net.liang.androidbaseapplication.dagger;
/**
* V注入P的Module,由于V有共同的抽象层MvpView,所以只要P的初始化参数为MvpView类型,
* 则,继承MvpView的V只需要在ViewComponent添加注入清单即可!
*/
@Module
public class PresenterModule {
| // Path: appbase/src/main/java/net/liang/appbaselibrary/base/mvp/MvpView.java
// public interface MvpView {
//
// void showToast(String toast);
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/dagger/PresenterModule.java
import net.liang.androidbaseapplication.dagger.scope.ActivityScoped;
import net.liang.appbaselibrary.base.mvp.MvpView;
import dagger.Module;
import dagger.Provides;
package net.liang.androidbaseapplication.dagger;
/**
* V注入P的Module,由于V有共同的抽象层MvpView,所以只要P的初始化参数为MvpView类型,
* 则,继承MvpView的V只需要在ViewComponent添加注入清单即可!
*/
@Module
public class PresenterModule {
| private final MvpView mView; |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java | // Path: app/src/main/java/net/liang/androidbaseapplication/data/local/Test2LocalDataSource.java
// public class Test2LocalDataSource implements Test2Api {
//
// @Override
// public List<String> testGet() {
//
// List<String> list = new ArrayList<>();
// list.add("数据源二:1");
// list.add("数据源二:2");
// list.add("数据源二:3");
// list.add("数据源二:4");
// list.add("数据源二:5");
// list.add("数据源二:6");
// list.add("数据源二:7");
// list.add("数据源二:8");
// return list;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/remote/Test2RemoteDataSource.java
// public class Test2RemoteDataSource implements Test2Api {
//
// @Override
// public List<String> testGet() {
// return null;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/network/Test2Api.java
// public interface Test2Api {
// /**
// * 测试接口
// */
// List<String> testGet();
// }
| import net.liang.androidbaseapplication.dagger.scope.Local;
import net.liang.androidbaseapplication.dagger.scope.Remote;
import net.liang.androidbaseapplication.data.local.Test2LocalDataSource;
import net.liang.androidbaseapplication.data.remote.Test2RemoteDataSource;
import net.liang.androidbaseapplication.network.Test2Api;
import java.util.List;
import javax.inject.Inject; | package net.liang.androidbaseapplication.data.repository;
/**
* Created by Liang on 2017/4/15.
* 数据管理仓库,控制选择使用remote数据还是local数据(SP、数据库、缓存)
*/
public class Test2Repository implements Test2Api {
private final Test2Api mTest2RemoteDataSource;
private final Test2Api mTest2LocalDataSource;
@Inject | // Path: app/src/main/java/net/liang/androidbaseapplication/data/local/Test2LocalDataSource.java
// public class Test2LocalDataSource implements Test2Api {
//
// @Override
// public List<String> testGet() {
//
// List<String> list = new ArrayList<>();
// list.add("数据源二:1");
// list.add("数据源二:2");
// list.add("数据源二:3");
// list.add("数据源二:4");
// list.add("数据源二:5");
// list.add("数据源二:6");
// list.add("数据源二:7");
// list.add("数据源二:8");
// return list;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/remote/Test2RemoteDataSource.java
// public class Test2RemoteDataSource implements Test2Api {
//
// @Override
// public List<String> testGet() {
// return null;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/network/Test2Api.java
// public interface Test2Api {
// /**
// * 测试接口
// */
// List<String> testGet();
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
import net.liang.androidbaseapplication.dagger.scope.Local;
import net.liang.androidbaseapplication.dagger.scope.Remote;
import net.liang.androidbaseapplication.data.local.Test2LocalDataSource;
import net.liang.androidbaseapplication.data.remote.Test2RemoteDataSource;
import net.liang.androidbaseapplication.network.Test2Api;
import java.util.List;
import javax.inject.Inject;
package net.liang.androidbaseapplication.data.repository;
/**
* Created by Liang on 2017/4/15.
* 数据管理仓库,控制选择使用remote数据还是local数据(SP、数据库、缓存)
*/
public class Test2Repository implements Test2Api {
private final Test2Api mTest2RemoteDataSource;
private final Test2Api mTest2LocalDataSource;
@Inject | public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) { |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java | // Path: app/src/main/java/net/liang/androidbaseapplication/data/local/Test2LocalDataSource.java
// public class Test2LocalDataSource implements Test2Api {
//
// @Override
// public List<String> testGet() {
//
// List<String> list = new ArrayList<>();
// list.add("数据源二:1");
// list.add("数据源二:2");
// list.add("数据源二:3");
// list.add("数据源二:4");
// list.add("数据源二:5");
// list.add("数据源二:6");
// list.add("数据源二:7");
// list.add("数据源二:8");
// return list;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/remote/Test2RemoteDataSource.java
// public class Test2RemoteDataSource implements Test2Api {
//
// @Override
// public List<String> testGet() {
// return null;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/network/Test2Api.java
// public interface Test2Api {
// /**
// * 测试接口
// */
// List<String> testGet();
// }
| import net.liang.androidbaseapplication.dagger.scope.Local;
import net.liang.androidbaseapplication.dagger.scope.Remote;
import net.liang.androidbaseapplication.data.local.Test2LocalDataSource;
import net.liang.androidbaseapplication.data.remote.Test2RemoteDataSource;
import net.liang.androidbaseapplication.network.Test2Api;
import java.util.List;
import javax.inject.Inject; | package net.liang.androidbaseapplication.data.repository;
/**
* Created by Liang on 2017/4/15.
* 数据管理仓库,控制选择使用remote数据还是local数据(SP、数据库、缓存)
*/
public class Test2Repository implements Test2Api {
private final Test2Api mTest2RemoteDataSource;
private final Test2Api mTest2LocalDataSource;
@Inject | // Path: app/src/main/java/net/liang/androidbaseapplication/data/local/Test2LocalDataSource.java
// public class Test2LocalDataSource implements Test2Api {
//
// @Override
// public List<String> testGet() {
//
// List<String> list = new ArrayList<>();
// list.add("数据源二:1");
// list.add("数据源二:2");
// list.add("数据源二:3");
// list.add("数据源二:4");
// list.add("数据源二:5");
// list.add("数据源二:6");
// list.add("数据源二:7");
// list.add("数据源二:8");
// return list;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/remote/Test2RemoteDataSource.java
// public class Test2RemoteDataSource implements Test2Api {
//
// @Override
// public List<String> testGet() {
// return null;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/network/Test2Api.java
// public interface Test2Api {
// /**
// * 测试接口
// */
// List<String> testGet();
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
import net.liang.androidbaseapplication.dagger.scope.Local;
import net.liang.androidbaseapplication.dagger.scope.Remote;
import net.liang.androidbaseapplication.data.local.Test2LocalDataSource;
import net.liang.androidbaseapplication.data.remote.Test2RemoteDataSource;
import net.liang.androidbaseapplication.network.Test2Api;
import java.util.List;
import javax.inject.Inject;
package net.liang.androidbaseapplication.data.repository;
/**
* Created by Liang on 2017/4/15.
* 数据管理仓库,控制选择使用remote数据还是local数据(SP、数据库、缓存)
*/
public class Test2Repository implements Test2Api {
private final Test2Api mTest2RemoteDataSource;
private final Test2Api mTest2LocalDataSource;
@Inject | public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) { |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/dagger/ViewComponent.java | // Path: app/src/main/java/net/liang/androidbaseapplication/mvp/daggerlist/Test_DaggerListActivity.java
// public class Test_DaggerListActivity extends BaseRecyclerViewActivity<List<String>> implements Test_DaggerListContract.View {
//
// @Inject
// Test_DaggerListPresenter presenter;
//
// @Override
// protected int getLayoutId() {
// return R.layout.activity_test__dagger_list;
// }
//
// @Override
// protected MvpPresenter getPresenter() {
// return presenter;
// }
//
// @Override
// public void init() {
// setToolbarCentel(true, "列表页面使用Dagger示例");
//
// // Create the presenter
// DaggerViewComponent.builder()
// .repositoryComponent(DaggerRepositoryComponent.builder().build())
// .presenterModule(new PresenterModule(this))
// .build()
// .inject(this);
// }
//
// @Override
// public Observable<List<String>> onListGetData(int pageNo) {
// return Observable.just(presenter.getListData());
// }
//
// @Override
// public void onListSuccess(List<String> list, int pageNo) {
// adapter.showList(list);
// }
//
// @Override
// public BaseRecyclerAdapter addListAdapter() {
// return new TestAdapter(recyclerView, null);
// }
//
// class TestAdapter extends BaseRecyclerAdapter<String> {
// TestAdapter(RecyclerView recyclerView, List<String> data) {
// super(recyclerView, R.layout.item_base_recyclerview_layout, data);
// }
//
// @Override
// protected void convert(BindingViewHolder helper, String item) {
// helper.setText(R.id.data, item);
// }
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/mvp/daggernormal/Test_DaggerNormalActivity.java
// public class Test_DaggerNormalActivity extends BaseAppCompatActivity implements Test_DaggerNormalContract.View, SwipeRefreshLayout.OnRefreshListener {
//
// TestAdapter adapter;
//
// @Inject
// Test_DaggerNormalPresenter presenter;
//
// @BindView(R.id.recyclerView)
// RecyclerView recyclerView;
// @BindView(R.id.swiperefresh)
// SwipeRefreshLayout swiperefresh;
//
// @Override
// protected int getLayoutId() {
// return R.layout.activity_test__dagger_list;
// }
//
// @Override
// protected MvpPresenter getPresenter() {
// return null;
// }
//
// @Override
// public void init() {
// super.init();
// setToolbarCentel(true, "Dagger示例");
//
// adapter = new TestAdapter(recyclerView, null);
//
// swiperefresh.setColorSchemeColors(Color.RED, Color.BLUE, Color.GREEN, Color.YELLOW);
// swiperefresh.setOnRefreshListener(this);
//
// recyclerView.setLayoutManager(new LinearLayoutManager(this));
// recyclerView.setHasFixedSize(true);
// recyclerView.setAdapter(adapter);
// showList(null);
//
// // Create the presenter
// DaggerViewComponent.builder()
// .repositoryComponent(DaggerRepositoryComponent.builder().build())
// .presenterModule(new PresenterModule(this))
// .build()
// .inject(this);
// }
//
// @Override
// public void showList(List<String> list) {
// adapter.showList(list);
// swiperefresh.setRefreshing(false);
// }
//
// @Override
// public void onRefresh() {
// presenter.getListData();
// }
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// // TODO: add setContentView(...) invocation
// ButterKnife.bind(this);
// }
//
// class TestAdapter extends BaseRecyclerAdapter<String> {
// public TestAdapter(RecyclerView recyclerView, List<String> data) {
// super(recyclerView, R.layout.item_base_recyclerview_layout, data);
// }
//
// @Override
// protected void convert(BindingViewHolder helper, String item) {
// helper.setText(R.id.data, item);
// }
// }
// }
| import net.liang.androidbaseapplication.dagger.scope.ActivityScoped;
import net.liang.androidbaseapplication.mvp.daggerlist.Test_DaggerListActivity;
import net.liang.androidbaseapplication.mvp.daggernormal.Test_DaggerNormalActivity;
import dagger.Component; | package net.liang.androidbaseapplication.dagger;
/**
* View注入P的参数清单
*
* 如果该V是集成MvpView,则在下列新增对应的V方法
* 比如:
* Test_DaggerListActivity
* 新增:
* void inject(Test_DaggerListActivity activity);
*
* 否则:另建与之相对应的Component
*/
@ActivityScoped
@Component(dependencies = RepositoryComponent.class, modules = PresenterModule.class)
public interface ViewComponent {
| // Path: app/src/main/java/net/liang/androidbaseapplication/mvp/daggerlist/Test_DaggerListActivity.java
// public class Test_DaggerListActivity extends BaseRecyclerViewActivity<List<String>> implements Test_DaggerListContract.View {
//
// @Inject
// Test_DaggerListPresenter presenter;
//
// @Override
// protected int getLayoutId() {
// return R.layout.activity_test__dagger_list;
// }
//
// @Override
// protected MvpPresenter getPresenter() {
// return presenter;
// }
//
// @Override
// public void init() {
// setToolbarCentel(true, "列表页面使用Dagger示例");
//
// // Create the presenter
// DaggerViewComponent.builder()
// .repositoryComponent(DaggerRepositoryComponent.builder().build())
// .presenterModule(new PresenterModule(this))
// .build()
// .inject(this);
// }
//
// @Override
// public Observable<List<String>> onListGetData(int pageNo) {
// return Observable.just(presenter.getListData());
// }
//
// @Override
// public void onListSuccess(List<String> list, int pageNo) {
// adapter.showList(list);
// }
//
// @Override
// public BaseRecyclerAdapter addListAdapter() {
// return new TestAdapter(recyclerView, null);
// }
//
// class TestAdapter extends BaseRecyclerAdapter<String> {
// TestAdapter(RecyclerView recyclerView, List<String> data) {
// super(recyclerView, R.layout.item_base_recyclerview_layout, data);
// }
//
// @Override
// protected void convert(BindingViewHolder helper, String item) {
// helper.setText(R.id.data, item);
// }
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/mvp/daggernormal/Test_DaggerNormalActivity.java
// public class Test_DaggerNormalActivity extends BaseAppCompatActivity implements Test_DaggerNormalContract.View, SwipeRefreshLayout.OnRefreshListener {
//
// TestAdapter adapter;
//
// @Inject
// Test_DaggerNormalPresenter presenter;
//
// @BindView(R.id.recyclerView)
// RecyclerView recyclerView;
// @BindView(R.id.swiperefresh)
// SwipeRefreshLayout swiperefresh;
//
// @Override
// protected int getLayoutId() {
// return R.layout.activity_test__dagger_list;
// }
//
// @Override
// protected MvpPresenter getPresenter() {
// return null;
// }
//
// @Override
// public void init() {
// super.init();
// setToolbarCentel(true, "Dagger示例");
//
// adapter = new TestAdapter(recyclerView, null);
//
// swiperefresh.setColorSchemeColors(Color.RED, Color.BLUE, Color.GREEN, Color.YELLOW);
// swiperefresh.setOnRefreshListener(this);
//
// recyclerView.setLayoutManager(new LinearLayoutManager(this));
// recyclerView.setHasFixedSize(true);
// recyclerView.setAdapter(adapter);
// showList(null);
//
// // Create the presenter
// DaggerViewComponent.builder()
// .repositoryComponent(DaggerRepositoryComponent.builder().build())
// .presenterModule(new PresenterModule(this))
// .build()
// .inject(this);
// }
//
// @Override
// public void showList(List<String> list) {
// adapter.showList(list);
// swiperefresh.setRefreshing(false);
// }
//
// @Override
// public void onRefresh() {
// presenter.getListData();
// }
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// // TODO: add setContentView(...) invocation
// ButterKnife.bind(this);
// }
//
// class TestAdapter extends BaseRecyclerAdapter<String> {
// public TestAdapter(RecyclerView recyclerView, List<String> data) {
// super(recyclerView, R.layout.item_base_recyclerview_layout, data);
// }
//
// @Override
// protected void convert(BindingViewHolder helper, String item) {
// helper.setText(R.id.data, item);
// }
// }
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/dagger/ViewComponent.java
import net.liang.androidbaseapplication.dagger.scope.ActivityScoped;
import net.liang.androidbaseapplication.mvp.daggerlist.Test_DaggerListActivity;
import net.liang.androidbaseapplication.mvp.daggernormal.Test_DaggerNormalActivity;
import dagger.Component;
package net.liang.androidbaseapplication.dagger;
/**
* View注入P的参数清单
*
* 如果该V是集成MvpView,则在下列新增对应的V方法
* 比如:
* Test_DaggerListActivity
* 新增:
* void inject(Test_DaggerListActivity activity);
*
* 否则:另建与之相对应的Component
*/
@ActivityScoped
@Component(dependencies = RepositoryComponent.class, modules = PresenterModule.class)
public interface ViewComponent {
| void inject(Test_DaggerListActivity activity); |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/dagger/ViewComponent.java | // Path: app/src/main/java/net/liang/androidbaseapplication/mvp/daggerlist/Test_DaggerListActivity.java
// public class Test_DaggerListActivity extends BaseRecyclerViewActivity<List<String>> implements Test_DaggerListContract.View {
//
// @Inject
// Test_DaggerListPresenter presenter;
//
// @Override
// protected int getLayoutId() {
// return R.layout.activity_test__dagger_list;
// }
//
// @Override
// protected MvpPresenter getPresenter() {
// return presenter;
// }
//
// @Override
// public void init() {
// setToolbarCentel(true, "列表页面使用Dagger示例");
//
// // Create the presenter
// DaggerViewComponent.builder()
// .repositoryComponent(DaggerRepositoryComponent.builder().build())
// .presenterModule(new PresenterModule(this))
// .build()
// .inject(this);
// }
//
// @Override
// public Observable<List<String>> onListGetData(int pageNo) {
// return Observable.just(presenter.getListData());
// }
//
// @Override
// public void onListSuccess(List<String> list, int pageNo) {
// adapter.showList(list);
// }
//
// @Override
// public BaseRecyclerAdapter addListAdapter() {
// return new TestAdapter(recyclerView, null);
// }
//
// class TestAdapter extends BaseRecyclerAdapter<String> {
// TestAdapter(RecyclerView recyclerView, List<String> data) {
// super(recyclerView, R.layout.item_base_recyclerview_layout, data);
// }
//
// @Override
// protected void convert(BindingViewHolder helper, String item) {
// helper.setText(R.id.data, item);
// }
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/mvp/daggernormal/Test_DaggerNormalActivity.java
// public class Test_DaggerNormalActivity extends BaseAppCompatActivity implements Test_DaggerNormalContract.View, SwipeRefreshLayout.OnRefreshListener {
//
// TestAdapter adapter;
//
// @Inject
// Test_DaggerNormalPresenter presenter;
//
// @BindView(R.id.recyclerView)
// RecyclerView recyclerView;
// @BindView(R.id.swiperefresh)
// SwipeRefreshLayout swiperefresh;
//
// @Override
// protected int getLayoutId() {
// return R.layout.activity_test__dagger_list;
// }
//
// @Override
// protected MvpPresenter getPresenter() {
// return null;
// }
//
// @Override
// public void init() {
// super.init();
// setToolbarCentel(true, "Dagger示例");
//
// adapter = new TestAdapter(recyclerView, null);
//
// swiperefresh.setColorSchemeColors(Color.RED, Color.BLUE, Color.GREEN, Color.YELLOW);
// swiperefresh.setOnRefreshListener(this);
//
// recyclerView.setLayoutManager(new LinearLayoutManager(this));
// recyclerView.setHasFixedSize(true);
// recyclerView.setAdapter(adapter);
// showList(null);
//
// // Create the presenter
// DaggerViewComponent.builder()
// .repositoryComponent(DaggerRepositoryComponent.builder().build())
// .presenterModule(new PresenterModule(this))
// .build()
// .inject(this);
// }
//
// @Override
// public void showList(List<String> list) {
// adapter.showList(list);
// swiperefresh.setRefreshing(false);
// }
//
// @Override
// public void onRefresh() {
// presenter.getListData();
// }
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// // TODO: add setContentView(...) invocation
// ButterKnife.bind(this);
// }
//
// class TestAdapter extends BaseRecyclerAdapter<String> {
// public TestAdapter(RecyclerView recyclerView, List<String> data) {
// super(recyclerView, R.layout.item_base_recyclerview_layout, data);
// }
//
// @Override
// protected void convert(BindingViewHolder helper, String item) {
// helper.setText(R.id.data, item);
// }
// }
// }
| import net.liang.androidbaseapplication.dagger.scope.ActivityScoped;
import net.liang.androidbaseapplication.mvp.daggerlist.Test_DaggerListActivity;
import net.liang.androidbaseapplication.mvp.daggernormal.Test_DaggerNormalActivity;
import dagger.Component; | package net.liang.androidbaseapplication.dagger;
/**
* View注入P的参数清单
*
* 如果该V是集成MvpView,则在下列新增对应的V方法
* 比如:
* Test_DaggerListActivity
* 新增:
* void inject(Test_DaggerListActivity activity);
*
* 否则:另建与之相对应的Component
*/
@ActivityScoped
@Component(dependencies = RepositoryComponent.class, modules = PresenterModule.class)
public interface ViewComponent {
void inject(Test_DaggerListActivity activity); | // Path: app/src/main/java/net/liang/androidbaseapplication/mvp/daggerlist/Test_DaggerListActivity.java
// public class Test_DaggerListActivity extends BaseRecyclerViewActivity<List<String>> implements Test_DaggerListContract.View {
//
// @Inject
// Test_DaggerListPresenter presenter;
//
// @Override
// protected int getLayoutId() {
// return R.layout.activity_test__dagger_list;
// }
//
// @Override
// protected MvpPresenter getPresenter() {
// return presenter;
// }
//
// @Override
// public void init() {
// setToolbarCentel(true, "列表页面使用Dagger示例");
//
// // Create the presenter
// DaggerViewComponent.builder()
// .repositoryComponent(DaggerRepositoryComponent.builder().build())
// .presenterModule(new PresenterModule(this))
// .build()
// .inject(this);
// }
//
// @Override
// public Observable<List<String>> onListGetData(int pageNo) {
// return Observable.just(presenter.getListData());
// }
//
// @Override
// public void onListSuccess(List<String> list, int pageNo) {
// adapter.showList(list);
// }
//
// @Override
// public BaseRecyclerAdapter addListAdapter() {
// return new TestAdapter(recyclerView, null);
// }
//
// class TestAdapter extends BaseRecyclerAdapter<String> {
// TestAdapter(RecyclerView recyclerView, List<String> data) {
// super(recyclerView, R.layout.item_base_recyclerview_layout, data);
// }
//
// @Override
// protected void convert(BindingViewHolder helper, String item) {
// helper.setText(R.id.data, item);
// }
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/mvp/daggernormal/Test_DaggerNormalActivity.java
// public class Test_DaggerNormalActivity extends BaseAppCompatActivity implements Test_DaggerNormalContract.View, SwipeRefreshLayout.OnRefreshListener {
//
// TestAdapter adapter;
//
// @Inject
// Test_DaggerNormalPresenter presenter;
//
// @BindView(R.id.recyclerView)
// RecyclerView recyclerView;
// @BindView(R.id.swiperefresh)
// SwipeRefreshLayout swiperefresh;
//
// @Override
// protected int getLayoutId() {
// return R.layout.activity_test__dagger_list;
// }
//
// @Override
// protected MvpPresenter getPresenter() {
// return null;
// }
//
// @Override
// public void init() {
// super.init();
// setToolbarCentel(true, "Dagger示例");
//
// adapter = new TestAdapter(recyclerView, null);
//
// swiperefresh.setColorSchemeColors(Color.RED, Color.BLUE, Color.GREEN, Color.YELLOW);
// swiperefresh.setOnRefreshListener(this);
//
// recyclerView.setLayoutManager(new LinearLayoutManager(this));
// recyclerView.setHasFixedSize(true);
// recyclerView.setAdapter(adapter);
// showList(null);
//
// // Create the presenter
// DaggerViewComponent.builder()
// .repositoryComponent(DaggerRepositoryComponent.builder().build())
// .presenterModule(new PresenterModule(this))
// .build()
// .inject(this);
// }
//
// @Override
// public void showList(List<String> list) {
// adapter.showList(list);
// swiperefresh.setRefreshing(false);
// }
//
// @Override
// public void onRefresh() {
// presenter.getListData();
// }
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// // TODO: add setContentView(...) invocation
// ButterKnife.bind(this);
// }
//
// class TestAdapter extends BaseRecyclerAdapter<String> {
// public TestAdapter(RecyclerView recyclerView, List<String> data) {
// super(recyclerView, R.layout.item_base_recyclerview_layout, data);
// }
//
// @Override
// protected void convert(BindingViewHolder helper, String item) {
// helper.setText(R.id.data, item);
// }
// }
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/dagger/ViewComponent.java
import net.liang.androidbaseapplication.dagger.scope.ActivityScoped;
import net.liang.androidbaseapplication.mvp.daggerlist.Test_DaggerListActivity;
import net.liang.androidbaseapplication.mvp.daggernormal.Test_DaggerNormalActivity;
import dagger.Component;
package net.liang.androidbaseapplication.dagger;
/**
* View注入P的参数清单
*
* 如果该V是集成MvpView,则在下列新增对应的V方法
* 比如:
* Test_DaggerListActivity
* 新增:
* void inject(Test_DaggerListActivity activity);
*
* 否则:另建与之相对应的Component
*/
@ActivityScoped
@Component(dependencies = RepositoryComponent.class, modules = PresenterModule.class)
public interface ViewComponent {
void inject(Test_DaggerListActivity activity); | void inject(Test_DaggerNormalActivity activity); |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/mvp/daggernormal/Test_DaggerNormalPresenter.java | // Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
// public class Test1Repository implements Test1Api {
//
// private final Test1Api mTest1RemoteDataSource;
//
// private final Test1Api mTest1LocalDataSource;
//
// @Inject
// public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) {
// this.mTest1RemoteDataSource = mTest1RemoteDataSource;
// this.mTest1LocalDataSource = mTest1LocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest1LocalDataSource.testGet();
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
// public class Test2Repository implements Test2Api {
//
// private final Test2Api mTest2RemoteDataSource;
//
// private final Test2Api mTest2LocalDataSource;
//
// @Inject
// public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) {
// this.mTest2RemoteDataSource = mTestRemoteDataSource;
// this.mTest2LocalDataSource = mTestLocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest2LocalDataSource.testGet();
// }
// }
//
// Path: appbase/src/main/java/net/liang/appbaselibrary/base/mvp/MvpView.java
// public interface MvpView {
//
// void showToast(String toast);
// }
| import net.liang.androidbaseapplication.data.repository.Test1Repository;
import net.liang.androidbaseapplication.data.repository.Test2Repository;
import net.liang.appbaselibrary.base.mvp.BasePresenter;
import net.liang.appbaselibrary.base.mvp.MvpView;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject; | package net.liang.androidbaseapplication.mvp.daggernormal;
/**
* Created by Liang on 2017/4/18.
*/
public class Test_DaggerNormalPresenter extends BasePresenter implements Test_DaggerNormalContract.Presenter {
private final Test_DaggerNormalContract.View mView;
@Inject | // Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
// public class Test1Repository implements Test1Api {
//
// private final Test1Api mTest1RemoteDataSource;
//
// private final Test1Api mTest1LocalDataSource;
//
// @Inject
// public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) {
// this.mTest1RemoteDataSource = mTest1RemoteDataSource;
// this.mTest1LocalDataSource = mTest1LocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest1LocalDataSource.testGet();
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
// public class Test2Repository implements Test2Api {
//
// private final Test2Api mTest2RemoteDataSource;
//
// private final Test2Api mTest2LocalDataSource;
//
// @Inject
// public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) {
// this.mTest2RemoteDataSource = mTestRemoteDataSource;
// this.mTest2LocalDataSource = mTestLocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest2LocalDataSource.testGet();
// }
// }
//
// Path: appbase/src/main/java/net/liang/appbaselibrary/base/mvp/MvpView.java
// public interface MvpView {
//
// void showToast(String toast);
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/mvp/daggernormal/Test_DaggerNormalPresenter.java
import net.liang.androidbaseapplication.data.repository.Test1Repository;
import net.liang.androidbaseapplication.data.repository.Test2Repository;
import net.liang.appbaselibrary.base.mvp.BasePresenter;
import net.liang.appbaselibrary.base.mvp.MvpView;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
package net.liang.androidbaseapplication.mvp.daggernormal;
/**
* Created by Liang on 2017/4/18.
*/
public class Test_DaggerNormalPresenter extends BasePresenter implements Test_DaggerNormalContract.Presenter {
private final Test_DaggerNormalContract.View mView;
@Inject | Test1Repository repository; |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/mvp/daggernormal/Test_DaggerNormalPresenter.java | // Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
// public class Test1Repository implements Test1Api {
//
// private final Test1Api mTest1RemoteDataSource;
//
// private final Test1Api mTest1LocalDataSource;
//
// @Inject
// public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) {
// this.mTest1RemoteDataSource = mTest1RemoteDataSource;
// this.mTest1LocalDataSource = mTest1LocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest1LocalDataSource.testGet();
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
// public class Test2Repository implements Test2Api {
//
// private final Test2Api mTest2RemoteDataSource;
//
// private final Test2Api mTest2LocalDataSource;
//
// @Inject
// public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) {
// this.mTest2RemoteDataSource = mTestRemoteDataSource;
// this.mTest2LocalDataSource = mTestLocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest2LocalDataSource.testGet();
// }
// }
//
// Path: appbase/src/main/java/net/liang/appbaselibrary/base/mvp/MvpView.java
// public interface MvpView {
//
// void showToast(String toast);
// }
| import net.liang.androidbaseapplication.data.repository.Test1Repository;
import net.liang.androidbaseapplication.data.repository.Test2Repository;
import net.liang.appbaselibrary.base.mvp.BasePresenter;
import net.liang.appbaselibrary.base.mvp.MvpView;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject; | package net.liang.androidbaseapplication.mvp.daggernormal;
/**
* Created by Liang on 2017/4/18.
*/
public class Test_DaggerNormalPresenter extends BasePresenter implements Test_DaggerNormalContract.Presenter {
private final Test_DaggerNormalContract.View mView;
@Inject
Test1Repository repository;
@Inject | // Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
// public class Test1Repository implements Test1Api {
//
// private final Test1Api mTest1RemoteDataSource;
//
// private final Test1Api mTest1LocalDataSource;
//
// @Inject
// public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) {
// this.mTest1RemoteDataSource = mTest1RemoteDataSource;
// this.mTest1LocalDataSource = mTest1LocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest1LocalDataSource.testGet();
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
// public class Test2Repository implements Test2Api {
//
// private final Test2Api mTest2RemoteDataSource;
//
// private final Test2Api mTest2LocalDataSource;
//
// @Inject
// public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) {
// this.mTest2RemoteDataSource = mTestRemoteDataSource;
// this.mTest2LocalDataSource = mTestLocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest2LocalDataSource.testGet();
// }
// }
//
// Path: appbase/src/main/java/net/liang/appbaselibrary/base/mvp/MvpView.java
// public interface MvpView {
//
// void showToast(String toast);
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/mvp/daggernormal/Test_DaggerNormalPresenter.java
import net.liang.androidbaseapplication.data.repository.Test1Repository;
import net.liang.androidbaseapplication.data.repository.Test2Repository;
import net.liang.appbaselibrary.base.mvp.BasePresenter;
import net.liang.appbaselibrary.base.mvp.MvpView;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
package net.liang.androidbaseapplication.mvp.daggernormal;
/**
* Created by Liang on 2017/4/18.
*/
public class Test_DaggerNormalPresenter extends BasePresenter implements Test_DaggerNormalContract.Presenter {
private final Test_DaggerNormalContract.View mView;
@Inject
Test1Repository repository;
@Inject | public Test_DaggerNormalPresenter(MvpView mView) { |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/data/Test1RepositoryModule.java | // Path: app/src/main/java/net/liang/androidbaseapplication/data/local/Test1LocalDataSource.java
// public class Test1LocalDataSource implements Test1Api {
//
// @Override
// public List<String> testGet() {
//
// List<String> list = new ArrayList<>();
// list.add("数据源一:1");
// list.add("数据源一:2");
// list.add("数据源一:3");
// list.add("数据源一:4");
// list.add("数据源一:5");
// list.add("数据源一:6");
// list.add("数据源一:7");
// list.add("数据源一:8");
// return list;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/remote/Test1RemoteDataSource.java
// public class Test1RemoteDataSource implements Test1Api {
//
// @Override
// public List<String> testGet() {
// return null;
// }
// }
| import net.liang.androidbaseapplication.dagger.scope.Local;
import net.liang.androidbaseapplication.dagger.scope.Remote;
import net.liang.androidbaseapplication.data.local.Test1LocalDataSource;
import net.liang.androidbaseapplication.data.remote.Test1RemoteDataSource;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides; | package net.liang.androidbaseapplication.data;
/**
* Test1Repository的module
*/
@Module
public class Test1RepositoryModule {
@Singleton
@Provides
@Local | // Path: app/src/main/java/net/liang/androidbaseapplication/data/local/Test1LocalDataSource.java
// public class Test1LocalDataSource implements Test1Api {
//
// @Override
// public List<String> testGet() {
//
// List<String> list = new ArrayList<>();
// list.add("数据源一:1");
// list.add("数据源一:2");
// list.add("数据源一:3");
// list.add("数据源一:4");
// list.add("数据源一:5");
// list.add("数据源一:6");
// list.add("数据源一:7");
// list.add("数据源一:8");
// return list;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/remote/Test1RemoteDataSource.java
// public class Test1RemoteDataSource implements Test1Api {
//
// @Override
// public List<String> testGet() {
// return null;
// }
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/data/Test1RepositoryModule.java
import net.liang.androidbaseapplication.dagger.scope.Local;
import net.liang.androidbaseapplication.dagger.scope.Remote;
import net.liang.androidbaseapplication.data.local.Test1LocalDataSource;
import net.liang.androidbaseapplication.data.remote.Test1RemoteDataSource;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
package net.liang.androidbaseapplication.data;
/**
* Test1Repository的module
*/
@Module
public class Test1RepositoryModule {
@Singleton
@Provides
@Local | Test1LocalDataSource provideTest1LocalDataSource() { |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/data/Test1RepositoryModule.java | // Path: app/src/main/java/net/liang/androidbaseapplication/data/local/Test1LocalDataSource.java
// public class Test1LocalDataSource implements Test1Api {
//
// @Override
// public List<String> testGet() {
//
// List<String> list = new ArrayList<>();
// list.add("数据源一:1");
// list.add("数据源一:2");
// list.add("数据源一:3");
// list.add("数据源一:4");
// list.add("数据源一:5");
// list.add("数据源一:6");
// list.add("数据源一:7");
// list.add("数据源一:8");
// return list;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/remote/Test1RemoteDataSource.java
// public class Test1RemoteDataSource implements Test1Api {
//
// @Override
// public List<String> testGet() {
// return null;
// }
// }
| import net.liang.androidbaseapplication.dagger.scope.Local;
import net.liang.androidbaseapplication.dagger.scope.Remote;
import net.liang.androidbaseapplication.data.local.Test1LocalDataSource;
import net.liang.androidbaseapplication.data.remote.Test1RemoteDataSource;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides; | package net.liang.androidbaseapplication.data;
/**
* Test1Repository的module
*/
@Module
public class Test1RepositoryModule {
@Singleton
@Provides
@Local
Test1LocalDataSource provideTest1LocalDataSource() {
return new Test1LocalDataSource();
}
@Singleton
@Provides
@Remote | // Path: app/src/main/java/net/liang/androidbaseapplication/data/local/Test1LocalDataSource.java
// public class Test1LocalDataSource implements Test1Api {
//
// @Override
// public List<String> testGet() {
//
// List<String> list = new ArrayList<>();
// list.add("数据源一:1");
// list.add("数据源一:2");
// list.add("数据源一:3");
// list.add("数据源一:4");
// list.add("数据源一:5");
// list.add("数据源一:6");
// list.add("数据源一:7");
// list.add("数据源一:8");
// return list;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/remote/Test1RemoteDataSource.java
// public class Test1RemoteDataSource implements Test1Api {
//
// @Override
// public List<String> testGet() {
// return null;
// }
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/data/Test1RepositoryModule.java
import net.liang.androidbaseapplication.dagger.scope.Local;
import net.liang.androidbaseapplication.dagger.scope.Remote;
import net.liang.androidbaseapplication.data.local.Test1LocalDataSource;
import net.liang.androidbaseapplication.data.remote.Test1RemoteDataSource;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
package net.liang.androidbaseapplication.data;
/**
* Test1Repository的module
*/
@Module
public class Test1RepositoryModule {
@Singleton
@Provides
@Local
Test1LocalDataSource provideTest1LocalDataSource() {
return new Test1LocalDataSource();
}
@Singleton
@Provides
@Remote | Test1RemoteDataSource provideTest1RemoteDataSource() { |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/mvp/daggerlist/Test_DaggerListPresenter.java | // Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
// public class Test1Repository implements Test1Api {
//
// private final Test1Api mTest1RemoteDataSource;
//
// private final Test1Api mTest1LocalDataSource;
//
// @Inject
// public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) {
// this.mTest1RemoteDataSource = mTest1RemoteDataSource;
// this.mTest1LocalDataSource = mTest1LocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest1LocalDataSource.testGet();
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
// public class Test2Repository implements Test2Api {
//
// private final Test2Api mTest2RemoteDataSource;
//
// private final Test2Api mTest2LocalDataSource;
//
// @Inject
// public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) {
// this.mTest2RemoteDataSource = mTestRemoteDataSource;
// this.mTest2LocalDataSource = mTestLocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest2LocalDataSource.testGet();
// }
// }
//
// Path: appbase/src/main/java/net/liang/appbaselibrary/base/mvp/MvpView.java
// public interface MvpView {
//
// void showToast(String toast);
// }
| import net.liang.androidbaseapplication.data.repository.Test1Repository;
import net.liang.androidbaseapplication.data.repository.Test2Repository;
import net.liang.appbaselibrary.base.mvp.BasePresenter;
import net.liang.appbaselibrary.base.mvp.MvpView;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject; | package net.liang.androidbaseapplication.mvp.daggerlist;
/**
* Created by Liang on 2017/4/18.
*/
public class Test_DaggerListPresenter extends BasePresenter implements Test_DaggerListContract.Presenter {
private final Test_DaggerListContract.View mView;
@Inject | // Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
// public class Test1Repository implements Test1Api {
//
// private final Test1Api mTest1RemoteDataSource;
//
// private final Test1Api mTest1LocalDataSource;
//
// @Inject
// public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) {
// this.mTest1RemoteDataSource = mTest1RemoteDataSource;
// this.mTest1LocalDataSource = mTest1LocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest1LocalDataSource.testGet();
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
// public class Test2Repository implements Test2Api {
//
// private final Test2Api mTest2RemoteDataSource;
//
// private final Test2Api mTest2LocalDataSource;
//
// @Inject
// public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) {
// this.mTest2RemoteDataSource = mTestRemoteDataSource;
// this.mTest2LocalDataSource = mTestLocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest2LocalDataSource.testGet();
// }
// }
//
// Path: appbase/src/main/java/net/liang/appbaselibrary/base/mvp/MvpView.java
// public interface MvpView {
//
// void showToast(String toast);
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/mvp/daggerlist/Test_DaggerListPresenter.java
import net.liang.androidbaseapplication.data.repository.Test1Repository;
import net.liang.androidbaseapplication.data.repository.Test2Repository;
import net.liang.appbaselibrary.base.mvp.BasePresenter;
import net.liang.appbaselibrary.base.mvp.MvpView;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
package net.liang.androidbaseapplication.mvp.daggerlist;
/**
* Created by Liang on 2017/4/18.
*/
public class Test_DaggerListPresenter extends BasePresenter implements Test_DaggerListContract.Presenter {
private final Test_DaggerListContract.View mView;
@Inject | Test1Repository repository1; |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/mvp/daggerlist/Test_DaggerListPresenter.java | // Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
// public class Test1Repository implements Test1Api {
//
// private final Test1Api mTest1RemoteDataSource;
//
// private final Test1Api mTest1LocalDataSource;
//
// @Inject
// public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) {
// this.mTest1RemoteDataSource = mTest1RemoteDataSource;
// this.mTest1LocalDataSource = mTest1LocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest1LocalDataSource.testGet();
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
// public class Test2Repository implements Test2Api {
//
// private final Test2Api mTest2RemoteDataSource;
//
// private final Test2Api mTest2LocalDataSource;
//
// @Inject
// public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) {
// this.mTest2RemoteDataSource = mTestRemoteDataSource;
// this.mTest2LocalDataSource = mTestLocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest2LocalDataSource.testGet();
// }
// }
//
// Path: appbase/src/main/java/net/liang/appbaselibrary/base/mvp/MvpView.java
// public interface MvpView {
//
// void showToast(String toast);
// }
| import net.liang.androidbaseapplication.data.repository.Test1Repository;
import net.liang.androidbaseapplication.data.repository.Test2Repository;
import net.liang.appbaselibrary.base.mvp.BasePresenter;
import net.liang.appbaselibrary.base.mvp.MvpView;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject; | package net.liang.androidbaseapplication.mvp.daggerlist;
/**
* Created by Liang on 2017/4/18.
*/
public class Test_DaggerListPresenter extends BasePresenter implements Test_DaggerListContract.Presenter {
private final Test_DaggerListContract.View mView;
@Inject
Test1Repository repository1;
@Inject | // Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
// public class Test1Repository implements Test1Api {
//
// private final Test1Api mTest1RemoteDataSource;
//
// private final Test1Api mTest1LocalDataSource;
//
// @Inject
// public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) {
// this.mTest1RemoteDataSource = mTest1RemoteDataSource;
// this.mTest1LocalDataSource = mTest1LocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest1LocalDataSource.testGet();
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
// public class Test2Repository implements Test2Api {
//
// private final Test2Api mTest2RemoteDataSource;
//
// private final Test2Api mTest2LocalDataSource;
//
// @Inject
// public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) {
// this.mTest2RemoteDataSource = mTestRemoteDataSource;
// this.mTest2LocalDataSource = mTestLocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest2LocalDataSource.testGet();
// }
// }
//
// Path: appbase/src/main/java/net/liang/appbaselibrary/base/mvp/MvpView.java
// public interface MvpView {
//
// void showToast(String toast);
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/mvp/daggerlist/Test_DaggerListPresenter.java
import net.liang.androidbaseapplication.data.repository.Test1Repository;
import net.liang.androidbaseapplication.data.repository.Test2Repository;
import net.liang.appbaselibrary.base.mvp.BasePresenter;
import net.liang.appbaselibrary.base.mvp.MvpView;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
package net.liang.androidbaseapplication.mvp.daggerlist;
/**
* Created by Liang on 2017/4/18.
*/
public class Test_DaggerListPresenter extends BasePresenter implements Test_DaggerListContract.Presenter {
private final Test_DaggerListContract.View mView;
@Inject
Test1Repository repository1;
@Inject | Test2Repository repository2; |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/mvp/daggerlist/Test_DaggerListPresenter.java | // Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
// public class Test1Repository implements Test1Api {
//
// private final Test1Api mTest1RemoteDataSource;
//
// private final Test1Api mTest1LocalDataSource;
//
// @Inject
// public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) {
// this.mTest1RemoteDataSource = mTest1RemoteDataSource;
// this.mTest1LocalDataSource = mTest1LocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest1LocalDataSource.testGet();
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
// public class Test2Repository implements Test2Api {
//
// private final Test2Api mTest2RemoteDataSource;
//
// private final Test2Api mTest2LocalDataSource;
//
// @Inject
// public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) {
// this.mTest2RemoteDataSource = mTestRemoteDataSource;
// this.mTest2LocalDataSource = mTestLocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest2LocalDataSource.testGet();
// }
// }
//
// Path: appbase/src/main/java/net/liang/appbaselibrary/base/mvp/MvpView.java
// public interface MvpView {
//
// void showToast(String toast);
// }
| import net.liang.androidbaseapplication.data.repository.Test1Repository;
import net.liang.androidbaseapplication.data.repository.Test2Repository;
import net.liang.appbaselibrary.base.mvp.BasePresenter;
import net.liang.appbaselibrary.base.mvp.MvpView;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject; | package net.liang.androidbaseapplication.mvp.daggerlist;
/**
* Created by Liang on 2017/4/18.
*/
public class Test_DaggerListPresenter extends BasePresenter implements Test_DaggerListContract.Presenter {
private final Test_DaggerListContract.View mView;
@Inject
Test1Repository repository1;
@Inject
Test2Repository repository2;
@Inject | // Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
// public class Test1Repository implements Test1Api {
//
// private final Test1Api mTest1RemoteDataSource;
//
// private final Test1Api mTest1LocalDataSource;
//
// @Inject
// public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) {
// this.mTest1RemoteDataSource = mTest1RemoteDataSource;
// this.mTest1LocalDataSource = mTest1LocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest1LocalDataSource.testGet();
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
// public class Test2Repository implements Test2Api {
//
// private final Test2Api mTest2RemoteDataSource;
//
// private final Test2Api mTest2LocalDataSource;
//
// @Inject
// public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) {
// this.mTest2RemoteDataSource = mTestRemoteDataSource;
// this.mTest2LocalDataSource = mTestLocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest2LocalDataSource.testGet();
// }
// }
//
// Path: appbase/src/main/java/net/liang/appbaselibrary/base/mvp/MvpView.java
// public interface MvpView {
//
// void showToast(String toast);
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/mvp/daggerlist/Test_DaggerListPresenter.java
import net.liang.androidbaseapplication.data.repository.Test1Repository;
import net.liang.androidbaseapplication.data.repository.Test2Repository;
import net.liang.appbaselibrary.base.mvp.BasePresenter;
import net.liang.appbaselibrary.base.mvp.MvpView;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
package net.liang.androidbaseapplication.mvp.daggerlist;
/**
* Created by Liang on 2017/4/18.
*/
public class Test_DaggerListPresenter extends BasePresenter implements Test_DaggerListContract.Presenter {
private final Test_DaggerListContract.View mView;
@Inject
Test1Repository repository1;
@Inject
Test2Repository repository2;
@Inject | public Test_DaggerListPresenter(MvpView mView) { |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/dagger/RepositoryComponent.java | // Path: app/src/main/java/net/liang/androidbaseapplication/data/Test1RepositoryModule.java
// @Module
// public class Test1RepositoryModule {
//
// @Singleton
// @Provides
// @Local
// Test1LocalDataSource provideTest1LocalDataSource() {
// return new Test1LocalDataSource();
// }
//
// @Singleton
// @Provides
// @Remote
// Test1RemoteDataSource provideTest1RemoteDataSource() {
// return new Test1RemoteDataSource();
// }
//
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/Test2RepositoryModule.java
// @Module
// public class Test2RepositoryModule {
//
// @Singleton
// @Provides
// @Local
// Test2LocalDataSource provideTest2LocalDataSource() {
// return new Test2LocalDataSource();
// }
//
// @Singleton
// @Provides
// @Remote
// Test2RemoteDataSource provideTest2RemoteDataSource() {
// return new Test2RemoteDataSource();
// }
//
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
// public class Test1Repository implements Test1Api {
//
// private final Test1Api mTest1RemoteDataSource;
//
// private final Test1Api mTest1LocalDataSource;
//
// @Inject
// public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) {
// this.mTest1RemoteDataSource = mTest1RemoteDataSource;
// this.mTest1LocalDataSource = mTest1LocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest1LocalDataSource.testGet();
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
// public class Test2Repository implements Test2Api {
//
// private final Test2Api mTest2RemoteDataSource;
//
// private final Test2Api mTest2LocalDataSource;
//
// @Inject
// public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) {
// this.mTest2RemoteDataSource = mTestRemoteDataSource;
// this.mTest2LocalDataSource = mTestLocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest2LocalDataSource.testGet();
// }
// }
| import net.liang.androidbaseapplication.data.Test1RepositoryModule;
import net.liang.androidbaseapplication.data.Test2RepositoryModule;
import net.liang.androidbaseapplication.data.repository.Test1Repository;
import net.liang.androidbaseapplication.data.repository.Test2Repository;
import javax.inject.Singleton;
import dagger.Component; | package net.liang.androidbaseapplication.dagger;
/**
* 数据源注入清单
* 每个数据源仓库,要有与之对应的数据源Module
* 比如:Test1Repository 对应 Test1RepositoryModule
*/
@Singleton
@Component(modules = {Test1RepositoryModule.class, | // Path: app/src/main/java/net/liang/androidbaseapplication/data/Test1RepositoryModule.java
// @Module
// public class Test1RepositoryModule {
//
// @Singleton
// @Provides
// @Local
// Test1LocalDataSource provideTest1LocalDataSource() {
// return new Test1LocalDataSource();
// }
//
// @Singleton
// @Provides
// @Remote
// Test1RemoteDataSource provideTest1RemoteDataSource() {
// return new Test1RemoteDataSource();
// }
//
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/Test2RepositoryModule.java
// @Module
// public class Test2RepositoryModule {
//
// @Singleton
// @Provides
// @Local
// Test2LocalDataSource provideTest2LocalDataSource() {
// return new Test2LocalDataSource();
// }
//
// @Singleton
// @Provides
// @Remote
// Test2RemoteDataSource provideTest2RemoteDataSource() {
// return new Test2RemoteDataSource();
// }
//
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
// public class Test1Repository implements Test1Api {
//
// private final Test1Api mTest1RemoteDataSource;
//
// private final Test1Api mTest1LocalDataSource;
//
// @Inject
// public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) {
// this.mTest1RemoteDataSource = mTest1RemoteDataSource;
// this.mTest1LocalDataSource = mTest1LocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest1LocalDataSource.testGet();
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
// public class Test2Repository implements Test2Api {
//
// private final Test2Api mTest2RemoteDataSource;
//
// private final Test2Api mTest2LocalDataSource;
//
// @Inject
// public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) {
// this.mTest2RemoteDataSource = mTestRemoteDataSource;
// this.mTest2LocalDataSource = mTestLocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest2LocalDataSource.testGet();
// }
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/dagger/RepositoryComponent.java
import net.liang.androidbaseapplication.data.Test1RepositoryModule;
import net.liang.androidbaseapplication.data.Test2RepositoryModule;
import net.liang.androidbaseapplication.data.repository.Test1Repository;
import net.liang.androidbaseapplication.data.repository.Test2Repository;
import javax.inject.Singleton;
import dagger.Component;
package net.liang.androidbaseapplication.dagger;
/**
* 数据源注入清单
* 每个数据源仓库,要有与之对应的数据源Module
* 比如:Test1Repository 对应 Test1RepositoryModule
*/
@Singleton
@Component(modules = {Test1RepositoryModule.class, | Test2RepositoryModule.class}) |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/dagger/RepositoryComponent.java | // Path: app/src/main/java/net/liang/androidbaseapplication/data/Test1RepositoryModule.java
// @Module
// public class Test1RepositoryModule {
//
// @Singleton
// @Provides
// @Local
// Test1LocalDataSource provideTest1LocalDataSource() {
// return new Test1LocalDataSource();
// }
//
// @Singleton
// @Provides
// @Remote
// Test1RemoteDataSource provideTest1RemoteDataSource() {
// return new Test1RemoteDataSource();
// }
//
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/Test2RepositoryModule.java
// @Module
// public class Test2RepositoryModule {
//
// @Singleton
// @Provides
// @Local
// Test2LocalDataSource provideTest2LocalDataSource() {
// return new Test2LocalDataSource();
// }
//
// @Singleton
// @Provides
// @Remote
// Test2RemoteDataSource provideTest2RemoteDataSource() {
// return new Test2RemoteDataSource();
// }
//
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
// public class Test1Repository implements Test1Api {
//
// private final Test1Api mTest1RemoteDataSource;
//
// private final Test1Api mTest1LocalDataSource;
//
// @Inject
// public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) {
// this.mTest1RemoteDataSource = mTest1RemoteDataSource;
// this.mTest1LocalDataSource = mTest1LocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest1LocalDataSource.testGet();
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
// public class Test2Repository implements Test2Api {
//
// private final Test2Api mTest2RemoteDataSource;
//
// private final Test2Api mTest2LocalDataSource;
//
// @Inject
// public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) {
// this.mTest2RemoteDataSource = mTestRemoteDataSource;
// this.mTest2LocalDataSource = mTestLocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest2LocalDataSource.testGet();
// }
// }
| import net.liang.androidbaseapplication.data.Test1RepositoryModule;
import net.liang.androidbaseapplication.data.Test2RepositoryModule;
import net.liang.androidbaseapplication.data.repository.Test1Repository;
import net.liang.androidbaseapplication.data.repository.Test2Repository;
import javax.inject.Singleton;
import dagger.Component; | package net.liang.androidbaseapplication.dagger;
/**
* 数据源注入清单
* 每个数据源仓库,要有与之对应的数据源Module
* 比如:Test1Repository 对应 Test1RepositoryModule
*/
@Singleton
@Component(modules = {Test1RepositoryModule.class,
Test2RepositoryModule.class})
public interface RepositoryComponent {
| // Path: app/src/main/java/net/liang/androidbaseapplication/data/Test1RepositoryModule.java
// @Module
// public class Test1RepositoryModule {
//
// @Singleton
// @Provides
// @Local
// Test1LocalDataSource provideTest1LocalDataSource() {
// return new Test1LocalDataSource();
// }
//
// @Singleton
// @Provides
// @Remote
// Test1RemoteDataSource provideTest1RemoteDataSource() {
// return new Test1RemoteDataSource();
// }
//
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/Test2RepositoryModule.java
// @Module
// public class Test2RepositoryModule {
//
// @Singleton
// @Provides
// @Local
// Test2LocalDataSource provideTest2LocalDataSource() {
// return new Test2LocalDataSource();
// }
//
// @Singleton
// @Provides
// @Remote
// Test2RemoteDataSource provideTest2RemoteDataSource() {
// return new Test2RemoteDataSource();
// }
//
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
// public class Test1Repository implements Test1Api {
//
// private final Test1Api mTest1RemoteDataSource;
//
// private final Test1Api mTest1LocalDataSource;
//
// @Inject
// public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) {
// this.mTest1RemoteDataSource = mTest1RemoteDataSource;
// this.mTest1LocalDataSource = mTest1LocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest1LocalDataSource.testGet();
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
// public class Test2Repository implements Test2Api {
//
// private final Test2Api mTest2RemoteDataSource;
//
// private final Test2Api mTest2LocalDataSource;
//
// @Inject
// public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) {
// this.mTest2RemoteDataSource = mTestRemoteDataSource;
// this.mTest2LocalDataSource = mTestLocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest2LocalDataSource.testGet();
// }
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/dagger/RepositoryComponent.java
import net.liang.androidbaseapplication.data.Test1RepositoryModule;
import net.liang.androidbaseapplication.data.Test2RepositoryModule;
import net.liang.androidbaseapplication.data.repository.Test1Repository;
import net.liang.androidbaseapplication.data.repository.Test2Repository;
import javax.inject.Singleton;
import dagger.Component;
package net.liang.androidbaseapplication.dagger;
/**
* 数据源注入清单
* 每个数据源仓库,要有与之对应的数据源Module
* 比如:Test1Repository 对应 Test1RepositoryModule
*/
@Singleton
@Component(modules = {Test1RepositoryModule.class,
Test2RepositoryModule.class})
public interface RepositoryComponent {
| Test1Repository getTest1Repository(); |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/dagger/RepositoryComponent.java | // Path: app/src/main/java/net/liang/androidbaseapplication/data/Test1RepositoryModule.java
// @Module
// public class Test1RepositoryModule {
//
// @Singleton
// @Provides
// @Local
// Test1LocalDataSource provideTest1LocalDataSource() {
// return new Test1LocalDataSource();
// }
//
// @Singleton
// @Provides
// @Remote
// Test1RemoteDataSource provideTest1RemoteDataSource() {
// return new Test1RemoteDataSource();
// }
//
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/Test2RepositoryModule.java
// @Module
// public class Test2RepositoryModule {
//
// @Singleton
// @Provides
// @Local
// Test2LocalDataSource provideTest2LocalDataSource() {
// return new Test2LocalDataSource();
// }
//
// @Singleton
// @Provides
// @Remote
// Test2RemoteDataSource provideTest2RemoteDataSource() {
// return new Test2RemoteDataSource();
// }
//
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
// public class Test1Repository implements Test1Api {
//
// private final Test1Api mTest1RemoteDataSource;
//
// private final Test1Api mTest1LocalDataSource;
//
// @Inject
// public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) {
// this.mTest1RemoteDataSource = mTest1RemoteDataSource;
// this.mTest1LocalDataSource = mTest1LocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest1LocalDataSource.testGet();
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
// public class Test2Repository implements Test2Api {
//
// private final Test2Api mTest2RemoteDataSource;
//
// private final Test2Api mTest2LocalDataSource;
//
// @Inject
// public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) {
// this.mTest2RemoteDataSource = mTestRemoteDataSource;
// this.mTest2LocalDataSource = mTestLocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest2LocalDataSource.testGet();
// }
// }
| import net.liang.androidbaseapplication.data.Test1RepositoryModule;
import net.liang.androidbaseapplication.data.Test2RepositoryModule;
import net.liang.androidbaseapplication.data.repository.Test1Repository;
import net.liang.androidbaseapplication.data.repository.Test2Repository;
import javax.inject.Singleton;
import dagger.Component; | package net.liang.androidbaseapplication.dagger;
/**
* 数据源注入清单
* 每个数据源仓库,要有与之对应的数据源Module
* 比如:Test1Repository 对应 Test1RepositoryModule
*/
@Singleton
@Component(modules = {Test1RepositoryModule.class,
Test2RepositoryModule.class})
public interface RepositoryComponent {
Test1Repository getTest1Repository(); | // Path: app/src/main/java/net/liang/androidbaseapplication/data/Test1RepositoryModule.java
// @Module
// public class Test1RepositoryModule {
//
// @Singleton
// @Provides
// @Local
// Test1LocalDataSource provideTest1LocalDataSource() {
// return new Test1LocalDataSource();
// }
//
// @Singleton
// @Provides
// @Remote
// Test1RemoteDataSource provideTest1RemoteDataSource() {
// return new Test1RemoteDataSource();
// }
//
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/Test2RepositoryModule.java
// @Module
// public class Test2RepositoryModule {
//
// @Singleton
// @Provides
// @Local
// Test2LocalDataSource provideTest2LocalDataSource() {
// return new Test2LocalDataSource();
// }
//
// @Singleton
// @Provides
// @Remote
// Test2RemoteDataSource provideTest2RemoteDataSource() {
// return new Test2RemoteDataSource();
// }
//
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test1Repository.java
// public class Test1Repository implements Test1Api {
//
// private final Test1Api mTest1RemoteDataSource;
//
// private final Test1Api mTest1LocalDataSource;
//
// @Inject
// public Test1Repository(@Local Test1LocalDataSource mTest1LocalDataSource, @Remote Test1RemoteDataSource mTest1RemoteDataSource) {
// this.mTest1RemoteDataSource = mTest1RemoteDataSource;
// this.mTest1LocalDataSource = mTest1LocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest1LocalDataSource.testGet();
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/repository/Test2Repository.java
// public class Test2Repository implements Test2Api {
//
// private final Test2Api mTest2RemoteDataSource;
//
// private final Test2Api mTest2LocalDataSource;
//
// @Inject
// public Test2Repository(@Local Test2LocalDataSource mTestLocalDataSource, @Remote Test2RemoteDataSource mTestRemoteDataSource) {
// this.mTest2RemoteDataSource = mTestRemoteDataSource;
// this.mTest2LocalDataSource = mTestLocalDataSource;
// }
//
// @Override
// public List<String> testGet() {
// return mTest2LocalDataSource.testGet();
// }
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/dagger/RepositoryComponent.java
import net.liang.androidbaseapplication.data.Test1RepositoryModule;
import net.liang.androidbaseapplication.data.Test2RepositoryModule;
import net.liang.androidbaseapplication.data.repository.Test1Repository;
import net.liang.androidbaseapplication.data.repository.Test2Repository;
import javax.inject.Singleton;
import dagger.Component;
package net.liang.androidbaseapplication.dagger;
/**
* 数据源注入清单
* 每个数据源仓库,要有与之对应的数据源Module
* 比如:Test1Repository 对应 Test1RepositoryModule
*/
@Singleton
@Component(modules = {Test1RepositoryModule.class,
Test2RepositoryModule.class})
public interface RepositoryComponent {
Test1Repository getTest1Repository(); | Test2Repository getTest2Repository(); |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/data/Test2RepositoryModule.java | // Path: app/src/main/java/net/liang/androidbaseapplication/data/local/Test2LocalDataSource.java
// public class Test2LocalDataSource implements Test2Api {
//
// @Override
// public List<String> testGet() {
//
// List<String> list = new ArrayList<>();
// list.add("数据源二:1");
// list.add("数据源二:2");
// list.add("数据源二:3");
// list.add("数据源二:4");
// list.add("数据源二:5");
// list.add("数据源二:6");
// list.add("数据源二:7");
// list.add("数据源二:8");
// return list;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/remote/Test2RemoteDataSource.java
// public class Test2RemoteDataSource implements Test2Api {
//
// @Override
// public List<String> testGet() {
// return null;
// }
// }
| import net.liang.androidbaseapplication.dagger.scope.Local;
import net.liang.androidbaseapplication.dagger.scope.Remote;
import net.liang.androidbaseapplication.data.local.Test2LocalDataSource;
import net.liang.androidbaseapplication.data.remote.Test2RemoteDataSource;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides; | package net.liang.androidbaseapplication.data;
/**
* Test2Repository的module
*/
@Module
public class Test2RepositoryModule {
@Singleton
@Provides
@Local | // Path: app/src/main/java/net/liang/androidbaseapplication/data/local/Test2LocalDataSource.java
// public class Test2LocalDataSource implements Test2Api {
//
// @Override
// public List<String> testGet() {
//
// List<String> list = new ArrayList<>();
// list.add("数据源二:1");
// list.add("数据源二:2");
// list.add("数据源二:3");
// list.add("数据源二:4");
// list.add("数据源二:5");
// list.add("数据源二:6");
// list.add("数据源二:7");
// list.add("数据源二:8");
// return list;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/remote/Test2RemoteDataSource.java
// public class Test2RemoteDataSource implements Test2Api {
//
// @Override
// public List<String> testGet() {
// return null;
// }
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/data/Test2RepositoryModule.java
import net.liang.androidbaseapplication.dagger.scope.Local;
import net.liang.androidbaseapplication.dagger.scope.Remote;
import net.liang.androidbaseapplication.data.local.Test2LocalDataSource;
import net.liang.androidbaseapplication.data.remote.Test2RemoteDataSource;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
package net.liang.androidbaseapplication.data;
/**
* Test2Repository的module
*/
@Module
public class Test2RepositoryModule {
@Singleton
@Provides
@Local | Test2LocalDataSource provideTest2LocalDataSource() { |
lianghuiyong/AndroidBase | app/src/main/java/net/liang/androidbaseapplication/data/Test2RepositoryModule.java | // Path: app/src/main/java/net/liang/androidbaseapplication/data/local/Test2LocalDataSource.java
// public class Test2LocalDataSource implements Test2Api {
//
// @Override
// public List<String> testGet() {
//
// List<String> list = new ArrayList<>();
// list.add("数据源二:1");
// list.add("数据源二:2");
// list.add("数据源二:3");
// list.add("数据源二:4");
// list.add("数据源二:5");
// list.add("数据源二:6");
// list.add("数据源二:7");
// list.add("数据源二:8");
// return list;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/remote/Test2RemoteDataSource.java
// public class Test2RemoteDataSource implements Test2Api {
//
// @Override
// public List<String> testGet() {
// return null;
// }
// }
| import net.liang.androidbaseapplication.dagger.scope.Local;
import net.liang.androidbaseapplication.dagger.scope.Remote;
import net.liang.androidbaseapplication.data.local.Test2LocalDataSource;
import net.liang.androidbaseapplication.data.remote.Test2RemoteDataSource;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides; | package net.liang.androidbaseapplication.data;
/**
* Test2Repository的module
*/
@Module
public class Test2RepositoryModule {
@Singleton
@Provides
@Local
Test2LocalDataSource provideTest2LocalDataSource() {
return new Test2LocalDataSource();
}
@Singleton
@Provides
@Remote | // Path: app/src/main/java/net/liang/androidbaseapplication/data/local/Test2LocalDataSource.java
// public class Test2LocalDataSource implements Test2Api {
//
// @Override
// public List<String> testGet() {
//
// List<String> list = new ArrayList<>();
// list.add("数据源二:1");
// list.add("数据源二:2");
// list.add("数据源二:3");
// list.add("数据源二:4");
// list.add("数据源二:5");
// list.add("数据源二:6");
// list.add("数据源二:7");
// list.add("数据源二:8");
// return list;
// }
// }
//
// Path: app/src/main/java/net/liang/androidbaseapplication/data/remote/Test2RemoteDataSource.java
// public class Test2RemoteDataSource implements Test2Api {
//
// @Override
// public List<String> testGet() {
// return null;
// }
// }
// Path: app/src/main/java/net/liang/androidbaseapplication/data/Test2RepositoryModule.java
import net.liang.androidbaseapplication.dagger.scope.Local;
import net.liang.androidbaseapplication.dagger.scope.Remote;
import net.liang.androidbaseapplication.data.local.Test2LocalDataSource;
import net.liang.androidbaseapplication.data.remote.Test2RemoteDataSource;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
package net.liang.androidbaseapplication.data;
/**
* Test2Repository的module
*/
@Module
public class Test2RepositoryModule {
@Singleton
@Provides
@Local
Test2LocalDataSource provideTest2LocalDataSource() {
return new Test2LocalDataSource();
}
@Singleton
@Provides
@Remote | Test2RemoteDataSource provideTest2RemoteDataSource() { |
apache/commons-exec | src/test/java/org/apache/commons/exec/util/MapUtilTest.java | // Path: src/main/java/org/apache/commons/exec/environment/EnvironmentUtils.java
// public class EnvironmentUtils
// {
//
// private static final DefaultProcessingEnvironment PROCESSING_ENVIRONMENT_IMPLEMENTATION;
//
// static {
// // if (OS.isFamilyOpenVms()) {
// // PROCESSING_ENVIRONMENT_IMPLEMENTATION = new OpenVmsProcessingEnvironment();
// // } else {
// PROCESSING_ENVIRONMENT_IMPLEMENTATION = new DefaultProcessingEnvironment();
// // }
// }
//
// /**
// * Disable constructor.
// */
// private EnvironmentUtils() {
//
// }
//
// /**
// * Get the variable list as an array.
// *
// * @param environment the environment to use, may be {@code null}
// * @return array of key=value assignment strings or {@code null} if and only if
// * the input map was {@code null}
// */
// public static String[] toStrings(final Map<String, String> environment) {
// if (environment == null) {
// return null;
// }
// final String[] result = new String[environment.size()];
// int i = 0;
// for (final Entry<String, String> entry : environment.entrySet()) {
// final String key = entry.getKey() == null ? "" : entry.getKey().toString();
// final String value = entry.getValue() == null ? "" : entry.getValue().toString();
// result[i] = key + "=" + value;
// i++;
// }
// return result;
// }
//
// /**
// * Find the list of environment variables for this process. The returned map preserves
// * the casing of a variable's name on all platforms but obeys the casing rules of the
// * current platform during lookup, e.g. key names will be case-insensitive on Windows
// * platforms.
// *
// * @return a map containing the environment variables, may be empty but never {@code null}
// * @throws IOException the operation failed
// */
// public static Map<String, String> getProcEnvironment() throws IOException {
// return PROCESSING_ENVIRONMENT_IMPLEMENTATION.getProcEnvironment();
// }
//
// /**
// * Add a key/value pair to the given environment.
// * If the key matches an existing key, the previous setting is replaced.
// *
// * @param environment the current environment
// * @param keyAndValue the key/value pair
// */
// public static void addVariableToEnvironment(final Map<String, String> environment, final String keyAndValue) {
// final String[] parsedVariable = parseEnvironmentVariable(keyAndValue);
// environment.put(parsedVariable[0], parsedVariable[1]);
// }
//
// /**
// * Split a key/value pair into a String[]. It is assumed
// * that the ky/value pair contains a '=' character.
// *
// * @param keyAndValue the key/value pair
// * @return a String[] containing the key and value
// */
// private static String[] parseEnvironmentVariable(final String keyAndValue) {
// final int index = keyAndValue.indexOf('=');
// if (index == -1) {
// throw new IllegalArgumentException(
// "Environment variable for this platform "
// + "must contain an equals sign ('=')");
// }
//
// final String[] result = new String[2];
// result[0] = keyAndValue.substring(0, index);
// result[1] = keyAndValue.substring(index + 1);
//
// return result;
// }
//
// }
| import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.exec.environment.EnvironmentUtils;
import org.junit.Test; | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.commons.exec.util;
/**
*/
public class MapUtilTest {
/**
* Test copying of map
*/
@Test
public void testCopyMap() throws Exception {
final HashMap<String, String> procEnvironment = new HashMap<>();
procEnvironment.put("JAVA_HOME", "/usr/opt/java");
final Map<String, String> result = MapUtils.copy(procEnvironment);
assertTrue(result.size() == 1);
assertTrue(procEnvironment.size() == 1);
assertEquals("/usr/opt/java", result.get("JAVA_HOME"));
result.remove("JAVA_HOME");
assertTrue(result.isEmpty());
assertTrue(procEnvironment.size() == 1);
}
/**
* Test merging of maps
*/
@Test
public void testMergeMap() throws Exception {
| // Path: src/main/java/org/apache/commons/exec/environment/EnvironmentUtils.java
// public class EnvironmentUtils
// {
//
// private static final DefaultProcessingEnvironment PROCESSING_ENVIRONMENT_IMPLEMENTATION;
//
// static {
// // if (OS.isFamilyOpenVms()) {
// // PROCESSING_ENVIRONMENT_IMPLEMENTATION = new OpenVmsProcessingEnvironment();
// // } else {
// PROCESSING_ENVIRONMENT_IMPLEMENTATION = new DefaultProcessingEnvironment();
// // }
// }
//
// /**
// * Disable constructor.
// */
// private EnvironmentUtils() {
//
// }
//
// /**
// * Get the variable list as an array.
// *
// * @param environment the environment to use, may be {@code null}
// * @return array of key=value assignment strings or {@code null} if and only if
// * the input map was {@code null}
// */
// public static String[] toStrings(final Map<String, String> environment) {
// if (environment == null) {
// return null;
// }
// final String[] result = new String[environment.size()];
// int i = 0;
// for (final Entry<String, String> entry : environment.entrySet()) {
// final String key = entry.getKey() == null ? "" : entry.getKey().toString();
// final String value = entry.getValue() == null ? "" : entry.getValue().toString();
// result[i] = key + "=" + value;
// i++;
// }
// return result;
// }
//
// /**
// * Find the list of environment variables for this process. The returned map preserves
// * the casing of a variable's name on all platforms but obeys the casing rules of the
// * current platform during lookup, e.g. key names will be case-insensitive on Windows
// * platforms.
// *
// * @return a map containing the environment variables, may be empty but never {@code null}
// * @throws IOException the operation failed
// */
// public static Map<String, String> getProcEnvironment() throws IOException {
// return PROCESSING_ENVIRONMENT_IMPLEMENTATION.getProcEnvironment();
// }
//
// /**
// * Add a key/value pair to the given environment.
// * If the key matches an existing key, the previous setting is replaced.
// *
// * @param environment the current environment
// * @param keyAndValue the key/value pair
// */
// public static void addVariableToEnvironment(final Map<String, String> environment, final String keyAndValue) {
// final String[] parsedVariable = parseEnvironmentVariable(keyAndValue);
// environment.put(parsedVariable[0], parsedVariable[1]);
// }
//
// /**
// * Split a key/value pair into a String[]. It is assumed
// * that the ky/value pair contains a '=' character.
// *
// * @param keyAndValue the key/value pair
// * @return a String[] containing the key and value
// */
// private static String[] parseEnvironmentVariable(final String keyAndValue) {
// final int index = keyAndValue.indexOf('=');
// if (index == -1) {
// throw new IllegalArgumentException(
// "Environment variable for this platform "
// + "must contain an equals sign ('=')");
// }
//
// final String[] result = new String[2];
// result[0] = keyAndValue.substring(0, index);
// result[1] = keyAndValue.substring(index + 1);
//
// return result;
// }
//
// }
// Path: src/test/java/org/apache/commons/exec/util/MapUtilTest.java
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.exec.environment.EnvironmentUtils;
import org.junit.Test;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.commons.exec.util;
/**
*/
public class MapUtilTest {
/**
* Test copying of map
*/
@Test
public void testCopyMap() throws Exception {
final HashMap<String, String> procEnvironment = new HashMap<>();
procEnvironment.put("JAVA_HOME", "/usr/opt/java");
final Map<String, String> result = MapUtils.copy(procEnvironment);
assertTrue(result.size() == 1);
assertTrue(procEnvironment.size() == 1);
assertEquals("/usr/opt/java", result.get("JAVA_HOME"));
result.remove("JAVA_HOME");
assertTrue(result.isEmpty());
assertTrue(procEnvironment.size() == 1);
}
/**
* Test merging of maps
*/
@Test
public void testMergeMap() throws Exception {
| final Map<String, String> procEnvironment = EnvironmentUtils.getProcEnvironment(); |
apache/commons-exec | src/main/java/org/apache/commons/exec/StreamPumper.java | // Path: src/main/java/org/apache/commons/exec/util/DebugUtils.java
// public class DebugUtils
// {
// /**
// * System property to determine how to handle exceptions. When
// * set to "false" we rethrow the otherwise silently catched
// * exceptions found in the original code. The default value
// * is "true"
// */
// public static final String COMMONS_EXEC_LENIENT = "org.apache.commons.exec.lenient";
//
// /**
// * System property to determine how to dump an exception. When
// * set to "true" we print any exception to stderr. The default
// * value is "false"
// */
// public static final String COMMONS_EXEC_DEBUG = "org.apache.commons.exec.debug";
//
// /**
// * Handles an exception based on the system properties.
// *
// * @param msg message describing the problem
// * @param e an exception being handled
// */
// public static void handleException(final String msg, final Exception e) {
//
// if (isDebugEnabled()) {
// System.err.println(msg);
// e.printStackTrace();
// }
//
// if (!isLenientEnabled()) {
// if (e instanceof RuntimeException) {
// throw (RuntimeException) e;
// }
// // can't pass root cause since the constructor is not available on JDK 1.3
// throw new RuntimeException(e.getMessage());
// }
// }
//
// /**
// * Determines if debugging is enabled based on the
// * system property "COMMONS_EXEC_DEBUG".
// *
// * @return true if debug mode is enabled
// */
// public static boolean isDebugEnabled() {
// final String debug = System.getProperty(COMMONS_EXEC_DEBUG, Boolean.FALSE.toString());
// return Boolean.TRUE.toString().equalsIgnoreCase(debug);
// }
//
// /**
// * Determines if lenient mode is enabled.
// *
// * @return true if lenient mode is enabled
// */
// public static boolean isLenientEnabled() {
// final String lenient = System.getProperty(COMMONS_EXEC_LENIENT, Boolean.TRUE.toString());
// return Boolean.TRUE.toString().equalsIgnoreCase(lenient);
// }
//
// }
| import org.apache.commons.exec.util.DebugUtils;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream; | public StreamPumper(final InputStream is, final OutputStream os) {
this(is, os, false);
}
/**
* Copies data from the input stream to the output stream. Terminates as
* soon as the input stream is closed or an error occurs.
*/
@Override
public void run() {
synchronized (this) {
// Just in case this object is reused in the future
finished = false;
}
final byte[] buf = new byte[this.size];
int length;
try {
while ((length = is.read(buf)) > 0) {
os.write(buf, 0, length);
}
} catch (final Exception e) {
// nothing to do - happens quite often with watchdog
} finally {
if (closeWhenExhausted) {
try {
os.close();
} catch (final IOException e) {
final String msg = "Got exception while closing exhausted output stream"; | // Path: src/main/java/org/apache/commons/exec/util/DebugUtils.java
// public class DebugUtils
// {
// /**
// * System property to determine how to handle exceptions. When
// * set to "false" we rethrow the otherwise silently catched
// * exceptions found in the original code. The default value
// * is "true"
// */
// public static final String COMMONS_EXEC_LENIENT = "org.apache.commons.exec.lenient";
//
// /**
// * System property to determine how to dump an exception. When
// * set to "true" we print any exception to stderr. The default
// * value is "false"
// */
// public static final String COMMONS_EXEC_DEBUG = "org.apache.commons.exec.debug";
//
// /**
// * Handles an exception based on the system properties.
// *
// * @param msg message describing the problem
// * @param e an exception being handled
// */
// public static void handleException(final String msg, final Exception e) {
//
// if (isDebugEnabled()) {
// System.err.println(msg);
// e.printStackTrace();
// }
//
// if (!isLenientEnabled()) {
// if (e instanceof RuntimeException) {
// throw (RuntimeException) e;
// }
// // can't pass root cause since the constructor is not available on JDK 1.3
// throw new RuntimeException(e.getMessage());
// }
// }
//
// /**
// * Determines if debugging is enabled based on the
// * system property "COMMONS_EXEC_DEBUG".
// *
// * @return true if debug mode is enabled
// */
// public static boolean isDebugEnabled() {
// final String debug = System.getProperty(COMMONS_EXEC_DEBUG, Boolean.FALSE.toString());
// return Boolean.TRUE.toString().equalsIgnoreCase(debug);
// }
//
// /**
// * Determines if lenient mode is enabled.
// *
// * @return true if lenient mode is enabled
// */
// public static boolean isLenientEnabled() {
// final String lenient = System.getProperty(COMMONS_EXEC_LENIENT, Boolean.TRUE.toString());
// return Boolean.TRUE.toString().equalsIgnoreCase(lenient);
// }
//
// }
// Path: src/main/java/org/apache/commons/exec/StreamPumper.java
import org.apache.commons.exec.util.DebugUtils;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public StreamPumper(final InputStream is, final OutputStream os) {
this(is, os, false);
}
/**
* Copies data from the input stream to the output stream. Terminates as
* soon as the input stream is closed or an error occurs.
*/
@Override
public void run() {
synchronized (this) {
// Just in case this object is reused in the future
finished = false;
}
final byte[] buf = new byte[this.size];
int length;
try {
while ((length = is.read(buf)) > 0) {
os.write(buf, 0, length);
}
} catch (final Exception e) {
// nothing to do - happens quite often with watchdog
} finally {
if (closeWhenExhausted) {
try {
os.close();
} catch (final IOException e) {
final String msg = "Got exception while closing exhausted output stream"; | DebugUtils.handleException(msg ,e); |
apache/commons-exec | src/test/java/org/apache/commons/exec/DefaultExecutorTest.java | // Path: src/main/java/org/apache/commons/exec/environment/EnvironmentUtils.java
// public class EnvironmentUtils
// {
//
// private static final DefaultProcessingEnvironment PROCESSING_ENVIRONMENT_IMPLEMENTATION;
//
// static {
// // if (OS.isFamilyOpenVms()) {
// // PROCESSING_ENVIRONMENT_IMPLEMENTATION = new OpenVmsProcessingEnvironment();
// // } else {
// PROCESSING_ENVIRONMENT_IMPLEMENTATION = new DefaultProcessingEnvironment();
// // }
// }
//
// /**
// * Disable constructor.
// */
// private EnvironmentUtils() {
//
// }
//
// /**
// * Get the variable list as an array.
// *
// * @param environment the environment to use, may be {@code null}
// * @return array of key=value assignment strings or {@code null} if and only if
// * the input map was {@code null}
// */
// public static String[] toStrings(final Map<String, String> environment) {
// if (environment == null) {
// return null;
// }
// final String[] result = new String[environment.size()];
// int i = 0;
// for (final Entry<String, String> entry : environment.entrySet()) {
// final String key = entry.getKey() == null ? "" : entry.getKey().toString();
// final String value = entry.getValue() == null ? "" : entry.getValue().toString();
// result[i] = key + "=" + value;
// i++;
// }
// return result;
// }
//
// /**
// * Find the list of environment variables for this process. The returned map preserves
// * the casing of a variable's name on all platforms but obeys the casing rules of the
// * current platform during lookup, e.g. key names will be case-insensitive on Windows
// * platforms.
// *
// * @return a map containing the environment variables, may be empty but never {@code null}
// * @throws IOException the operation failed
// */
// public static Map<String, String> getProcEnvironment() throws IOException {
// return PROCESSING_ENVIRONMENT_IMPLEMENTATION.getProcEnvironment();
// }
//
// /**
// * Add a key/value pair to the given environment.
// * If the key matches an existing key, the previous setting is replaced.
// *
// * @param environment the current environment
// * @param keyAndValue the key/value pair
// */
// public static void addVariableToEnvironment(final Map<String, String> environment, final String keyAndValue) {
// final String[] parsedVariable = parseEnvironmentVariable(keyAndValue);
// environment.put(parsedVariable[0], parsedVariable[1]);
// }
//
// /**
// * Split a key/value pair into a String[]. It is assumed
// * that the ky/value pair contains a '=' character.
// *
// * @param keyAndValue the key/value pair
// * @return a String[] containing the key and value
// */
// private static String[] parseEnvironmentVariable(final String keyAndValue) {
// final int index = keyAndValue.indexOf('=');
// if (index == -1) {
// throw new IllegalArgumentException(
// "Environment variable for this platform "
// + "must contain an equals sign ('=')");
// }
//
// final String[] result = new String[2];
// result[0] = keyAndValue.substring(0, index);
// result[1] = keyAndValue.substring(index + 1);
//
// return result;
// }
//
// }
| import org.apache.commons.exec.environment.EnvironmentUtils;
import org.junit.*;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
import static org.junit.Assert.*; |
resultHandler.waitFor(WAITFOR_TIMEOUT);
assertTrue("ResultHandler received a result", resultHandler.hasResult());
assertFalse(exec.isFailure(resultHandler.getExitValue()));
final String result = baos.toString();
assertTrue("Result '" + result + "' should contain 'Hello Foo!'", result.indexOf("Hello Foo!") >= 0);
}
/**
* Call a script to dump the environment variables of the subprocess.
*
* @throws Exception the test failed
*/
@Test
public void testEnvironmentVariables() throws Exception {
exec.execute(new CommandLine(environmentSript));
final String environment = baos.toString().trim();
assertFalse("Found no environment variables", environment.isEmpty());
assertFalse(environment.indexOf("NEW_VAR") >= 0);
}
/**
* Call a script to dump the environment variables of the subprocess
* after adding a custom environment variable.
*
* @throws Exception the test failed
*/
@Test
public void testAddEnvironmentVariables() throws Exception { | // Path: src/main/java/org/apache/commons/exec/environment/EnvironmentUtils.java
// public class EnvironmentUtils
// {
//
// private static final DefaultProcessingEnvironment PROCESSING_ENVIRONMENT_IMPLEMENTATION;
//
// static {
// // if (OS.isFamilyOpenVms()) {
// // PROCESSING_ENVIRONMENT_IMPLEMENTATION = new OpenVmsProcessingEnvironment();
// // } else {
// PROCESSING_ENVIRONMENT_IMPLEMENTATION = new DefaultProcessingEnvironment();
// // }
// }
//
// /**
// * Disable constructor.
// */
// private EnvironmentUtils() {
//
// }
//
// /**
// * Get the variable list as an array.
// *
// * @param environment the environment to use, may be {@code null}
// * @return array of key=value assignment strings or {@code null} if and only if
// * the input map was {@code null}
// */
// public static String[] toStrings(final Map<String, String> environment) {
// if (environment == null) {
// return null;
// }
// final String[] result = new String[environment.size()];
// int i = 0;
// for (final Entry<String, String> entry : environment.entrySet()) {
// final String key = entry.getKey() == null ? "" : entry.getKey().toString();
// final String value = entry.getValue() == null ? "" : entry.getValue().toString();
// result[i] = key + "=" + value;
// i++;
// }
// return result;
// }
//
// /**
// * Find the list of environment variables for this process. The returned map preserves
// * the casing of a variable's name on all platforms but obeys the casing rules of the
// * current platform during lookup, e.g. key names will be case-insensitive on Windows
// * platforms.
// *
// * @return a map containing the environment variables, may be empty but never {@code null}
// * @throws IOException the operation failed
// */
// public static Map<String, String> getProcEnvironment() throws IOException {
// return PROCESSING_ENVIRONMENT_IMPLEMENTATION.getProcEnvironment();
// }
//
// /**
// * Add a key/value pair to the given environment.
// * If the key matches an existing key, the previous setting is replaced.
// *
// * @param environment the current environment
// * @param keyAndValue the key/value pair
// */
// public static void addVariableToEnvironment(final Map<String, String> environment, final String keyAndValue) {
// final String[] parsedVariable = parseEnvironmentVariable(keyAndValue);
// environment.put(parsedVariable[0], parsedVariable[1]);
// }
//
// /**
// * Split a key/value pair into a String[]. It is assumed
// * that the ky/value pair contains a '=' character.
// *
// * @param keyAndValue the key/value pair
// * @return a String[] containing the key and value
// */
// private static String[] parseEnvironmentVariable(final String keyAndValue) {
// final int index = keyAndValue.indexOf('=');
// if (index == -1) {
// throw new IllegalArgumentException(
// "Environment variable for this platform "
// + "must contain an equals sign ('=')");
// }
//
// final String[] result = new String[2];
// result[0] = keyAndValue.substring(0, index);
// result[1] = keyAndValue.substring(index + 1);
//
// return result;
// }
//
// }
// Path: src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
import org.apache.commons.exec.environment.EnvironmentUtils;
import org.junit.*;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
import static org.junit.Assert.*;
resultHandler.waitFor(WAITFOR_TIMEOUT);
assertTrue("ResultHandler received a result", resultHandler.hasResult());
assertFalse(exec.isFailure(resultHandler.getExitValue()));
final String result = baos.toString();
assertTrue("Result '" + result + "' should contain 'Hello Foo!'", result.indexOf("Hello Foo!") >= 0);
}
/**
* Call a script to dump the environment variables of the subprocess.
*
* @throws Exception the test failed
*/
@Test
public void testEnvironmentVariables() throws Exception {
exec.execute(new CommandLine(environmentSript));
final String environment = baos.toString().trim();
assertFalse("Found no environment variables", environment.isEmpty());
assertFalse(environment.indexOf("NEW_VAR") >= 0);
}
/**
* Call a script to dump the environment variables of the subprocess
* after adding a custom environment variable.
*
* @throws Exception the test failed
*/
@Test
public void testAddEnvironmentVariables() throws Exception { | final Map<String, String> myEnvVars = new HashMap<>(EnvironmentUtils.getProcEnvironment()); |
apache/commons-exec | src/main/java/org/apache/commons/exec/ExecuteWatchdog.java | // Path: src/main/java/org/apache/commons/exec/util/DebugUtils.java
// public class DebugUtils
// {
// /**
// * System property to determine how to handle exceptions. When
// * set to "false" we rethrow the otherwise silently catched
// * exceptions found in the original code. The default value
// * is "true"
// */
// public static final String COMMONS_EXEC_LENIENT = "org.apache.commons.exec.lenient";
//
// /**
// * System property to determine how to dump an exception. When
// * set to "true" we print any exception to stderr. The default
// * value is "false"
// */
// public static final String COMMONS_EXEC_DEBUG = "org.apache.commons.exec.debug";
//
// /**
// * Handles an exception based on the system properties.
// *
// * @param msg message describing the problem
// * @param e an exception being handled
// */
// public static void handleException(final String msg, final Exception e) {
//
// if (isDebugEnabled()) {
// System.err.println(msg);
// e.printStackTrace();
// }
//
// if (!isLenientEnabled()) {
// if (e instanceof RuntimeException) {
// throw (RuntimeException) e;
// }
// // can't pass root cause since the constructor is not available on JDK 1.3
// throw new RuntimeException(e.getMessage());
// }
// }
//
// /**
// * Determines if debugging is enabled based on the
// * system property "COMMONS_EXEC_DEBUG".
// *
// * @return true if debug mode is enabled
// */
// public static boolean isDebugEnabled() {
// final String debug = System.getProperty(COMMONS_EXEC_DEBUG, Boolean.FALSE.toString());
// return Boolean.TRUE.toString().equalsIgnoreCase(debug);
// }
//
// /**
// * Determines if lenient mode is enabled.
// *
// * @return true if lenient mode is enabled
// */
// public static boolean isLenientEnabled() {
// final String lenient = System.getProperty(COMMONS_EXEC_LENIENT, Boolean.TRUE.toString());
// return Boolean.TRUE.toString().equalsIgnoreCase(lenient);
// }
//
// }
| import org.apache.commons.exec.util.DebugUtils; | * Destroys the running process manually.
*/
public synchronized void destroyProcess() {
ensureStarted();
this.timeoutOccured(null);
this.stop();
}
/**
* Called after watchdog has finished.
*/
@Override
public synchronized void timeoutOccured(final Watchdog w) {
try {
try {
// We must check if the process was not stopped
// before being here
if (process != null) {
process.exitValue();
}
} catch (final IllegalThreadStateException itse) {
// the process is not terminated, if this is really
// a timeout and not a manual stop then destroy it.
if (watch) {
killedProcess = true;
process.destroy();
}
}
} catch (final Exception e) {
caught = e; | // Path: src/main/java/org/apache/commons/exec/util/DebugUtils.java
// public class DebugUtils
// {
// /**
// * System property to determine how to handle exceptions. When
// * set to "false" we rethrow the otherwise silently catched
// * exceptions found in the original code. The default value
// * is "true"
// */
// public static final String COMMONS_EXEC_LENIENT = "org.apache.commons.exec.lenient";
//
// /**
// * System property to determine how to dump an exception. When
// * set to "true" we print any exception to stderr. The default
// * value is "false"
// */
// public static final String COMMONS_EXEC_DEBUG = "org.apache.commons.exec.debug";
//
// /**
// * Handles an exception based on the system properties.
// *
// * @param msg message describing the problem
// * @param e an exception being handled
// */
// public static void handleException(final String msg, final Exception e) {
//
// if (isDebugEnabled()) {
// System.err.println(msg);
// e.printStackTrace();
// }
//
// if (!isLenientEnabled()) {
// if (e instanceof RuntimeException) {
// throw (RuntimeException) e;
// }
// // can't pass root cause since the constructor is not available on JDK 1.3
// throw new RuntimeException(e.getMessage());
// }
// }
//
// /**
// * Determines if debugging is enabled based on the
// * system property "COMMONS_EXEC_DEBUG".
// *
// * @return true if debug mode is enabled
// */
// public static boolean isDebugEnabled() {
// final String debug = System.getProperty(COMMONS_EXEC_DEBUG, Boolean.FALSE.toString());
// return Boolean.TRUE.toString().equalsIgnoreCase(debug);
// }
//
// /**
// * Determines if lenient mode is enabled.
// *
// * @return true if lenient mode is enabled
// */
// public static boolean isLenientEnabled() {
// final String lenient = System.getProperty(COMMONS_EXEC_LENIENT, Boolean.TRUE.toString());
// return Boolean.TRUE.toString().equalsIgnoreCase(lenient);
// }
//
// }
// Path: src/main/java/org/apache/commons/exec/ExecuteWatchdog.java
import org.apache.commons.exec.util.DebugUtils;
* Destroys the running process manually.
*/
public synchronized void destroyProcess() {
ensureStarted();
this.timeoutOccured(null);
this.stop();
}
/**
* Called after watchdog has finished.
*/
@Override
public synchronized void timeoutOccured(final Watchdog w) {
try {
try {
// We must check if the process was not stopped
// before being here
if (process != null) {
process.exitValue();
}
} catch (final IllegalThreadStateException itse) {
// the process is not terminated, if this is really
// a timeout and not a manual stop then destroy it.
if (watch) {
killedProcess = true;
process.destroy();
}
}
} catch (final Exception e) {
caught = e; | DebugUtils.handleException("Getting the exit value of the process failed", e); |
apache/commons-exec | src/main/java/org/apache/commons/exec/DefaultExecutor.java | // Path: src/main/java/org/apache/commons/exec/launcher/CommandLauncher.java
// public interface CommandLauncher {
//
// /**
// * Launches the given command in a new process.
// *
// * @param cmd
// * The command to execute
// * @param env
// * The environment for the new process. If null, the environment
// * of the current process is used.
// *
// * @return the newly created process
// * @throws IOException
// * if attempting to run a command in a specific directory
// */
// Process exec(final CommandLine cmd, final Map<String, String> env)
// throws IOException;
//
// /**
// * Launches the given command in a new process, in the given working
// * directory.
// *
// * @param cmd
// * The command to execute
// * @param env
// * The environment for the new process. If null, the environment
// * of the current process is used.
// * @param workingDir
// * The directory to start the command in. If null, the current
// * directory is used
// *
// * @return the newly created process
// * @throws IOException
// * if trying to change directory
// */
// Process exec(final CommandLine cmd, final Map<String, String> env,
// final File workingDir) throws IOException;
//
//
// /**
// * Checks whether {@code exitValue} signals a failure on the current
// * system (OS specific).
// * <p>
// * <b>Note</b> that this method relies on the conventions of the OS, it
// * will return false results if the application you are running doesn't
// * follow these conventions. One notable exception is the Java VM provided
// * by HP for OpenVMS - it will return 0 if successful (like on any other
// * platform), but this signals a failure on OpenVMS. So if you execute a new
// * Java VM on OpenVMS, you cannot trust this method.
// * </p>
// *
// * @param exitValue the exit value (return code) to be checked
// * @return {@code true} if {@code exitValue} signals a failure
// */
// boolean isFailure(final int exitValue);
// }
//
// Path: src/main/java/org/apache/commons/exec/launcher/CommandLauncherFactory.java
// public final class CommandLauncherFactory {
//
// private CommandLauncherFactory() {
// }
//
// /**
// * Factory method to create an appropriate launcher.
// *
// * @return the command launcher
// */
// public static CommandLauncher createVMLauncher() {
// // Try using a JDK 1.3 launcher
// CommandLauncher launcher;
//
// if (OS.isFamilyOpenVms()) {
// launcher = new VmsCommandLauncher();
// } else {
// launcher = new Java13CommandLauncher();
// }
//
// return launcher;
// }
// }
| import org.apache.commons.exec.launcher.CommandLauncher;
import org.apache.commons.exec.launcher.CommandLauncherFactory;
import java.io.File;
import java.io.IOException;
import java.util.Map; | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.exec;
/**
* The default class to start a subprocess. The implementation
* allows to
* <ul>
* <li>set a current working directory for the subprocess</li>
* <li>provide a set of environment variables passed to the subprocess</li>
* <li>capture the subprocess output of stdout and stderr using an ExecuteStreamHandler</li>
* <li>kill long-running processes using an ExecuteWatchdog</li>
* <li>define a set of expected exit values</li>
* <li>terminate any started processes when the main process is terminating using a ProcessDestroyer</li>
* </ul>
*
* The following example shows the basic usage:
*
* <pre>
* Executor exec = new DefaultExecutor();
* CommandLine cl = new CommandLine("ls -l");
* int exitvalue = exec.execute(cl);
* </pre>
*
*/
public class DefaultExecutor implements Executor {
/** taking care of output and error stream */
private ExecuteStreamHandler streamHandler;
/** the working directory of the process */
private File workingDirectory;
/** monitoring of long running processes */
private ExecuteWatchdog watchdog;
/** the exit values considered to be successful */
private int[] exitValues;
/** launches the command in a new process */
private final CommandLauncher launcher;
/** optional cleanup of started processes */
private ProcessDestroyer processDestroyer;
/** worker thread for asynchronous execution */
private Thread executorThread;
/** the first exception being caught to be thrown to the caller */
private IOException exceptionCaught;
/**
* Default constructor creating a default {@code PumpStreamHandler}
* and sets the working directory of the subprocess to the current
* working directory.
*
* The {@code PumpStreamHandler} pumps the output of the subprocess
* into our {@code System.out} and {@code System.err} to avoid
* into our {@code System.out} and {@code System.err} to avoid
* a blocked or deadlocked subprocess (see{@link java.lang.Process Process}).
*/
public DefaultExecutor() {
this.streamHandler = new PumpStreamHandler(); | // Path: src/main/java/org/apache/commons/exec/launcher/CommandLauncher.java
// public interface CommandLauncher {
//
// /**
// * Launches the given command in a new process.
// *
// * @param cmd
// * The command to execute
// * @param env
// * The environment for the new process. If null, the environment
// * of the current process is used.
// *
// * @return the newly created process
// * @throws IOException
// * if attempting to run a command in a specific directory
// */
// Process exec(final CommandLine cmd, final Map<String, String> env)
// throws IOException;
//
// /**
// * Launches the given command in a new process, in the given working
// * directory.
// *
// * @param cmd
// * The command to execute
// * @param env
// * The environment for the new process. If null, the environment
// * of the current process is used.
// * @param workingDir
// * The directory to start the command in. If null, the current
// * directory is used
// *
// * @return the newly created process
// * @throws IOException
// * if trying to change directory
// */
// Process exec(final CommandLine cmd, final Map<String, String> env,
// final File workingDir) throws IOException;
//
//
// /**
// * Checks whether {@code exitValue} signals a failure on the current
// * system (OS specific).
// * <p>
// * <b>Note</b> that this method relies on the conventions of the OS, it
// * will return false results if the application you are running doesn't
// * follow these conventions. One notable exception is the Java VM provided
// * by HP for OpenVMS - it will return 0 if successful (like on any other
// * platform), but this signals a failure on OpenVMS. So if you execute a new
// * Java VM on OpenVMS, you cannot trust this method.
// * </p>
// *
// * @param exitValue the exit value (return code) to be checked
// * @return {@code true} if {@code exitValue} signals a failure
// */
// boolean isFailure(final int exitValue);
// }
//
// Path: src/main/java/org/apache/commons/exec/launcher/CommandLauncherFactory.java
// public final class CommandLauncherFactory {
//
// private CommandLauncherFactory() {
// }
//
// /**
// * Factory method to create an appropriate launcher.
// *
// * @return the command launcher
// */
// public static CommandLauncher createVMLauncher() {
// // Try using a JDK 1.3 launcher
// CommandLauncher launcher;
//
// if (OS.isFamilyOpenVms()) {
// launcher = new VmsCommandLauncher();
// } else {
// launcher = new Java13CommandLauncher();
// }
//
// return launcher;
// }
// }
// Path: src/main/java/org/apache/commons/exec/DefaultExecutor.java
import org.apache.commons.exec.launcher.CommandLauncher;
import org.apache.commons.exec.launcher.CommandLauncherFactory;
import java.io.File;
import java.io.IOException;
import java.util.Map;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.exec;
/**
* The default class to start a subprocess. The implementation
* allows to
* <ul>
* <li>set a current working directory for the subprocess</li>
* <li>provide a set of environment variables passed to the subprocess</li>
* <li>capture the subprocess output of stdout and stderr using an ExecuteStreamHandler</li>
* <li>kill long-running processes using an ExecuteWatchdog</li>
* <li>define a set of expected exit values</li>
* <li>terminate any started processes when the main process is terminating using a ProcessDestroyer</li>
* </ul>
*
* The following example shows the basic usage:
*
* <pre>
* Executor exec = new DefaultExecutor();
* CommandLine cl = new CommandLine("ls -l");
* int exitvalue = exec.execute(cl);
* </pre>
*
*/
public class DefaultExecutor implements Executor {
/** taking care of output and error stream */
private ExecuteStreamHandler streamHandler;
/** the working directory of the process */
private File workingDirectory;
/** monitoring of long running processes */
private ExecuteWatchdog watchdog;
/** the exit values considered to be successful */
private int[] exitValues;
/** launches the command in a new process */
private final CommandLauncher launcher;
/** optional cleanup of started processes */
private ProcessDestroyer processDestroyer;
/** worker thread for asynchronous execution */
private Thread executorThread;
/** the first exception being caught to be thrown to the caller */
private IOException exceptionCaught;
/**
* Default constructor creating a default {@code PumpStreamHandler}
* and sets the working directory of the subprocess to the current
* working directory.
*
* The {@code PumpStreamHandler} pumps the output of the subprocess
* into our {@code System.out} and {@code System.err} to avoid
* into our {@code System.out} and {@code System.err} to avoid
* a blocked or deadlocked subprocess (see{@link java.lang.Process Process}).
*/
public DefaultExecutor() {
this.streamHandler = new PumpStreamHandler(); | this.launcher = CommandLauncherFactory.createVMLauncher(); |
apache/commons-exec | src/main/java/org/apache/commons/exec/PumpStreamHandler.java | // Path: src/main/java/org/apache/commons/exec/util/DebugUtils.java
// public class DebugUtils
// {
// /**
// * System property to determine how to handle exceptions. When
// * set to "false" we rethrow the otherwise silently catched
// * exceptions found in the original code. The default value
// * is "true"
// */
// public static final String COMMONS_EXEC_LENIENT = "org.apache.commons.exec.lenient";
//
// /**
// * System property to determine how to dump an exception. When
// * set to "true" we print any exception to stderr. The default
// * value is "false"
// */
// public static final String COMMONS_EXEC_DEBUG = "org.apache.commons.exec.debug";
//
// /**
// * Handles an exception based on the system properties.
// *
// * @param msg message describing the problem
// * @param e an exception being handled
// */
// public static void handleException(final String msg, final Exception e) {
//
// if (isDebugEnabled()) {
// System.err.println(msg);
// e.printStackTrace();
// }
//
// if (!isLenientEnabled()) {
// if (e instanceof RuntimeException) {
// throw (RuntimeException) e;
// }
// // can't pass root cause since the constructor is not available on JDK 1.3
// throw new RuntimeException(e.getMessage());
// }
// }
//
// /**
// * Determines if debugging is enabled based on the
// * system property "COMMONS_EXEC_DEBUG".
// *
// * @return true if debug mode is enabled
// */
// public static boolean isDebugEnabled() {
// final String debug = System.getProperty(COMMONS_EXEC_DEBUG, Boolean.FALSE.toString());
// return Boolean.TRUE.toString().equalsIgnoreCase(debug);
// }
//
// /**
// * Determines if lenient mode is enabled.
// *
// * @return true if lenient mode is enabled
// */
// public static boolean isLenientEnabled() {
// final String lenient = System.getProperty(COMMONS_EXEC_LENIENT, Boolean.TRUE.toString());
// return Boolean.TRUE.toString().equalsIgnoreCase(lenient);
// }
//
// }
| import org.apache.commons.exec.util.DebugUtils;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PipedOutputStream; | * of the process.
*
* @param is the <CODE>InputStream</CODE>.
*/
@Override
public void setProcessErrorStream(final InputStream is) {
if (err != null) {
createProcessErrorPump(is, err);
}
}
/**
* Set the <CODE>OutputStream</CODE> by means of which input can be sent
* to the process.
*
* @param os the <CODE>OutputStream</CODE>.
*/
@Override
public void setProcessInputStream(final OutputStream os) {
if (input != null) {
if (input == System.in) {
inputThread = createSystemInPump(input, os);
} else {
inputThread = createPump(input, os, true);
}
} else {
try {
os.close();
} catch (final IOException e) {
final String msg = "Got exception while closing output stream"; | // Path: src/main/java/org/apache/commons/exec/util/DebugUtils.java
// public class DebugUtils
// {
// /**
// * System property to determine how to handle exceptions. When
// * set to "false" we rethrow the otherwise silently catched
// * exceptions found in the original code. The default value
// * is "true"
// */
// public static final String COMMONS_EXEC_LENIENT = "org.apache.commons.exec.lenient";
//
// /**
// * System property to determine how to dump an exception. When
// * set to "true" we print any exception to stderr. The default
// * value is "false"
// */
// public static final String COMMONS_EXEC_DEBUG = "org.apache.commons.exec.debug";
//
// /**
// * Handles an exception based on the system properties.
// *
// * @param msg message describing the problem
// * @param e an exception being handled
// */
// public static void handleException(final String msg, final Exception e) {
//
// if (isDebugEnabled()) {
// System.err.println(msg);
// e.printStackTrace();
// }
//
// if (!isLenientEnabled()) {
// if (e instanceof RuntimeException) {
// throw (RuntimeException) e;
// }
// // can't pass root cause since the constructor is not available on JDK 1.3
// throw new RuntimeException(e.getMessage());
// }
// }
//
// /**
// * Determines if debugging is enabled based on the
// * system property "COMMONS_EXEC_DEBUG".
// *
// * @return true if debug mode is enabled
// */
// public static boolean isDebugEnabled() {
// final String debug = System.getProperty(COMMONS_EXEC_DEBUG, Boolean.FALSE.toString());
// return Boolean.TRUE.toString().equalsIgnoreCase(debug);
// }
//
// /**
// * Determines if lenient mode is enabled.
// *
// * @return true if lenient mode is enabled
// */
// public static boolean isLenientEnabled() {
// final String lenient = System.getProperty(COMMONS_EXEC_LENIENT, Boolean.TRUE.toString());
// return Boolean.TRUE.toString().equalsIgnoreCase(lenient);
// }
//
// }
// Path: src/main/java/org/apache/commons/exec/PumpStreamHandler.java
import org.apache.commons.exec.util.DebugUtils;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PipedOutputStream;
* of the process.
*
* @param is the <CODE>InputStream</CODE>.
*/
@Override
public void setProcessErrorStream(final InputStream is) {
if (err != null) {
createProcessErrorPump(is, err);
}
}
/**
* Set the <CODE>OutputStream</CODE> by means of which input can be sent
* to the process.
*
* @param os the <CODE>OutputStream</CODE>.
*/
@Override
public void setProcessInputStream(final OutputStream os) {
if (input != null) {
if (input == System.in) {
inputThread = createSystemInPump(input, os);
} else {
inputThread = createPump(input, os, true);
}
} else {
try {
os.close();
} catch (final IOException e) {
final String msg = "Got exception while closing output stream"; | DebugUtils.handleException(msg, e); |
apache/commons-exec | src/main/java/org/apache/commons/exec/InputStreamPumper.java | // Path: src/main/java/org/apache/commons/exec/util/DebugUtils.java
// public class DebugUtils
// {
// /**
// * System property to determine how to handle exceptions. When
// * set to "false" we rethrow the otherwise silently catched
// * exceptions found in the original code. The default value
// * is "true"
// */
// public static final String COMMONS_EXEC_LENIENT = "org.apache.commons.exec.lenient";
//
// /**
// * System property to determine how to dump an exception. When
// * set to "true" we print any exception to stderr. The default
// * value is "false"
// */
// public static final String COMMONS_EXEC_DEBUG = "org.apache.commons.exec.debug";
//
// /**
// * Handles an exception based on the system properties.
// *
// * @param msg message describing the problem
// * @param e an exception being handled
// */
// public static void handleException(final String msg, final Exception e) {
//
// if (isDebugEnabled()) {
// System.err.println(msg);
// e.printStackTrace();
// }
//
// if (!isLenientEnabled()) {
// if (e instanceof RuntimeException) {
// throw (RuntimeException) e;
// }
// // can't pass root cause since the constructor is not available on JDK 1.3
// throw new RuntimeException(e.getMessage());
// }
// }
//
// /**
// * Determines if debugging is enabled based on the
// * system property "COMMONS_EXEC_DEBUG".
// *
// * @return true if debug mode is enabled
// */
// public static boolean isDebugEnabled() {
// final String debug = System.getProperty(COMMONS_EXEC_DEBUG, Boolean.FALSE.toString());
// return Boolean.TRUE.toString().equalsIgnoreCase(debug);
// }
//
// /**
// * Determines if lenient mode is enabled.
// *
// * @return true if lenient mode is enabled
// */
// public static boolean isLenientEnabled() {
// final String lenient = System.getProperty(COMMONS_EXEC_LENIENT, Boolean.TRUE.toString());
// return Boolean.TRUE.toString().equalsIgnoreCase(lenient);
// }
//
// }
| import java.io.InputStream;
import java.io.OutputStream;
import org.apache.commons.exec.util.DebugUtils; | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.commons.exec;
/**
* Copies all data from an System.input stream to an output stream of the executed process.
*
*/
public class InputStreamPumper implements Runnable {
public static final int SLEEPING_TIME = 100;
/** the input stream to pump from */
private final InputStream is;
/** the output stream to pmp into */
private final OutputStream os;
/** flag to stop the stream pumping */
private volatile boolean stop;
/**
* Create a new stream pumper.
*
* @param is input stream to read data from
* @param os output stream to write data to.
*/
public InputStreamPumper(final InputStream is, final OutputStream os) {
this.is = is;
this.os = os;
this.stop = false;
}
/**
* Copies data from the input stream to the output stream. Terminates as
* soon as the input stream is closed or an error occurs.
*/
@Override
public void run() {
try {
while (!stop) {
while (is.available() > 0 && !stop) {
os.write(is.read());
}
os.flush();
Thread.sleep(SLEEPING_TIME);
}
} catch (final Exception e) {
final String msg = "Got exception while reading/writing the stream"; | // Path: src/main/java/org/apache/commons/exec/util/DebugUtils.java
// public class DebugUtils
// {
// /**
// * System property to determine how to handle exceptions. When
// * set to "false" we rethrow the otherwise silently catched
// * exceptions found in the original code. The default value
// * is "true"
// */
// public static final String COMMONS_EXEC_LENIENT = "org.apache.commons.exec.lenient";
//
// /**
// * System property to determine how to dump an exception. When
// * set to "true" we print any exception to stderr. The default
// * value is "false"
// */
// public static final String COMMONS_EXEC_DEBUG = "org.apache.commons.exec.debug";
//
// /**
// * Handles an exception based on the system properties.
// *
// * @param msg message describing the problem
// * @param e an exception being handled
// */
// public static void handleException(final String msg, final Exception e) {
//
// if (isDebugEnabled()) {
// System.err.println(msg);
// e.printStackTrace();
// }
//
// if (!isLenientEnabled()) {
// if (e instanceof RuntimeException) {
// throw (RuntimeException) e;
// }
// // can't pass root cause since the constructor is not available on JDK 1.3
// throw new RuntimeException(e.getMessage());
// }
// }
//
// /**
// * Determines if debugging is enabled based on the
// * system property "COMMONS_EXEC_DEBUG".
// *
// * @return true if debug mode is enabled
// */
// public static boolean isDebugEnabled() {
// final String debug = System.getProperty(COMMONS_EXEC_DEBUG, Boolean.FALSE.toString());
// return Boolean.TRUE.toString().equalsIgnoreCase(debug);
// }
//
// /**
// * Determines if lenient mode is enabled.
// *
// * @return true if lenient mode is enabled
// */
// public static boolean isLenientEnabled() {
// final String lenient = System.getProperty(COMMONS_EXEC_LENIENT, Boolean.TRUE.toString());
// return Boolean.TRUE.toString().equalsIgnoreCase(lenient);
// }
//
// }
// Path: src/main/java/org/apache/commons/exec/InputStreamPumper.java
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.commons.exec.util.DebugUtils;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.commons.exec;
/**
* Copies all data from an System.input stream to an output stream of the executed process.
*
*/
public class InputStreamPumper implements Runnable {
public static final int SLEEPING_TIME = 100;
/** the input stream to pump from */
private final InputStream is;
/** the output stream to pmp into */
private final OutputStream os;
/** flag to stop the stream pumping */
private volatile boolean stop;
/**
* Create a new stream pumper.
*
* @param is input stream to read data from
* @param os output stream to write data to.
*/
public InputStreamPumper(final InputStream is, final OutputStream os) {
this.is = is;
this.os = os;
this.stop = false;
}
/**
* Copies data from the input stream to the output stream. Terminates as
* soon as the input stream is closed or an error occurs.
*/
@Override
public void run() {
try {
while (!stop) {
while (is.available() > 0 && !stop) {
os.write(is.read());
}
os.flush();
Thread.sleep(SLEEPING_TIME);
}
} catch (final Exception e) {
final String msg = "Got exception while reading/writing the stream"; | DebugUtils.handleException(msg ,e); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/store/ExtractedArtifactStore.java | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileSet.java
// @Value.Immutable
// public interface FileSet {
//
// List<Entry> entries();
//
// @Check
// default void shouldContainOneMoreExecutable() {
// boolean oneOrMoreExecutableFound = entries().stream().anyMatch(e -> e.type()==FileType.Executable);
// if (!oneOrMoreExecutableFound) {
// throw new IllegalArgumentException("there is no executable in this file set");
// }
// }
//
// @Value.Immutable
// abstract class Entry {
// @Parameter
// public abstract FileType type();
//
// @Parameter
// public abstract String destination();
//
// @Parameter
// protected abstract UncompiledPattern uncompiledMatchingPattern();
//
// @Auxiliary
// public Pattern matchingPattern() {
// return uncompiledMatchingPattern().compile();
// }
//
// static Entry of(FileType type, String filename, Pattern pattern) {
// return ImmutableEntry.of(type,filename, UncompiledPattern.of(pattern));
// }
// }
//
// class Builder extends ImmutableFileSet.Builder {
//
// public Builder addEntry(FileType type, String filename) {
// return addEntry(type,filename,".*"+filename);
// }
//
// public Builder addEntry(FileType type, String filename, String pattern) {
// return addEntry(type,filename,Pattern.compile(pattern,Pattern.CASE_INSENSITIVE));
// }
//
// public Builder addEntry(FileType type, String filename, Pattern pattern) {
// return addEntries(Entry.of(type,filename, pattern));
// }
//
// }
//
// static Builder builder() {
// return new Builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/file/FileAlreadyExistsException.java
// public class FileAlreadyExistsException extends IOException {
//
// public FileAlreadyExistsException(String message, File file) {
// super(message+": "+file);
// }
//
// }
| import de.flapdoodle.embed.process.io.directories.Directory;
import de.flapdoodle.embed.process.io.file.FileAlreadyExistsException;
import de.flapdoodle.os.Version;
import org.immutables.value.Value.Immutable;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.util.Optional;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileSet;
import de.flapdoodle.embed.process.config.store.FileType;
import de.flapdoodle.embed.process.config.store.ImmutableDownloadConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.*;
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.store;
@Immutable
public abstract class ExtractedArtifactStore implements IArtifactStore {
| // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileSet.java
// @Value.Immutable
// public interface FileSet {
//
// List<Entry> entries();
//
// @Check
// default void shouldContainOneMoreExecutable() {
// boolean oneOrMoreExecutableFound = entries().stream().anyMatch(e -> e.type()==FileType.Executable);
// if (!oneOrMoreExecutableFound) {
// throw new IllegalArgumentException("there is no executable in this file set");
// }
// }
//
// @Value.Immutable
// abstract class Entry {
// @Parameter
// public abstract FileType type();
//
// @Parameter
// public abstract String destination();
//
// @Parameter
// protected abstract UncompiledPattern uncompiledMatchingPattern();
//
// @Auxiliary
// public Pattern matchingPattern() {
// return uncompiledMatchingPattern().compile();
// }
//
// static Entry of(FileType type, String filename, Pattern pattern) {
// return ImmutableEntry.of(type,filename, UncompiledPattern.of(pattern));
// }
// }
//
// class Builder extends ImmutableFileSet.Builder {
//
// public Builder addEntry(FileType type, String filename) {
// return addEntry(type,filename,".*"+filename);
// }
//
// public Builder addEntry(FileType type, String filename, String pattern) {
// return addEntry(type,filename,Pattern.compile(pattern,Pattern.CASE_INSENSITIVE));
// }
//
// public Builder addEntry(FileType type, String filename, Pattern pattern) {
// return addEntries(Entry.of(type,filename, pattern));
// }
//
// }
//
// static Builder builder() {
// return new Builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/file/FileAlreadyExistsException.java
// public class FileAlreadyExistsException extends IOException {
//
// public FileAlreadyExistsException(String message, File file) {
// super(message+": "+file);
// }
//
// }
// Path: src/main/java/de/flapdoodle/embed/process/store/ExtractedArtifactStore.java
import de.flapdoodle.embed.process.io.directories.Directory;
import de.flapdoodle.embed.process.io.file.FileAlreadyExistsException;
import de.flapdoodle.os.Version;
import org.immutables.value.Value.Immutable;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.util.Optional;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileSet;
import de.flapdoodle.embed.process.config.store.FileType;
import de.flapdoodle.embed.process.config.store.ImmutableDownloadConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.*;
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.store;
@Immutable
public abstract class ExtractedArtifactStore implements IArtifactStore {
| abstract DownloadConfig downloadConfig(); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/store/ExtractedArtifactStore.java | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileSet.java
// @Value.Immutable
// public interface FileSet {
//
// List<Entry> entries();
//
// @Check
// default void shouldContainOneMoreExecutable() {
// boolean oneOrMoreExecutableFound = entries().stream().anyMatch(e -> e.type()==FileType.Executable);
// if (!oneOrMoreExecutableFound) {
// throw new IllegalArgumentException("there is no executable in this file set");
// }
// }
//
// @Value.Immutable
// abstract class Entry {
// @Parameter
// public abstract FileType type();
//
// @Parameter
// public abstract String destination();
//
// @Parameter
// protected abstract UncompiledPattern uncompiledMatchingPattern();
//
// @Auxiliary
// public Pattern matchingPattern() {
// return uncompiledMatchingPattern().compile();
// }
//
// static Entry of(FileType type, String filename, Pattern pattern) {
// return ImmutableEntry.of(type,filename, UncompiledPattern.of(pattern));
// }
// }
//
// class Builder extends ImmutableFileSet.Builder {
//
// public Builder addEntry(FileType type, String filename) {
// return addEntry(type,filename,".*"+filename);
// }
//
// public Builder addEntry(FileType type, String filename, String pattern) {
// return addEntry(type,filename,Pattern.compile(pattern,Pattern.CASE_INSENSITIVE));
// }
//
// public Builder addEntry(FileType type, String filename, Pattern pattern) {
// return addEntries(Entry.of(type,filename, pattern));
// }
//
// }
//
// static Builder builder() {
// return new Builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/file/FileAlreadyExistsException.java
// public class FileAlreadyExistsException extends IOException {
//
// public FileAlreadyExistsException(String message, File file) {
// super(message+": "+file);
// }
//
// }
| import de.flapdoodle.embed.process.io.directories.Directory;
import de.flapdoodle.embed.process.io.file.FileAlreadyExistsException;
import de.flapdoodle.os.Version;
import org.immutables.value.Value.Immutable;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.util.Optional;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileSet;
import de.flapdoodle.embed.process.config.store.FileType;
import de.flapdoodle.embed.process.config.store.ImmutableDownloadConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.*;
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.store;
@Immutable
public abstract class ExtractedArtifactStore implements IArtifactStore {
abstract DownloadConfig downloadConfig();
abstract Downloader downloader();
abstract DirectoryAndExecutableNaming extraction();
abstract DirectoryAndExecutableNaming temp();
| // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileSet.java
// @Value.Immutable
// public interface FileSet {
//
// List<Entry> entries();
//
// @Check
// default void shouldContainOneMoreExecutable() {
// boolean oneOrMoreExecutableFound = entries().stream().anyMatch(e -> e.type()==FileType.Executable);
// if (!oneOrMoreExecutableFound) {
// throw new IllegalArgumentException("there is no executable in this file set");
// }
// }
//
// @Value.Immutable
// abstract class Entry {
// @Parameter
// public abstract FileType type();
//
// @Parameter
// public abstract String destination();
//
// @Parameter
// protected abstract UncompiledPattern uncompiledMatchingPattern();
//
// @Auxiliary
// public Pattern matchingPattern() {
// return uncompiledMatchingPattern().compile();
// }
//
// static Entry of(FileType type, String filename, Pattern pattern) {
// return ImmutableEntry.of(type,filename, UncompiledPattern.of(pattern));
// }
// }
//
// class Builder extends ImmutableFileSet.Builder {
//
// public Builder addEntry(FileType type, String filename) {
// return addEntry(type,filename,".*"+filename);
// }
//
// public Builder addEntry(FileType type, String filename, String pattern) {
// return addEntry(type,filename,Pattern.compile(pattern,Pattern.CASE_INSENSITIVE));
// }
//
// public Builder addEntry(FileType type, String filename, Pattern pattern) {
// return addEntries(Entry.of(type,filename, pattern));
// }
//
// }
//
// static Builder builder() {
// return new Builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/file/FileAlreadyExistsException.java
// public class FileAlreadyExistsException extends IOException {
//
// public FileAlreadyExistsException(String message, File file) {
// super(message+": "+file);
// }
//
// }
// Path: src/main/java/de/flapdoodle/embed/process/store/ExtractedArtifactStore.java
import de.flapdoodle.embed.process.io.directories.Directory;
import de.flapdoodle.embed.process.io.file.FileAlreadyExistsException;
import de.flapdoodle.os.Version;
import org.immutables.value.Value.Immutable;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.util.Optional;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileSet;
import de.flapdoodle.embed.process.config.store.FileType;
import de.flapdoodle.embed.process.config.store.ImmutableDownloadConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.*;
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.store;
@Immutable
public abstract class ExtractedArtifactStore implements IArtifactStore {
abstract DownloadConfig downloadConfig();
abstract Downloader downloader();
abstract DirectoryAndExecutableNaming extraction();
abstract DirectoryAndExecutableNaming temp();
| private ArtifactStore store(Directory withDistribution, TempNaming naming) { |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/store/ExtractedArtifactStore.java | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileSet.java
// @Value.Immutable
// public interface FileSet {
//
// List<Entry> entries();
//
// @Check
// default void shouldContainOneMoreExecutable() {
// boolean oneOrMoreExecutableFound = entries().stream().anyMatch(e -> e.type()==FileType.Executable);
// if (!oneOrMoreExecutableFound) {
// throw new IllegalArgumentException("there is no executable in this file set");
// }
// }
//
// @Value.Immutable
// abstract class Entry {
// @Parameter
// public abstract FileType type();
//
// @Parameter
// public abstract String destination();
//
// @Parameter
// protected abstract UncompiledPattern uncompiledMatchingPattern();
//
// @Auxiliary
// public Pattern matchingPattern() {
// return uncompiledMatchingPattern().compile();
// }
//
// static Entry of(FileType type, String filename, Pattern pattern) {
// return ImmutableEntry.of(type,filename, UncompiledPattern.of(pattern));
// }
// }
//
// class Builder extends ImmutableFileSet.Builder {
//
// public Builder addEntry(FileType type, String filename) {
// return addEntry(type,filename,".*"+filename);
// }
//
// public Builder addEntry(FileType type, String filename, String pattern) {
// return addEntry(type,filename,Pattern.compile(pattern,Pattern.CASE_INSENSITIVE));
// }
//
// public Builder addEntry(FileType type, String filename, Pattern pattern) {
// return addEntries(Entry.of(type,filename, pattern));
// }
//
// }
//
// static Builder builder() {
// return new Builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/file/FileAlreadyExistsException.java
// public class FileAlreadyExistsException extends IOException {
//
// public FileAlreadyExistsException(String message, File file) {
// super(message+": "+file);
// }
//
// }
| import de.flapdoodle.embed.process.io.directories.Directory;
import de.flapdoodle.embed.process.io.file.FileAlreadyExistsException;
import de.flapdoodle.os.Version;
import org.immutables.value.Value.Immutable;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.util.Optional;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileSet;
import de.flapdoodle.embed.process.config.store.FileType;
import de.flapdoodle.embed.process.config.store.ImmutableDownloadConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.*;
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder; | .executableNaming(naming)
.downloader(downloader())
.build();
}
@Deprecated
public ExtractedArtifactStore executableNaming(TempNaming tempNaming) {
return ImmutableExtractedArtifactStore.copyOf(this)
.withExtraction(ImmutableDirectoryAndExecutableNaming.copyOf(extraction()).withExecutableNaming(tempNaming));
}
@Deprecated
public ExtractedArtifactStore download(ImmutableDownloadConfig.Builder downloadConfigBuilder) {
return ImmutableExtractedArtifactStore.copyOf(this).withDownloadConfig(downloadConfigBuilder.build());
}
@Override
public Optional<ExtractedFileSet> extractFileSet(Distribution distribution)
throws IOException {
Directory withDistribution = withDistribution(extraction().getDirectory(), distribution);
ArtifactStore baseStore = store(withDistribution, extraction().getExecutableNaming());
boolean foundExecutable=false;
File destinationDir = withDistribution.asFile();
Builder fileSetBuilder = ExtractedFileSet.builder(destinationDir)
.baseDirIsGenerated(withDistribution.isGenerated());
FilesToExtract filesToExtract = baseStore.filesToExtract(distribution); | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileSet.java
// @Value.Immutable
// public interface FileSet {
//
// List<Entry> entries();
//
// @Check
// default void shouldContainOneMoreExecutable() {
// boolean oneOrMoreExecutableFound = entries().stream().anyMatch(e -> e.type()==FileType.Executable);
// if (!oneOrMoreExecutableFound) {
// throw new IllegalArgumentException("there is no executable in this file set");
// }
// }
//
// @Value.Immutable
// abstract class Entry {
// @Parameter
// public abstract FileType type();
//
// @Parameter
// public abstract String destination();
//
// @Parameter
// protected abstract UncompiledPattern uncompiledMatchingPattern();
//
// @Auxiliary
// public Pattern matchingPattern() {
// return uncompiledMatchingPattern().compile();
// }
//
// static Entry of(FileType type, String filename, Pattern pattern) {
// return ImmutableEntry.of(type,filename, UncompiledPattern.of(pattern));
// }
// }
//
// class Builder extends ImmutableFileSet.Builder {
//
// public Builder addEntry(FileType type, String filename) {
// return addEntry(type,filename,".*"+filename);
// }
//
// public Builder addEntry(FileType type, String filename, String pattern) {
// return addEntry(type,filename,Pattern.compile(pattern,Pattern.CASE_INSENSITIVE));
// }
//
// public Builder addEntry(FileType type, String filename, Pattern pattern) {
// return addEntries(Entry.of(type,filename, pattern));
// }
//
// }
//
// static Builder builder() {
// return new Builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/file/FileAlreadyExistsException.java
// public class FileAlreadyExistsException extends IOException {
//
// public FileAlreadyExistsException(String message, File file) {
// super(message+": "+file);
// }
//
// }
// Path: src/main/java/de/flapdoodle/embed/process/store/ExtractedArtifactStore.java
import de.flapdoodle.embed.process.io.directories.Directory;
import de.flapdoodle.embed.process.io.file.FileAlreadyExistsException;
import de.flapdoodle.os.Version;
import org.immutables.value.Value.Immutable;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.util.Optional;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileSet;
import de.flapdoodle.embed.process.config.store.FileType;
import de.flapdoodle.embed.process.config.store.ImmutableDownloadConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.*;
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder;
.executableNaming(naming)
.downloader(downloader())
.build();
}
@Deprecated
public ExtractedArtifactStore executableNaming(TempNaming tempNaming) {
return ImmutableExtractedArtifactStore.copyOf(this)
.withExtraction(ImmutableDirectoryAndExecutableNaming.copyOf(extraction()).withExecutableNaming(tempNaming));
}
@Deprecated
public ExtractedArtifactStore download(ImmutableDownloadConfig.Builder downloadConfigBuilder) {
return ImmutableExtractedArtifactStore.copyOf(this).withDownloadConfig(downloadConfigBuilder.build());
}
@Override
public Optional<ExtractedFileSet> extractFileSet(Distribution distribution)
throws IOException {
Directory withDistribution = withDistribution(extraction().getDirectory(), distribution);
ArtifactStore baseStore = store(withDistribution, extraction().getExecutableNaming());
boolean foundExecutable=false;
File destinationDir = withDistribution.asFile();
Builder fileSetBuilder = ExtractedFileSet.builder(destinationDir)
.baseDirIsGenerated(withDistribution.isGenerated());
FilesToExtract filesToExtract = baseStore.filesToExtract(distribution); | for (FileSet.Entry file : filesToExtract.files()) { |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/store/ExtractedArtifactStore.java | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileSet.java
// @Value.Immutable
// public interface FileSet {
//
// List<Entry> entries();
//
// @Check
// default void shouldContainOneMoreExecutable() {
// boolean oneOrMoreExecutableFound = entries().stream().anyMatch(e -> e.type()==FileType.Executable);
// if (!oneOrMoreExecutableFound) {
// throw new IllegalArgumentException("there is no executable in this file set");
// }
// }
//
// @Value.Immutable
// abstract class Entry {
// @Parameter
// public abstract FileType type();
//
// @Parameter
// public abstract String destination();
//
// @Parameter
// protected abstract UncompiledPattern uncompiledMatchingPattern();
//
// @Auxiliary
// public Pattern matchingPattern() {
// return uncompiledMatchingPattern().compile();
// }
//
// static Entry of(FileType type, String filename, Pattern pattern) {
// return ImmutableEntry.of(type,filename, UncompiledPattern.of(pattern));
// }
// }
//
// class Builder extends ImmutableFileSet.Builder {
//
// public Builder addEntry(FileType type, String filename) {
// return addEntry(type,filename,".*"+filename);
// }
//
// public Builder addEntry(FileType type, String filename, String pattern) {
// return addEntry(type,filename,Pattern.compile(pattern,Pattern.CASE_INSENSITIVE));
// }
//
// public Builder addEntry(FileType type, String filename, Pattern pattern) {
// return addEntries(Entry.of(type,filename, pattern));
// }
//
// }
//
// static Builder builder() {
// return new Builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/file/FileAlreadyExistsException.java
// public class FileAlreadyExistsException extends IOException {
//
// public FileAlreadyExistsException(String message, File file) {
// super(message+": "+file);
// }
//
// }
| import de.flapdoodle.embed.process.io.directories.Directory;
import de.flapdoodle.embed.process.io.file.FileAlreadyExistsException;
import de.flapdoodle.os.Version;
import org.immutables.value.Value.Immutable;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.util.Optional;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileSet;
import de.flapdoodle.embed.process.config.store.FileType;
import de.flapdoodle.embed.process.config.store.ImmutableDownloadConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.*;
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder; | .downloader(downloader())
.build();
}
@Deprecated
public ExtractedArtifactStore executableNaming(TempNaming tempNaming) {
return ImmutableExtractedArtifactStore.copyOf(this)
.withExtraction(ImmutableDirectoryAndExecutableNaming.copyOf(extraction()).withExecutableNaming(tempNaming));
}
@Deprecated
public ExtractedArtifactStore download(ImmutableDownloadConfig.Builder downloadConfigBuilder) {
return ImmutableExtractedArtifactStore.copyOf(this).withDownloadConfig(downloadConfigBuilder.build());
}
@Override
public Optional<ExtractedFileSet> extractFileSet(Distribution distribution)
throws IOException {
Directory withDistribution = withDistribution(extraction().getDirectory(), distribution);
ArtifactStore baseStore = store(withDistribution, extraction().getExecutableNaming());
boolean foundExecutable=false;
File destinationDir = withDistribution.asFile();
Builder fileSetBuilder = ExtractedFileSet.builder(destinationDir)
.baseDirIsGenerated(withDistribution.isGenerated());
FilesToExtract filesToExtract = baseStore.filesToExtract(distribution);
for (FileSet.Entry file : filesToExtract.files()) { | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileSet.java
// @Value.Immutable
// public interface FileSet {
//
// List<Entry> entries();
//
// @Check
// default void shouldContainOneMoreExecutable() {
// boolean oneOrMoreExecutableFound = entries().stream().anyMatch(e -> e.type()==FileType.Executable);
// if (!oneOrMoreExecutableFound) {
// throw new IllegalArgumentException("there is no executable in this file set");
// }
// }
//
// @Value.Immutable
// abstract class Entry {
// @Parameter
// public abstract FileType type();
//
// @Parameter
// public abstract String destination();
//
// @Parameter
// protected abstract UncompiledPattern uncompiledMatchingPattern();
//
// @Auxiliary
// public Pattern matchingPattern() {
// return uncompiledMatchingPattern().compile();
// }
//
// static Entry of(FileType type, String filename, Pattern pattern) {
// return ImmutableEntry.of(type,filename, UncompiledPattern.of(pattern));
// }
// }
//
// class Builder extends ImmutableFileSet.Builder {
//
// public Builder addEntry(FileType type, String filename) {
// return addEntry(type,filename,".*"+filename);
// }
//
// public Builder addEntry(FileType type, String filename, String pattern) {
// return addEntry(type,filename,Pattern.compile(pattern,Pattern.CASE_INSENSITIVE));
// }
//
// public Builder addEntry(FileType type, String filename, Pattern pattern) {
// return addEntries(Entry.of(type,filename, pattern));
// }
//
// }
//
// static Builder builder() {
// return new Builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/file/FileAlreadyExistsException.java
// public class FileAlreadyExistsException extends IOException {
//
// public FileAlreadyExistsException(String message, File file) {
// super(message+": "+file);
// }
//
// }
// Path: src/main/java/de/flapdoodle/embed/process/store/ExtractedArtifactStore.java
import de.flapdoodle.embed.process.io.directories.Directory;
import de.flapdoodle.embed.process.io.file.FileAlreadyExistsException;
import de.flapdoodle.os.Version;
import org.immutables.value.Value.Immutable;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.util.Optional;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileSet;
import de.flapdoodle.embed.process.config.store.FileType;
import de.flapdoodle.embed.process.config.store.ImmutableDownloadConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.*;
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder;
.downloader(downloader())
.build();
}
@Deprecated
public ExtractedArtifactStore executableNaming(TempNaming tempNaming) {
return ImmutableExtractedArtifactStore.copyOf(this)
.withExtraction(ImmutableDirectoryAndExecutableNaming.copyOf(extraction()).withExecutableNaming(tempNaming));
}
@Deprecated
public ExtractedArtifactStore download(ImmutableDownloadConfig.Builder downloadConfigBuilder) {
return ImmutableExtractedArtifactStore.copyOf(this).withDownloadConfig(downloadConfigBuilder.build());
}
@Override
public Optional<ExtractedFileSet> extractFileSet(Distribution distribution)
throws IOException {
Directory withDistribution = withDistribution(extraction().getDirectory(), distribution);
ArtifactStore baseStore = store(withDistribution, extraction().getExecutableNaming());
boolean foundExecutable=false;
File destinationDir = withDistribution.asFile();
Builder fileSetBuilder = ExtractedFileSet.builder(destinationDir)
.baseDirIsGenerated(withDistribution.isGenerated());
FilesToExtract filesToExtract = baseStore.filesToExtract(distribution);
for (FileSet.Entry file : filesToExtract.files()) { | if (file.type()==FileType.Executable) { |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/store/ExtractedArtifactStore.java | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileSet.java
// @Value.Immutable
// public interface FileSet {
//
// List<Entry> entries();
//
// @Check
// default void shouldContainOneMoreExecutable() {
// boolean oneOrMoreExecutableFound = entries().stream().anyMatch(e -> e.type()==FileType.Executable);
// if (!oneOrMoreExecutableFound) {
// throw new IllegalArgumentException("there is no executable in this file set");
// }
// }
//
// @Value.Immutable
// abstract class Entry {
// @Parameter
// public abstract FileType type();
//
// @Parameter
// public abstract String destination();
//
// @Parameter
// protected abstract UncompiledPattern uncompiledMatchingPattern();
//
// @Auxiliary
// public Pattern matchingPattern() {
// return uncompiledMatchingPattern().compile();
// }
//
// static Entry of(FileType type, String filename, Pattern pattern) {
// return ImmutableEntry.of(type,filename, UncompiledPattern.of(pattern));
// }
// }
//
// class Builder extends ImmutableFileSet.Builder {
//
// public Builder addEntry(FileType type, String filename) {
// return addEntry(type,filename,".*"+filename);
// }
//
// public Builder addEntry(FileType type, String filename, String pattern) {
// return addEntry(type,filename,Pattern.compile(pattern,Pattern.CASE_INSENSITIVE));
// }
//
// public Builder addEntry(FileType type, String filename, Pattern pattern) {
// return addEntries(Entry.of(type,filename, pattern));
// }
//
// }
//
// static Builder builder() {
// return new Builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/file/FileAlreadyExistsException.java
// public class FileAlreadyExistsException extends IOException {
//
// public FileAlreadyExistsException(String message, File file) {
// super(message+": "+file);
// }
//
// }
| import de.flapdoodle.embed.process.io.directories.Directory;
import de.flapdoodle.embed.process.io.file.FileAlreadyExistsException;
import de.flapdoodle.os.Version;
import org.immutables.value.Value.Immutable;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.util.Optional;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileSet;
import de.flapdoodle.embed.process.config.store.FileType;
import de.flapdoodle.embed.process.config.store.ImmutableDownloadConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.*;
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder; |
Directory withDistribution = withDistribution(extraction().getDirectory(), distribution);
ArtifactStore baseStore = store(withDistribution, extraction().getExecutableNaming());
boolean foundExecutable=false;
File destinationDir = withDistribution.asFile();
Builder fileSetBuilder = ExtractedFileSet.builder(destinationDir)
.baseDirIsGenerated(withDistribution.isGenerated());
FilesToExtract filesToExtract = baseStore.filesToExtract(distribution);
for (FileSet.Entry file : filesToExtract.files()) {
if (file.type()==FileType.Executable) {
String executableName = FilesToExtract.executableName(extraction().getExecutableNaming(), file);
File executableFile = new File(executableName);
File resolvedExecutableFile = new File(destinationDir, executableName);
if (resolvedExecutableFile.isFile()) {
foundExecutable=true;
}
fileSetBuilder.executable(executableFile);
} else {
fileSetBuilder.addLibraryFiles(new File(FilesToExtract.fileName(file)));
}
}
ExtractedFileSet extractedFileSet;
if (!foundExecutable) {
// we found no executable, so we trigger extraction and hope for the best
try {
extractedFileSet = baseStore.extractFileSet(distribution).get(); | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileSet.java
// @Value.Immutable
// public interface FileSet {
//
// List<Entry> entries();
//
// @Check
// default void shouldContainOneMoreExecutable() {
// boolean oneOrMoreExecutableFound = entries().stream().anyMatch(e -> e.type()==FileType.Executable);
// if (!oneOrMoreExecutableFound) {
// throw new IllegalArgumentException("there is no executable in this file set");
// }
// }
//
// @Value.Immutable
// abstract class Entry {
// @Parameter
// public abstract FileType type();
//
// @Parameter
// public abstract String destination();
//
// @Parameter
// protected abstract UncompiledPattern uncompiledMatchingPattern();
//
// @Auxiliary
// public Pattern matchingPattern() {
// return uncompiledMatchingPattern().compile();
// }
//
// static Entry of(FileType type, String filename, Pattern pattern) {
// return ImmutableEntry.of(type,filename, UncompiledPattern.of(pattern));
// }
// }
//
// class Builder extends ImmutableFileSet.Builder {
//
// public Builder addEntry(FileType type, String filename) {
// return addEntry(type,filename,".*"+filename);
// }
//
// public Builder addEntry(FileType type, String filename, String pattern) {
// return addEntry(type,filename,Pattern.compile(pattern,Pattern.CASE_INSENSITIVE));
// }
//
// public Builder addEntry(FileType type, String filename, Pattern pattern) {
// return addEntries(Entry.of(type,filename, pattern));
// }
//
// }
//
// static Builder builder() {
// return new Builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/file/FileAlreadyExistsException.java
// public class FileAlreadyExistsException extends IOException {
//
// public FileAlreadyExistsException(String message, File file) {
// super(message+": "+file);
// }
//
// }
// Path: src/main/java/de/flapdoodle/embed/process/store/ExtractedArtifactStore.java
import de.flapdoodle.embed.process.io.directories.Directory;
import de.flapdoodle.embed.process.io.file.FileAlreadyExistsException;
import de.flapdoodle.os.Version;
import org.immutables.value.Value.Immutable;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.util.Optional;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileSet;
import de.flapdoodle.embed.process.config.store.FileType;
import de.flapdoodle.embed.process.config.store.ImmutableDownloadConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.*;
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder;
Directory withDistribution = withDistribution(extraction().getDirectory(), distribution);
ArtifactStore baseStore = store(withDistribution, extraction().getExecutableNaming());
boolean foundExecutable=false;
File destinationDir = withDistribution.asFile();
Builder fileSetBuilder = ExtractedFileSet.builder(destinationDir)
.baseDirIsGenerated(withDistribution.isGenerated());
FilesToExtract filesToExtract = baseStore.filesToExtract(distribution);
for (FileSet.Entry file : filesToExtract.files()) {
if (file.type()==FileType.Executable) {
String executableName = FilesToExtract.executableName(extraction().getExecutableNaming(), file);
File executableFile = new File(executableName);
File resolvedExecutableFile = new File(destinationDir, executableName);
if (resolvedExecutableFile.isFile()) {
foundExecutable=true;
}
fileSetBuilder.executable(executableFile);
} else {
fileSetBuilder.addLibraryFiles(new File(FilesToExtract.fileName(file)));
}
}
ExtractedFileSet extractedFileSet;
if (!foundExecutable) {
// we found no executable, so we trigger extraction and hope for the best
try {
extractedFileSet = baseStore.extractFileSet(distribution).get(); | } catch (FileAlreadyExistsException fx) { |
flapdoodle-oss/de.flapdoodle.embed.process | src/test/java/de/flapdoodle/embed/process/config/store/FileSetTest.java | // Path: src/main/java/de/flapdoodle/embed/process/config/store/FileSet.java
// @Value.Immutable
// abstract class Entry {
// @Parameter
// public abstract FileType type();
//
// @Parameter
// public abstract String destination();
//
// @Parameter
// protected abstract UncompiledPattern uncompiledMatchingPattern();
//
// @Auxiliary
// public Pattern matchingPattern() {
// return uncompiledMatchingPattern().compile();
// }
//
// static Entry of(FileType type, String filename, Pattern pattern) {
// return ImmutableEntry.of(type,filename, UncompiledPattern.of(pattern));
// }
// }
| import de.flapdoodle.embed.process.config.store.FileSet.Entry;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.regex.Pattern;
import org.junit.Test; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.store;
public class FileSetTest {
@Test
public void ensureHashcodeAndEqualsForEntries() { | // Path: src/main/java/de/flapdoodle/embed/process/config/store/FileSet.java
// @Value.Immutable
// abstract class Entry {
// @Parameter
// public abstract FileType type();
//
// @Parameter
// public abstract String destination();
//
// @Parameter
// protected abstract UncompiledPattern uncompiledMatchingPattern();
//
// @Auxiliary
// public Pattern matchingPattern() {
// return uncompiledMatchingPattern().compile();
// }
//
// static Entry of(FileType type, String filename, Pattern pattern) {
// return ImmutableEntry.of(type,filename, UncompiledPattern.of(pattern));
// }
// }
// Path: src/test/java/de/flapdoodle/embed/process/config/store/FileSetTest.java
import de.flapdoodle.embed.process.config.store.FileSet.Entry;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.regex.Pattern;
import org.junit.Test;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.store;
public class FileSetTest {
@Test
public void ensureHashcodeAndEqualsForEntries() { | Entry entryA = FileSet.Entry.of(FileType.Executable,"foo",Pattern.compile("foo")); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/extract/ExtractionMatch.java | // Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
| import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import de.flapdoodle.embed.process.config.store.FileType; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
public interface ExtractionMatch {
File write(InputStream source, long size) throws IOException;
| // Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractionMatch.java
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import de.flapdoodle.embed.process.config.store.FileType;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
public interface ExtractionMatch {
File write(InputStream source, long size) throws IOException;
| FileType type(); |
flapdoodle-oss/de.flapdoodle.embed.process | src/test/java/de/flapdoodle/embed/process/example/GenericStarter.java | // Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/runtime/Starter.java
// public abstract class Starter<CONFIG extends ExecutableProcessConfig,EXECUTABLE extends Executable<CONFIG, PROCESS>,PROCESS extends IStopable> {
//
// private static Logger logger = LoggerFactory.getLogger(Starter.class);
//
// private final RuntimeConfig runtime;
//
// protected Starter(RuntimeConfig config) {
// runtime = config;
// }
//
// public EXECUTABLE prepare(CONFIG config) {
// return prepare(config, Distribution.detectFor(config.version()));
// }
//
// public EXECUTABLE prepare(CONFIG config, Distribution distribution) {
// try {
// IArtifactStore artifactStore = runtime.artifactStore();
//
// Optional<ExtractedFileSet> files = artifactStore.extractFileSet(distribution);
// if (files.isPresent()) {
// return newExecutable(config, distribution, runtime, files.get());
// } else {
// throw new DistributionException("could not find Distribution",distribution);
// }
// } catch (IOException iox) {
// String messageOnException = config.supportConfig().messageOnException().apply(getClass(), iox);
// if (messageOnException==null) {
// messageOnException="prepare executable";
// }
// logger.error(messageOnException, iox);
// throw new DistributionException(distribution,iox);
// }
// }
//
// protected abstract EXECUTABLE newExecutable(CONFIG config, Distribution distribution, RuntimeConfig runtime, ExtractedFileSet exe);
// }
| import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import de.flapdoodle.embed.process.runtime.Starter; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.example;
public class GenericStarter extends Starter<GenericProcessConfig, GenericExecuteable, GenericProcess> {
GenericStarter(RuntimeConfig config) {
super(config);
}
@Override | // Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/runtime/Starter.java
// public abstract class Starter<CONFIG extends ExecutableProcessConfig,EXECUTABLE extends Executable<CONFIG, PROCESS>,PROCESS extends IStopable> {
//
// private static Logger logger = LoggerFactory.getLogger(Starter.class);
//
// private final RuntimeConfig runtime;
//
// protected Starter(RuntimeConfig config) {
// runtime = config;
// }
//
// public EXECUTABLE prepare(CONFIG config) {
// return prepare(config, Distribution.detectFor(config.version()));
// }
//
// public EXECUTABLE prepare(CONFIG config, Distribution distribution) {
// try {
// IArtifactStore artifactStore = runtime.artifactStore();
//
// Optional<ExtractedFileSet> files = artifactStore.extractFileSet(distribution);
// if (files.isPresent()) {
// return newExecutable(config, distribution, runtime, files.get());
// } else {
// throw new DistributionException("could not find Distribution",distribution);
// }
// } catch (IOException iox) {
// String messageOnException = config.supportConfig().messageOnException().apply(getClass(), iox);
// if (messageOnException==null) {
// messageOnException="prepare executable";
// }
// logger.error(messageOnException, iox);
// throw new DistributionException(distribution,iox);
// }
// }
//
// protected abstract EXECUTABLE newExecutable(CONFIG config, Distribution distribution, RuntimeConfig runtime, ExtractedFileSet exe);
// }
// Path: src/test/java/de/flapdoodle/embed/process/example/GenericStarter.java
import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import de.flapdoodle.embed.process.runtime.Starter;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.example;
public class GenericStarter extends Starter<GenericProcessConfig, GenericExecuteable, GenericProcess> {
GenericStarter(RuntimeConfig config) {
super(config);
}
@Override | protected GenericExecuteable newExecutable(GenericProcessConfig config, Distribution distribution, |
flapdoodle-oss/de.flapdoodle.embed.process | src/test/java/de/flapdoodle/embed/process/example/GenericStarter.java | // Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/runtime/Starter.java
// public abstract class Starter<CONFIG extends ExecutableProcessConfig,EXECUTABLE extends Executable<CONFIG, PROCESS>,PROCESS extends IStopable> {
//
// private static Logger logger = LoggerFactory.getLogger(Starter.class);
//
// private final RuntimeConfig runtime;
//
// protected Starter(RuntimeConfig config) {
// runtime = config;
// }
//
// public EXECUTABLE prepare(CONFIG config) {
// return prepare(config, Distribution.detectFor(config.version()));
// }
//
// public EXECUTABLE prepare(CONFIG config, Distribution distribution) {
// try {
// IArtifactStore artifactStore = runtime.artifactStore();
//
// Optional<ExtractedFileSet> files = artifactStore.extractFileSet(distribution);
// if (files.isPresent()) {
// return newExecutable(config, distribution, runtime, files.get());
// } else {
// throw new DistributionException("could not find Distribution",distribution);
// }
// } catch (IOException iox) {
// String messageOnException = config.supportConfig().messageOnException().apply(getClass(), iox);
// if (messageOnException==null) {
// messageOnException="prepare executable";
// }
// logger.error(messageOnException, iox);
// throw new DistributionException(distribution,iox);
// }
// }
//
// protected abstract EXECUTABLE newExecutable(CONFIG config, Distribution distribution, RuntimeConfig runtime, ExtractedFileSet exe);
// }
| import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import de.flapdoodle.embed.process.runtime.Starter; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.example;
public class GenericStarter extends Starter<GenericProcessConfig, GenericExecuteable, GenericProcess> {
GenericStarter(RuntimeConfig config) {
super(config);
}
@Override
protected GenericExecuteable newExecutable(GenericProcessConfig config, Distribution distribution, | // Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/runtime/Starter.java
// public abstract class Starter<CONFIG extends ExecutableProcessConfig,EXECUTABLE extends Executable<CONFIG, PROCESS>,PROCESS extends IStopable> {
//
// private static Logger logger = LoggerFactory.getLogger(Starter.class);
//
// private final RuntimeConfig runtime;
//
// protected Starter(RuntimeConfig config) {
// runtime = config;
// }
//
// public EXECUTABLE prepare(CONFIG config) {
// return prepare(config, Distribution.detectFor(config.version()));
// }
//
// public EXECUTABLE prepare(CONFIG config, Distribution distribution) {
// try {
// IArtifactStore artifactStore = runtime.artifactStore();
//
// Optional<ExtractedFileSet> files = artifactStore.extractFileSet(distribution);
// if (files.isPresent()) {
// return newExecutable(config, distribution, runtime, files.get());
// } else {
// throw new DistributionException("could not find Distribution",distribution);
// }
// } catch (IOException iox) {
// String messageOnException = config.supportConfig().messageOnException().apply(getClass(), iox);
// if (messageOnException==null) {
// messageOnException="prepare executable";
// }
// logger.error(messageOnException, iox);
// throw new DistributionException(distribution,iox);
// }
// }
//
// protected abstract EXECUTABLE newExecutable(CONFIG config, Distribution distribution, RuntimeConfig runtime, ExtractedFileSet exe);
// }
// Path: src/test/java/de/flapdoodle/embed/process/example/GenericStarter.java
import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import de.flapdoodle.embed.process.runtime.Starter;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.example;
public class GenericStarter extends Starter<GenericProcessConfig, GenericExecuteable, GenericProcess> {
GenericStarter(RuntimeConfig config) {
super(config);
}
@Override
protected GenericExecuteable newExecutable(GenericProcessConfig config, Distribution distribution, | RuntimeConfig runtimeConfig, ExtractedFileSet executable) { |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/runtime/Starter.java | // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/exceptions/DistributionException.java
// public class DistributionException extends RuntimeException {
//
// private final Distribution _distribution;
//
// public DistributionException(Distribution distribution) {
// super();
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution, Throwable cause) {
// super(message, cause);
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution) {
// super(message);
// _distribution = distribution;
// }
//
// public DistributionException(Distribution distribution, Throwable cause) {
// super(cause);
// _distribution = distribution;
// }
//
//
// public Distribution withDistribution() {
// return _distribution;
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/store/IArtifactStore.java
// public interface IArtifactStore {
//
// Optional<ExtractedFileSet> extractFileSet(Distribution distribution) throws IOException;
//
// void removeFileSet(Distribution distribution, ExtractedFileSet files);
// }
| import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.exceptions.DistributionException;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import de.flapdoodle.embed.process.store.IArtifactStore;
import de.flapdoodle.os.Platform;
import java.io.IOException;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.ExecutableProcessConfig; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public abstract class Starter<CONFIG extends ExecutableProcessConfig,EXECUTABLE extends Executable<CONFIG, PROCESS>,PROCESS extends IStopable> {
private static Logger logger = LoggerFactory.getLogger(Starter.class);
| // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/exceptions/DistributionException.java
// public class DistributionException extends RuntimeException {
//
// private final Distribution _distribution;
//
// public DistributionException(Distribution distribution) {
// super();
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution, Throwable cause) {
// super(message, cause);
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution) {
// super(message);
// _distribution = distribution;
// }
//
// public DistributionException(Distribution distribution, Throwable cause) {
// super(cause);
// _distribution = distribution;
// }
//
//
// public Distribution withDistribution() {
// return _distribution;
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/store/IArtifactStore.java
// public interface IArtifactStore {
//
// Optional<ExtractedFileSet> extractFileSet(Distribution distribution) throws IOException;
//
// void removeFileSet(Distribution distribution, ExtractedFileSet files);
// }
// Path: src/main/java/de/flapdoodle/embed/process/runtime/Starter.java
import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.exceptions.DistributionException;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import de.flapdoodle.embed.process.store.IArtifactStore;
import de.flapdoodle.os.Platform;
import java.io.IOException;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.ExecutableProcessConfig;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public abstract class Starter<CONFIG extends ExecutableProcessConfig,EXECUTABLE extends Executable<CONFIG, PROCESS>,PROCESS extends IStopable> {
private static Logger logger = LoggerFactory.getLogger(Starter.class);
| private final RuntimeConfig runtime; |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/runtime/Starter.java | // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/exceptions/DistributionException.java
// public class DistributionException extends RuntimeException {
//
// private final Distribution _distribution;
//
// public DistributionException(Distribution distribution) {
// super();
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution, Throwable cause) {
// super(message, cause);
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution) {
// super(message);
// _distribution = distribution;
// }
//
// public DistributionException(Distribution distribution, Throwable cause) {
// super(cause);
// _distribution = distribution;
// }
//
//
// public Distribution withDistribution() {
// return _distribution;
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/store/IArtifactStore.java
// public interface IArtifactStore {
//
// Optional<ExtractedFileSet> extractFileSet(Distribution distribution) throws IOException;
//
// void removeFileSet(Distribution distribution, ExtractedFileSet files);
// }
| import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.exceptions.DistributionException;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import de.flapdoodle.embed.process.store.IArtifactStore;
import de.flapdoodle.os.Platform;
import java.io.IOException;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.ExecutableProcessConfig; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public abstract class Starter<CONFIG extends ExecutableProcessConfig,EXECUTABLE extends Executable<CONFIG, PROCESS>,PROCESS extends IStopable> {
private static Logger logger = LoggerFactory.getLogger(Starter.class);
private final RuntimeConfig runtime;
protected Starter(RuntimeConfig config) {
runtime = config;
}
public EXECUTABLE prepare(CONFIG config) { | // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/exceptions/DistributionException.java
// public class DistributionException extends RuntimeException {
//
// private final Distribution _distribution;
//
// public DistributionException(Distribution distribution) {
// super();
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution, Throwable cause) {
// super(message, cause);
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution) {
// super(message);
// _distribution = distribution;
// }
//
// public DistributionException(Distribution distribution, Throwable cause) {
// super(cause);
// _distribution = distribution;
// }
//
//
// public Distribution withDistribution() {
// return _distribution;
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/store/IArtifactStore.java
// public interface IArtifactStore {
//
// Optional<ExtractedFileSet> extractFileSet(Distribution distribution) throws IOException;
//
// void removeFileSet(Distribution distribution, ExtractedFileSet files);
// }
// Path: src/main/java/de/flapdoodle/embed/process/runtime/Starter.java
import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.exceptions.DistributionException;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import de.flapdoodle.embed.process.store.IArtifactStore;
import de.flapdoodle.os.Platform;
import java.io.IOException;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.ExecutableProcessConfig;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public abstract class Starter<CONFIG extends ExecutableProcessConfig,EXECUTABLE extends Executable<CONFIG, PROCESS>,PROCESS extends IStopable> {
private static Logger logger = LoggerFactory.getLogger(Starter.class);
private final RuntimeConfig runtime;
protected Starter(RuntimeConfig config) {
runtime = config;
}
public EXECUTABLE prepare(CONFIG config) { | return prepare(config, Distribution.detectFor(config.version())); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/runtime/Starter.java | // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/exceptions/DistributionException.java
// public class DistributionException extends RuntimeException {
//
// private final Distribution _distribution;
//
// public DistributionException(Distribution distribution) {
// super();
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution, Throwable cause) {
// super(message, cause);
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution) {
// super(message);
// _distribution = distribution;
// }
//
// public DistributionException(Distribution distribution, Throwable cause) {
// super(cause);
// _distribution = distribution;
// }
//
//
// public Distribution withDistribution() {
// return _distribution;
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/store/IArtifactStore.java
// public interface IArtifactStore {
//
// Optional<ExtractedFileSet> extractFileSet(Distribution distribution) throws IOException;
//
// void removeFileSet(Distribution distribution, ExtractedFileSet files);
// }
| import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.exceptions.DistributionException;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import de.flapdoodle.embed.process.store.IArtifactStore;
import de.flapdoodle.os.Platform;
import java.io.IOException;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.ExecutableProcessConfig; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public abstract class Starter<CONFIG extends ExecutableProcessConfig,EXECUTABLE extends Executable<CONFIG, PROCESS>,PROCESS extends IStopable> {
private static Logger logger = LoggerFactory.getLogger(Starter.class);
private final RuntimeConfig runtime;
protected Starter(RuntimeConfig config) {
runtime = config;
}
public EXECUTABLE prepare(CONFIG config) {
return prepare(config, Distribution.detectFor(config.version()));
}
public EXECUTABLE prepare(CONFIG config, Distribution distribution) {
try { | // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/exceptions/DistributionException.java
// public class DistributionException extends RuntimeException {
//
// private final Distribution _distribution;
//
// public DistributionException(Distribution distribution) {
// super();
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution, Throwable cause) {
// super(message, cause);
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution) {
// super(message);
// _distribution = distribution;
// }
//
// public DistributionException(Distribution distribution, Throwable cause) {
// super(cause);
// _distribution = distribution;
// }
//
//
// public Distribution withDistribution() {
// return _distribution;
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/store/IArtifactStore.java
// public interface IArtifactStore {
//
// Optional<ExtractedFileSet> extractFileSet(Distribution distribution) throws IOException;
//
// void removeFileSet(Distribution distribution, ExtractedFileSet files);
// }
// Path: src/main/java/de/flapdoodle/embed/process/runtime/Starter.java
import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.exceptions.DistributionException;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import de.flapdoodle.embed.process.store.IArtifactStore;
import de.flapdoodle.os.Platform;
import java.io.IOException;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.ExecutableProcessConfig;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public abstract class Starter<CONFIG extends ExecutableProcessConfig,EXECUTABLE extends Executable<CONFIG, PROCESS>,PROCESS extends IStopable> {
private static Logger logger = LoggerFactory.getLogger(Starter.class);
private final RuntimeConfig runtime;
protected Starter(RuntimeConfig config) {
runtime = config;
}
public EXECUTABLE prepare(CONFIG config) {
return prepare(config, Distribution.detectFor(config.version()));
}
public EXECUTABLE prepare(CONFIG config, Distribution distribution) {
try { | IArtifactStore artifactStore = runtime.artifactStore(); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/runtime/Starter.java | // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/exceptions/DistributionException.java
// public class DistributionException extends RuntimeException {
//
// private final Distribution _distribution;
//
// public DistributionException(Distribution distribution) {
// super();
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution, Throwable cause) {
// super(message, cause);
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution) {
// super(message);
// _distribution = distribution;
// }
//
// public DistributionException(Distribution distribution, Throwable cause) {
// super(cause);
// _distribution = distribution;
// }
//
//
// public Distribution withDistribution() {
// return _distribution;
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/store/IArtifactStore.java
// public interface IArtifactStore {
//
// Optional<ExtractedFileSet> extractFileSet(Distribution distribution) throws IOException;
//
// void removeFileSet(Distribution distribution, ExtractedFileSet files);
// }
| import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.exceptions.DistributionException;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import de.flapdoodle.embed.process.store.IArtifactStore;
import de.flapdoodle.os.Platform;
import java.io.IOException;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.ExecutableProcessConfig; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public abstract class Starter<CONFIG extends ExecutableProcessConfig,EXECUTABLE extends Executable<CONFIG, PROCESS>,PROCESS extends IStopable> {
private static Logger logger = LoggerFactory.getLogger(Starter.class);
private final RuntimeConfig runtime;
protected Starter(RuntimeConfig config) {
runtime = config;
}
public EXECUTABLE prepare(CONFIG config) {
return prepare(config, Distribution.detectFor(config.version()));
}
public EXECUTABLE prepare(CONFIG config, Distribution distribution) {
try {
IArtifactStore artifactStore = runtime.artifactStore();
| // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/exceptions/DistributionException.java
// public class DistributionException extends RuntimeException {
//
// private final Distribution _distribution;
//
// public DistributionException(Distribution distribution) {
// super();
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution, Throwable cause) {
// super(message, cause);
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution) {
// super(message);
// _distribution = distribution;
// }
//
// public DistributionException(Distribution distribution, Throwable cause) {
// super(cause);
// _distribution = distribution;
// }
//
//
// public Distribution withDistribution() {
// return _distribution;
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/store/IArtifactStore.java
// public interface IArtifactStore {
//
// Optional<ExtractedFileSet> extractFileSet(Distribution distribution) throws IOException;
//
// void removeFileSet(Distribution distribution, ExtractedFileSet files);
// }
// Path: src/main/java/de/flapdoodle/embed/process/runtime/Starter.java
import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.exceptions.DistributionException;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import de.flapdoodle.embed.process.store.IArtifactStore;
import de.flapdoodle.os.Platform;
import java.io.IOException;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.ExecutableProcessConfig;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public abstract class Starter<CONFIG extends ExecutableProcessConfig,EXECUTABLE extends Executable<CONFIG, PROCESS>,PROCESS extends IStopable> {
private static Logger logger = LoggerFactory.getLogger(Starter.class);
private final RuntimeConfig runtime;
protected Starter(RuntimeConfig config) {
runtime = config;
}
public EXECUTABLE prepare(CONFIG config) {
return prepare(config, Distribution.detectFor(config.version()));
}
public EXECUTABLE prepare(CONFIG config, Distribution distribution) {
try {
IArtifactStore artifactStore = runtime.artifactStore();
| Optional<ExtractedFileSet> files = artifactStore.extractFileSet(distribution); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/runtime/Starter.java | // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/exceptions/DistributionException.java
// public class DistributionException extends RuntimeException {
//
// private final Distribution _distribution;
//
// public DistributionException(Distribution distribution) {
// super();
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution, Throwable cause) {
// super(message, cause);
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution) {
// super(message);
// _distribution = distribution;
// }
//
// public DistributionException(Distribution distribution, Throwable cause) {
// super(cause);
// _distribution = distribution;
// }
//
//
// public Distribution withDistribution() {
// return _distribution;
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/store/IArtifactStore.java
// public interface IArtifactStore {
//
// Optional<ExtractedFileSet> extractFileSet(Distribution distribution) throws IOException;
//
// void removeFileSet(Distribution distribution, ExtractedFileSet files);
// }
| import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.exceptions.DistributionException;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import de.flapdoodle.embed.process.store.IArtifactStore;
import de.flapdoodle.os.Platform;
import java.io.IOException;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.ExecutableProcessConfig; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public abstract class Starter<CONFIG extends ExecutableProcessConfig,EXECUTABLE extends Executable<CONFIG, PROCESS>,PROCESS extends IStopable> {
private static Logger logger = LoggerFactory.getLogger(Starter.class);
private final RuntimeConfig runtime;
protected Starter(RuntimeConfig config) {
runtime = config;
}
public EXECUTABLE prepare(CONFIG config) {
return prepare(config, Distribution.detectFor(config.version()));
}
public EXECUTABLE prepare(CONFIG config, Distribution distribution) {
try {
IArtifactStore artifactStore = runtime.artifactStore();
Optional<ExtractedFileSet> files = artifactStore.extractFileSet(distribution);
if (files.isPresent()) {
return newExecutable(config, distribution, runtime, files.get());
} else { | // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/exceptions/DistributionException.java
// public class DistributionException extends RuntimeException {
//
// private final Distribution _distribution;
//
// public DistributionException(Distribution distribution) {
// super();
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution, Throwable cause) {
// super(message, cause);
// _distribution = distribution;
// }
//
// public DistributionException(String message, Distribution distribution) {
// super(message);
// _distribution = distribution;
// }
//
// public DistributionException(Distribution distribution, Throwable cause) {
// super(cause);
// _distribution = distribution;
// }
//
//
// public Distribution withDistribution() {
// return _distribution;
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/store/IArtifactStore.java
// public interface IArtifactStore {
//
// Optional<ExtractedFileSet> extractFileSet(Distribution distribution) throws IOException;
//
// void removeFileSet(Distribution distribution, ExtractedFileSet files);
// }
// Path: src/main/java/de/flapdoodle/embed/process/runtime/Starter.java
import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.exceptions.DistributionException;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import de.flapdoodle.embed.process.store.IArtifactStore;
import de.flapdoodle.os.Platform;
import java.io.IOException;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.ExecutableProcessConfig;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public abstract class Starter<CONFIG extends ExecutableProcessConfig,EXECUTABLE extends Executable<CONFIG, PROCESS>,PROCESS extends IStopable> {
private static Logger logger = LoggerFactory.getLogger(Starter.class);
private final RuntimeConfig runtime;
protected Starter(RuntimeConfig config) {
runtime = config;
}
public EXECUTABLE prepare(CONFIG config) {
return prepare(config, Distribution.detectFor(config.version()));
}
public EXECUTABLE prepare(CONFIG config, Distribution distribution) {
try {
IArtifactStore artifactStore = runtime.artifactStore();
Optional<ExtractedFileSet> files = artifactStore.extractFileSet(distribution);
if (files.isPresent()) {
return newExecutable(config, distribution, runtime, files.get());
} else { | throw new DistributionException("could not find Distribution",distribution); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/store/Downloader.java | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
| import java.io.File;
import java.io.IOException;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.distribution.Distribution; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.store;
public interface Downloader {
@Deprecated
// should not be used | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/store/Downloader.java
import java.io.File;
import java.io.IOException;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.store;
public interface Downloader {
@Deprecated
// should not be used | String getDownloadUrl(DownloadConfig runtime, Distribution distribution); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/store/Downloader.java | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
| import java.io.File;
import java.io.IOException;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.distribution.Distribution; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.store;
public interface Downloader {
@Deprecated
// should not be used | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/store/Downloader.java
import java.io.File;
import java.io.IOException;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.store;
public interface Downloader {
@Deprecated
// should not be used | String getDownloadUrl(DownloadConfig runtime, Distribution distribution); |
flapdoodle-oss/de.flapdoodle.embed.process | src/test/java/de/flapdoodle/embed/process/extract/ExtractedFileSetsTest.java | // Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
| import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.FileTime;
import static org.assertj.core.api.Assertions.assertThat;
import de.flapdoodle.embed.process.io.directories.Directory;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
public class ExtractedFileSetsTest {
@Test
public void shouldNotCopyIfFileAlreadyExists(@TempDir Path tempFolder) throws IOException {
// given
// Make sure we already have a file at the target destination
File platformTempDir = tempFolder.resolve("target").toFile();
Files.createDirectory(platformTempDir.toPath());
File executableInPlatformTempDir = new File(platformTempDir, "mongod");
Files.write(executableInPlatformTempDir.toPath(), "old".getBytes(StandardCharsets.UTF_8));
FileTime lastModified = Files.getLastModifiedTime(executableInPlatformTempDir.toPath());
// when
File baseDir = tempFolder.resolve("source").toFile();
Files.createDirectory(baseDir.toPath());
File executable = new File(baseDir, "mongod");
Files.write(executable.toPath(), "old".getBytes(StandardCharsets.UTF_8));
ExtractedFileSet src = ExtractedFileSet.builder(baseDir).executable(executable).baseDirIsGenerated(false).build();
ExtractedFileSets.copy(src, directory(platformTempDir), (prefix, postfix) -> "mongod");
// then
byte[] allBytes = Files.readAllBytes(executableInPlatformTempDir.toPath());
assertThat(new String(allBytes, StandardCharsets.UTF_8)).isEqualTo("old");
FileTime lastModifiedAfterCopy = Files.getLastModifiedTime(executableInPlatformTempDir.toPath());
assertThat(lastModifiedAfterCopy).isEqualTo(lastModified);
}
| // Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
// Path: src/test/java/de/flapdoodle/embed/process/extract/ExtractedFileSetsTest.java
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.FileTime;
import static org.assertj.core.api.Assertions.assertThat;
import de.flapdoodle.embed.process.io.directories.Directory;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
public class ExtractedFileSetsTest {
@Test
public void shouldNotCopyIfFileAlreadyExists(@TempDir Path tempFolder) throws IOException {
// given
// Make sure we already have a file at the target destination
File platformTempDir = tempFolder.resolve("target").toFile();
Files.createDirectory(platformTempDir.toPath());
File executableInPlatformTempDir = new File(platformTempDir, "mongod");
Files.write(executableInPlatformTempDir.toPath(), "old".getBytes(StandardCharsets.UTF_8));
FileTime lastModified = Files.getLastModifiedTime(executableInPlatformTempDir.toPath());
// when
File baseDir = tempFolder.resolve("source").toFile();
Files.createDirectory(baseDir.toPath());
File executable = new File(baseDir, "mongod");
Files.write(executable.toPath(), "old".getBytes(StandardCharsets.UTF_8));
ExtractedFileSet src = ExtractedFileSet.builder(baseDir).executable(executable).baseDirIsGenerated(false).build();
ExtractedFileSets.copy(src, directory(platformTempDir), (prefix, postfix) -> "mongod");
// then
byte[] allBytes = Files.readAllBytes(executableInPlatformTempDir.toPath());
assertThat(new String(allBytes, StandardCharsets.UTF_8)).isEqualTo("old");
FileTime lastModifiedAfterCopy = Files.getLastModifiedTime(executableInPlatformTempDir.toPath());
assertThat(lastModifiedAfterCopy).isEqualTo(lastModified);
}
| private static Directory directory(File directory) { |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/runtime/Executable.java | // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
| import de.flapdoodle.embed.process.config.ExecutableProcessConfig;
import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public abstract class Executable<T extends ExecutableProcessConfig, P extends IStopable> implements IStopable {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final T config; | // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/runtime/Executable.java
import de.flapdoodle.embed.process.config.ExecutableProcessConfig;
import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public abstract class Executable<T extends ExecutableProcessConfig, P extends IStopable> implements IStopable {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final T config; | private final RuntimeConfig runtimeConfig; |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/runtime/Executable.java | // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
| import de.flapdoodle.embed.process.config.ExecutableProcessConfig;
import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public abstract class Executable<T extends ExecutableProcessConfig, P extends IStopable> implements IStopable {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final T config;
private final RuntimeConfig runtimeConfig; | // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/runtime/Executable.java
import de.flapdoodle.embed.process.config.ExecutableProcessConfig;
import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public abstract class Executable<T extends ExecutableProcessConfig, P extends IStopable> implements IStopable {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final T config;
private final RuntimeConfig runtimeConfig; | private final ExtractedFileSet executable; |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/runtime/Executable.java | // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
| import de.flapdoodle.embed.process.config.ExecutableProcessConfig;
import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public abstract class Executable<T extends ExecutableProcessConfig, P extends IStopable> implements IStopable {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final T config;
private final RuntimeConfig runtimeConfig;
private final ExtractedFileSet executable;
private boolean stopped;
private boolean registeredJobKiller;
private List<IStopable> stopables = new ArrayList<>();
| // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/runtime/Executable.java
import de.flapdoodle.embed.process.config.ExecutableProcessConfig;
import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public abstract class Executable<T extends ExecutableProcessConfig, P extends IStopable> implements IStopable {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final T config;
private final RuntimeConfig runtimeConfig;
private final ExtractedFileSet executable;
private boolean stopped;
private boolean registeredJobKiller;
private List<IStopable> stopables = new ArrayList<>();
| private final Distribution distribution; |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/config/io/ProcessOutput.java | // Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Slf4jLevel.java
// public enum Slf4jLevel {
//
// TRACE {
// public void log(Logger logger, String message, Object... arguments) {
// logger.trace(message, arguments);
// }
// },
// DEBUG {
// public void log(Logger logger, String message, Object... arguments) {
// logger.debug(message, arguments);
// }
// },
// INFO {
// public void log(Logger logger, String message, Object... arguments) {
// logger.info(message, arguments);
// }
// },
// WARN {
// public void log(Logger logger, String message, Object... arguments) {
// logger.warn(message, arguments);
// }
// },
// ERROR {
// public void log(Logger logger, String message, Object... arguments) {
// logger.error(message, arguments);
// }
// };
//
// public abstract void log(Logger logger, String message, Object... arguments);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/StreamProcessor.java
// public interface StreamProcessor {
// void process(String block);
//
// void onProcessed();
// }
| import de.flapdoodle.embed.process.io.Processors;
import de.flapdoodle.embed.process.io.Slf4jLevel;
import de.flapdoodle.embed.process.io.StreamProcessor; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.io;
/**
* helper class to fix some spring boot issues
* @see de.flapdoodle.embed.process.config.process.ProcessOutput#builder()
*/
@Deprecated
public class ProcessOutput implements de.flapdoodle.embed.process.config.process.ProcessOutput {
| // Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Slf4jLevel.java
// public enum Slf4jLevel {
//
// TRACE {
// public void log(Logger logger, String message, Object... arguments) {
// logger.trace(message, arguments);
// }
// },
// DEBUG {
// public void log(Logger logger, String message, Object... arguments) {
// logger.debug(message, arguments);
// }
// },
// INFO {
// public void log(Logger logger, String message, Object... arguments) {
// logger.info(message, arguments);
// }
// },
// WARN {
// public void log(Logger logger, String message, Object... arguments) {
// logger.warn(message, arguments);
// }
// },
// ERROR {
// public void log(Logger logger, String message, Object... arguments) {
// logger.error(message, arguments);
// }
// };
//
// public abstract void log(Logger logger, String message, Object... arguments);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/StreamProcessor.java
// public interface StreamProcessor {
// void process(String block);
//
// void onProcessed();
// }
// Path: src/main/java/de/flapdoodle/embed/process/config/io/ProcessOutput.java
import de.flapdoodle.embed.process.io.Processors;
import de.flapdoodle.embed.process.io.Slf4jLevel;
import de.flapdoodle.embed.process.io.StreamProcessor;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.io;
/**
* helper class to fix some spring boot issues
* @see de.flapdoodle.embed.process.config.process.ProcessOutput#builder()
*/
@Deprecated
public class ProcessOutput implements de.flapdoodle.embed.process.config.process.ProcessOutput {
| private final StreamProcessor output; |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/config/io/ProcessOutput.java | // Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Slf4jLevel.java
// public enum Slf4jLevel {
//
// TRACE {
// public void log(Logger logger, String message, Object... arguments) {
// logger.trace(message, arguments);
// }
// },
// DEBUG {
// public void log(Logger logger, String message, Object... arguments) {
// logger.debug(message, arguments);
// }
// },
// INFO {
// public void log(Logger logger, String message, Object... arguments) {
// logger.info(message, arguments);
// }
// },
// WARN {
// public void log(Logger logger, String message, Object... arguments) {
// logger.warn(message, arguments);
// }
// },
// ERROR {
// public void log(Logger logger, String message, Object... arguments) {
// logger.error(message, arguments);
// }
// };
//
// public abstract void log(Logger logger, String message, Object... arguments);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/StreamProcessor.java
// public interface StreamProcessor {
// void process(String block);
//
// void onProcessed();
// }
| import de.flapdoodle.embed.process.io.Processors;
import de.flapdoodle.embed.process.io.Slf4jLevel;
import de.flapdoodle.embed.process.io.StreamProcessor; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.io;
/**
* helper class to fix some spring boot issues
* @see de.flapdoodle.embed.process.config.process.ProcessOutput#builder()
*/
@Deprecated
public class ProcessOutput implements de.flapdoodle.embed.process.config.process.ProcessOutput {
private final StreamProcessor output;
private final StreamProcessor error;
private final StreamProcessor commands;
public ProcessOutput(StreamProcessor output, StreamProcessor error, StreamProcessor commands) {
this.output = output;
this.error = error;
this.commands = commands;
}
@Override
public StreamProcessor output() {
return output;
}
@Override
public StreamProcessor error() {
return error;
}
@Override
public StreamProcessor commands() {
return commands;
}
public static ProcessOutput namedConsole(String label) {
return new ProcessOutput( | // Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Slf4jLevel.java
// public enum Slf4jLevel {
//
// TRACE {
// public void log(Logger logger, String message, Object... arguments) {
// logger.trace(message, arguments);
// }
// },
// DEBUG {
// public void log(Logger logger, String message, Object... arguments) {
// logger.debug(message, arguments);
// }
// },
// INFO {
// public void log(Logger logger, String message, Object... arguments) {
// logger.info(message, arguments);
// }
// },
// WARN {
// public void log(Logger logger, String message, Object... arguments) {
// logger.warn(message, arguments);
// }
// },
// ERROR {
// public void log(Logger logger, String message, Object... arguments) {
// logger.error(message, arguments);
// }
// };
//
// public abstract void log(Logger logger, String message, Object... arguments);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/StreamProcessor.java
// public interface StreamProcessor {
// void process(String block);
//
// void onProcessed();
// }
// Path: src/main/java/de/flapdoodle/embed/process/config/io/ProcessOutput.java
import de.flapdoodle.embed.process.io.Processors;
import de.flapdoodle.embed.process.io.Slf4jLevel;
import de.flapdoodle.embed.process.io.StreamProcessor;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.io;
/**
* helper class to fix some spring boot issues
* @see de.flapdoodle.embed.process.config.process.ProcessOutput#builder()
*/
@Deprecated
public class ProcessOutput implements de.flapdoodle.embed.process.config.process.ProcessOutput {
private final StreamProcessor output;
private final StreamProcessor error;
private final StreamProcessor commands;
public ProcessOutput(StreamProcessor output, StreamProcessor error, StreamProcessor commands) {
this.output = output;
this.error = error;
this.commands = commands;
}
@Override
public StreamProcessor output() {
return output;
}
@Override
public StreamProcessor error() {
return error;
}
@Override
public StreamProcessor commands() {
return commands;
}
public static ProcessOutput namedConsole(String label) {
return new ProcessOutput( | Processors.namedConsole("["+label+" output]"), |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/config/io/ProcessOutput.java | // Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Slf4jLevel.java
// public enum Slf4jLevel {
//
// TRACE {
// public void log(Logger logger, String message, Object... arguments) {
// logger.trace(message, arguments);
// }
// },
// DEBUG {
// public void log(Logger logger, String message, Object... arguments) {
// logger.debug(message, arguments);
// }
// },
// INFO {
// public void log(Logger logger, String message, Object... arguments) {
// logger.info(message, arguments);
// }
// },
// WARN {
// public void log(Logger logger, String message, Object... arguments) {
// logger.warn(message, arguments);
// }
// },
// ERROR {
// public void log(Logger logger, String message, Object... arguments) {
// logger.error(message, arguments);
// }
// };
//
// public abstract void log(Logger logger, String message, Object... arguments);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/StreamProcessor.java
// public interface StreamProcessor {
// void process(String block);
//
// void onProcessed();
// }
| import de.flapdoodle.embed.process.io.Processors;
import de.flapdoodle.embed.process.io.Slf4jLevel;
import de.flapdoodle.embed.process.io.StreamProcessor; | this.output = output;
this.error = error;
this.commands = commands;
}
@Override
public StreamProcessor output() {
return output;
}
@Override
public StreamProcessor error() {
return error;
}
@Override
public StreamProcessor commands() {
return commands;
}
public static ProcessOutput namedConsole(String label) {
return new ProcessOutput(
Processors.namedConsole("["+label+" output]"),
Processors.namedConsole("["+label+" error]"),
Processors.console()
);
}
public static ProcessOutput named(String label, org.slf4j.Logger logger) {
return new ProcessOutput( | // Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Slf4jLevel.java
// public enum Slf4jLevel {
//
// TRACE {
// public void log(Logger logger, String message, Object... arguments) {
// logger.trace(message, arguments);
// }
// },
// DEBUG {
// public void log(Logger logger, String message, Object... arguments) {
// logger.debug(message, arguments);
// }
// },
// INFO {
// public void log(Logger logger, String message, Object... arguments) {
// logger.info(message, arguments);
// }
// },
// WARN {
// public void log(Logger logger, String message, Object... arguments) {
// logger.warn(message, arguments);
// }
// },
// ERROR {
// public void log(Logger logger, String message, Object... arguments) {
// logger.error(message, arguments);
// }
// };
//
// public abstract void log(Logger logger, String message, Object... arguments);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/StreamProcessor.java
// public interface StreamProcessor {
// void process(String block);
//
// void onProcessed();
// }
// Path: src/main/java/de/flapdoodle/embed/process/config/io/ProcessOutput.java
import de.flapdoodle.embed.process.io.Processors;
import de.flapdoodle.embed.process.io.Slf4jLevel;
import de.flapdoodle.embed.process.io.StreamProcessor;
this.output = output;
this.error = error;
this.commands = commands;
}
@Override
public StreamProcessor output() {
return output;
}
@Override
public StreamProcessor error() {
return error;
}
@Override
public StreamProcessor commands() {
return commands;
}
public static ProcessOutput namedConsole(String label) {
return new ProcessOutput(
Processors.namedConsole("["+label+" output]"),
Processors.namedConsole("["+label+" error]"),
Processors.console()
);
}
public static ProcessOutput named(String label, org.slf4j.Logger logger) {
return new ProcessOutput( | Processors.named("["+label+" output]", Processors.logTo(logger, Slf4jLevel.INFO)), |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/config/process/ProcessConfig.java | // Path: src/main/java/de/flapdoodle/embed/process/io/StreamProcessor.java
// public interface StreamProcessor {
// void process(String block);
//
// void onProcessed();
// }
| import java.util.List;
import org.immutables.value.Value.Default;
import org.immutables.value.Value.Immutable;
import de.flapdoodle.embed.process.config.process.ImmutableProcessConfig.Builder;
import de.flapdoodle.embed.process.io.StreamProcessor; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.process;
@Immutable
public interface ProcessConfig {
List<String> commandLine();
| // Path: src/main/java/de/flapdoodle/embed/process/io/StreamProcessor.java
// public interface StreamProcessor {
// void process(String block);
//
// void onProcessed();
// }
// Path: src/main/java/de/flapdoodle/embed/process/config/process/ProcessConfig.java
import java.util.List;
import org.immutables.value.Value.Default;
import org.immutables.value.Value.Immutable;
import de.flapdoodle.embed.process.config.process.ImmutableProcessConfig.Builder;
import de.flapdoodle.embed.process.io.StreamProcessor;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.process;
@Immutable
public interface ProcessConfig {
List<String> commandLine();
| StreamProcessor output(); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/config/store/DistributionPackage.java | // Path: src/main/java/de/flapdoodle/embed/process/distribution/ArchiveType.java
// public enum ArchiveType {
// TGZ(new TgzExtractor()),
// TBZ2(new Tbz2Extractor()),
// ZIP(new ZipExtractor()),
// EXE(new ArchiveIsFileExtractor()),
// TXZ(new TxzExtractor());
//
// private final Extractor extractor;
//
// ArchiveType(Extractor extractor) {
// this.extractor = extractor;
// }
//
// public Extractor getExtractor() {
// return extractor;
// }
// }
| import org.immutables.value.Value;
import org.immutables.value.Value.Parameter;
import de.flapdoodle.embed.process.distribution.ArchiveType; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.store;
@Value.Immutable
public interface DistributionPackage {
@Parameter | // Path: src/main/java/de/flapdoodle/embed/process/distribution/ArchiveType.java
// public enum ArchiveType {
// TGZ(new TgzExtractor()),
// TBZ2(new Tbz2Extractor()),
// ZIP(new ZipExtractor()),
// EXE(new ArchiveIsFileExtractor()),
// TXZ(new TxzExtractor());
//
// private final Extractor extractor;
//
// ArchiveType(Extractor extractor) {
// this.extractor = extractor;
// }
//
// public Extractor getExtractor() {
// return extractor;
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/config/store/DistributionPackage.java
import org.immutables.value.Value;
import org.immutables.value.Value.Parameter;
import de.flapdoodle.embed.process.distribution.ArchiveType;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.store;
@Value.Immutable
public interface DistributionPackage {
@Parameter | ArchiveType archiveType(); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/io/file/Files.java | // Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/PropertyOrPlatformTempDir.java
// public class PropertyOrPlatformTempDir extends PlatformTempDir {
//
// private static final PropertyOrPlatformTempDir _instance=new PropertyOrPlatformTempDir();
//
// @Override
// public File asFile() {
// String customTempDir = System.getProperty("de.flapdoodle.embed.io.tmpdir");
// if (customTempDir!=null) {
// return new File(customTempDir);
// }
// return super.asFile();
// }
//
// public static Directory defaultInstance() {
// return _instance;
// }
// }
| import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.UUID;
import de.flapdoodle.embed.process.io.directories.Directory;
import de.flapdoodle.embed.process.io.directories.PropertyOrPlatformTempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.nio.file.FileVisitResult; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.io.file;
/**
*
*/
public class Files {
private static Logger logger = LoggerFactory.getLogger(Files.class);
private static final int BYTE_BUFFER_LENGTH = 1024 * 16;
/**
* Instance to force loading {@link DeleteDirVisitor} class to avoid
* {@link NoClassDefFoundError} in shutdown hook.
*/
private static final SimpleFileVisitor<Path> DELETE_DIR_VISITOR = new DeleteDirVisitor();
private Files() {
}
@Deprecated
public static File createTempFile(String tempFileName) throws IOException { | // Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/PropertyOrPlatformTempDir.java
// public class PropertyOrPlatformTempDir extends PlatformTempDir {
//
// private static final PropertyOrPlatformTempDir _instance=new PropertyOrPlatformTempDir();
//
// @Override
// public File asFile() {
// String customTempDir = System.getProperty("de.flapdoodle.embed.io.tmpdir");
// if (customTempDir!=null) {
// return new File(customTempDir);
// }
// return super.asFile();
// }
//
// public static Directory defaultInstance() {
// return _instance;
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/io/file/Files.java
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.UUID;
import de.flapdoodle.embed.process.io.directories.Directory;
import de.flapdoodle.embed.process.io.directories.PropertyOrPlatformTempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.nio.file.FileVisitResult;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.io.file;
/**
*
*/
public class Files {
private static Logger logger = LoggerFactory.getLogger(Files.class);
private static final int BYTE_BUFFER_LENGTH = 1024 * 16;
/**
* Instance to force loading {@link DeleteDirVisitor} class to avoid
* {@link NoClassDefFoundError} in shutdown hook.
*/
private static final SimpleFileVisitor<Path> DELETE_DIR_VISITOR = new DeleteDirVisitor();
private Files() {
}
@Deprecated
public static File createTempFile(String tempFileName) throws IOException { | return createTempFile(PropertyOrPlatformTempDir.defaultInstance(), tempFileName); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/io/file/Files.java | // Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/PropertyOrPlatformTempDir.java
// public class PropertyOrPlatformTempDir extends PlatformTempDir {
//
// private static final PropertyOrPlatformTempDir _instance=new PropertyOrPlatformTempDir();
//
// @Override
// public File asFile() {
// String customTempDir = System.getProperty("de.flapdoodle.embed.io.tmpdir");
// if (customTempDir!=null) {
// return new File(customTempDir);
// }
// return super.asFile();
// }
//
// public static Directory defaultInstance() {
// return _instance;
// }
// }
| import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.UUID;
import de.flapdoodle.embed.process.io.directories.Directory;
import de.flapdoodle.embed.process.io.directories.PropertyOrPlatformTempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.nio.file.FileVisitResult; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.io.file;
/**
*
*/
public class Files {
private static Logger logger = LoggerFactory.getLogger(Files.class);
private static final int BYTE_BUFFER_LENGTH = 1024 * 16;
/**
* Instance to force loading {@link DeleteDirVisitor} class to avoid
* {@link NoClassDefFoundError} in shutdown hook.
*/
private static final SimpleFileVisitor<Path> DELETE_DIR_VISITOR = new DeleteDirVisitor();
private Files() {
}
@Deprecated
public static File createTempFile(String tempFileName) throws IOException {
return createTempFile(PropertyOrPlatformTempDir.defaultInstance(), tempFileName);
}
| // Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/PropertyOrPlatformTempDir.java
// public class PropertyOrPlatformTempDir extends PlatformTempDir {
//
// private static final PropertyOrPlatformTempDir _instance=new PropertyOrPlatformTempDir();
//
// @Override
// public File asFile() {
// String customTempDir = System.getProperty("de.flapdoodle.embed.io.tmpdir");
// if (customTempDir!=null) {
// return new File(customTempDir);
// }
// return super.asFile();
// }
//
// public static Directory defaultInstance() {
// return _instance;
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/io/file/Files.java
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.UUID;
import de.flapdoodle.embed.process.io.directories.Directory;
import de.flapdoodle.embed.process.io.directories.PropertyOrPlatformTempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.nio.file.FileVisitResult;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.io.file;
/**
*
*/
public class Files {
private static Logger logger = LoggerFactory.getLogger(Files.class);
private static final int BYTE_BUFFER_LENGTH = 1024 * 16;
/**
* Instance to force loading {@link DeleteDirVisitor} class to avoid
* {@link NoClassDefFoundError} in shutdown hook.
*/
private static final SimpleFileVisitor<Path> DELETE_DIR_VISITOR = new DeleteDirVisitor();
private Files() {
}
@Deprecated
public static File createTempFile(String tempFileName) throws IOException {
return createTempFile(PropertyOrPlatformTempDir.defaultInstance(), tempFileName);
}
| public static File createTempFile(Directory directory, String tempFileName) throws IOException { |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/extract/ArchiveIsFileExtractor.java | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
| import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder;
import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileType; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
public class ArchiveIsFileExtractor implements Extractor {
@Override | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
// Path: src/main/java/de/flapdoodle/embed/process/extract/ArchiveIsFileExtractor.java
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder;
import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileType;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
public class ArchiveIsFileExtractor implements Extractor {
@Override | public ExtractedFileSet extract(DownloadConfig runtime, File source, FilesToExtract toExtract) throws IOException { |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/extract/ArchiveIsFileExtractor.java | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
| import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder;
import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileType; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
public class ArchiveIsFileExtractor implements Extractor {
@Override
public ExtractedFileSet extract(DownloadConfig runtime, File source, FilesToExtract toExtract) throws IOException {
Builder builder = ExtractedFileSet.builder(toExtract.baseDir())
.baseDirIsGenerated(toExtract.baseDirIsGenerated());
| // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
// Path: src/main/java/de/flapdoodle/embed/process/extract/ArchiveIsFileExtractor.java
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder;
import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileType;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
public class ArchiveIsFileExtractor implements Extractor {
@Override
public ExtractedFileSet extract(DownloadConfig runtime, File source, FilesToExtract toExtract) throws IOException {
Builder builder = ExtractedFileSet.builder(toExtract.baseDir())
.baseDirIsGenerated(toExtract.baseDirIsGenerated());
| ProgressListener progressListener = runtime.getProgressListener(); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/extract/ArchiveIsFileExtractor.java | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
| import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder;
import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileType; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
public class ArchiveIsFileExtractor implements Extractor {
@Override
public ExtractedFileSet extract(DownloadConfig runtime, File source, FilesToExtract toExtract) throws IOException {
Builder builder = ExtractedFileSet.builder(toExtract.baseDir())
.baseDirIsGenerated(toExtract.baseDirIsGenerated());
ProgressListener progressListener = runtime.getProgressListener();
String progressLabel = "Extract (not really) " + source;
progressListener.start(progressLabel);
ExtractionMatch match = toExtract.find(new FileAsArchiveEntry(source));
if (match != null) {
try (FileInputStream fin = new FileInputStream(source);
BufferedInputStream in = new BufferedInputStream(fin)) {
File file = match.write(in, source.length()); | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
// Path: src/main/java/de/flapdoodle/embed/process/extract/ArchiveIsFileExtractor.java
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder;
import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileType;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
public class ArchiveIsFileExtractor implements Extractor {
@Override
public ExtractedFileSet extract(DownloadConfig runtime, File source, FilesToExtract toExtract) throws IOException {
Builder builder = ExtractedFileSet.builder(toExtract.baseDir())
.baseDirIsGenerated(toExtract.baseDirIsGenerated());
ProgressListener progressListener = runtime.getProgressListener();
String progressLabel = "Extract (not really) " + source;
progressListener.start(progressLabel);
ExtractionMatch match = toExtract.find(new FileAsArchiveEntry(source));
if (match != null) {
try (FileInputStream fin = new FileInputStream(source);
BufferedInputStream in = new BufferedInputStream(fin)) {
File file = match.write(in, source.length()); | FileType type = match.type(); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/config/process/ProcessOutput.java | // Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Slf4jLevel.java
// public enum Slf4jLevel {
//
// TRACE {
// public void log(Logger logger, String message, Object... arguments) {
// logger.trace(message, arguments);
// }
// },
// DEBUG {
// public void log(Logger logger, String message, Object... arguments) {
// logger.debug(message, arguments);
// }
// },
// INFO {
// public void log(Logger logger, String message, Object... arguments) {
// logger.info(message, arguments);
// }
// },
// WARN {
// public void log(Logger logger, String message, Object... arguments) {
// logger.warn(message, arguments);
// }
// },
// ERROR {
// public void log(Logger logger, String message, Object... arguments) {
// logger.error(message, arguments);
// }
// };
//
// public abstract void log(Logger logger, String message, Object... arguments);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/StreamProcessor.java
// public interface StreamProcessor {
// void process(String block);
//
// void onProcessed();
// }
| import org.immutables.value.Value.Immutable;
import de.flapdoodle.embed.process.io.Processors;
import de.flapdoodle.embed.process.io.Slf4jLevel;
import de.flapdoodle.embed.process.io.StreamProcessor; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.process;
@Immutable
public interface ProcessOutput {
| // Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Slf4jLevel.java
// public enum Slf4jLevel {
//
// TRACE {
// public void log(Logger logger, String message, Object... arguments) {
// logger.trace(message, arguments);
// }
// },
// DEBUG {
// public void log(Logger logger, String message, Object... arguments) {
// logger.debug(message, arguments);
// }
// },
// INFO {
// public void log(Logger logger, String message, Object... arguments) {
// logger.info(message, arguments);
// }
// },
// WARN {
// public void log(Logger logger, String message, Object... arguments) {
// logger.warn(message, arguments);
// }
// },
// ERROR {
// public void log(Logger logger, String message, Object... arguments) {
// logger.error(message, arguments);
// }
// };
//
// public abstract void log(Logger logger, String message, Object... arguments);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/StreamProcessor.java
// public interface StreamProcessor {
// void process(String block);
//
// void onProcessed();
// }
// Path: src/main/java/de/flapdoodle/embed/process/config/process/ProcessOutput.java
import org.immutables.value.Value.Immutable;
import de.flapdoodle.embed.process.io.Processors;
import de.flapdoodle.embed.process.io.Slf4jLevel;
import de.flapdoodle.embed.process.io.StreamProcessor;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.process;
@Immutable
public interface ProcessOutput {
| StreamProcessor output(); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/config/process/ProcessOutput.java | // Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Slf4jLevel.java
// public enum Slf4jLevel {
//
// TRACE {
// public void log(Logger logger, String message, Object... arguments) {
// logger.trace(message, arguments);
// }
// },
// DEBUG {
// public void log(Logger logger, String message, Object... arguments) {
// logger.debug(message, arguments);
// }
// },
// INFO {
// public void log(Logger logger, String message, Object... arguments) {
// logger.info(message, arguments);
// }
// },
// WARN {
// public void log(Logger logger, String message, Object... arguments) {
// logger.warn(message, arguments);
// }
// },
// ERROR {
// public void log(Logger logger, String message, Object... arguments) {
// logger.error(message, arguments);
// }
// };
//
// public abstract void log(Logger logger, String message, Object... arguments);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/StreamProcessor.java
// public interface StreamProcessor {
// void process(String block);
//
// void onProcessed();
// }
| import org.immutables.value.Value.Immutable;
import de.flapdoodle.embed.process.io.Processors;
import de.flapdoodle.embed.process.io.Slf4jLevel;
import de.flapdoodle.embed.process.io.StreamProcessor; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.process;
@Immutable
public interface ProcessOutput {
StreamProcessor output();
StreamProcessor error();
StreamProcessor commands();
static ProcessOutput namedConsole(String label) {
return builder() | // Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Slf4jLevel.java
// public enum Slf4jLevel {
//
// TRACE {
// public void log(Logger logger, String message, Object... arguments) {
// logger.trace(message, arguments);
// }
// },
// DEBUG {
// public void log(Logger logger, String message, Object... arguments) {
// logger.debug(message, arguments);
// }
// },
// INFO {
// public void log(Logger logger, String message, Object... arguments) {
// logger.info(message, arguments);
// }
// },
// WARN {
// public void log(Logger logger, String message, Object... arguments) {
// logger.warn(message, arguments);
// }
// },
// ERROR {
// public void log(Logger logger, String message, Object... arguments) {
// logger.error(message, arguments);
// }
// };
//
// public abstract void log(Logger logger, String message, Object... arguments);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/StreamProcessor.java
// public interface StreamProcessor {
// void process(String block);
//
// void onProcessed();
// }
// Path: src/main/java/de/flapdoodle/embed/process/config/process/ProcessOutput.java
import org.immutables.value.Value.Immutable;
import de.flapdoodle.embed.process.io.Processors;
import de.flapdoodle.embed.process.io.Slf4jLevel;
import de.flapdoodle.embed.process.io.StreamProcessor;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.process;
@Immutable
public interface ProcessOutput {
StreamProcessor output();
StreamProcessor error();
StreamProcessor commands();
static ProcessOutput namedConsole(String label) {
return builder() | .output(Processors.namedConsole("["+label+" output]")) |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/config/process/ProcessOutput.java | // Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Slf4jLevel.java
// public enum Slf4jLevel {
//
// TRACE {
// public void log(Logger logger, String message, Object... arguments) {
// logger.trace(message, arguments);
// }
// },
// DEBUG {
// public void log(Logger logger, String message, Object... arguments) {
// logger.debug(message, arguments);
// }
// },
// INFO {
// public void log(Logger logger, String message, Object... arguments) {
// logger.info(message, arguments);
// }
// },
// WARN {
// public void log(Logger logger, String message, Object... arguments) {
// logger.warn(message, arguments);
// }
// },
// ERROR {
// public void log(Logger logger, String message, Object... arguments) {
// logger.error(message, arguments);
// }
// };
//
// public abstract void log(Logger logger, String message, Object... arguments);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/StreamProcessor.java
// public interface StreamProcessor {
// void process(String block);
//
// void onProcessed();
// }
| import org.immutables.value.Value.Immutable;
import de.flapdoodle.embed.process.io.Processors;
import de.flapdoodle.embed.process.io.Slf4jLevel;
import de.flapdoodle.embed.process.io.StreamProcessor; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.process;
@Immutable
public interface ProcessOutput {
StreamProcessor output();
StreamProcessor error();
StreamProcessor commands();
static ProcessOutput namedConsole(String label) {
return builder()
.output(Processors.namedConsole("["+label+" output]"))
.error(Processors.namedConsole("["+label+" error]"))
.commands(Processors.console())
.build();
}
static ProcessOutput silent() {
return builder()
.output(Processors.silent())
.error(Processors.silent())
.commands(Processors.silent())
.build();
}
static ProcessOutput named(String label, org.slf4j.Logger logger) {
return builder() | // Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Slf4jLevel.java
// public enum Slf4jLevel {
//
// TRACE {
// public void log(Logger logger, String message, Object... arguments) {
// logger.trace(message, arguments);
// }
// },
// DEBUG {
// public void log(Logger logger, String message, Object... arguments) {
// logger.debug(message, arguments);
// }
// },
// INFO {
// public void log(Logger logger, String message, Object... arguments) {
// logger.info(message, arguments);
// }
// },
// WARN {
// public void log(Logger logger, String message, Object... arguments) {
// logger.warn(message, arguments);
// }
// },
// ERROR {
// public void log(Logger logger, String message, Object... arguments) {
// logger.error(message, arguments);
// }
// };
//
// public abstract void log(Logger logger, String message, Object... arguments);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/StreamProcessor.java
// public interface StreamProcessor {
// void process(String block);
//
// void onProcessed();
// }
// Path: src/main/java/de/flapdoodle/embed/process/config/process/ProcessOutput.java
import org.immutables.value.Value.Immutable;
import de.flapdoodle.embed.process.io.Processors;
import de.flapdoodle.embed.process.io.Slf4jLevel;
import de.flapdoodle.embed.process.io.StreamProcessor;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.process;
@Immutable
public interface ProcessOutput {
StreamProcessor output();
StreamProcessor error();
StreamProcessor commands();
static ProcessOutput namedConsole(String label) {
return builder()
.output(Processors.namedConsole("["+label+" output]"))
.error(Processors.namedConsole("["+label+" error]"))
.commands(Processors.console())
.build();
}
static ProcessOutput silent() {
return builder()
.output(Processors.silent())
.error(Processors.silent())
.commands(Processors.silent())
.build();
}
static ProcessOutput named(String label, org.slf4j.Logger logger) {
return builder() | .output(Processors.named("["+label+" output]", Processors.logTo(logger, Slf4jLevel.INFO))) |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java | // Path: src/main/java/de/flapdoodle/embed/process/extract/TempNaming.java
// public interface TempNaming {
// String nameFor(String prefix, String postfix);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
| import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.util.Optional;
import org.immutables.value.Value;
import org.immutables.value.Value.Default;
import de.flapdoodle.embed.process.extract.TempNaming;
import de.flapdoodle.embed.process.io.directories.Directory; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.store;
@Value.Immutable
public interface DownloadConfig {
DistributionDownloadPath getDownloadPath();
| // Path: src/main/java/de/flapdoodle/embed/process/extract/TempNaming.java
// public interface TempNaming {
// String nameFor(String prefix, String postfix);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
// Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.util.Optional;
import org.immutables.value.Value;
import org.immutables.value.Value.Default;
import de.flapdoodle.embed.process.extract.TempNaming;
import de.flapdoodle.embed.process.io.directories.Directory;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.store;
@Value.Immutable
public interface DownloadConfig {
DistributionDownloadPath getDownloadPath();
| ProgressListener getProgressListener(); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java | // Path: src/main/java/de/flapdoodle/embed/process/extract/TempNaming.java
// public interface TempNaming {
// String nameFor(String prefix, String postfix);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
| import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.util.Optional;
import org.immutables.value.Value;
import org.immutables.value.Value.Default;
import de.flapdoodle.embed.process.extract.TempNaming;
import de.flapdoodle.embed.process.io.directories.Directory; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.store;
@Value.Immutable
public interface DownloadConfig {
DistributionDownloadPath getDownloadPath();
ProgressListener getProgressListener();
| // Path: src/main/java/de/flapdoodle/embed/process/extract/TempNaming.java
// public interface TempNaming {
// String nameFor(String prefix, String postfix);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
// Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.util.Optional;
import org.immutables.value.Value;
import org.immutables.value.Value.Default;
import de.flapdoodle.embed.process.extract.TempNaming;
import de.flapdoodle.embed.process.io.directories.Directory;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.store;
@Value.Immutable
public interface DownloadConfig {
DistributionDownloadPath getDownloadPath();
ProgressListener getProgressListener();
| Directory getArtifactStorePath(); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java | // Path: src/main/java/de/flapdoodle/embed/process/extract/TempNaming.java
// public interface TempNaming {
// String nameFor(String prefix, String postfix);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
| import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.util.Optional;
import org.immutables.value.Value;
import org.immutables.value.Value.Default;
import de.flapdoodle.embed.process.extract.TempNaming;
import de.flapdoodle.embed.process.io.directories.Directory; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.store;
@Value.Immutable
public interface DownloadConfig {
DistributionDownloadPath getDownloadPath();
ProgressListener getProgressListener();
Directory getArtifactStorePath();
| // Path: src/main/java/de/flapdoodle/embed/process/extract/TempNaming.java
// public interface TempNaming {
// String nameFor(String prefix, String postfix);
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
// Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.util.Optional;
import org.immutables.value.Value;
import org.immutables.value.Value.Default;
import de.flapdoodle.embed.process.extract.TempNaming;
import de.flapdoodle.embed.process.io.directories.Directory;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.store;
@Value.Immutable
public interface DownloadConfig {
DistributionDownloadPath getDownloadPath();
ProgressListener getProgressListener();
Directory getArtifactStorePath();
| TempNaming getFileNaming(); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/config/store/SameDownloadPathForEveryDistribution.java | // Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
| import de.flapdoodle.embed.process.distribution.Distribution; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.store;
public class SameDownloadPathForEveryDistribution implements DistributionDownloadPath {
private final String _path;
public SameDownloadPathForEveryDistribution(String path) {
_path = path;
}
@Override | // Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/config/store/SameDownloadPathForEveryDistribution.java
import de.flapdoodle.embed.process.distribution.Distribution;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.store;
public class SameDownloadPathForEveryDistribution implements DistributionDownloadPath {
private final String _path;
public SameDownloadPathForEveryDistribution(String path) {
_path = path;
}
@Override | public String getPath(Distribution distribution) { |
flapdoodle-oss/de.flapdoodle.embed.process | src/test/java/de/flapdoodle/embed/process/io/file/TestFileCleaner.java | // Path: src/main/java/de/flapdoodle/embed/process/io/directories/PlatformTempDir.java
// public class PlatformTempDir implements Directory {
//
// @Override
// public File asFile() {
// return new File(System.getProperty("java.io.tmpdir"));
// }
//
// @Override
// public boolean isGenerated() {
// return false;
// }
//
// }
| import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import de.flapdoodle.embed.process.io.directories.PlatformTempDir;
import de.flapdoodle.os.OS;
import de.flapdoodle.os.Platform;
import junit.framework.TestCase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.io.file;
public class TestFileCleaner extends TestCase {
private static Logger logger = LoggerFactory.getLogger(TestFileCleaner.class.getName());
String prefix = UUID.randomUUID().toString();
public void testCleanup() throws IOException, InterruptedException {
boolean runsOnWindows = Platform.detect().operatingSystem() == OS.Windows;
List<File> files = new ArrayList<File>();
logger.info("create temp files");
for (int i = 0; i < 10; i++) { | // Path: src/main/java/de/flapdoodle/embed/process/io/directories/PlatformTempDir.java
// public class PlatformTempDir implements Directory {
//
// @Override
// public File asFile() {
// return new File(System.getProperty("java.io.tmpdir"));
// }
//
// @Override
// public boolean isGenerated() {
// return false;
// }
//
// }
// Path: src/test/java/de/flapdoodle/embed/process/io/file/TestFileCleaner.java
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import de.flapdoodle.embed.process.io.directories.PlatformTempDir;
import de.flapdoodle.os.OS;
import de.flapdoodle.os.Platform;
import junit.framework.TestCase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.io.file;
public class TestFileCleaner extends TestCase {
private static Logger logger = LoggerFactory.getLogger(TestFileCleaner.class.getName());
String prefix = UUID.randomUUID().toString();
public void testCleanup() throws IOException, InterruptedException {
boolean runsOnWindows = Platform.detect().operatingSystem() == OS.Windows;
List<File> files = new ArrayList<File>();
logger.info("create temp files");
for (int i = 0; i < 10; i++) { | files.add(Files.createTempFile(new PlatformTempDir(), "fileCleanerTest-" + prefix + "-some-" + i)); |
flapdoodle-oss/de.flapdoodle.embed.process | src/test/java/de/flapdoodle/embed/process/example/GenericExecuteable.java | // Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/runtime/Executable.java
// public abstract class Executable<T extends ExecutableProcessConfig, P extends IStopable> implements IStopable {
//
// private final Logger logger = LoggerFactory.getLogger(getClass());
//
// private final T config;
// private final RuntimeConfig runtimeConfig;
// private final ExtractedFileSet executable;
// private boolean stopped;
// private boolean registeredJobKiller;
//
// private List<IStopable> stopables = new ArrayList<>();
//
// private final Distribution distribution;
//
// public Executable(Distribution distribution, T config, RuntimeConfig runtimeConfig, ExtractedFileSet executable) {
// this.distribution = distribution;
// this.config = config;
// this.runtimeConfig = runtimeConfig;
// this.executable = executable;
// // only add shutdown hook for daemon processes,
// // clis being invoked will usually die by themselves
// if (runtimeConfig.isDaemonProcess()) {
// ProcessControl.addShutdownHook(new JobKiller());
// registeredJobKiller = true;
// }
// }
//
// @Override
// public boolean isRegisteredJobKiller() {
// return registeredJobKiller;
// }
//
// /**
// * use stop (this calls stop anyway)
// */
// @Deprecated
// public synchronized void cleanup() {
// stop();
// }
//
// public synchronized void stop() {
// if (!stopped) {
// for (IStopable s : stopables) {
// s.stop();
// }
// stopables = new ArrayList<>();
//
// runtimeConfig.artifactStore().removeFileSet(distribution, executable);
//
// stopped = true;
// }
// }
//
// /**
// *
// */
// class JobKiller implements Runnable {
//
// @Override
// public void run() {
// stop();
// }
// }
//
// public ExtractedFileSet getFile() {
// return executable;
// }
//
// public synchronized P start() throws IOException {
// if (stopped) throw new RuntimeException("Already stopped");
//
// P start = start(distribution, config, runtimeConfig);
// logger.info("start {}", config);
// addStopable(start);
// return start;
// }
//
// private void addStopable(P start) {
// stopables.add(start);
// }
//
// protected abstract P start(Distribution distribution, T config, RuntimeConfig runtime) throws IOException;
//
// }
| import java.io.IOException;
import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import de.flapdoodle.embed.process.runtime.Executable; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.example;
public class GenericExecuteable extends Executable<GenericProcessConfig, GenericProcess> {
public GenericExecuteable(Distribution distribution, GenericProcessConfig config, RuntimeConfig runtimeConfig, | // Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
// @Value.Immutable
// public interface RuntimeConfig {
//
// ProcessOutput processOutput();
//
// @Default
// default CommandLinePostProcessor commandLinePostProcessor() {
// return new CommandLinePostProcessor.Noop();
// }
//
// IArtifactStore artifactStore();
//
// @Default
// default boolean isDaemonProcess() {
// return false;
// }
//
// static ImmutableRuntimeConfig.Builder builder() {
// return ImmutableRuntimeConfig.builder();
// }
//
// /**
// * some api hacks to reenable spring boot support until they fix their api usage
// */
// static interface Builder {
// ImmutableRuntimeConfig.Builder processOutput(ProcessOutput processOutput);
//
// default ImmutableRuntimeConfig.Builder processOutput(de.flapdoodle.embed.process.config.io.ProcessOutput processOutput) {
// return processOutput((ProcessOutput) processOutput);
// }
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/runtime/Executable.java
// public abstract class Executable<T extends ExecutableProcessConfig, P extends IStopable> implements IStopable {
//
// private final Logger logger = LoggerFactory.getLogger(getClass());
//
// private final T config;
// private final RuntimeConfig runtimeConfig;
// private final ExtractedFileSet executable;
// private boolean stopped;
// private boolean registeredJobKiller;
//
// private List<IStopable> stopables = new ArrayList<>();
//
// private final Distribution distribution;
//
// public Executable(Distribution distribution, T config, RuntimeConfig runtimeConfig, ExtractedFileSet executable) {
// this.distribution = distribution;
// this.config = config;
// this.runtimeConfig = runtimeConfig;
// this.executable = executable;
// // only add shutdown hook for daemon processes,
// // clis being invoked will usually die by themselves
// if (runtimeConfig.isDaemonProcess()) {
// ProcessControl.addShutdownHook(new JobKiller());
// registeredJobKiller = true;
// }
// }
//
// @Override
// public boolean isRegisteredJobKiller() {
// return registeredJobKiller;
// }
//
// /**
// * use stop (this calls stop anyway)
// */
// @Deprecated
// public synchronized void cleanup() {
// stop();
// }
//
// public synchronized void stop() {
// if (!stopped) {
// for (IStopable s : stopables) {
// s.stop();
// }
// stopables = new ArrayList<>();
//
// runtimeConfig.artifactStore().removeFileSet(distribution, executable);
//
// stopped = true;
// }
// }
//
// /**
// *
// */
// class JobKiller implements Runnable {
//
// @Override
// public void run() {
// stop();
// }
// }
//
// public ExtractedFileSet getFile() {
// return executable;
// }
//
// public synchronized P start() throws IOException {
// if (stopped) throw new RuntimeException("Already stopped");
//
// P start = start(distribution, config, runtimeConfig);
// logger.info("start {}", config);
// addStopable(start);
// return start;
// }
//
// private void addStopable(P start) {
// stopables.add(start);
// }
//
// protected abstract P start(Distribution distribution, T config, RuntimeConfig runtime) throws IOException;
//
// }
// Path: src/test/java/de/flapdoodle/embed/process/example/GenericExecuteable.java
import java.io.IOException;
import de.flapdoodle.embed.process.config.RuntimeConfig;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
import de.flapdoodle.embed.process.runtime.Executable;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.example;
public class GenericExecuteable extends Executable<GenericProcessConfig, GenericProcess> {
public GenericExecuteable(Distribution distribution, GenericProcessConfig config, RuntimeConfig runtimeConfig, | ExtractedFileSet executable) { |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/extract/Extractor.java | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
| import java.io.File;
import java.io.IOException;
import de.flapdoodle.embed.process.config.store.DownloadConfig; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
/**
* Extractor interface
*/
@FunctionalInterface
public interface Extractor {
| // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/extract/Extractor.java
import java.io.File;
import java.io.IOException;
import de.flapdoodle.embed.process.config.store.DownloadConfig;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
/**
* Extractor interface
*/
@FunctionalInterface
public interface Extractor {
| ExtractedFileSet extract(DownloadConfig runtime, File source, FilesToExtract toExtract) throws IOException; |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/runtime/ProcessControl.java | // Path: src/main/java/de/flapdoodle/embed/process/config/SupportConfig.java
// @Value.Immutable
// public interface SupportConfig {
//
// String name();
//
// String supportUrl();
//
// BiFunction<Class<?>, Exception, String> messageOnException();
//
// static SupportConfig generic() {
// return builder()
// .name("generic")
// .supportUrl("https://github.com/flapdoodle-oss/de.flapdoodle.embed.process")
// .messageOnException((clazz,ex) -> null)
// .build();
// }
//
// static ImmutableSupportConfig.Builder builder() {
// return ImmutableSupportConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/process/ProcessConfig.java
// @Immutable
// public interface ProcessConfig {
//
// List<String> commandLine();
//
// StreamProcessor output();
//
// @Default
// default StreamProcessor error() {
// return output();
// }
//
// public static Builder builder() {
// return ImmutableProcessConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
| import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.SupportConfig;
import de.flapdoodle.embed.process.config.process.ProcessConfig;
import de.flapdoodle.embed.process.io.Processors;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public class ProcessControl {
private static final long MAX_STOP_TIMEOUT_MS = 5000;
private static Logger logger = LoggerFactory.getLogger(ProcessControl.class);
private static final int SLEEP_TIMEOUT = 10;
private final Process process;
private InputStreamReader reader;
private final InputStreamReader error;
private final Long pid;
| // Path: src/main/java/de/flapdoodle/embed/process/config/SupportConfig.java
// @Value.Immutable
// public interface SupportConfig {
//
// String name();
//
// String supportUrl();
//
// BiFunction<Class<?>, Exception, String> messageOnException();
//
// static SupportConfig generic() {
// return builder()
// .name("generic")
// .supportUrl("https://github.com/flapdoodle-oss/de.flapdoodle.embed.process")
// .messageOnException((clazz,ex) -> null)
// .build();
// }
//
// static ImmutableSupportConfig.Builder builder() {
// return ImmutableSupportConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/process/ProcessConfig.java
// @Immutable
// public interface ProcessConfig {
//
// List<String> commandLine();
//
// StreamProcessor output();
//
// @Default
// default StreamProcessor error() {
// return output();
// }
//
// public static Builder builder() {
// return ImmutableProcessConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/runtime/ProcessControl.java
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.SupportConfig;
import de.flapdoodle.embed.process.config.process.ProcessConfig;
import de.flapdoodle.embed.process.io.Processors;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
public class ProcessControl {
private static final long MAX_STOP_TIMEOUT_MS = 5000;
private static Logger logger = LoggerFactory.getLogger(ProcessControl.class);
private static final int SLEEP_TIMEOUT = 10;
private final Process process;
private InputStreamReader reader;
private final InputStreamReader error;
private final Long pid;
| private final SupportConfig runtime; |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/runtime/ProcessControl.java | // Path: src/main/java/de/flapdoodle/embed/process/config/SupportConfig.java
// @Value.Immutable
// public interface SupportConfig {
//
// String name();
//
// String supportUrl();
//
// BiFunction<Class<?>, Exception, String> messageOnException();
//
// static SupportConfig generic() {
// return builder()
// .name("generic")
// .supportUrl("https://github.com/flapdoodle-oss/de.flapdoodle.embed.process")
// .messageOnException((clazz,ex) -> null)
// .build();
// }
//
// static ImmutableSupportConfig.Builder builder() {
// return ImmutableSupportConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/process/ProcessConfig.java
// @Immutable
// public interface ProcessConfig {
//
// List<String> commandLine();
//
// StreamProcessor output();
//
// @Default
// default StreamProcessor error() {
// return output();
// }
//
// public static Builder builder() {
// return ImmutableProcessConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
| import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.SupportConfig;
import de.flapdoodle.embed.process.config.process.ProcessConfig;
import de.flapdoodle.embed.process.io.Processors;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable; | + "Thank you:)\n" + "----------------------------------------------------\n\n";
throw new IllegalStateException("Couldn't kill "+runtime.name()+" process!" + message);
}
return retCode;
}
public static ProcessControl fromCommandLine(SupportConfig runtime, List<String> commandLine, boolean redirectErrorStream)
throws IOException {
ProcessBuilder processBuilder = newProcessBuilder(commandLine, redirectErrorStream);
return start(runtime, processBuilder);
}
public static ProcessControl start(SupportConfig runtime, ProcessBuilder processBuilder) throws IOException {
return new ProcessControl(runtime, processBuilder.start());
}
public static ProcessBuilder newProcessBuilder(List<String> commandLine, boolean redirectErrorStream) {
return newProcessBuilder(commandLine, new HashMap<>(), redirectErrorStream);
}
public static ProcessBuilder newProcessBuilder(List<String> commandLine, Map<String,String> environment, boolean redirectErrorStream) {
ProcessBuilder processBuilder = new ProcessBuilder(commandLine);
if (!environment.isEmpty()){
processBuilder.environment().putAll(environment);
}
if (redirectErrorStream)
processBuilder.redirectErrorStream();
return processBuilder;
}
| // Path: src/main/java/de/flapdoodle/embed/process/config/SupportConfig.java
// @Value.Immutable
// public interface SupportConfig {
//
// String name();
//
// String supportUrl();
//
// BiFunction<Class<?>, Exception, String> messageOnException();
//
// static SupportConfig generic() {
// return builder()
// .name("generic")
// .supportUrl("https://github.com/flapdoodle-oss/de.flapdoodle.embed.process")
// .messageOnException((clazz,ex) -> null)
// .build();
// }
//
// static ImmutableSupportConfig.Builder builder() {
// return ImmutableSupportConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/process/ProcessConfig.java
// @Immutable
// public interface ProcessConfig {
//
// List<String> commandLine();
//
// StreamProcessor output();
//
// @Default
// default StreamProcessor error() {
// return output();
// }
//
// public static Builder builder() {
// return ImmutableProcessConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/runtime/ProcessControl.java
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.SupportConfig;
import de.flapdoodle.embed.process.config.process.ProcessConfig;
import de.flapdoodle.embed.process.io.Processors;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
+ "Thank you:)\n" + "----------------------------------------------------\n\n";
throw new IllegalStateException("Couldn't kill "+runtime.name()+" process!" + message);
}
return retCode;
}
public static ProcessControl fromCommandLine(SupportConfig runtime, List<String> commandLine, boolean redirectErrorStream)
throws IOException {
ProcessBuilder processBuilder = newProcessBuilder(commandLine, redirectErrorStream);
return start(runtime, processBuilder);
}
public static ProcessControl start(SupportConfig runtime, ProcessBuilder processBuilder) throws IOException {
return new ProcessControl(runtime, processBuilder.start());
}
public static ProcessBuilder newProcessBuilder(List<String> commandLine, boolean redirectErrorStream) {
return newProcessBuilder(commandLine, new HashMap<>(), redirectErrorStream);
}
public static ProcessBuilder newProcessBuilder(List<String> commandLine, Map<String,String> environment, boolean redirectErrorStream) {
ProcessBuilder processBuilder = new ProcessBuilder(commandLine);
if (!environment.isEmpty()){
processBuilder.environment().putAll(environment);
}
if (redirectErrorStream)
processBuilder.redirectErrorStream();
return processBuilder;
}
| public static boolean executeCommandLine(SupportConfig support, String label, ProcessConfig processConfig) { |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/runtime/ProcessControl.java | // Path: src/main/java/de/flapdoodle/embed/process/config/SupportConfig.java
// @Value.Immutable
// public interface SupportConfig {
//
// String name();
//
// String supportUrl();
//
// BiFunction<Class<?>, Exception, String> messageOnException();
//
// static SupportConfig generic() {
// return builder()
// .name("generic")
// .supportUrl("https://github.com/flapdoodle-oss/de.flapdoodle.embed.process")
// .messageOnException((clazz,ex) -> null)
// .build();
// }
//
// static ImmutableSupportConfig.Builder builder() {
// return ImmutableSupportConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/process/ProcessConfig.java
// @Immutable
// public interface ProcessConfig {
//
// List<String> commandLine();
//
// StreamProcessor output();
//
// @Default
// default StreamProcessor error() {
// return output();
// }
//
// public static Builder builder() {
// return ImmutableProcessConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
| import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.SupportConfig;
import de.flapdoodle.embed.process.config.process.ProcessConfig;
import de.flapdoodle.embed.process.io.Processors;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable; | public static ProcessControl fromCommandLine(SupportConfig runtime, List<String> commandLine, boolean redirectErrorStream)
throws IOException {
ProcessBuilder processBuilder = newProcessBuilder(commandLine, redirectErrorStream);
return start(runtime, processBuilder);
}
public static ProcessControl start(SupportConfig runtime, ProcessBuilder processBuilder) throws IOException {
return new ProcessControl(runtime, processBuilder.start());
}
public static ProcessBuilder newProcessBuilder(List<String> commandLine, boolean redirectErrorStream) {
return newProcessBuilder(commandLine, new HashMap<>(), redirectErrorStream);
}
public static ProcessBuilder newProcessBuilder(List<String> commandLine, Map<String,String> environment, boolean redirectErrorStream) {
ProcessBuilder processBuilder = new ProcessBuilder(commandLine);
if (!environment.isEmpty()){
processBuilder.environment().putAll(environment);
}
if (redirectErrorStream)
processBuilder.redirectErrorStream();
return processBuilder;
}
public static boolean executeCommandLine(SupportConfig support, String label, ProcessConfig processConfig) {
boolean ret;
List<String> commandLine = processConfig.commandLine();
try {
ProcessControl process = fromCommandLine(support, processConfig.commandLine(), processConfig.error() == null); | // Path: src/main/java/de/flapdoodle/embed/process/config/SupportConfig.java
// @Value.Immutable
// public interface SupportConfig {
//
// String name();
//
// String supportUrl();
//
// BiFunction<Class<?>, Exception, String> messageOnException();
//
// static SupportConfig generic() {
// return builder()
// .name("generic")
// .supportUrl("https://github.com/flapdoodle-oss/de.flapdoodle.embed.process")
// .messageOnException((clazz,ex) -> null)
// .build();
// }
//
// static ImmutableSupportConfig.Builder builder() {
// return ImmutableSupportConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/process/ProcessConfig.java
// @Immutable
// public interface ProcessConfig {
//
// List<String> commandLine();
//
// StreamProcessor output();
//
// @Default
// default StreamProcessor error() {
// return output();
// }
//
// public static Builder builder() {
// return ImmutableProcessConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Processors.java
// public class Processors {
//
// private Processors() {
// throw new IllegalAccessError("singleton");
// }
//
// public static StreamProcessor console() {
// return new ConsoleOutputStreamProcessor();
// }
//
// public static StreamProcessor silent() {
// return new NullProcessor();
// }
//
// public static StreamProcessor named(String name, StreamProcessor destination) {
// return new NamedOutputStreamProcessor(name, destination);
// }
//
// public static StreamProcessor namedConsole(String name) {
// return named(name, console());
// }
//
// public static StreamProcessor logTo(Logger logger, Slf4jLevel level) {
// return new Slf4jStreamProcessor(logger, level);
// }
//
// public static ReaderProcessor connect(Reader reader, StreamProcessor processor) {
// return new ReaderProcessor(reader, processor);
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/runtime/ProcessControl.java
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.SupportConfig;
import de.flapdoodle.embed.process.config.process.ProcessConfig;
import de.flapdoodle.embed.process.io.Processors;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
public static ProcessControl fromCommandLine(SupportConfig runtime, List<String> commandLine, boolean redirectErrorStream)
throws IOException {
ProcessBuilder processBuilder = newProcessBuilder(commandLine, redirectErrorStream);
return start(runtime, processBuilder);
}
public static ProcessControl start(SupportConfig runtime, ProcessBuilder processBuilder) throws IOException {
return new ProcessControl(runtime, processBuilder.start());
}
public static ProcessBuilder newProcessBuilder(List<String> commandLine, boolean redirectErrorStream) {
return newProcessBuilder(commandLine, new HashMap<>(), redirectErrorStream);
}
public static ProcessBuilder newProcessBuilder(List<String> commandLine, Map<String,String> environment, boolean redirectErrorStream) {
ProcessBuilder processBuilder = new ProcessBuilder(commandLine);
if (!environment.isEmpty()){
processBuilder.environment().putAll(environment);
}
if (redirectErrorStream)
processBuilder.redirectErrorStream();
return processBuilder;
}
public static boolean executeCommandLine(SupportConfig support, String label, ProcessConfig processConfig) {
boolean ret;
List<String> commandLine = processConfig.commandLine();
try {
ProcessControl process = fromCommandLine(support, processConfig.commandLine(), processConfig.error() == null); | Processors.connect(process.getReader(), processConfig.output()); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/store/StaticArtifactStore.java | // Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
| import java.util.Map;
import java.util.Optional;
import org.immutables.value.Value.Immutable;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.ExtractedFileSet; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.store;
@Immutable
public abstract class StaticArtifactStore implements IArtifactStore {
| // Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/store/StaticArtifactStore.java
import java.util.Map;
import java.util.Optional;
import org.immutables.value.Value.Immutable;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.store;
@Immutable
public abstract class StaticArtifactStore implements IArtifactStore {
| protected abstract Map<Distribution, ExtractedFileSet> fileSet(); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/store/StaticArtifactStore.java | // Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
| import java.util.Map;
import java.util.Optional;
import org.immutables.value.Value.Immutable;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.ExtractedFileSet; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.store;
@Immutable
public abstract class StaticArtifactStore implements IArtifactStore {
| // Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/extract/ExtractedFileSet.java
// @Value.Immutable
// @Style(strictBuilder=true)
// public abstract class ExtractedFileSet {
//
// @Parameter
// public abstract File baseDir();
//
// public abstract File executable();
//
// public abstract Set<File> libraryFiles();
//
// public abstract boolean baseDirIsGenerated();
//
// public static ImmutableExtractedFileSet.Builder builder(File baseDir) {
// return ImmutableExtractedFileSet.builder(baseDir);
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/store/StaticArtifactStore.java
import java.util.Map;
import java.util.Optional;
import org.immutables.value.Value.Immutable;
import de.flapdoodle.embed.process.distribution.Distribution;
import de.flapdoodle.embed.process.extract.ExtractedFileSet;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.store;
@Immutable
public abstract class StaticArtifactStore implements IArtifactStore {
| protected abstract Map<Distribution, ExtractedFileSet> fileSet(); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/runtime/CommandLinePostProcessor.java | // Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
| import java.util.List;
import de.flapdoodle.embed.process.distribution.Distribution; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
@FunctionalInterface
public interface CommandLinePostProcessor { | // Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/runtime/CommandLinePostProcessor.java
import java.util.List;
import de.flapdoodle.embed.process.distribution.Distribution;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
@FunctionalInterface
public interface CommandLinePostProcessor { | List<String> process(Distribution distribution, List<String> args); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/extract/AbstractExtractor.java | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
| import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileType;
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder;
import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
public abstract class AbstractExtractor implements Extractor {
private static Logger _logger=LoggerFactory.getLogger(AbstractExtractor.class);
protected abstract ArchiveWrapper archiveStream(File source) throws IOException;
private ArchiveWrapper archiveStreamWithExceptionHint(File source) throws IOException {
try {
return archiveStream(source);
} catch (IOException iox) {
_logger.warn("\n--------------------------\n"
+ "If you get this exception more than once, you should check if the file is corrupt.\n"
+ "If you remove the file ({}), it will be downloaded again.\n"
+ "--------------------------", source.getAbsolutePath(), iox);
throw new IOException("File "+source.getAbsolutePath(),iox);
}
}
@Override | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
// Path: src/main/java/de/flapdoodle/embed/process/extract/AbstractExtractor.java
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileType;
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder;
import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
public abstract class AbstractExtractor implements Extractor {
private static Logger _logger=LoggerFactory.getLogger(AbstractExtractor.class);
protected abstract ArchiveWrapper archiveStream(File source) throws IOException;
private ArchiveWrapper archiveStreamWithExceptionHint(File source) throws IOException {
try {
return archiveStream(source);
} catch (IOException iox) {
_logger.warn("\n--------------------------\n"
+ "If you get this exception more than once, you should check if the file is corrupt.\n"
+ "If you remove the file ({}), it will be downloaded again.\n"
+ "--------------------------", source.getAbsolutePath(), iox);
throw new IOException("File "+source.getAbsolutePath(),iox);
}
}
@Override | public ExtractedFileSet extract(DownloadConfig runtime, File source, FilesToExtract toExtract) throws IOException { |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/extract/AbstractExtractor.java | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
| import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileType;
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder;
import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
public abstract class AbstractExtractor implements Extractor {
private static Logger _logger=LoggerFactory.getLogger(AbstractExtractor.class);
protected abstract ArchiveWrapper archiveStream(File source) throws IOException;
private ArchiveWrapper archiveStreamWithExceptionHint(File source) throws IOException {
try {
return archiveStream(source);
} catch (IOException iox) {
_logger.warn("\n--------------------------\n"
+ "If you get this exception more than once, you should check if the file is corrupt.\n"
+ "If you remove the file ({}), it will be downloaded again.\n"
+ "--------------------------", source.getAbsolutePath(), iox);
throw new IOException("File "+source.getAbsolutePath(),iox);
}
}
@Override
public ExtractedFileSet extract(DownloadConfig runtime, File source, FilesToExtract toExtract) throws IOException {
Builder builder = ExtractedFileSet.builder(toExtract.baseDir())
.baseDirIsGenerated(toExtract.baseDirIsGenerated());
| // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
// Path: src/main/java/de/flapdoodle/embed/process/extract/AbstractExtractor.java
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileType;
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder;
import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
public abstract class AbstractExtractor implements Extractor {
private static Logger _logger=LoggerFactory.getLogger(AbstractExtractor.class);
protected abstract ArchiveWrapper archiveStream(File source) throws IOException;
private ArchiveWrapper archiveStreamWithExceptionHint(File source) throws IOException {
try {
return archiveStream(source);
} catch (IOException iox) {
_logger.warn("\n--------------------------\n"
+ "If you get this exception more than once, you should check if the file is corrupt.\n"
+ "If you remove the file ({}), it will be downloaded again.\n"
+ "--------------------------", source.getAbsolutePath(), iox);
throw new IOException("File "+source.getAbsolutePath(),iox);
}
}
@Override
public ExtractedFileSet extract(DownloadConfig runtime, File source, FilesToExtract toExtract) throws IOException {
Builder builder = ExtractedFileSet.builder(toExtract.baseDir())
.baseDirIsGenerated(toExtract.baseDirIsGenerated());
| ProgressListener progressListener = runtime.getProgressListener(); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/extract/AbstractExtractor.java | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
| import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileType;
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder;
import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
public abstract class AbstractExtractor implements Extractor {
private static Logger _logger=LoggerFactory.getLogger(AbstractExtractor.class);
protected abstract ArchiveWrapper archiveStream(File source) throws IOException;
private ArchiveWrapper archiveStreamWithExceptionHint(File source) throws IOException {
try {
return archiveStream(source);
} catch (IOException iox) {
_logger.warn("\n--------------------------\n"
+ "If you get this exception more than once, you should check if the file is corrupt.\n"
+ "If you remove the file ({}), it will be downloaded again.\n"
+ "--------------------------", source.getAbsolutePath(), iox);
throw new IOException("File "+source.getAbsolutePath(),iox);
}
}
@Override
public ExtractedFileSet extract(DownloadConfig runtime, File source, FilesToExtract toExtract) throws IOException {
Builder builder = ExtractedFileSet.builder(toExtract.baseDir())
.baseDirIsGenerated(toExtract.baseDirIsGenerated());
ProgressListener progressListener = runtime.getProgressListener();
String progressLabel = "Extract " + source;
progressListener.start(progressLabel);
ArchiveWrapper archive = archiveStreamWithExceptionHint(source);
try {
org.apache.commons.compress.archivers.ArchiveEntry entry;
while ((entry = archive.getNextEntry()) != null) {
ExtractionMatch match = toExtract.find(new CommonsArchiveEntryAdapter(entry));
if (match != null) {
if (archive.canReadEntryData(entry)) {
long size = entry.getSize(); | // Path: src/main/java/de/flapdoodle/embed/process/config/store/DownloadConfig.java
// @Value.Immutable
// public interface DownloadConfig {
//
// DistributionDownloadPath getDownloadPath();
//
// ProgressListener getProgressListener();
//
// Directory getArtifactStorePath();
//
// TempNaming getFileNaming();
//
// String getDownloadPrefix();
//
// String getUserAgent();
//
// Optional<String> getAuthorization();
//
// PackageResolver getPackageResolver();
//
// @Default
// default TimeoutConfig getTimeoutConfig() {
// return TimeoutConfig.defaults();
// }
//
// Optional<ProxyFactory> proxyFactory();
//
// public static ImmutableDownloadConfig.Builder builder() {
// return ImmutableDownloadConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/store/FileType.java
// public enum FileType {
// Executable,
// Library
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/ProgressListener.java
// public interface ProgressListener {
//
// void progress(String label, int percent);
//
// void done(String label);
//
// void start(String label);
//
// void info(String label, String message);
// }
// Path: src/main/java/de/flapdoodle/embed/process/extract/AbstractExtractor.java
import de.flapdoodle.embed.process.config.store.DownloadConfig;
import de.flapdoodle.embed.process.config.store.FileType;
import de.flapdoodle.embed.process.extract.ImmutableExtractedFileSet.Builder;
import de.flapdoodle.embed.process.io.progress.ProgressListener;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
public abstract class AbstractExtractor implements Extractor {
private static Logger _logger=LoggerFactory.getLogger(AbstractExtractor.class);
protected abstract ArchiveWrapper archiveStream(File source) throws IOException;
private ArchiveWrapper archiveStreamWithExceptionHint(File source) throws IOException {
try {
return archiveStream(source);
} catch (IOException iox) {
_logger.warn("\n--------------------------\n"
+ "If you get this exception more than once, you should check if the file is corrupt.\n"
+ "If you remove the file ({}), it will be downloaded again.\n"
+ "--------------------------", source.getAbsolutePath(), iox);
throw new IOException("File "+source.getAbsolutePath(),iox);
}
}
@Override
public ExtractedFileSet extract(DownloadConfig runtime, File source, FilesToExtract toExtract) throws IOException {
Builder builder = ExtractedFileSet.builder(toExtract.baseDir())
.baseDirIsGenerated(toExtract.baseDirIsGenerated());
ProgressListener progressListener = runtime.getProgressListener();
String progressLabel = "Extract " + source;
progressListener.start(progressLabel);
ArchiveWrapper archive = archiveStreamWithExceptionHint(source);
try {
org.apache.commons.compress.archivers.ArchiveEntry entry;
while ((entry = archive.getNextEntry()) != null) {
ExtractionMatch match = toExtract.find(new CommonsArchiveEntryAdapter(entry));
if (match != null) {
if (archive.canReadEntryData(entry)) {
long size = entry.getSize(); | FileType type = match.type(); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/extract/DirectoryAndExecutableNaming.java | // Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
| import org.immutables.value.Value.Immutable;
import de.flapdoodle.embed.process.io.directories.Directory; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
@Immutable
public abstract class DirectoryAndExecutableNaming {
| // Path: src/main/java/de/flapdoodle/embed/process/io/directories/Directory.java
// public interface Directory {
//
// File asFile();
//
// boolean isGenerated();
// }
// Path: src/main/java/de/flapdoodle/embed/process/extract/DirectoryAndExecutableNaming.java
import org.immutables.value.Value.Immutable;
import de.flapdoodle.embed.process.io.directories.Directory;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
@Immutable
public abstract class DirectoryAndExecutableNaming {
| public abstract Directory getDirectory(); |
flapdoodle-oss/de.flapdoodle.embed.process | src/test/java/de/flapdoodle/embed/process/example/GenericProcessConfig.java | // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/SupportConfig.java
// @Value.Immutable
// public interface SupportConfig {
//
// String name();
//
// String supportUrl();
//
// BiFunction<Class<?>, Exception, String> messageOnException();
//
// static SupportConfig generic() {
// return builder()
// .name("generic")
// .supportUrl("https://github.com/flapdoodle-oss/de.flapdoodle.embed.process")
// .messageOnException((clazz,ex) -> null)
// .build();
// }
//
// static ImmutableSupportConfig.Builder builder() {
// return ImmutableSupportConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Version.java
// @FunctionalInterface
// public interface Version {
//
// String asInDownloadPath();
//
// @Value.Immutable
// interface GenericVersion extends Version {
//
// @Override
// @Parameter
// String asInDownloadPath();
// }
//
// static GenericVersion of(String asInDownloadPath) {
// return ImmutableGenericVersion.of(asInDownloadPath);
// }
// }
| import java.util.OptionalLong;
import de.flapdoodle.embed.process.config.ExecutableProcessConfig;
import de.flapdoodle.embed.process.config.SupportConfig;
import de.flapdoodle.embed.process.distribution.Version; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.example;
public class GenericProcessConfig implements ExecutableProcessConfig {
protected final Version version; | // Path: src/main/java/de/flapdoodle/embed/process/config/ExecutableProcessConfig.java
// public interface ExecutableProcessConfig {
//
// Version version();
//
// SupportConfig supportConfig();
//
// OptionalLong stopTimeoutInMillis();
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/config/SupportConfig.java
// @Value.Immutable
// public interface SupportConfig {
//
// String name();
//
// String supportUrl();
//
// BiFunction<Class<?>, Exception, String> messageOnException();
//
// static SupportConfig generic() {
// return builder()
// .name("generic")
// .supportUrl("https://github.com/flapdoodle-oss/de.flapdoodle.embed.process")
// .messageOnException((clazz,ex) -> null)
// .build();
// }
//
// static ImmutableSupportConfig.Builder builder() {
// return ImmutableSupportConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/distribution/Version.java
// @FunctionalInterface
// public interface Version {
//
// String asInDownloadPath();
//
// @Value.Immutable
// interface GenericVersion extends Version {
//
// @Override
// @Parameter
// String asInDownloadPath();
// }
//
// static GenericVersion of(String asInDownloadPath) {
// return ImmutableGenericVersion.of(asInDownloadPath);
// }
// }
// Path: src/test/java/de/flapdoodle/embed/process/example/GenericProcessConfig.java
import java.util.OptionalLong;
import de.flapdoodle.embed.process.config.ExecutableProcessConfig;
import de.flapdoodle.embed.process.config.SupportConfig;
import de.flapdoodle.embed.process.distribution.Version;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.example;
public class GenericProcessConfig implements ExecutableProcessConfig {
protected final Version version; | private final SupportConfig _supportConfig; |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/config/store/DistributionDownloadPath.java | // Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
| import de.flapdoodle.embed.process.distribution.Distribution; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.store;
@FunctionalInterface
public interface DistributionDownloadPath { | // Path: src/main/java/de/flapdoodle/embed/process/distribution/Distribution.java
// @Value.Immutable
// public abstract class Distribution {
//
// @Parameter
// public abstract Version version();
//
// @Parameter
// public abstract Platform platform();
//
// @Override
// public String toString() {
// return "" + version() + ":" + platform();
// }
//
// public static Distribution detectFor(Version version) {
// return of(version, Platform.detect());
// }
//
// public static Distribution of(Version version, Platform platform) {
// return ImmutableDistribution.of(version, platform);
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/config/store/DistributionDownloadPath.java
import de.flapdoodle.embed.process.distribution.Distribution;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config.store;
@FunctionalInterface
public interface DistributionDownloadPath { | String getPath(Distribution distribution); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/runtime/NUMA.java | // Path: src/main/java/de/flapdoodle/embed/process/config/SupportConfig.java
// @Value.Immutable
// public interface SupportConfig {
//
// String name();
//
// String supportUrl();
//
// BiFunction<Class<?>, Exception, String> messageOnException();
//
// static SupportConfig generic() {
// return builder()
// .name("generic")
// .supportUrl("https://github.com/flapdoodle-oss/de.flapdoodle.embed.process")
// .messageOnException((clazz,ex) -> null)
// .build();
// }
//
// static ImmutableSupportConfig.Builder builder() {
// return ImmutableSupportConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Readers.java
// public class Readers {
//
// private static final int CHAR_BUFFER_LENGTH = 512;
//
// private Readers() {
// throw new IllegalAccessError("singleton");
// }
//
// public static String readAll(Reader reader) throws IOException {
// StringBuilder sb = new StringBuilder();
// int read;
// char[] buf = new char[CHAR_BUFFER_LENGTH];
// while ((read = reader.read(buf)) != -1) {
// sb.append(new String(buf, 0, read));
// }
// return sb.toString();
// }
// }
| import de.flapdoodle.os.OS;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.SupportConfig;
import de.flapdoodle.os.Platform;
import de.flapdoodle.embed.process.io.Readers;
import static java.util.Arrays.asList;
import java.io.IOException;
import java.io.Reader;
import java.util.HashMap;
import java.util.Map; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
/**
*
*/
public class NUMA {
private static Logger logger = LoggerFactory.getLogger(NUMA.class);
| // Path: src/main/java/de/flapdoodle/embed/process/config/SupportConfig.java
// @Value.Immutable
// public interface SupportConfig {
//
// String name();
//
// String supportUrl();
//
// BiFunction<Class<?>, Exception, String> messageOnException();
//
// static SupportConfig generic() {
// return builder()
// .name("generic")
// .supportUrl("https://github.com/flapdoodle-oss/de.flapdoodle.embed.process")
// .messageOnException((clazz,ex) -> null)
// .build();
// }
//
// static ImmutableSupportConfig.Builder builder() {
// return ImmutableSupportConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Readers.java
// public class Readers {
//
// private static final int CHAR_BUFFER_LENGTH = 512;
//
// private Readers() {
// throw new IllegalAccessError("singleton");
// }
//
// public static String readAll(Reader reader) throws IOException {
// StringBuilder sb = new StringBuilder();
// int read;
// char[] buf = new char[CHAR_BUFFER_LENGTH];
// while ((read = reader.read(buf)) != -1) {
// sb.append(new String(buf, 0, read));
// }
// return sb.toString();
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/runtime/NUMA.java
import de.flapdoodle.os.OS;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.SupportConfig;
import de.flapdoodle.os.Platform;
import de.flapdoodle.embed.process.io.Readers;
import static java.util.Arrays.asList;
import java.io.IOException;
import java.io.Reader;
import java.util.HashMap;
import java.util.Map;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
/**
*
*/
public class NUMA {
private static Logger logger = LoggerFactory.getLogger(NUMA.class);
| public static synchronized boolean isNUMA(SupportConfig support, Platform platform) { |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/runtime/NUMA.java | // Path: src/main/java/de/flapdoodle/embed/process/config/SupportConfig.java
// @Value.Immutable
// public interface SupportConfig {
//
// String name();
//
// String supportUrl();
//
// BiFunction<Class<?>, Exception, String> messageOnException();
//
// static SupportConfig generic() {
// return builder()
// .name("generic")
// .supportUrl("https://github.com/flapdoodle-oss/de.flapdoodle.embed.process")
// .messageOnException((clazz,ex) -> null)
// .build();
// }
//
// static ImmutableSupportConfig.Builder builder() {
// return ImmutableSupportConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Readers.java
// public class Readers {
//
// private static final int CHAR_BUFFER_LENGTH = 512;
//
// private Readers() {
// throw new IllegalAccessError("singleton");
// }
//
// public static String readAll(Reader reader) throws IOException {
// StringBuilder sb = new StringBuilder();
// int read;
// char[] buf = new char[CHAR_BUFFER_LENGTH];
// while ((read = reader.read(buf)) != -1) {
// sb.append(new String(buf, 0, read));
// }
// return sb.toString();
// }
// }
| import de.flapdoodle.os.OS;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.SupportConfig;
import de.flapdoodle.os.Platform;
import de.flapdoodle.embed.process.io.Readers;
import static java.util.Arrays.asList;
import java.io.IOException;
import java.io.Reader;
import java.util.HashMap;
import java.util.Map; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
/**
*
*/
public class NUMA {
private static Logger logger = LoggerFactory.getLogger(NUMA.class);
public static synchronized boolean isNUMA(SupportConfig support, Platform platform) {
return NUMA_STATUS_MAP.computeIfAbsent(platform, p -> isNUMAOnce(support, p));
}
private static final Map<Platform, Boolean> NUMA_STATUS_MAP = new HashMap<>();
public static boolean isNUMAOnce(SupportConfig support, Platform platform) {
if (platform.operatingSystem() == OS.Linux) {
try {
ProcessControl process = ProcessControl
.fromCommandLine(support, asList("grep", "NUMA=y", "/boot/config-`uname -r`"), true);
Reader reader = process.getReader(); | // Path: src/main/java/de/flapdoodle/embed/process/config/SupportConfig.java
// @Value.Immutable
// public interface SupportConfig {
//
// String name();
//
// String supportUrl();
//
// BiFunction<Class<?>, Exception, String> messageOnException();
//
// static SupportConfig generic() {
// return builder()
// .name("generic")
// .supportUrl("https://github.com/flapdoodle-oss/de.flapdoodle.embed.process")
// .messageOnException((clazz,ex) -> null)
// .build();
// }
//
// static ImmutableSupportConfig.Builder builder() {
// return ImmutableSupportConfig.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/io/Readers.java
// public class Readers {
//
// private static final int CHAR_BUFFER_LENGTH = 512;
//
// private Readers() {
// throw new IllegalAccessError("singleton");
// }
//
// public static String readAll(Reader reader) throws IOException {
// StringBuilder sb = new StringBuilder();
// int read;
// char[] buf = new char[CHAR_BUFFER_LENGTH];
// while ((read = reader.read(buf)) != -1) {
// sb.append(new String(buf, 0, read));
// }
// return sb.toString();
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/runtime/NUMA.java
import de.flapdoodle.os.OS;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.flapdoodle.embed.process.config.SupportConfig;
import de.flapdoodle.os.Platform;
import de.flapdoodle.embed.process.io.Readers;
import static java.util.Arrays.asList;
import java.io.IOException;
import java.io.Reader;
import java.util.HashMap;
import java.util.Map;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.runtime;
/**
*
*/
public class NUMA {
private static Logger logger = LoggerFactory.getLogger(NUMA.class);
public static synchronized boolean isNUMA(SupportConfig support, Platform platform) {
return NUMA_STATUS_MAP.computeIfAbsent(platform, p -> isNUMAOnce(support, p));
}
private static final Map<Platform, Boolean> NUMA_STATUS_MAP = new HashMap<>();
public static boolean isNUMAOnce(SupportConfig support, Platform platform) {
if (platform.operatingSystem() == OS.Linux) {
try {
ProcessControl process = ProcessControl
.fromCommandLine(support, asList("grep", "NUMA=y", "/boot/config-`uname -r`"), true);
Reader reader = process.getReader(); | String content = Readers.readAll(reader); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/io/progress/Slf4jProgressListener.java | // Path: src/main/java/de/flapdoodle/embed/process/io/Slf4jLevel.java
// public enum Slf4jLevel {
//
// TRACE {
// public void log(Logger logger, String message, Object... arguments) {
// logger.trace(message, arguments);
// }
// },
// DEBUG {
// public void log(Logger logger, String message, Object... arguments) {
// logger.debug(message, arguments);
// }
// },
// INFO {
// public void log(Logger logger, String message, Object... arguments) {
// logger.info(message, arguments);
// }
// },
// WARN {
// public void log(Logger logger, String message, Object... arguments) {
// logger.warn(message, arguments);
// }
// },
// ERROR {
// public void log(Logger logger, String message, Object... arguments) {
// logger.error(message, arguments);
// }
// };
//
// public abstract void log(Logger logger, String message, Object... arguments);
// }
| import org.slf4j.Logger;
import de.flapdoodle.embed.process.io.Slf4jLevel; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.io.progress;
public class Slf4jProgressListener implements ProgressListener {
private final Logger logger; | // Path: src/main/java/de/flapdoodle/embed/process/io/Slf4jLevel.java
// public enum Slf4jLevel {
//
// TRACE {
// public void log(Logger logger, String message, Object... arguments) {
// logger.trace(message, arguments);
// }
// },
// DEBUG {
// public void log(Logger logger, String message, Object... arguments) {
// logger.debug(message, arguments);
// }
// },
// INFO {
// public void log(Logger logger, String message, Object... arguments) {
// logger.info(message, arguments);
// }
// },
// WARN {
// public void log(Logger logger, String message, Object... arguments) {
// logger.warn(message, arguments);
// }
// },
// ERROR {
// public void log(Logger logger, String message, Object... arguments) {
// logger.error(message, arguments);
// }
// };
//
// public abstract void log(Logger logger, String message, Object... arguments);
// }
// Path: src/main/java/de/flapdoodle/embed/process/io/progress/Slf4jProgressListener.java
import org.slf4j.Logger;
import de.flapdoodle.embed.process.io.Slf4jLevel;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.io.progress;
public class Slf4jProgressListener implements ProgressListener {
private final Logger logger; | private final Slf4jLevel level; |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/extract/Extractors.java | // Path: src/main/java/de/flapdoodle/embed/process/distribution/ArchiveType.java
// public enum ArchiveType {
// TGZ(new TgzExtractor()),
// TBZ2(new Tbz2Extractor()),
// ZIP(new ZipExtractor()),
// EXE(new ArchiveIsFileExtractor()),
// TXZ(new TxzExtractor());
//
// private final Extractor extractor;
//
// ArchiveType(Extractor extractor) {
// this.extractor = extractor;
// }
//
// public Extractor getExtractor() {
// return extractor;
// }
// }
| import de.flapdoodle.embed.process.distribution.ArchiveType; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
/**
* Extractor Helper
*/
public class Extractors {
private Extractors() {
}
| // Path: src/main/java/de/flapdoodle/embed/process/distribution/ArchiveType.java
// public enum ArchiveType {
// TGZ(new TgzExtractor()),
// TBZ2(new Tbz2Extractor()),
// ZIP(new ZipExtractor()),
// EXE(new ArchiveIsFileExtractor()),
// TXZ(new TxzExtractor());
//
// private final Extractor extractor;
//
// ArchiveType(Extractor extractor) {
// this.extractor = extractor;
// }
//
// public Extractor getExtractor() {
// return extractor;
// }
// }
// Path: src/main/java/de/flapdoodle/embed/process/extract/Extractors.java
import de.flapdoodle.embed.process.distribution.ArchiveType;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.extract;
/**
* Extractor Helper
*/
public class Extractors {
private Extractors() {
}
| public static Extractor getExtractor(ArchiveType archiveType) { |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java | // Path: src/main/java/de/flapdoodle/embed/process/config/process/ProcessOutput.java
// @Immutable
// public interface ProcessOutput {
//
// StreamProcessor output();
//
// StreamProcessor error();
//
// StreamProcessor commands();
//
// static ProcessOutput namedConsole(String label) {
// return builder()
// .output(Processors.namedConsole("["+label+" output]"))
// .error(Processors.namedConsole("["+label+" error]"))
// .commands(Processors.console())
// .build();
// }
//
// static ProcessOutput silent() {
// return builder()
// .output(Processors.silent())
// .error(Processors.silent())
// .commands(Processors.silent())
// .build();
// }
//
// static ProcessOutput named(String label, org.slf4j.Logger logger) {
// return builder()
// .output(Processors.named("["+label+" output]", Processors.logTo(logger, Slf4jLevel.INFO)))
// .error(Processors.named("["+label+" error]", Processors.logTo(logger, Slf4jLevel.ERROR)))
// .commands(Processors.logTo(logger, Slf4jLevel.DEBUG))
// .build();
// }
//
// static ImmutableProcessOutput.Builder builder() {
// return ImmutableProcessOutput.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/runtime/CommandLinePostProcessor.java
// @FunctionalInterface
// public interface CommandLinePostProcessor {
// List<String> process(Distribution distribution, List<String> args);
//
// class Noop implements CommandLinePostProcessor {
//
// @Override
// public List<String> process(Distribution distribution, List<String> args) {
// return args;
// }
//
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/store/IArtifactStore.java
// public interface IArtifactStore {
//
// Optional<ExtractedFileSet> extractFileSet(Distribution distribution) throws IOException;
//
// void removeFileSet(Distribution distribution, ExtractedFileSet files);
// }
| import org.immutables.value.Value;
import org.immutables.value.Value.Default;
import de.flapdoodle.embed.process.config.process.ProcessOutput;
import de.flapdoodle.embed.process.runtime.CommandLinePostProcessor;
import de.flapdoodle.embed.process.store.IArtifactStore; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config;
@Value.Immutable
public interface RuntimeConfig {
| // Path: src/main/java/de/flapdoodle/embed/process/config/process/ProcessOutput.java
// @Immutable
// public interface ProcessOutput {
//
// StreamProcessor output();
//
// StreamProcessor error();
//
// StreamProcessor commands();
//
// static ProcessOutput namedConsole(String label) {
// return builder()
// .output(Processors.namedConsole("["+label+" output]"))
// .error(Processors.namedConsole("["+label+" error]"))
// .commands(Processors.console())
// .build();
// }
//
// static ProcessOutput silent() {
// return builder()
// .output(Processors.silent())
// .error(Processors.silent())
// .commands(Processors.silent())
// .build();
// }
//
// static ProcessOutput named(String label, org.slf4j.Logger logger) {
// return builder()
// .output(Processors.named("["+label+" output]", Processors.logTo(logger, Slf4jLevel.INFO)))
// .error(Processors.named("["+label+" error]", Processors.logTo(logger, Slf4jLevel.ERROR)))
// .commands(Processors.logTo(logger, Slf4jLevel.DEBUG))
// .build();
// }
//
// static ImmutableProcessOutput.Builder builder() {
// return ImmutableProcessOutput.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/runtime/CommandLinePostProcessor.java
// @FunctionalInterface
// public interface CommandLinePostProcessor {
// List<String> process(Distribution distribution, List<String> args);
//
// class Noop implements CommandLinePostProcessor {
//
// @Override
// public List<String> process(Distribution distribution, List<String> args) {
// return args;
// }
//
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/store/IArtifactStore.java
// public interface IArtifactStore {
//
// Optional<ExtractedFileSet> extractFileSet(Distribution distribution) throws IOException;
//
// void removeFileSet(Distribution distribution, ExtractedFileSet files);
// }
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
import org.immutables.value.Value;
import org.immutables.value.Value.Default;
import de.flapdoodle.embed.process.config.process.ProcessOutput;
import de.flapdoodle.embed.process.runtime.CommandLinePostProcessor;
import de.flapdoodle.embed.process.store.IArtifactStore;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config;
@Value.Immutable
public interface RuntimeConfig {
| ProcessOutput processOutput(); |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java | // Path: src/main/java/de/flapdoodle/embed/process/config/process/ProcessOutput.java
// @Immutable
// public interface ProcessOutput {
//
// StreamProcessor output();
//
// StreamProcessor error();
//
// StreamProcessor commands();
//
// static ProcessOutput namedConsole(String label) {
// return builder()
// .output(Processors.namedConsole("["+label+" output]"))
// .error(Processors.namedConsole("["+label+" error]"))
// .commands(Processors.console())
// .build();
// }
//
// static ProcessOutput silent() {
// return builder()
// .output(Processors.silent())
// .error(Processors.silent())
// .commands(Processors.silent())
// .build();
// }
//
// static ProcessOutput named(String label, org.slf4j.Logger logger) {
// return builder()
// .output(Processors.named("["+label+" output]", Processors.logTo(logger, Slf4jLevel.INFO)))
// .error(Processors.named("["+label+" error]", Processors.logTo(logger, Slf4jLevel.ERROR)))
// .commands(Processors.logTo(logger, Slf4jLevel.DEBUG))
// .build();
// }
//
// static ImmutableProcessOutput.Builder builder() {
// return ImmutableProcessOutput.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/runtime/CommandLinePostProcessor.java
// @FunctionalInterface
// public interface CommandLinePostProcessor {
// List<String> process(Distribution distribution, List<String> args);
//
// class Noop implements CommandLinePostProcessor {
//
// @Override
// public List<String> process(Distribution distribution, List<String> args) {
// return args;
// }
//
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/store/IArtifactStore.java
// public interface IArtifactStore {
//
// Optional<ExtractedFileSet> extractFileSet(Distribution distribution) throws IOException;
//
// void removeFileSet(Distribution distribution, ExtractedFileSet files);
// }
| import org.immutables.value.Value;
import org.immutables.value.Value.Default;
import de.flapdoodle.embed.process.config.process.ProcessOutput;
import de.flapdoodle.embed.process.runtime.CommandLinePostProcessor;
import de.flapdoodle.embed.process.store.IArtifactStore; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config;
@Value.Immutable
public interface RuntimeConfig {
ProcessOutput processOutput();
@Default | // Path: src/main/java/de/flapdoodle/embed/process/config/process/ProcessOutput.java
// @Immutable
// public interface ProcessOutput {
//
// StreamProcessor output();
//
// StreamProcessor error();
//
// StreamProcessor commands();
//
// static ProcessOutput namedConsole(String label) {
// return builder()
// .output(Processors.namedConsole("["+label+" output]"))
// .error(Processors.namedConsole("["+label+" error]"))
// .commands(Processors.console())
// .build();
// }
//
// static ProcessOutput silent() {
// return builder()
// .output(Processors.silent())
// .error(Processors.silent())
// .commands(Processors.silent())
// .build();
// }
//
// static ProcessOutput named(String label, org.slf4j.Logger logger) {
// return builder()
// .output(Processors.named("["+label+" output]", Processors.logTo(logger, Slf4jLevel.INFO)))
// .error(Processors.named("["+label+" error]", Processors.logTo(logger, Slf4jLevel.ERROR)))
// .commands(Processors.logTo(logger, Slf4jLevel.DEBUG))
// .build();
// }
//
// static ImmutableProcessOutput.Builder builder() {
// return ImmutableProcessOutput.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/runtime/CommandLinePostProcessor.java
// @FunctionalInterface
// public interface CommandLinePostProcessor {
// List<String> process(Distribution distribution, List<String> args);
//
// class Noop implements CommandLinePostProcessor {
//
// @Override
// public List<String> process(Distribution distribution, List<String> args) {
// return args;
// }
//
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/store/IArtifactStore.java
// public interface IArtifactStore {
//
// Optional<ExtractedFileSet> extractFileSet(Distribution distribution) throws IOException;
//
// void removeFileSet(Distribution distribution, ExtractedFileSet files);
// }
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
import org.immutables.value.Value;
import org.immutables.value.Value.Default;
import de.flapdoodle.embed.process.config.process.ProcessOutput;
import de.flapdoodle.embed.process.runtime.CommandLinePostProcessor;
import de.flapdoodle.embed.process.store.IArtifactStore;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config;
@Value.Immutable
public interface RuntimeConfig {
ProcessOutput processOutput();
@Default | default CommandLinePostProcessor commandLinePostProcessor() { |
flapdoodle-oss/de.flapdoodle.embed.process | src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java | // Path: src/main/java/de/flapdoodle/embed/process/config/process/ProcessOutput.java
// @Immutable
// public interface ProcessOutput {
//
// StreamProcessor output();
//
// StreamProcessor error();
//
// StreamProcessor commands();
//
// static ProcessOutput namedConsole(String label) {
// return builder()
// .output(Processors.namedConsole("["+label+" output]"))
// .error(Processors.namedConsole("["+label+" error]"))
// .commands(Processors.console())
// .build();
// }
//
// static ProcessOutput silent() {
// return builder()
// .output(Processors.silent())
// .error(Processors.silent())
// .commands(Processors.silent())
// .build();
// }
//
// static ProcessOutput named(String label, org.slf4j.Logger logger) {
// return builder()
// .output(Processors.named("["+label+" output]", Processors.logTo(logger, Slf4jLevel.INFO)))
// .error(Processors.named("["+label+" error]", Processors.logTo(logger, Slf4jLevel.ERROR)))
// .commands(Processors.logTo(logger, Slf4jLevel.DEBUG))
// .build();
// }
//
// static ImmutableProcessOutput.Builder builder() {
// return ImmutableProcessOutput.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/runtime/CommandLinePostProcessor.java
// @FunctionalInterface
// public interface CommandLinePostProcessor {
// List<String> process(Distribution distribution, List<String> args);
//
// class Noop implements CommandLinePostProcessor {
//
// @Override
// public List<String> process(Distribution distribution, List<String> args) {
// return args;
// }
//
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/store/IArtifactStore.java
// public interface IArtifactStore {
//
// Optional<ExtractedFileSet> extractFileSet(Distribution distribution) throws IOException;
//
// void removeFileSet(Distribution distribution, ExtractedFileSet files);
// }
| import org.immutables.value.Value;
import org.immutables.value.Value.Default;
import de.flapdoodle.embed.process.config.process.ProcessOutput;
import de.flapdoodle.embed.process.runtime.CommandLinePostProcessor;
import de.flapdoodle.embed.process.store.IArtifactStore; | /**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config;
@Value.Immutable
public interface RuntimeConfig {
ProcessOutput processOutput();
@Default
default CommandLinePostProcessor commandLinePostProcessor() {
return new CommandLinePostProcessor.Noop();
}
| // Path: src/main/java/de/flapdoodle/embed/process/config/process/ProcessOutput.java
// @Immutable
// public interface ProcessOutput {
//
// StreamProcessor output();
//
// StreamProcessor error();
//
// StreamProcessor commands();
//
// static ProcessOutput namedConsole(String label) {
// return builder()
// .output(Processors.namedConsole("["+label+" output]"))
// .error(Processors.namedConsole("["+label+" error]"))
// .commands(Processors.console())
// .build();
// }
//
// static ProcessOutput silent() {
// return builder()
// .output(Processors.silent())
// .error(Processors.silent())
// .commands(Processors.silent())
// .build();
// }
//
// static ProcessOutput named(String label, org.slf4j.Logger logger) {
// return builder()
// .output(Processors.named("["+label+" output]", Processors.logTo(logger, Slf4jLevel.INFO)))
// .error(Processors.named("["+label+" error]", Processors.logTo(logger, Slf4jLevel.ERROR)))
// .commands(Processors.logTo(logger, Slf4jLevel.DEBUG))
// .build();
// }
//
// static ImmutableProcessOutput.Builder builder() {
// return ImmutableProcessOutput.builder();
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/runtime/CommandLinePostProcessor.java
// @FunctionalInterface
// public interface CommandLinePostProcessor {
// List<String> process(Distribution distribution, List<String> args);
//
// class Noop implements CommandLinePostProcessor {
//
// @Override
// public List<String> process(Distribution distribution, List<String> args) {
// return args;
// }
//
// }
// }
//
// Path: src/main/java/de/flapdoodle/embed/process/store/IArtifactStore.java
// public interface IArtifactStore {
//
// Optional<ExtractedFileSet> extractFileSet(Distribution distribution) throws IOException;
//
// void removeFileSet(Distribution distribution, ExtractedFileSet files);
// }
// Path: src/main/java/de/flapdoodle/embed/process/config/RuntimeConfig.java
import org.immutables.value.Value;
import org.immutables.value.Value.Default;
import de.flapdoodle.embed.process.config.process.ProcessOutput;
import de.flapdoodle.embed.process.runtime.CommandLinePostProcessor;
import de.flapdoodle.embed.process.store.IArtifactStore;
/**
* Copyright (C) 2011
* Michael Mosmann <michael@mosmann.de>
* Martin Jöhren <m.joehren@googlemail.com>
*
* with contributions from
* konstantin-ba@github,
Archimedes Trajano (trajano@github),
Kevin D. Keck (kdkeck@github),
Ben McCann (benmccann@github)
*
* 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 de.flapdoodle.embed.process.config;
@Value.Immutable
public interface RuntimeConfig {
ProcessOutput processOutput();
@Default
default CommandLinePostProcessor commandLinePostProcessor() {
return new CommandLinePostProcessor.Noop();
}
| IArtifactStore artifactStore(); |
protolambda/blocktopograph | app/src/main/java/com/protolambda/blocktopograph/map/MCTileProvider.java | // Path: app/src/main/java/com/protolambda/blocktopograph/WorldActivityInterface.java
// public interface WorldActivityInterface {
//
//
// World getWorld();
//
// Dimension getDimension();
//
// MapType getMapType();
//
// boolean getShowGrid();
//
// void onFatalDBError(WorldData.WorldDBException worldDB);
//
// void addMarker(AbstractMarker marker);
//
// void logFirebaseEvent(WorldActivity.CustomFirebaseEvent firebaseEvent);
//
// void logFirebaseEvent(WorldActivity.CustomFirebaseEvent firebaseEvent, Bundle eventContent);
//
// void showActionBar();
//
// void hideActionBar();
//
// EditableNBT getEditablePlayer() throws Exception;
//
// void changeMapType(MapType mapType, Dimension dimension);
//
// void openChunkNBTEditor(final int chunkX, final int chunkZ, final NBTChunkData nbtChunkData, final ViewGroup viewGroup);
// }
//
// Path: app/src/main/java/com/protolambda/blocktopograph/chunk/ChunkManager.java
// public class ChunkManager {
//
// @SuppressLint("UseSparseArrays")
// private Map<Long, Chunk> chunks = new HashMap<>();
//
// private WorldData worldData;
//
// public final Dimension dimension;
//
// public ChunkManager(WorldData worldData, Dimension dimension){
// this.worldData = worldData;
// this.dimension = dimension;
// }
//
//
// public static long xzToKey(int x, int z){
// return (((long) x) << 32) | (((long) z) & 0xFFFFFFFFL);
// }
//
// public Chunk getChunk(int cX, int cZ) {
// long key = xzToKey(cX, cZ);
// Chunk chunk = chunks.get(key);
// if(chunk == null) {
// chunk = new Chunk(worldData, cX, cZ, dimension);
// this.chunks.put(key, chunk);
// }
// return chunk;
// }
//
// public void disposeAll(){
// this.chunks.clear();
// }
//
//
//
//
// }
//
// Path: app/src/main/java/com/protolambda/blocktopograph/map/renderer/MapType.java
// public enum MapType implements DetailLevelManager.LevelType {
//
// //shows that a chunk was present, but couldn't be renderer
// ERROR(new ChessPatternRenderer(0xFF2B0000, 0xFF580000)),
//
// //simple xor pattern renderer
// DEBUG(new DebugRenderer()),
//
// //simple chess pattern renderer
// CHESS(new ChessPatternRenderer(0xFF2B2B2B, 0xFF585858)),
//
// //just the surface of the world, with shading for height diff
// OVERWORLD_SATELLITE(new SatelliteRenderer()),
//
// //cave mapping
// OVERWORLD_CAVE(new CaveRenderer()),
//
// OVERWORLD_SLIME_CHUNK(new SlimeChunkRenderer()),
//
// //render skylight value of highest block
// OVERWORLD_HEIGHTMAP(new HeightmapRenderer()),
//
// //render biome id as biome-unique color
// OVERWORLD_BIOME(new BiomeRenderer()),
//
// //render the voliage colors
// OVERWORLD_GRASS(new GrassRenderer()),
//
// //render only the valuable blocks to mine (diamonds, emeralds, gold, etc.)
// OVERWORLD_XRAY(new XRayRenderer()),
//
// //block-light renderer: from light-sources like torches etc.
// OVERWORLD_BLOCK_LIGHT(new BlockLightRenderer()),
//
// NETHER(new NetherRenderer()),
//
// NETHER_XRAY(new XRayRenderer()),
//
// NETHER_BLOCK_LIGHT(new BlockLightRenderer()),
//
// END_SATELLITE(new SatelliteRenderer()),
//
// END_HEIGHTMAP(new HeightmapRenderer()),
//
// END_BLOCK_LIGHT(new BlockLightRenderer());
//
// //REDSTONE //TODO redstone circuit mapping
// //TRAFFIC //TODO traffic mapping (land = green, water = blue, gravel/stone/etc. = gray, rails = yellow)
//
//
// public final MapRenderer renderer;
//
// MapType(MapRenderer renderer){
// this.renderer = renderer;
// }
//
// }
| import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.text.Layout;
import android.text.StaticLayout;
import android.text.TextPaint;
import com.protolambda.blocktopograph.WorldActivityInterface;
import com.protolambda.blocktopograph.chunk.ChunkManager;
import com.protolambda.blocktopograph.map.renderer.MapType;
import com.qozix.tileview.graphics.BitmapProvider;
import com.qozix.tileview.tiles.Tile; | package com.protolambda.blocktopograph.map;
public class MCTileProvider implements BitmapProvider {
public static final int TILESIZE = 256,
//TODO the maximum world size is way bigger than the worldsize that this app can handle (due to render glitches & rounding errors)
//HALF_WORLDSIZE has to be a power of 2! (It must be perfectly divisible by TILESIZE, which is a power of two)
HALF_WORLDSIZE = 1 << 20;
public static int worldSizeInBlocks = 2 * HALF_WORLDSIZE,
viewSizeW = worldSizeInBlocks * TILESIZE / Dimension.OVERWORLD.chunkW,
viewSizeL = worldSizeInBlocks * TILESIZE / Dimension.OVERWORLD.chunkL;
| // Path: app/src/main/java/com/protolambda/blocktopograph/WorldActivityInterface.java
// public interface WorldActivityInterface {
//
//
// World getWorld();
//
// Dimension getDimension();
//
// MapType getMapType();
//
// boolean getShowGrid();
//
// void onFatalDBError(WorldData.WorldDBException worldDB);
//
// void addMarker(AbstractMarker marker);
//
// void logFirebaseEvent(WorldActivity.CustomFirebaseEvent firebaseEvent);
//
// void logFirebaseEvent(WorldActivity.CustomFirebaseEvent firebaseEvent, Bundle eventContent);
//
// void showActionBar();
//
// void hideActionBar();
//
// EditableNBT getEditablePlayer() throws Exception;
//
// void changeMapType(MapType mapType, Dimension dimension);
//
// void openChunkNBTEditor(final int chunkX, final int chunkZ, final NBTChunkData nbtChunkData, final ViewGroup viewGroup);
// }
//
// Path: app/src/main/java/com/protolambda/blocktopograph/chunk/ChunkManager.java
// public class ChunkManager {
//
// @SuppressLint("UseSparseArrays")
// private Map<Long, Chunk> chunks = new HashMap<>();
//
// private WorldData worldData;
//
// public final Dimension dimension;
//
// public ChunkManager(WorldData worldData, Dimension dimension){
// this.worldData = worldData;
// this.dimension = dimension;
// }
//
//
// public static long xzToKey(int x, int z){
// return (((long) x) << 32) | (((long) z) & 0xFFFFFFFFL);
// }
//
// public Chunk getChunk(int cX, int cZ) {
// long key = xzToKey(cX, cZ);
// Chunk chunk = chunks.get(key);
// if(chunk == null) {
// chunk = new Chunk(worldData, cX, cZ, dimension);
// this.chunks.put(key, chunk);
// }
// return chunk;
// }
//
// public void disposeAll(){
// this.chunks.clear();
// }
//
//
//
//
// }
//
// Path: app/src/main/java/com/protolambda/blocktopograph/map/renderer/MapType.java
// public enum MapType implements DetailLevelManager.LevelType {
//
// //shows that a chunk was present, but couldn't be renderer
// ERROR(new ChessPatternRenderer(0xFF2B0000, 0xFF580000)),
//
// //simple xor pattern renderer
// DEBUG(new DebugRenderer()),
//
// //simple chess pattern renderer
// CHESS(new ChessPatternRenderer(0xFF2B2B2B, 0xFF585858)),
//
// //just the surface of the world, with shading for height diff
// OVERWORLD_SATELLITE(new SatelliteRenderer()),
//
// //cave mapping
// OVERWORLD_CAVE(new CaveRenderer()),
//
// OVERWORLD_SLIME_CHUNK(new SlimeChunkRenderer()),
//
// //render skylight value of highest block
// OVERWORLD_HEIGHTMAP(new HeightmapRenderer()),
//
// //render biome id as biome-unique color
// OVERWORLD_BIOME(new BiomeRenderer()),
//
// //render the voliage colors
// OVERWORLD_GRASS(new GrassRenderer()),
//
// //render only the valuable blocks to mine (diamonds, emeralds, gold, etc.)
// OVERWORLD_XRAY(new XRayRenderer()),
//
// //block-light renderer: from light-sources like torches etc.
// OVERWORLD_BLOCK_LIGHT(new BlockLightRenderer()),
//
// NETHER(new NetherRenderer()),
//
// NETHER_XRAY(new XRayRenderer()),
//
// NETHER_BLOCK_LIGHT(new BlockLightRenderer()),
//
// END_SATELLITE(new SatelliteRenderer()),
//
// END_HEIGHTMAP(new HeightmapRenderer()),
//
// END_BLOCK_LIGHT(new BlockLightRenderer());
//
// //REDSTONE //TODO redstone circuit mapping
// //TRAFFIC //TODO traffic mapping (land = green, water = blue, gravel/stone/etc. = gray, rails = yellow)
//
//
// public final MapRenderer renderer;
//
// MapType(MapRenderer renderer){
// this.renderer = renderer;
// }
//
// }
// Path: app/src/main/java/com/protolambda/blocktopograph/map/MCTileProvider.java
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.text.Layout;
import android.text.StaticLayout;
import android.text.TextPaint;
import com.protolambda.blocktopograph.WorldActivityInterface;
import com.protolambda.blocktopograph.chunk.ChunkManager;
import com.protolambda.blocktopograph.map.renderer.MapType;
import com.qozix.tileview.graphics.BitmapProvider;
import com.qozix.tileview.tiles.Tile;
package com.protolambda.blocktopograph.map;
public class MCTileProvider implements BitmapProvider {
public static final int TILESIZE = 256,
//TODO the maximum world size is way bigger than the worldsize that this app can handle (due to render glitches & rounding errors)
//HALF_WORLDSIZE has to be a power of 2! (It must be perfectly divisible by TILESIZE, which is a power of two)
HALF_WORLDSIZE = 1 << 20;
public static int worldSizeInBlocks = 2 * HALF_WORLDSIZE,
viewSizeW = worldSizeInBlocks * TILESIZE / Dimension.OVERWORLD.chunkW,
viewSizeL = worldSizeInBlocks * TILESIZE / Dimension.OVERWORLD.chunkL;
| public final WorldActivityInterface worldProvider; |
protolambda/blocktopograph | app/src/main/java/com/protolambda/blocktopograph/map/MCTileProvider.java | // Path: app/src/main/java/com/protolambda/blocktopograph/WorldActivityInterface.java
// public interface WorldActivityInterface {
//
//
// World getWorld();
//
// Dimension getDimension();
//
// MapType getMapType();
//
// boolean getShowGrid();
//
// void onFatalDBError(WorldData.WorldDBException worldDB);
//
// void addMarker(AbstractMarker marker);
//
// void logFirebaseEvent(WorldActivity.CustomFirebaseEvent firebaseEvent);
//
// void logFirebaseEvent(WorldActivity.CustomFirebaseEvent firebaseEvent, Bundle eventContent);
//
// void showActionBar();
//
// void hideActionBar();
//
// EditableNBT getEditablePlayer() throws Exception;
//
// void changeMapType(MapType mapType, Dimension dimension);
//
// void openChunkNBTEditor(final int chunkX, final int chunkZ, final NBTChunkData nbtChunkData, final ViewGroup viewGroup);
// }
//
// Path: app/src/main/java/com/protolambda/blocktopograph/chunk/ChunkManager.java
// public class ChunkManager {
//
// @SuppressLint("UseSparseArrays")
// private Map<Long, Chunk> chunks = new HashMap<>();
//
// private WorldData worldData;
//
// public final Dimension dimension;
//
// public ChunkManager(WorldData worldData, Dimension dimension){
// this.worldData = worldData;
// this.dimension = dimension;
// }
//
//
// public static long xzToKey(int x, int z){
// return (((long) x) << 32) | (((long) z) & 0xFFFFFFFFL);
// }
//
// public Chunk getChunk(int cX, int cZ) {
// long key = xzToKey(cX, cZ);
// Chunk chunk = chunks.get(key);
// if(chunk == null) {
// chunk = new Chunk(worldData, cX, cZ, dimension);
// this.chunks.put(key, chunk);
// }
// return chunk;
// }
//
// public void disposeAll(){
// this.chunks.clear();
// }
//
//
//
//
// }
//
// Path: app/src/main/java/com/protolambda/blocktopograph/map/renderer/MapType.java
// public enum MapType implements DetailLevelManager.LevelType {
//
// //shows that a chunk was present, but couldn't be renderer
// ERROR(new ChessPatternRenderer(0xFF2B0000, 0xFF580000)),
//
// //simple xor pattern renderer
// DEBUG(new DebugRenderer()),
//
// //simple chess pattern renderer
// CHESS(new ChessPatternRenderer(0xFF2B2B2B, 0xFF585858)),
//
// //just the surface of the world, with shading for height diff
// OVERWORLD_SATELLITE(new SatelliteRenderer()),
//
// //cave mapping
// OVERWORLD_CAVE(new CaveRenderer()),
//
// OVERWORLD_SLIME_CHUNK(new SlimeChunkRenderer()),
//
// //render skylight value of highest block
// OVERWORLD_HEIGHTMAP(new HeightmapRenderer()),
//
// //render biome id as biome-unique color
// OVERWORLD_BIOME(new BiomeRenderer()),
//
// //render the voliage colors
// OVERWORLD_GRASS(new GrassRenderer()),
//
// //render only the valuable blocks to mine (diamonds, emeralds, gold, etc.)
// OVERWORLD_XRAY(new XRayRenderer()),
//
// //block-light renderer: from light-sources like torches etc.
// OVERWORLD_BLOCK_LIGHT(new BlockLightRenderer()),
//
// NETHER(new NetherRenderer()),
//
// NETHER_XRAY(new XRayRenderer()),
//
// NETHER_BLOCK_LIGHT(new BlockLightRenderer()),
//
// END_SATELLITE(new SatelliteRenderer()),
//
// END_HEIGHTMAP(new HeightmapRenderer()),
//
// END_BLOCK_LIGHT(new BlockLightRenderer());
//
// //REDSTONE //TODO redstone circuit mapping
// //TRAFFIC //TODO traffic mapping (land = green, water = blue, gravel/stone/etc. = gray, rails = yellow)
//
//
// public final MapRenderer renderer;
//
// MapType(MapRenderer renderer){
// this.renderer = renderer;
// }
//
// }
| import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.text.Layout;
import android.text.StaticLayout;
import android.text.TextPaint;
import com.protolambda.blocktopograph.WorldActivityInterface;
import com.protolambda.blocktopograph.chunk.ChunkManager;
import com.protolambda.blocktopograph.map.renderer.MapType;
import com.qozix.tileview.graphics.BitmapProvider;
import com.qozix.tileview.tiles.Tile; |
// this will be the amount of chunks in the width of one tile
int invScale = Math.round(1f / scale);
//scale the amount of pixels, less pixels per block if zoomed out
int pixelsPerBlockW = Math.round(pixelsPerBlockW_unscaled * scale);
int pixelsPerBlockL = Math.round(pixelsPerBlockL_unscaled * scale);
// for translating to origin
// HALF_WORLDSIZE and TILESIZE must be a power of two
int tilesInHalfWorldW = (HALF_WORLDSIZE * pixelsPerBlockW) / TILESIZE;
int tilesInHalfWorldL = (HALF_WORLDSIZE * pixelsPerBlockL) / TILESIZE;
// translate tile coord to origin, multiply origin-relative-tile-coordinate with the chunks per tile
int minChunkX = ( tile.getColumn() - tilesInHalfWorldW) * invScale;
int minChunkZ = ( tile.getRow() - tilesInHalfWorldL) * invScale;
int maxChunkX = minChunkX + invScale;
int maxChunkZ = minChunkZ + invScale;
//scale pixels to dimension scale (Nether 1 : 8 Overworld)
pixelsPerBlockW *= dimension.dimensionScale;
pixelsPerBlockL *= dimension.dimensionScale;
ChunkManager cm = new ChunkManager(worldProvider.getWorld().getWorldData(), dimension);
| // Path: app/src/main/java/com/protolambda/blocktopograph/WorldActivityInterface.java
// public interface WorldActivityInterface {
//
//
// World getWorld();
//
// Dimension getDimension();
//
// MapType getMapType();
//
// boolean getShowGrid();
//
// void onFatalDBError(WorldData.WorldDBException worldDB);
//
// void addMarker(AbstractMarker marker);
//
// void logFirebaseEvent(WorldActivity.CustomFirebaseEvent firebaseEvent);
//
// void logFirebaseEvent(WorldActivity.CustomFirebaseEvent firebaseEvent, Bundle eventContent);
//
// void showActionBar();
//
// void hideActionBar();
//
// EditableNBT getEditablePlayer() throws Exception;
//
// void changeMapType(MapType mapType, Dimension dimension);
//
// void openChunkNBTEditor(final int chunkX, final int chunkZ, final NBTChunkData nbtChunkData, final ViewGroup viewGroup);
// }
//
// Path: app/src/main/java/com/protolambda/blocktopograph/chunk/ChunkManager.java
// public class ChunkManager {
//
// @SuppressLint("UseSparseArrays")
// private Map<Long, Chunk> chunks = new HashMap<>();
//
// private WorldData worldData;
//
// public final Dimension dimension;
//
// public ChunkManager(WorldData worldData, Dimension dimension){
// this.worldData = worldData;
// this.dimension = dimension;
// }
//
//
// public static long xzToKey(int x, int z){
// return (((long) x) << 32) | (((long) z) & 0xFFFFFFFFL);
// }
//
// public Chunk getChunk(int cX, int cZ) {
// long key = xzToKey(cX, cZ);
// Chunk chunk = chunks.get(key);
// if(chunk == null) {
// chunk = new Chunk(worldData, cX, cZ, dimension);
// this.chunks.put(key, chunk);
// }
// return chunk;
// }
//
// public void disposeAll(){
// this.chunks.clear();
// }
//
//
//
//
// }
//
// Path: app/src/main/java/com/protolambda/blocktopograph/map/renderer/MapType.java
// public enum MapType implements DetailLevelManager.LevelType {
//
// //shows that a chunk was present, but couldn't be renderer
// ERROR(new ChessPatternRenderer(0xFF2B0000, 0xFF580000)),
//
// //simple xor pattern renderer
// DEBUG(new DebugRenderer()),
//
// //simple chess pattern renderer
// CHESS(new ChessPatternRenderer(0xFF2B2B2B, 0xFF585858)),
//
// //just the surface of the world, with shading for height diff
// OVERWORLD_SATELLITE(new SatelliteRenderer()),
//
// //cave mapping
// OVERWORLD_CAVE(new CaveRenderer()),
//
// OVERWORLD_SLIME_CHUNK(new SlimeChunkRenderer()),
//
// //render skylight value of highest block
// OVERWORLD_HEIGHTMAP(new HeightmapRenderer()),
//
// //render biome id as biome-unique color
// OVERWORLD_BIOME(new BiomeRenderer()),
//
// //render the voliage colors
// OVERWORLD_GRASS(new GrassRenderer()),
//
// //render only the valuable blocks to mine (diamonds, emeralds, gold, etc.)
// OVERWORLD_XRAY(new XRayRenderer()),
//
// //block-light renderer: from light-sources like torches etc.
// OVERWORLD_BLOCK_LIGHT(new BlockLightRenderer()),
//
// NETHER(new NetherRenderer()),
//
// NETHER_XRAY(new XRayRenderer()),
//
// NETHER_BLOCK_LIGHT(new BlockLightRenderer()),
//
// END_SATELLITE(new SatelliteRenderer()),
//
// END_HEIGHTMAP(new HeightmapRenderer()),
//
// END_BLOCK_LIGHT(new BlockLightRenderer());
//
// //REDSTONE //TODO redstone circuit mapping
// //TRAFFIC //TODO traffic mapping (land = green, water = blue, gravel/stone/etc. = gray, rails = yellow)
//
//
// public final MapRenderer renderer;
//
// MapType(MapRenderer renderer){
// this.renderer = renderer;
// }
//
// }
// Path: app/src/main/java/com/protolambda/blocktopograph/map/MCTileProvider.java
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.text.Layout;
import android.text.StaticLayout;
import android.text.TextPaint;
import com.protolambda.blocktopograph.WorldActivityInterface;
import com.protolambda.blocktopograph.chunk.ChunkManager;
import com.protolambda.blocktopograph.map.renderer.MapType;
import com.qozix.tileview.graphics.BitmapProvider;
import com.qozix.tileview.tiles.Tile;
// this will be the amount of chunks in the width of one tile
int invScale = Math.round(1f / scale);
//scale the amount of pixels, less pixels per block if zoomed out
int pixelsPerBlockW = Math.round(pixelsPerBlockW_unscaled * scale);
int pixelsPerBlockL = Math.round(pixelsPerBlockL_unscaled * scale);
// for translating to origin
// HALF_WORLDSIZE and TILESIZE must be a power of two
int tilesInHalfWorldW = (HALF_WORLDSIZE * pixelsPerBlockW) / TILESIZE;
int tilesInHalfWorldL = (HALF_WORLDSIZE * pixelsPerBlockL) / TILESIZE;
// translate tile coord to origin, multiply origin-relative-tile-coordinate with the chunks per tile
int minChunkX = ( tile.getColumn() - tilesInHalfWorldW) * invScale;
int minChunkZ = ( tile.getRow() - tilesInHalfWorldL) * invScale;
int maxChunkX = minChunkX + invScale;
int maxChunkZ = minChunkZ + invScale;
//scale pixels to dimension scale (Nether 1 : 8 Overworld)
pixelsPerBlockW *= dimension.dimensionScale;
pixelsPerBlockL *= dimension.dimensionScale;
ChunkManager cm = new ChunkManager(worldProvider.getWorld().getWorldData(), dimension);
| MapType mapType = (MapType) tile.getDetailLevel().getLevelType(); |
protolambda/blocktopograph | app/src/main/java/com/protolambda/blocktopograph/nbt/tags/CompoundTag.java | // Path: app/src/main/java/com/protolambda/blocktopograph/nbt/convert/NBTConstants.java
// public class NBTConstants {
//
// public enum NBTType {
//
// END(0, EndTag.class, "EndTag"),
// BYTE(1, ByteTag.class, "ByteTag"),
// SHORT(2, ShortTag.class, "ShortTag"),
// INT(3, IntTag.class, "IntTag"),
// LONG(4, LongTag.class, "LongTag"),
// FLOAT(5, FloatTag.class, "FloatTag"),
// DOUBLE(6, DoubleTag.class, "DoubleTag"),
// BYTE_ARRAY(7, ByteArrayTag.class, "ByteArrayTag"),
// STRING(8, StringTag.class, "StringTag"),
// LIST(9, ListTag.class, "ListTag"),
// COMPOUND(10, CompoundTag.class, "CompoundTag"),
// INT_ARRAY(11, IntArrayTag.class, "IntArrayTag"),
//
// //Is this one even used?!? Maybe used in mods?
// SHORT_ARRAY(100, ShortArrayTag.class, "ShortArrayTag");
//
// public final int id;
// public final Class<? extends Tag> tagClazz;
// public final String displayName;
//
// static public Map<Integer, NBTType> typesByID = new HashMap<>();
// static public Map<Class<? extends Tag>, NBTType> typesByClazz = new HashMap<>();
//
// NBTType(int id, Class<? extends Tag> tagClazz, String displayName){
// this.id = id;
// this.tagClazz = tagClazz;
// this.displayName = displayName;
// }
//
// //not all NBT types are meant to be created in an editor, the END tag for example.
// public static String[] editorOptions_asString;
// public static NBTType[] editorOptions_asType = new NBTType[]{
// BYTE,
// SHORT,
// INT,
// LONG,
// FLOAT,
// DOUBLE,
// BYTE_ARRAY,
// STRING,
// LIST,
// COMPOUND,
// INT_ARRAY,
// SHORT_ARRAY
// };
//
// static {
//
//
// int len = editorOptions_asType.length;
// editorOptions_asString = new String[len];
// for(int i = 0; i < len; i++){
// editorOptions_asString[i] = editorOptions_asType[i].displayName;
// }
//
//
// //fill maps
// for(NBTType type : NBTType.values()){
// typesByID.put(type.id, type);
// typesByClazz.put(type.tagClazz, type);
// }
// }
//
// public static Tag newInstance(String tagName, NBTType type){
// switch (type){
// case END: return new EndTag();
// case BYTE: return new ByteTag(tagName, (byte) 0);
// case SHORT: return new ShortTag(tagName, (short) 0);
// case INT: return new IntTag(tagName, 0);
// case LONG: return new LongTag(tagName, 0L);
// case FLOAT: return new FloatTag(tagName, 0f);
// case DOUBLE: return new DoubleTag(tagName, 0.0);
// case BYTE_ARRAY: return new ByteArrayTag(tagName, null);
// case STRING: return new StringTag(tagName, "");
// case LIST: return new ListTag(tagName, new ArrayList<Tag>());
// case COMPOUND: return new CompoundTag(tagName, new ArrayList<Tag>());
// default: return null;
// }
// }
//
// }
//
// public static final Charset CHARSET = Charset.forName("UTF-8");
//
// }
| import com.protolambda.blocktopograph.nbt.convert.NBTConstants;
import java.util.ArrayList;
import java.util.List; | package com.protolambda.blocktopograph.nbt.tags;
public class CompoundTag extends Tag<ArrayList<Tag>> {
private static final long serialVersionUID = 4540757946052775740L;
public CompoundTag(String name, ArrayList<Tag> value) {
super(name, value);
}
@Override | // Path: app/src/main/java/com/protolambda/blocktopograph/nbt/convert/NBTConstants.java
// public class NBTConstants {
//
// public enum NBTType {
//
// END(0, EndTag.class, "EndTag"),
// BYTE(1, ByteTag.class, "ByteTag"),
// SHORT(2, ShortTag.class, "ShortTag"),
// INT(3, IntTag.class, "IntTag"),
// LONG(4, LongTag.class, "LongTag"),
// FLOAT(5, FloatTag.class, "FloatTag"),
// DOUBLE(6, DoubleTag.class, "DoubleTag"),
// BYTE_ARRAY(7, ByteArrayTag.class, "ByteArrayTag"),
// STRING(8, StringTag.class, "StringTag"),
// LIST(9, ListTag.class, "ListTag"),
// COMPOUND(10, CompoundTag.class, "CompoundTag"),
// INT_ARRAY(11, IntArrayTag.class, "IntArrayTag"),
//
// //Is this one even used?!? Maybe used in mods?
// SHORT_ARRAY(100, ShortArrayTag.class, "ShortArrayTag");
//
// public final int id;
// public final Class<? extends Tag> tagClazz;
// public final String displayName;
//
// static public Map<Integer, NBTType> typesByID = new HashMap<>();
// static public Map<Class<? extends Tag>, NBTType> typesByClazz = new HashMap<>();
//
// NBTType(int id, Class<? extends Tag> tagClazz, String displayName){
// this.id = id;
// this.tagClazz = tagClazz;
// this.displayName = displayName;
// }
//
// //not all NBT types are meant to be created in an editor, the END tag for example.
// public static String[] editorOptions_asString;
// public static NBTType[] editorOptions_asType = new NBTType[]{
// BYTE,
// SHORT,
// INT,
// LONG,
// FLOAT,
// DOUBLE,
// BYTE_ARRAY,
// STRING,
// LIST,
// COMPOUND,
// INT_ARRAY,
// SHORT_ARRAY
// };
//
// static {
//
//
// int len = editorOptions_asType.length;
// editorOptions_asString = new String[len];
// for(int i = 0; i < len; i++){
// editorOptions_asString[i] = editorOptions_asType[i].displayName;
// }
//
//
// //fill maps
// for(NBTType type : NBTType.values()){
// typesByID.put(type.id, type);
// typesByClazz.put(type.tagClazz, type);
// }
// }
//
// public static Tag newInstance(String tagName, NBTType type){
// switch (type){
// case END: return new EndTag();
// case BYTE: return new ByteTag(tagName, (byte) 0);
// case SHORT: return new ShortTag(tagName, (short) 0);
// case INT: return new IntTag(tagName, 0);
// case LONG: return new LongTag(tagName, 0L);
// case FLOAT: return new FloatTag(tagName, 0f);
// case DOUBLE: return new DoubleTag(tagName, 0.0);
// case BYTE_ARRAY: return new ByteArrayTag(tagName, null);
// case STRING: return new StringTag(tagName, "");
// case LIST: return new ListTag(tagName, new ArrayList<Tag>());
// case COMPOUND: return new CompoundTag(tagName, new ArrayList<Tag>());
// default: return null;
// }
// }
//
// }
//
// public static final Charset CHARSET = Charset.forName("UTF-8");
//
// }
// Path: app/src/main/java/com/protolambda/blocktopograph/nbt/tags/CompoundTag.java
import com.protolambda.blocktopograph.nbt.convert.NBTConstants;
import java.util.ArrayList;
import java.util.List;
package com.protolambda.blocktopograph.nbt.tags;
public class CompoundTag extends Tag<ArrayList<Tag>> {
private static final long serialVersionUID = 4540757946052775740L;
public CompoundTag(String name, ArrayList<Tag> value) {
super(name, value);
}
@Override | public NBTConstants.NBTType getType() { |
protolambda/blocktopograph | app/src/main/java/com/protolambda/blocktopograph/chunk/terrain/TerrainChunkData.java | // Path: app/src/main/java/com/protolambda/blocktopograph/chunk/Chunk.java
// public class Chunk {
//
// public final WorldData worldData;
//
// public final int x, z;
// public final Dimension dimension;
//
// private Version version;
//
// private AtomicReferenceArray<TerrainChunkData>
// terrain = new AtomicReferenceArray<>(256);
//
// private volatile NBTChunkData entity, blockEntity;
//
// public Chunk(WorldData worldData, int x, int z, Dimension dimension) {
// this.worldData = worldData;
// this.x = x;
// this.z = z;
// this.dimension = dimension;
// }
//
// public TerrainChunkData getTerrain(byte subChunk) throws Version.VersionException {
// TerrainChunkData data = terrain.get(subChunk & 0xff);
// if(data == null){
// data = this.getVersion().createTerrainChunkData(this, subChunk);
// terrain.set(subChunk & 0xff, data);
// }
// return data;
// }
//
// public NBTChunkData getEntity() throws Version.VersionException {
// if(entity == null) entity = this.getVersion().createEntityChunkData(this);
// return entity;
// }
//
//
// public NBTChunkData getBlockEntity() throws Version.VersionException {
// if(blockEntity == null) blockEntity = this.getVersion().createBlockEntityChunkData(this);
// return blockEntity;
// }
//
// public Version getVersion(){
// if(this.version == null) try {
// byte[] data = this.worldData.getChunkData(x, z, ChunkTag.VERSION, dimension, (byte) 0, false);
// this.version = Version.getVersion(data);
// } catch (WorldData.WorldDBLoadException | WorldData.WorldDBException e) {
// e.printStackTrace();
// this.version = Version.ERROR;
// }
//
// return this.version;
// }
//
//
// //TODO: should we use the heightmap???
// public int getHighestBlockYAt(int x, int z) throws Version.VersionException {
// Version cVersion = getVersion();
// TerrainChunkData data;
// for(int subChunk = cVersion.subChunks - 1; subChunk >= 0; subChunk--) {
// data = this.getTerrain((byte) subChunk);
// if (data == null || !data.loadTerrain()) continue;
//
// for (int y = cVersion.subChunkHeight; y >= 0; y--) {
// if (data.getBlockTypeId(x & 15, y, z & 15) != 0)
// return (subChunk * cVersion.subChunkHeight) + y;
// }
// }
// return -1;
// }
//
// public int getHighestBlockYUnderAt(int x, int z, int y) throws Version.VersionException {
// Version cVersion = getVersion();
// int offset = y % cVersion.subChunkHeight;
// int subChunk = y / cVersion.subChunkHeight;
// TerrainChunkData data;
//
// for(; subChunk >= 0; subChunk--) {
// data = this.getTerrain((byte) subChunk);
// if (data == null || !data.loadTerrain()) continue;
//
// for (y = offset; y >= 0; y--) {
// if (data.getBlockTypeId(x & 15, y, z & 15) != 0)
// return (subChunk * cVersion.subChunkHeight) + y;
// }
//
// //start at the top of the next chunk! (current offset might differ)
// offset = cVersion.subChunkHeight - 1;
// }
// return -1;
// }
//
// public int getCaveYUnderAt(int x, int z, int y) throws Version.VersionException {
// Version cVersion = getVersion();
// int offset = y % cVersion.subChunkHeight;
// int subChunk = y / cVersion.subChunkHeight;
// TerrainChunkData data;
//
// for(; subChunk >= 0; subChunk--) {
// data = this.getTerrain((byte) subChunk);
// if (data == null || !data.loadTerrain()) continue;
// for (y = offset; y >= 0; y--) {
// if (data.getBlockTypeId(x & 15, y, z & 15) == 0)
// return (subChunk * cVersion.subChunkHeight) + y;
// }
//
// //start at the top of the next chunk! (current offset might differ)
// offset = cVersion.subChunkHeight - 1;
// }
// return -1;
// }
//
//
// }
//
// Path: app/src/main/java/com/protolambda/blocktopograph/chunk/ChunkData.java
// public abstract class ChunkData {
//
// public final Chunk chunk;
//
//
//
// public ChunkData(Chunk chunk){
// this.chunk = chunk;
// }
//
// public abstract void createEmpty();
//
// public abstract void write() throws IOException, WorldData.WorldDBException;
//
// }
| import com.protolambda.blocktopograph.chunk.Chunk;
import com.protolambda.blocktopograph.chunk.ChunkData; | package com.protolambda.blocktopograph.chunk.terrain;
public abstract class TerrainChunkData extends ChunkData {
public final byte subChunk;
| // Path: app/src/main/java/com/protolambda/blocktopograph/chunk/Chunk.java
// public class Chunk {
//
// public final WorldData worldData;
//
// public final int x, z;
// public final Dimension dimension;
//
// private Version version;
//
// private AtomicReferenceArray<TerrainChunkData>
// terrain = new AtomicReferenceArray<>(256);
//
// private volatile NBTChunkData entity, blockEntity;
//
// public Chunk(WorldData worldData, int x, int z, Dimension dimension) {
// this.worldData = worldData;
// this.x = x;
// this.z = z;
// this.dimension = dimension;
// }
//
// public TerrainChunkData getTerrain(byte subChunk) throws Version.VersionException {
// TerrainChunkData data = terrain.get(subChunk & 0xff);
// if(data == null){
// data = this.getVersion().createTerrainChunkData(this, subChunk);
// terrain.set(subChunk & 0xff, data);
// }
// return data;
// }
//
// public NBTChunkData getEntity() throws Version.VersionException {
// if(entity == null) entity = this.getVersion().createEntityChunkData(this);
// return entity;
// }
//
//
// public NBTChunkData getBlockEntity() throws Version.VersionException {
// if(blockEntity == null) blockEntity = this.getVersion().createBlockEntityChunkData(this);
// return blockEntity;
// }
//
// public Version getVersion(){
// if(this.version == null) try {
// byte[] data = this.worldData.getChunkData(x, z, ChunkTag.VERSION, dimension, (byte) 0, false);
// this.version = Version.getVersion(data);
// } catch (WorldData.WorldDBLoadException | WorldData.WorldDBException e) {
// e.printStackTrace();
// this.version = Version.ERROR;
// }
//
// return this.version;
// }
//
//
// //TODO: should we use the heightmap???
// public int getHighestBlockYAt(int x, int z) throws Version.VersionException {
// Version cVersion = getVersion();
// TerrainChunkData data;
// for(int subChunk = cVersion.subChunks - 1; subChunk >= 0; subChunk--) {
// data = this.getTerrain((byte) subChunk);
// if (data == null || !data.loadTerrain()) continue;
//
// for (int y = cVersion.subChunkHeight; y >= 0; y--) {
// if (data.getBlockTypeId(x & 15, y, z & 15) != 0)
// return (subChunk * cVersion.subChunkHeight) + y;
// }
// }
// return -1;
// }
//
// public int getHighestBlockYUnderAt(int x, int z, int y) throws Version.VersionException {
// Version cVersion = getVersion();
// int offset = y % cVersion.subChunkHeight;
// int subChunk = y / cVersion.subChunkHeight;
// TerrainChunkData data;
//
// for(; subChunk >= 0; subChunk--) {
// data = this.getTerrain((byte) subChunk);
// if (data == null || !data.loadTerrain()) continue;
//
// for (y = offset; y >= 0; y--) {
// if (data.getBlockTypeId(x & 15, y, z & 15) != 0)
// return (subChunk * cVersion.subChunkHeight) + y;
// }
//
// //start at the top of the next chunk! (current offset might differ)
// offset = cVersion.subChunkHeight - 1;
// }
// return -1;
// }
//
// public int getCaveYUnderAt(int x, int z, int y) throws Version.VersionException {
// Version cVersion = getVersion();
// int offset = y % cVersion.subChunkHeight;
// int subChunk = y / cVersion.subChunkHeight;
// TerrainChunkData data;
//
// for(; subChunk >= 0; subChunk--) {
// data = this.getTerrain((byte) subChunk);
// if (data == null || !data.loadTerrain()) continue;
// for (y = offset; y >= 0; y--) {
// if (data.getBlockTypeId(x & 15, y, z & 15) == 0)
// return (subChunk * cVersion.subChunkHeight) + y;
// }
//
// //start at the top of the next chunk! (current offset might differ)
// offset = cVersion.subChunkHeight - 1;
// }
// return -1;
// }
//
//
// }
//
// Path: app/src/main/java/com/protolambda/blocktopograph/chunk/ChunkData.java
// public abstract class ChunkData {
//
// public final Chunk chunk;
//
//
//
// public ChunkData(Chunk chunk){
// this.chunk = chunk;
// }
//
// public abstract void createEmpty();
//
// public abstract void write() throws IOException, WorldData.WorldDBException;
//
// }
// Path: app/src/main/java/com/protolambda/blocktopograph/chunk/terrain/TerrainChunkData.java
import com.protolambda.blocktopograph.chunk.Chunk;
import com.protolambda.blocktopograph.chunk.ChunkData;
package com.protolambda.blocktopograph.chunk.terrain;
public abstract class TerrainChunkData extends ChunkData {
public final byte subChunk;
| public TerrainChunkData(Chunk chunk, byte subChunk) { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.