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 |
|---|---|---|---|---|---|---|
robneild/pocket-query-creator | app/src/main/java/org/pquery/util/IOUtils.java | // Path: app/src/main/java/org/pquery/webdriver/CancelledListener.java
// public interface CancelledListener {
// void ifCancelledThrow() throws InterruptedException;
// }
//
// Path: app/src/main/java/org/pquery/webdriver/HttpClientFactory.java
// public class HttpClientFactory {
//
// // public static Def... | import android.content.Context;
import android.util.Pair;
import org.pquery.webdriver.CancelledListener;
import org.pquery.webdriver.HttpClientFactory;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import... | cancelledListener.ifCancelledThrow();
}
Logger.d("toByteArray expectedLength=" + expectedLength + ", actualLength=" + total);
return byteOut.toByteArray();
}
public static String httpGet(Context cxt, String path, CancelledListener cancelledListener, Listener listener) thr... | // Path: app/src/main/java/org/pquery/webdriver/CancelledListener.java
// public interface CancelledListener {
// void ifCancelledThrow() throws InterruptedException;
// }
//
// Path: app/src/main/java/org/pquery/webdriver/HttpClientFactory.java
// public class HttpClientFactory {
//
// // public static Def... | HttpURLConnection client = HttpClientFactory.createURLConnection(url); |
robneild/pocket-query-creator | app/src/main/java/org/pquery/filter/CacheTypeList.java | // Path: app/src/main/java/org/pquery/util/Assert.java
// public class Assert {
//
// public static void assertNotNull(Object a) {
// if (a == null) {
// throw new IllegalArgumentException("null reference");
// }
// }
//
// public static void assertEquals(int a, int b) {
// ... | import android.content.res.Resources;
import com.google.android.gms.common.internal.Asserts;
import org.pquery.R;
import org.pquery.util.Assert;
import org.pquery.util.MyColors;
import java.util.Iterator;
import java.util.LinkedList; | package org.pquery.filter;
/**
* Represents a list of CacheTypes
* Used as a creation filter
*/
public class CacheTypeList implements Iterable<CacheType> {
/**
* wrapped list
*/
private LinkedList<CacheType> inner = new LinkedList<CacheType>();
public CacheTypeList() {
}
/**
... | // Path: app/src/main/java/org/pquery/util/Assert.java
// public class Assert {
//
// public static void assertNotNull(Object a) {
// if (a == null) {
// throw new IllegalArgumentException("null reference");
// }
// }
//
// public static void assertEquals(int a, int b) {
// ... | Assert.assertEquals(CacheType.values().length, selection.length); |
robneild/pocket-query-creator | app/src/main/java/org/pquery/filter/CacheTypeList.java | // Path: app/src/main/java/org/pquery/util/Assert.java
// public class Assert {
//
// public static void assertNotNull(Object a) {
// if (a == null) {
// throw new IllegalArgumentException("null reference");
// }
// }
//
// public static void assertEquals(int a, int b) {
// ... | import android.content.res.Resources;
import com.google.android.gms.common.internal.Asserts;
import org.pquery.R;
import org.pquery.util.Assert;
import org.pquery.util.MyColors;
import java.util.Iterator;
import java.util.LinkedList; | for (int i = 0; i < selection.length; i++) {
if (selection[i]) {
inner.add(CacheType.values()[i]);
}
}
if (CacheType.values().length == inner.size())
inner.clear();
}
/**
* Convert to comma seperated string. Uses enum type name... | // Path: app/src/main/java/org/pquery/util/Assert.java
// public class Assert {
//
// public static void assertNotNull(Object a) {
// if (a == null) {
// throw new IllegalArgumentException("null reference");
// }
// }
//
// public static void assertEquals(int a, int b) {
// ... | return "<font color='" + MyColors.LIME + "'>" + res.getString(R.string.any) + "</font>"; |
robneild/pocket-query-creator | app/src/main/java/org/pquery/filter/OneToFiveFilter.java | // Path: app/src/main/java/org/pquery/util/Assert.java
// public class Assert {
//
// public static void assertNotNull(Object a) {
// if (a == null) {
// throw new IllegalArgumentException("null reference");
// }
// }
//
// public static void assertEquals(int a, int b) {
// ... | import android.content.Context;
import org.pquery.R;
import org.pquery.util.Assert;
import org.pquery.util.MyColors;
| package org.pquery.filter;
public class OneToFiveFilter {
public int value;
public boolean up;
public OneToFiveFilter() {
value = 5;
up = false;
}
public OneToFiveFilter(String s) {
if (s.equals("1")) {
value = 1;
up = false;
... | // Path: app/src/main/java/org/pquery/util/Assert.java
// public class Assert {
//
// public static void assertNotNull(Object a) {
// if (a == null) {
// throw new IllegalArgumentException("null reference");
// }
// }
//
// public static void assertEquals(int a, int b) {
// ... | Assert.fail();
|
robneild/pocket-query-creator | app/src/main/java/org/pquery/filter/OneToFiveFilter.java | // Path: app/src/main/java/org/pquery/util/Assert.java
// public class Assert {
//
// public static void assertNotNull(Object a) {
// if (a == null) {
// throw new IllegalArgumentException("null reference");
// }
// }
//
// public static void assertEquals(int a, int b) {
// ... | import android.content.Context;
import org.pquery.R;
import org.pquery.util.Assert;
import org.pquery.util.MyColors;
| value = v1;
} else
Assert.fail();
}
}
@Override
public String toString() {
if (value == 5 && up)
return "5";
if (value == 1 && !up)
return "1";
if ((value == 1 && up) || (value == 5 && !up))
... | // Path: app/src/main/java/org/pquery/util/Assert.java
// public class Assert {
//
// public static void assertNotNull(Object a) {
// if (a == null) {
// throw new IllegalArgumentException("null reference");
// }
// }
//
// public static void assertEquals(int a, int b) {
// ... | ret ="<font color='" + MyColors.LIME + "'>"; // Lime
|
robneild/pocket-query-creator | app/src/androidTest/java/org/pquery/webdriver/parser/GeocachingPageTest.java | // Path: app/src/main/java/org/pquery/util/Util.java
// public class Util {
//
// /**
// * Produce a human download progress string given bytes downloaded and total
// * e.g 14/100 KiB
// */
// public static String humanDownloadCounter(int bytesDownloaded, int expected) {
// Strin... | import android.test.AndroidTestCase;
import net.htmlparser.jericho.FormFields;
import org.pquery.util.Util;
import org.pquery.webdriver.parser.GeocachingPage.ParseException;
import java.io.IOException;
import java.io.InputStream;
| package org.pquery.webdriver.parser;
public class GeocachingPageTest extends AndroidTestCase {
private GeocachingPage simple;
private GeocachingPage createNewPocketQuery;
private GeocachingPage createNewPocketQueryLoggedOut;
private GeocachingPage createNewPocketQueryNonPremium;
... | // Path: app/src/main/java/org/pquery/util/Util.java
// public class Util {
//
// /**
// * Produce a human download progress string given bytes downloaded and total
// * e.g 14/100 KiB
// */
// public static String humanDownloadCounter(int bytesDownloaded, int expected) {
// Strin... | String ret = Util.inputStreamIntoString(in);
|
robneild/pocket-query-creator | app/src/main/java/com/gisgraphy/gishraphoid/AndroidAddressBuilder.java | // Path: app/src/main/java/com/gisgraphy/domain/valueobject/GeoNamesAddressDto.java
// public class GeoNamesAddressDto {
//
// public String countryName;
// public String toponymName;
// public String name;
//
// }
//
// Path: app/src/main/java/com/gisgraphy/domain/valueobject/Street.java
// publi... | import android.location.Address;
import com.gisgraphy.domain.valueobject.GeoNamesAddressDto;
import com.gisgraphy.domain.valueobject.Street;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
| package com.gisgraphy.gishraphoid;
public class AndroidAddressBuilder {
public AndroidAddressBuilder(Locale locale) {
}
public AndroidAddressBuilder() {
}
| // Path: app/src/main/java/com/gisgraphy/domain/valueobject/GeoNamesAddressDto.java
// public class GeoNamesAddressDto {
//
// public String countryName;
// public String toponymName;
// public String name;
//
// }
//
// Path: app/src/main/java/com/gisgraphy/domain/valueobject/Street.java
// publi... | public List<Address> transformStreetsToAndroidAddresses(Street[] result) {
|
robneild/pocket-query-creator | app/src/main/java/com/gisgraphy/gishraphoid/AndroidAddressBuilder.java | // Path: app/src/main/java/com/gisgraphy/domain/valueobject/GeoNamesAddressDto.java
// public class GeoNamesAddressDto {
//
// public String countryName;
// public String toponymName;
// public String name;
//
// }
//
// Path: app/src/main/java/com/gisgraphy/domain/valueobject/Street.java
// publi... | import android.location.Address;
import com.gisgraphy.domain.valueobject.GeoNamesAddressDto;
import com.gisgraphy.domain.valueobject.Street;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
| package com.gisgraphy.gishraphoid;
public class AndroidAddressBuilder {
public AndroidAddressBuilder(Locale locale) {
}
public AndroidAddressBuilder() {
}
public List<Address> transformStreetsToAndroidAddresses(Street[] result) {
ArrayList<Address> ret = new ArrayList<Ad... | // Path: app/src/main/java/com/gisgraphy/domain/valueobject/GeoNamesAddressDto.java
// public class GeoNamesAddressDto {
//
// public String countryName;
// public String toponymName;
// public String name;
//
// }
//
// Path: app/src/main/java/com/gisgraphy/domain/valueobject/Street.java
// publi... | public List<Address> transformStreetsToAndroidAddresses(GeoNamesAddressDto[] result) {
|
robneild/pocket-query-creator | app/src/main/java/com/gisgraphy/gishraphoid/GeoNamesGeocoder.java | // Path: app/src/main/java/com/gisgraphy/domain/valueobject/GeoNamesDto.java
// public class GeoNamesDto {
//
// public GeoNamesAddressDto[] geonames;
//
// public GeoNamesAddressDto[] getResult() {
// return geonames;
// }
// }
| import android.content.Context;
import android.location.Address;
import com.gisgraphy.domain.valueobject.GeoNamesDto;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map; | * @param maxResults max number of addresses to return. Smaller numbers (1 to 5)
* are recommended
* @return a list of Address objects. Returns empty list if no matches were
* found or there is no backend service available.
* @throws IllegalArgumentException if latitude is less... | // Path: app/src/main/java/com/gisgraphy/domain/valueobject/GeoNamesDto.java
// public class GeoNamesDto {
//
// public GeoNamesAddressDto[] geonames;
//
// public GeoNamesAddressDto[] getResult() {
// return geonames;
// }
// }
// Path: app/src/main/java/com/gisgraphy/gishraphoid/GeoNam... | GeoNamesDto response = webService.get(REVERSE_GEOCODING_URI, GeoNamesDto.class, params); |
ForeverWJY/CoolQ_Java_Plugin | src/main/java/com/wjyup/coolq/event/PrivateMsgEvent.java | // Path: src/main/java/com/wjyup/coolq/entity/RequestData.java
// @Getter
// @Setter
// public class RequestData implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// /**
// * <pre>
// 代码(Type) 说明 含有的子消息类型(SubType)
// 1 私聊信息 11/来自好友 1/来自在线状态 2/来自群 3/来自讨论组
// 2 群消息 1/普通消息 ... | import com.wjyup.coolq.entity.RequestData;
import com.wjyup.coolq.eventbus.XEvent;
import lombok.Data; | package com.wjyup.coolq.event;
/**
* 私聊事件
*/
@Data
public class PrivateMsgEvent implements XEvent {
| // Path: src/main/java/com/wjyup/coolq/entity/RequestData.java
// @Getter
// @Setter
// public class RequestData implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// /**
// * <pre>
// 代码(Type) 说明 含有的子消息类型(SubType)
// 1 私聊信息 11/来自好友 1/来自在线状态 2/来自群 3/来自讨论组
// 2 群消息 1/普通消息 ... | private RequestData requestData; |
ForeverWJY/CoolQ_Java_Plugin | src/main/java/com/wjyup/coolq/util/ConfigCache.java | // Path: src/main/java/com/wjyup/coolq/service/ResolveMessageService.java
// public abstract class ResolveMessageService {
// public final static Logger log = LogManager.getLogger(ResolveMessageService.class);
//
// /**
// * 用于主动回复消息
// * @param data 收到的消息
// * @param message 回复的消息
// */
//... | import com.wjyup.coolq.service.ResolveMessageService;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;... | package com.wjyup.coolq.util;
/**
* 静态配置
*
* @author WJY
*/
@Component
@Data
@Configuration
@PropertySource(value = "classpath:data.properties")
public class ConfigCache implements InitializingBean {
private Logger log = LogManager.getLogger(ConfigCache.class);
// 使用Websocket方式推送消息,访问插件的Websocket的Host和Port
... | // Path: src/main/java/com/wjyup/coolq/service/ResolveMessageService.java
// public abstract class ResolveMessageService {
// public final static Logger log = LogManager.getLogger(ResolveMessageService.class);
//
// /**
// * 用于主动回复消息
// * @param data 收到的消息
// * @param message 回复的消息
// */
//... | public static final List<ResolveMessageService> MSG_PLUGIN_LIST = new ArrayList<>(); |
ForeverWJY/CoolQ_Java_Plugin | src/main/java/com/wjyup/coolq/event/GroupMsgEvent.java | // Path: src/main/java/com/wjyup/coolq/entity/RequestData.java
// @Getter
// @Setter
// public class RequestData implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// /**
// * <pre>
// 代码(Type) 说明 含有的子消息类型(SubType)
// 1 私聊信息 11/来自好友 1/来自在线状态 2/来自群 3/来自讨论组
// 2 群消息 1/普通消息 ... | import com.wjyup.coolq.entity.RequestData;
import com.wjyup.coolq.eventbus.XEvent;
import lombok.Data; | package com.wjyup.coolq.event;
/**
* 群聊事件
*/
@Data
public class GroupMsgEvent implements XEvent { | // Path: src/main/java/com/wjyup/coolq/entity/RequestData.java
// @Getter
// @Setter
// public class RequestData implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// /**
// * <pre>
// 代码(Type) 说明 含有的子消息类型(SubType)
// 1 私聊信息 11/来自好友 1/来自在线状态 2/来自群 3/来自讨论组
// 2 群消息 1/普通消息 ... | private RequestData requestData; |
ForeverWJY/CoolQ_Java_Plugin | src/main/java/com/wjyup/coolq/util/Predicates.java | // Path: src/main/java/com/wjyup/coolq/exception/PredicateException.java
// public class PredicateException extends RuntimeException{
// private static final long serialVersionUID = 1L;
//
// public PredicateException(String message) {
// super(message);
// }
// }
//
// Path: src/main/java/com/wjy... | import com.google.common.base.Strings;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
import com.wjyup.coolq.exception.PredicateException;
import com.wjyup.coolq.exception.UnexpectedException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
imp... | package com.wjyup.coolq.util;
public class Predicates {
private static final Pattern IP_PATTERN = Pattern
.compile("^([1-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}$");
/**
* 检查数值范围
*
* @param number 数值
* @param min 最小值
* @param... | // Path: src/main/java/com/wjyup/coolq/exception/PredicateException.java
// public class PredicateException extends RuntimeException{
// private static final long serialVersionUID = 1L;
//
// public PredicateException(String message) {
// super(message);
// }
// }
//
// Path: src/main/java/com/wjy... | public static void ensureNumberRange(int number, int min, int max, String msg) throws PredicateException { |
ForeverWJY/CoolQ_Java_Plugin | src/main/java/com/wjyup/coolq/util/Predicates.java | // Path: src/main/java/com/wjyup/coolq/exception/PredicateException.java
// public class PredicateException extends RuntimeException{
// private static final long serialVersionUID = 1L;
//
// public PredicateException(String message) {
// super(message);
// }
// }
//
// Path: src/main/java/com/wjy... | import com.google.common.base.Strings;
import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
import com.wjyup.coolq.exception.PredicateException;
import com.wjyup.coolq.exception.UnexpectedException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
imp... | ensureIn(value, predicates, msg.get());
}
private static int compare(Number x, Number y) {
if(isSpecial(x) || isSpecial(y)) {
return Double.compare(x.doubleValue(), y.doubleValue());
} else {
return toBigDecimal(x).compareTo(toBigDecimal(y));
}
}
... | // Path: src/main/java/com/wjyup/coolq/exception/PredicateException.java
// public class PredicateException extends RuntimeException{
// private static final long serialVersionUID = 1L;
//
// public PredicateException(String message) {
// super(message);
// }
// }
//
// Path: src/main/java/com/wjy... | throw new UnexpectedException(String.format("数值%s(类型%s)无法转换为合法的字符串", number.toString(), number.getClass().getName()), e); |
ForeverWJY/CoolQ_Java_Plugin | src/test/java/junit/SpringJunit.java | // Path: src/main/java/com/wjyup/coolq/MainApp.java
// @SpringBootApplication
// @EnableTransactionManagement
// public class MainApp {
// private static final Logger log = LogManager.getLogger(MainApp.class);
//
// @Bean
// public TaskExecutor taskExecutor() {
// ThreadPoolTaskExecutor executor = ... | import com.wjyup.coolq.MainApp;
import com.wjyup.coolq.entity.RequestData;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springfr... | package junit;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {MainApp.class})
//相当于 --spring.profiles.active=dev
@ActiveProfiles(value="dev")
public class SpringJunit {
private final Logger log = LogManager.getLogger("SpringJunit"); | // Path: src/main/java/com/wjyup/coolq/MainApp.java
// @SpringBootApplication
// @EnableTransactionManagement
// public class MainApp {
// private static final Logger log = LogManager.getLogger(MainApp.class);
//
// @Bean
// public TaskExecutor taskExecutor() {
// ThreadPoolTaskExecutor executor = ... | private RequestData requestData = new RequestData(); |
memo33/jDBPFX | src/jdbpfx/util/DBPFUtil.java | // Path: src/jdbpfx/properties/DBPFPropertyType.java
// public enum DBPFPropertyType {
// UINT8 ((short) 0x0100, "Uint8", 1),
// UINT16 ((short) 0x0200, "Uint16", 2),
// UINT32 ((short) 0x0300, "Uint32", 4),
// SINT32 ((short) 0x0700, "Sint32", 4),
// SINT64 ((short) 0x0800, "Sint64", 8),
// FL... | import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Locale;
import java.util.logging.Logger;
import jdbpfx.properties.DBPFPropertyType; | long result = 0;
hexString = hexString.toLowerCase();
if (hexString.startsWith("0x")) {
hexString = hexString.substring(2);
}
result = Long.parseLong(hexString, 16);
if(signed) {
long signBit = 1L << ((hexString.length() * 4) - 1);
if((... | // Path: src/jdbpfx/properties/DBPFPropertyType.java
// public enum DBPFPropertyType {
// UINT8 ((short) 0x0100, "Uint8", 1),
// UINT16 ((short) 0x0200, "Uint16", 2),
// UINT32 ((short) 0x0300, "Uint32", 4),
// SINT32 ((short) 0x0700, "Sint32", 4),
// SINT64 ((short) 0x0800, "Sint64", 8),
// FL... | public static long getValue(DBPFPropertyType type, byte[] data, int start, int length) { |
jskcse4/FreeTamilEBooks | src/com/jskaleel/abstracts/BasicFragment.java | // Path: src/com/jskaleel/fte/common/UIProgressLoading.java
// public class UIProgressLoading {
//
// public ProgressLoading progressLoading;
// public Activity activity;
// public void init(Activity context){
// progressLoading = new ProgressLoading(context);
// activity = context;
// }
// public ... | import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.KeyEvent;
import com.jskaleel.fte.common.UIProgressLoading;
| package com.jskaleel.abstracts;
public class BasicFragment extends Fragment{
public AlertDialog alertDialog;
| // Path: src/com/jskaleel/fte/common/UIProgressLoading.java
// public class UIProgressLoading {
//
// public ProgressLoading progressLoading;
// public Activity activity;
// public void init(Activity context){
// progressLoading = new ProgressLoading(context);
// activity = context;
// }
// public ... | public UIProgressLoading uiProgressLoading;
|
jskcse4/FreeTamilEBooks | src/com/jskaleel/fte/app/FTEApplication.java | // Path: src/com/jskaleel/fte/common/LruBitmapCache.java
// public class LruBitmapCache extends LruCache<String, Bitmap> implements
// ImageCache {
// public static int getDefaultLruCacheSize() {
// final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
// final int cacheSize = maxMemory / 8;... | import android.app.Application;
import android.content.Context;
import android.text.TextUtils;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
import com.jskaleel.fte.common.LruBitmapCache; | @Override
public void onCreate() {
super.onCreate();
mInstance = this;
this.setAppContext(getApplicationContext());
}
public static FTEApplication getInstance(){
return mInstance;
}
public static Context getAppContext() {
return mAppContext;
}
public void setAppContext(Context mAppContext) {
FTE... | // Path: src/com/jskaleel/fte/common/LruBitmapCache.java
// public class LruBitmapCache extends LruCache<String, Bitmap> implements
// ImageCache {
// public static int getDefaultLruCacheSize() {
// final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
// final int cacheSize = maxMemory / 8;... | mImageLoader = new ImageLoader(this.mRequestQueue, new LruBitmapCache()); |
jskcse4/FreeTamilEBooks | src/com/jskaleel/abstracts/BasicActivity.java | // Path: src/com/jskaleel/fte/common/ConnectionDetector.java
// public class ConnectionDetector {
//
// private Context _context;
//
//
// public ConnectionDetector(Context context) {
// this._context = context;
// }
//
// public boolean isConnectingToInternet()
// {
// ConnectivityManager connectivity ... | import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.KeyEvent;
import com.jskaleel.fte.common.ConnectionDetector;
import com.jskaleel.fte.common.PrintLog;
import com.jskaleel.fte.common.UIProgressLoad... | package com.jskaleel.abstracts;
public class BasicActivity extends FragmentActivity{
public AlertDialog alertDialog;
// public ProgressDialog progressDialog;
| // Path: src/com/jskaleel/fte/common/ConnectionDetector.java
// public class ConnectionDetector {
//
// private Context _context;
//
//
// public ConnectionDetector(Context context) {
// this._context = context;
// }
//
// public boolean isConnectingToInternet()
// {
// ConnectivityManager connectivity ... | public UIProgressLoading uiProgressLoading;
|
jskcse4/FreeTamilEBooks | src/com/jskaleel/abstracts/BasicActivity.java | // Path: src/com/jskaleel/fte/common/ConnectionDetector.java
// public class ConnectionDetector {
//
// private Context _context;
//
//
// public ConnectionDetector(Context context) {
// this._context = context;
// }
//
// public boolean isConnectingToInternet()
// {
// ConnectivityManager connectivity ... | import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.KeyEvent;
import com.jskaleel.fte.common.ConnectionDetector;
import com.jskaleel.fte.common.PrintLog;
import com.jskaleel.fte.common.UIProgressLoad... | package com.jskaleel.abstracts;
public class BasicActivity extends FragmentActivity{
public AlertDialog alertDialog;
// public ProgressDialog progressDialog;
public UIProgressLoading uiProgressLoading;
public static Boolean isAppRunningBackground = false;
public static String TAG = "BasicActivity";
... | // Path: src/com/jskaleel/fte/common/ConnectionDetector.java
// public class ConnectionDetector {
//
// private Context _context;
//
//
// public ConnectionDetector(Context context) {
// this._context = context;
// }
//
// public boolean isConnectingToInternet()
// {
// ConnectivityManager connectivity ... | public ConnectionDetector connectionDetector;
|
jskcse4/FreeTamilEBooks | src/com/jskaleel/abstracts/BasicActivity.java | // Path: src/com/jskaleel/fte/common/ConnectionDetector.java
// public class ConnectionDetector {
//
// private Context _context;
//
//
// public ConnectionDetector(Context context) {
// this._context = context;
// }
//
// public boolean isConnectingToInternet()
// {
// ConnectivityManager connectivity ... | import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.KeyEvent;
import com.jskaleel.fte.common.ConnectionDetector;
import com.jskaleel.fte.common.PrintLog;
import com.jskaleel.fte.common.UIProgressLoad... | alertDialogBuilder.setCancelable(false);
alertDialogBuilder.setNeutralButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
finish();
}
});
alertDialogBuilder.setOnKeyListen... | // Path: src/com/jskaleel/fte/common/ConnectionDetector.java
// public class ConnectionDetector {
//
// private Context _context;
//
//
// public ConnectionDetector(Context context) {
// this._context = context;
// }
//
// public boolean isConnectingToInternet()
// {
// ConnectivityManager connectivity ... | PrintLog.debug(TAG, "isAppRunningBackground onPause: "+isAppRunningBackground);
|
jskcse4/FreeTamilEBooks | src/com/jskaleel/http/HttpGetConnection.java | // Path: src/com/jskaleel/fte/common/PrintLog.java
// public class PrintLog {
//
// public static void debug(String TAG,String str) {
// if(str.length() > 4000)
// {
// Log.d("FTE",TAG+" ---> " + str.substring(0, 4000));
// debug(TAG,str.substring(4000));
// } else
// {
// Log.d("FTE",TAG+ " ---->"... | import java.io.IOException;
import java.io.InputStream;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import com.jskaleel.ft... | package com.jskaleel.http;
public class HttpGetConnection {
public static String HTTP_LOG = "HttpConnection";
public static UrlResponse getRequest(String url) {
UrlResponse response = new UrlResponse();
HttpClient httpclient = new DefaultHttpClient();
| // Path: src/com/jskaleel/fte/common/PrintLog.java
// public class PrintLog {
//
// public static void debug(String TAG,String str) {
// if(str.length() > 4000)
// {
// Log.d("FTE",TAG+" ---> " + str.substring(0, 4000));
// debug(TAG,str.substring(4000));
// } else
// {
// Log.d("FTE",TAG+ " ---->"... | PrintLog.debug("URL", "---->"+url);
|
jskcse4/FreeTamilEBooks | src/com/jskaleel/http/HttpUtils.java | // Path: src/com/jskaleel/fte/common/TextUtils.java
// public class TextUtils {
//
// public static final String encodeToBase64(CharSequence content){
// byte[] bytes = Base64.encode(content.toString().getBytes(), Base64.DEFAULT);
// return new String(bytes);
// }
//
// public static final String dec... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import org.apache.http.HttpStatus;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
... | }
} catch (JSONException e) {
e.printStackTrace();
}
}
return isErrorcode;
}
public static UrlResponse getResponse(int responseCode, String content){
UrlResponse response = new UrlResponse();
response.setResposeCode(responseCode);
String errorMsg = HttpUtils.getErrorMsg(conte... | // Path: src/com/jskaleel/fte/common/TextUtils.java
// public class TextUtils {
//
// public static final String encodeToBase64(CharSequence content){
// byte[] bytes = Base64.encode(content.toString().getBytes(), Base64.DEFAULT);
// return new String(bytes);
// }
//
// public static final String dec... | if(!TextUtils.isNullOrEmpty(content)){
|
jskcse4/FreeTamilEBooks | src/com/jskaleel/http/HttpGetUrlConnection.java | // Path: src/com/jskaleel/fte/common/PrintLog.java
// public class PrintLog {
//
// public static void debug(String TAG,String str) {
// if(str.length() > 4000)
// {
// Log.d("FTE",TAG+" ---> " + str.substring(0, 4000));
// debug(TAG,str.substring(4000));
// } else
// {
// Log.d("FTE",TAG+ " ---->"... | import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import com.jskaleel.fte.common.PrintLog;
| package com.jskaleel.http;
public class HttpGetUrlConnection {
public HttpGetUrlConnection(){
}
public static String getContentFromUrl(String api_url) throws UnsupportedEncodingException{
HttpURLConnection conn = null;
StringBuilder jsonResults = new StringBuilder();
UrlResponse response = n... | // Path: src/com/jskaleel/fte/common/PrintLog.java
// public class PrintLog {
//
// public static void debug(String TAG,String str) {
// if(str.length() > 4000)
// {
// Log.d("FTE",TAG+" ---> " + str.substring(0, 4000));
// debug(TAG,str.substring(4000));
// } else
// {
// Log.d("FTE",TAG+ " ---->"... | PrintLog.debug("HttpGerUrl", "Response: "+content);
|
jskcse4/FreeTamilEBooks | src/com/jskaleel/fte/common/FTEDevice.java | // Path: src/com/jskaleel/fte/AppPreference.java
// public class AppPreference extends Application {
//
//
// public static final String PREFS_NAME = "app_preference";
// public static final String IS_OPEN_FIRSTTIME = "open firsttime";
//
// private SharedPreferences mPrefrence;
// private SharedPre... | import android.app.Application;
import android.content.Context;
import android.os.Build;
import android.os.Build.VERSION_CODES;
import android.util.TypedValue;
import com.jskaleel.fte.AppPreference;
| package com.jskaleel.fte.common;
public class FTEDevice extends Application {
// public static boolean GTE_GB_9 = false;
// public static boolean GTE_GB_10 = false;
public static boolean GTE_HC_11 = false;
// public static boolean GTE_HC_12 = false;
// public static boolean GTE_HC_13 = false;
... | // Path: src/com/jskaleel/fte/AppPreference.java
// public class AppPreference extends Application {
//
//
// public static final String PREFS_NAME = "app_preference";
// public static final String IS_OPEN_FIRSTTIME = "open firsttime";
//
// private SharedPreferences mPrefrence;
// private SharedPre... | private static AppPreference mUserPrefrence;
|
jskcse4/FreeTamilEBooks | src/com/jskaleel/http/HttpUrlConnection.java | // Path: src/com/jskaleel/fte/common/PrintLog.java
// public class PrintLog {
//
// public static void debug(String TAG,String str) {
// if(str.length() > 4000)
// {
// Log.d("FTE",TAG+" ---> " + str.substring(0, 4000));
// debug(TAG,str.substring(4000));
// } else
// {
// Log.d("FTE",TAG+ " ---->"... | import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import com.jskaleel.fte.common.PrintLog;
| package com.jskaleel.http;
public class HttpUrlConnection {
private static final String TAG = "HttpUrlConnection";
public HttpUrlConnection(){
}
public static String getContentFromUrl(String api_url) throws UnsupportedEncodingException{
HttpURLConnection conn = null;
StringBuilder j... | // Path: src/com/jskaleel/fte/common/PrintLog.java
// public class PrintLog {
//
// public static void debug(String TAG,String str) {
// if(str.length() > 4000)
// {
// Log.d("FTE",TAG+" ---> " + str.substring(0, 4000));
// debug(TAG,str.substring(4000));
// } else
// {
// Log.d("FTE",TAG+ " ---->"... | PrintLog.debug("HttpUrlConnection", "getContentFromUrl Url: "+api_url);
|
MatteoJoliveau/PlugFace | plugface-core/src/main/java/org/plugface/core/internal/DependencyResolver.java | // Path: plugface-core/src/main/java/org/plugface/core/internal/di/Graph.java
// public class Graph {
//
// private Set<Node> all = new HashSet<>();
// private Map<Node, List<Node>> adj = new HashMap<>();
//
// public Graph addLeaf(Node<?> node) {
// addEdge(node, null);
// return this;
//... | import org.plugface.core.internal.di.Graph;
import org.plugface.core.internal.di.Node;
import java.util.Collection; | package org.plugface.core.internal;
/*-
* #%L
* PlugFace :: Core
* %%
* Copyright (C) 2017 - 2018 PlugFace
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includi... | // Path: plugface-core/src/main/java/org/plugface/core/internal/di/Graph.java
// public class Graph {
//
// private Set<Node> all = new HashSet<>();
// private Map<Node, List<Node>> adj = new HashMap<>();
//
// public Graph addLeaf(Node<?> node) {
// addEdge(node, null);
// return this;
//... | public Collection<Node<?>> resolve(Collection<Class<?>> pluginClasses) { |
MatteoJoliveau/PlugFace | plugface-core/src/main/java/org/plugface/core/internal/DependencyResolver.java | // Path: plugface-core/src/main/java/org/plugface/core/internal/di/Graph.java
// public class Graph {
//
// private Set<Node> all = new HashSet<>();
// private Map<Node, List<Node>> adj = new HashMap<>();
//
// public Graph addLeaf(Node<?> node) {
// addEdge(node, null);
// return this;
//... | import org.plugface.core.internal.di.Graph;
import org.plugface.core.internal.di.Node;
import java.util.Collection; | package org.plugface.core.internal;
/*-
* #%L
* PlugFace :: Core
* %%
* Copyright (C) 2017 - 2018 PlugFace
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includi... | // Path: plugface-core/src/main/java/org/plugface/core/internal/di/Graph.java
// public class Graph {
//
// private Set<Node> all = new HashSet<>();
// private Map<Node, List<Node>> adj = new HashMap<>();
//
// public Graph addLeaf(Node<?> node) {
// addEdge(node, null);
// return this;
//... | final Graph graph = new Graph(); |
MatteoJoliveau/PlugFace | plugface-core/src/main/java/org/plugface/core/internal/AnnotationProcessor.java | // Path: plugface-core/src/main/java/org/plugface/core/internal/di/Node.java
// public class Node<T> {
// private final Class<T> refClass;
//
// public Node(Class<T> refClass) {
// this.refClass = refClass;
// }
//
// public Class<T> getRefClass() {
// return refClass;
// }
//
// ... | import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.Collection;
import org.plugface.core.annotations.Plugin;
import org.plugface.core.internal.di.Node;
import javax.inject.Inject; | package org.plugface.core.internal;
/*-
* #%L
* PlugFace :: Core
* %%
* Copyright (C) 2017 - 2018 PlugFace
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includi... | // Path: plugface-core/src/main/java/org/plugface/core/internal/di/Node.java
// public class Node<T> {
// private final Class<T> refClass;
//
// public Node(Class<T> refClass) {
// this.refClass = refClass;
// }
//
// public Class<T> getRefClass() {
// return refClass;
// }
//
// ... | public Collection<Node<?>> getDependencies(Class<?> pluginClass) { |
MatteoJoliveau/PlugFace | plugface-core/src/test/java/org/plugface/core/internal/AnnotationProcessorTest.java | // Path: plugface-core/src/main/java/org/plugface/core/internal/di/Node.java
// public class Node<T> {
// private final Class<T> refClass;
//
// public Node(Class<T> refClass) {
// this.refClass = refClass;
// }
//
// public Class<T> getRefClass() {
// return refClass;
// }
//
// ... | import org.plugface.core.plugins.DependencyPlugin;
import org.plugface.core.plugins.TestPlugin;
import java.util.Collection;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.plugface.core.annotations.Plugin;
import org.plugface.core.internal.di.Node; | package org.plugface.core.internal;
/*-
* #%L
* PlugFace :: Core
* %%
* Copyright (C) 2017 - 2018 PlugFace
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includi... | // Path: plugface-core/src/main/java/org/plugface/core/internal/di/Node.java
// public class Node<T> {
// private final Class<T> refClass;
//
// public Node(Class<T> refClass) {
// this.refClass = refClass;
// }
//
// public Class<T> getRefClass() {
// return refClass;
// }
//
// ... | final String name = sut.getPluginName(new TestPlugin()); |
MatteoJoliveau/PlugFace | plugface-core/src/test/java/org/plugface/core/internal/AnnotationProcessorTest.java | // Path: plugface-core/src/main/java/org/plugface/core/internal/di/Node.java
// public class Node<T> {
// private final Class<T> refClass;
//
// public Node(Class<T> refClass) {
// this.refClass = refClass;
// }
//
// public Class<T> getRefClass() {
// return refClass;
// }
//
// ... | import org.plugface.core.plugins.DependencyPlugin;
import org.plugface.core.plugins.TestPlugin;
import java.util.Collection;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.plugface.core.annotations.Plugin;
import org.plugface.core.internal.di.Node; | package org.plugface.core.internal;
/*-
* #%L
* PlugFace :: Core
* %%
* Copyright (C) 2017 - 2018 PlugFace
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includi... | // Path: plugface-core/src/main/java/org/plugface/core/internal/di/Node.java
// public class Node<T> {
// private final Class<T> refClass;
//
// public Node(Class<T> refClass) {
// this.refClass = refClass;
// }
//
// public Class<T> getRefClass() {
// return refClass;
// }
//
// ... | final boolean hasDependencies = sut.hasDependencies(DependencyPlugin.class); |
MatteoJoliveau/PlugFace | plugface-core/src/test/java/org/plugface/core/internal/AnnotationProcessorTest.java | // Path: plugface-core/src/main/java/org/plugface/core/internal/di/Node.java
// public class Node<T> {
// private final Class<T> refClass;
//
// public Node(Class<T> refClass) {
// this.refClass = refClass;
// }
//
// public Class<T> getRefClass() {
// return refClass;
// }
//
// ... | import org.plugface.core.plugins.DependencyPlugin;
import org.plugface.core.plugins.TestPlugin;
import java.util.Collection;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.plugface.core.annotations.Plugin;
import org.plugface.core.internal.di.Node; | package org.plugface.core.internal;
/*-
* #%L
* PlugFace :: Core
* %%
* Copyright (C) 2017 - 2018 PlugFace
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includi... | // Path: plugface-core/src/main/java/org/plugface/core/internal/di/Node.java
// public class Node<T> {
// private final Class<T> refClass;
//
// public Node(Class<T> refClass) {
// this.refClass = refClass;
// }
//
// public Class<T> getRefClass() {
// return refClass;
// }
//
// ... | final Collection<Node<?>> dependencies = sut.getDependencies(DependencyPlugin.class); |
MatteoJoliveau/PlugFace | plugface-spring/src/test/java/org/plugface/spring/SpringPluginContextTest.java | // Path: plugface-core/src/main/java/org/plugface/core/PluginContext.java
// public interface PluginContext {
// /**
// * Return an instance of the plugin that is registered with the given name
// *
// * @param pluginName the name of the plugin
// * @param <T> the inferred type of the plu... | import org.plugface.core.annotations.Plugin;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import st... | package org.plugface.spring;
/*-
* #%L
* PlugFace :: Spring
* %%
* Copyright (C) 2017 - 2018 PlugFace
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including wi... | // Path: plugface-core/src/main/java/org/plugface/core/PluginContext.java
// public interface PluginContext {
// /**
// * Return an instance of the plugin that is registered with the given name
// *
// * @param pluginName the name of the plugin
// * @param <T> the inferred type of the plu... | private PluginContext sut; |
MatteoJoliveau/PlugFace | plugface-core/src/test/java/org/plugface/core/impl/DefaultPluginContextTest.java | // Path: plugface-core/src/main/java/org/plugface/core/PluginRef.java
// public final class PluginRef<T> {
//
// private final T ref;
// private final String name;
// private final Class<T> type;
//
// private PluginRef(T ref, String name, Class<T> type) {
// this.ref = Objects.requireNonNull(... | import org.plugface.core.plugins.OptionalPlugin;
import org.plugface.core.plugins.TestInterface;
import org.plugface.core.plugins.TestPlugin;
import org.plugface.core.plugins.TestSuperclass;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.*;
import org.junit.Before;... | package org.plugface.core.impl;
/*-
* #%L
* PlugFace :: Core
* %%
* Copyright (C) 2017 - 2018 PlugFace
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including w... | // Path: plugface-core/src/main/java/org/plugface/core/PluginRef.java
// public final class PluginRef<T> {
//
// private final T ref;
// private final String name;
// private final Class<T> type;
//
// private PluginRef(T ref, String name, Class<T> type) {
// this.ref = Objects.requireNonNull(... | private TestPlugin plugin = new TestPlugin(); |
MatteoJoliveau/PlugFace | plugface-core/src/test/java/org/plugface/core/impl/DefaultPluginContextTest.java | // Path: plugface-core/src/main/java/org/plugface/core/PluginRef.java
// public final class PluginRef<T> {
//
// private final T ref;
// private final String name;
// private final Class<T> type;
//
// private PluginRef(T ref, String name, Class<T> type) {
// this.ref = Objects.requireNonNull(... | import org.plugface.core.plugins.OptionalPlugin;
import org.plugface.core.plugins.TestInterface;
import org.plugface.core.plugins.TestPlugin;
import org.plugface.core.plugins.TestSuperclass;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.*;
import org.junit.Before;... | package org.plugface.core.impl;
/*-
* #%L
* PlugFace :: Core
* %%
* Copyright (C) 2017 - 2018 PlugFace
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including w... | // Path: plugface-core/src/main/java/org/plugface/core/PluginRef.java
// public final class PluginRef<T> {
//
// private final T ref;
// private final String name;
// private final Class<T> type;
//
// private PluginRef(T ref, String name, Class<T> type) {
// this.ref = Objects.requireNonNull(... | private OptionalPlugin optionalPlugin = new OptionalPlugin(); |
MatteoJoliveau/PlugFace | plugface-core/src/test/java/org/plugface/core/impl/DefaultPluginContextTest.java | // Path: plugface-core/src/main/java/org/plugface/core/PluginRef.java
// public final class PluginRef<T> {
//
// private final T ref;
// private final String name;
// private final Class<T> type;
//
// private PluginRef(T ref, String name, Class<T> type) {
// this.ref = Objects.requireNonNull(... | import org.plugface.core.plugins.OptionalPlugin;
import org.plugface.core.plugins.TestInterface;
import org.plugface.core.plugins.TestPlugin;
import org.plugface.core.plugins.TestSuperclass;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.*;
import org.junit.Before;... | assertEquals(plugin, test);
}
@Test
public void shouldRemovePluginFromInstance() {
registry.put("test", plugin);
final TestPlugin test = context.removePlugin(plugin);
assertFalse(registry.containsKey("test"));
assertEquals(plugin, test);
}
@Test
public v... | // Path: plugface-core/src/main/java/org/plugface/core/PluginRef.java
// public final class PluginRef<T> {
//
// private final T ref;
// private final String name;
// private final Class<T> type;
//
// private PluginRef(T ref, String name, Class<T> type) {
// this.ref = Objects.requireNonNull(... | final TestInterface test = context.getPlugin(TestInterface.class); |
MatteoJoliveau/PlugFace | plugface-core/src/test/java/org/plugface/core/impl/DefaultPluginContextTest.java | // Path: plugface-core/src/main/java/org/plugface/core/PluginRef.java
// public final class PluginRef<T> {
//
// private final T ref;
// private final String name;
// private final Class<T> type;
//
// private PluginRef(T ref, String name, Class<T> type) {
// this.ref = Objects.requireNonNull(... | import org.plugface.core.plugins.OptionalPlugin;
import org.plugface.core.plugins.TestInterface;
import org.plugface.core.plugins.TestPlugin;
import org.plugface.core.plugins.TestSuperclass;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.*;
import org.junit.Before;... | assertEquals(plugin, test);
}
@Test
public void shouldRetrievePluginFromName() {
registry.put("test", plugin);
final TestPlugin test = context.getPlugin("test");
assertTrue(registry.containsKey("test"));
assertEquals(plugin, test);
}
@Test
public void sh... | // Path: plugface-core/src/main/java/org/plugface/core/PluginRef.java
// public final class PluginRef<T> {
//
// private final T ref;
// private final String name;
// private final Class<T> type;
//
// private PluginRef(T ref, String name, Class<T> type) {
// this.ref = Objects.requireNonNull(... | final TestSuperclass test = context.getPlugin(TestSuperclass.class); |
MatteoJoliveau/PlugFace | plugface-core/src/test/java/org/plugface/core/impl/DefaultPluginContextTest.java | // Path: plugface-core/src/main/java/org/plugface/core/PluginRef.java
// public final class PluginRef<T> {
//
// private final T ref;
// private final String name;
// private final Class<T> type;
//
// private PluginRef(T ref, String name, Class<T> type) {
// this.ref = Objects.requireNonNull(... | import org.plugface.core.plugins.OptionalPlugin;
import org.plugface.core.plugins.TestInterface;
import org.plugface.core.plugins.TestPlugin;
import org.plugface.core.plugins.TestSuperclass;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.*;
import org.junit.Before;... |
@Test
public void shouldRetrievePluginFromClass() {
registry.put("test", plugin);
final TestPlugin test = context.getPlugin(TestPlugin.class);
assertTrue(registry.containsKey("test"));
assertEquals(plugin, test);
}
@Test
public void shouldRetrievePluginFromInterface... | // Path: plugface-core/src/main/java/org/plugface/core/PluginRef.java
// public final class PluginRef<T> {
//
// private final T ref;
// private final String name;
// private final Class<T> type;
//
// private PluginRef(T ref, String name, Class<T> type) {
// this.ref = Objects.requireNonNull(... | final List<PluginRef> all = (List<PluginRef>) context.getAllPlugins(); |
MatteoJoliveau/PlugFace | plugface-core/src/test/java/org/plugface/core/internal/DependencyResolverTest.java | // Path: plugface-core/src/main/java/org/plugface/core/internal/di/Node.java
// public class Node<T> {
// private final Class<T> refClass;
//
// public Node(Class<T> refClass) {
// this.refClass = refClass;
// }
//
// public Class<T> getRefClass() {
// return refClass;
// }
//
// ... | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.plugface.core.internal.di.Node;
import org.plugface.core.plugins.*; | package org.plugface.core.internal;
/*-
* #%L
* PlugFace :: Core
* %%
* Copyright (C) 2017 - 2018 PlugFace
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includi... | // Path: plugface-core/src/main/java/org/plugface/core/internal/di/Node.java
// public class Node<T> {
// private final Class<T> refClass;
//
// public Node(Class<T> refClass) {
// this.refClass = refClass;
// }
//
// public Class<T> getRefClass() {
// return refClass;
// }
//
// ... | Collection<Node<?>> nodes = sut.resolve(plugins); |
MatteoJoliveau/PlugFace | plugface-core/src/test/java/org/plugface/core/impl/ITPluginLoading.java | // Path: plugface-core/src/main/java/org/plugface/core/PluginManager.java
// public interface PluginManager {
//
// /**
// * Register a plugin in the context
// *
// * @param plugin the plugin object to register
// * @param <T> the inferred type of the plugin
// */
// <T> void regis... | import org.plugface.core.factory.PluginManagers;
import org.plugface.core.plugins.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.plugface.core.PluginManager;
import o... | package org.plugface.core.impl;
/*-
* #%L
* PlugFace :: Core
* %%
* Copyright (C) 2017 - 2018 PlugFace
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including w... | // Path: plugface-core/src/main/java/org/plugface/core/PluginManager.java
// public interface PluginManager {
//
// /**
// * Register a plugin in the context
// *
// * @param plugin the plugin object to register
// * @param <T> the inferred type of the plugin
// */
// <T> void regis... | manager = PluginManagers.defaultPluginManager(); |
MatteoJoliveau/PlugFace | plugface-core/src/test/java/org/plugface/core/impl/ITPluginLoading.java | // Path: plugface-core/src/main/java/org/plugface/core/PluginManager.java
// public interface PluginManager {
//
// /**
// * Register a plugin in the context
// *
// * @param plugin the plugin object to register
// * @param <T> the inferred type of the plugin
// */
// <T> void regis... | import org.plugface.core.factory.PluginManagers;
import org.plugface.core.plugins.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.plugface.core.PluginManager;
import o... | package org.plugface.core.impl;
/*-
* #%L
* PlugFace :: Core
* %%
* Copyright (C) 2017 - 2018 PlugFace
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including w... | // Path: plugface-core/src/main/java/org/plugface/core/PluginManager.java
// public interface PluginManager {
//
// /**
// * Register a plugin in the context
// *
// * @param plugin the plugin object to register
// * @param <T> the inferred type of the plugin
// */
// <T> void regis... | final PluginSource source = new PluginSource() { |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/OsMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.monitor.os.OsStats;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter; | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class OsMetricsGenerator extends MetricsGenerator<OsStats> {
private static final Logger logger = Loggers.getLogger(OsMetricsGenerator.class, "init");
@Override | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | public PrometheusFormatWriter generateMetrics(PrometheusFormatWriter writer, OsStats osStats) { |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/StriptsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.elasticsearch.script.ScriptStats;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter; | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class StriptsGenerator extends MetricsGenerator<ScriptStats> {
@Override | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | public PrometheusFormatWriter generateMetrics(PrometheusFormatWriter writer, ScriptStats scriptsStats) { |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/PendingTasksMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse;
import org.elasticsearch.cluster.service.PendingClusterTask;
import org.elasticsearch.common.logging.Loggers;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import p... | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class PendingTasksMetricsGenerator extends MetricsGenerator<PendingClusterTasksResponse> {
private static final Logger logger = Loggers.getLogger(PendingTasksMetricsGenerator.class, "init");
@Override | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | public PrometheusFormatWriter generateMetrics(PrometheusFormatWriter writer, |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/PendingTasksMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse;
import org.elasticsearch.cluster.service.PendingClusterTask;
import org.elasticsearch.common.logging.Loggers;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import p... | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class PendingTasksMetricsGenerator extends MetricsGenerator<PendingClusterTasksResponse> {
private static final Logger logger = Loggers.getLogger(PendingTasksMetricsGenerator.class, "init");
@Override
public PrometheusFormatWriter gen... | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | SingleValueWriter esTasksTimeInQueueSeconds = writer |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/HttpMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.http.HttpStats;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter; | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class HttpMetricsGenerator extends MetricsGenerator<HttpStats> {
private static final Logger logger = Loggers.getLogger(HttpMetricsGenerator.class, "init");
@Override | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | public PrometheusFormatWriter generateMetrics(PrometheusFormatWriter writer, HttpStats httpStats) { |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/ProcessMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.monitor.process.ProcessStats;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter; | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
/*
Aligned with process data returned by JVM and golang clients
https://github.com/prometheus/client_java/blob/master/simpleclient_hotspot/src/main/java/io/prometheus/client/hotspot/StandardExports.java
https://github.com/prometheus/client_golang/blob... | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | public PrometheusFormatWriter generateMetrics(PrometheusFormatWriter writer, ProcessStats processStats) { |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/FsMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.monitor.fs.FsInfo;
import org.elasticsearch.monitor.fs.FsInfo.Path;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.... | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class FsMetricsGenerator extends MetricsGenerator<FsInfo> {
private static final Logger logger = Loggers.getLogger(FsMetricsGenerator.class, "init");
private static final String PATH_LABEL = "path";
@Override | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | public PrometheusFormatWriter generateMetrics(PrometheusFormatWriter writer, FsInfo fsInfo) { |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/FsMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.monitor.fs.FsInfo;
import org.elasticsearch.monitor.fs.FsInfo.Path;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.... | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class FsMetricsGenerator extends MetricsGenerator<FsInfo> {
private static final Logger logger = Loggers.getLogger(FsMetricsGenerator.class, "init");
private static final String PATH_LABEL = "path";
@Override
public PrometheusForma... | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | SingleValueWriter pathTotal = writer.addGauge("es_fs_path_total_bytes") |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/IndicesMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.index.cache.query.QueryCacheStats;
import org.elasticsearch.index.fielddata.FieldDataStats;
import org.elasticsearch.index.recovery.RecoveryStats;
import org.elasticsearch.index.search.stats.SearchStats;
im... | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class IndicesMetricsGenerator extends MetricsGenerator<NodeIndicesStats> {
private static final Logger logger = Loggers.getLogger(IndicesMetricsGenerator.class, "init");
@Override | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | public PrometheusFormatWriter generateMetrics(PrometheusFormatWriter writer, NodeIndicesStats indicesStats) { |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/TransportMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.transport.TransportStats;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter; | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class TransportMetricsGenerator extends MetricsGenerator<TransportStats>{
private static final Logger logger = Loggers.getLogger(OsMetricsGenerator.class, "init");
@Override | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | public PrometheusFormatWriter generateMetrics(PrometheusFormatWriter writer, TransportStats transportStats) { |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/ClusterStateMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import pl.suchenia.elasticsearchPrometheusMetrics.wr... | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class ClusterStateMetricsGenerator extends MetricsGenerator<ClusterState> {
private static final Logger logger = Loggers.getLogger(ClusterStateMetricsGenerator.class, "init");
@Override | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | public PrometheusFormatWriter generateMetrics(PrometheusFormatWriter writer, ClusterState clusterState) { |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/ClusterStateMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import pl.suchenia.elasticsearchPrometheusMetrics.wr... | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class ClusterStateMetricsGenerator extends MetricsGenerator<ClusterState> {
private static final Logger logger = Loggers.getLogger(ClusterStateMetricsGenerator.class, "init");
@Override
public PrometheusFormatWriter generateMetrics(Pro... | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | SingleValueWriter persistentGauge = writer.addGauge("es_cluster_persistent_settings") |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/StringBufferedRestHandler.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.rest.BytesRestResponse;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestHandler;
import org.elasticsearch.rest.RestRequest;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import java.... | package pl.suchenia.elasticsearchPrometheusMetrics;
@FunctionalInterface
public interface StringBufferedRestHandler extends RestHandler {
@Override
default void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception {
generateResponse(channel, client)
... | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | CompletableFuture<PrometheusFormatWriter> generateResponse(RestChannel channel, NodeClient client); |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/ThreadPoolMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.threadpool.ThreadPoolStats;
import org.elasticsearch.threadpool.ThreadPoolStats.Stats;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import pl.suchenia.elasticsearchPromet... | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class ThreadPoolMetricsGenerator extends MetricsGenerator<ThreadPoolStats> {
private static final Logger logger = Loggers.getLogger(ThreadPoolMetricsGenerator.class, "init");
private static final String LABEL_NAME = "threadpool";
@Over... | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | public PrometheusFormatWriter generateMetrics(PrometheusFormatWriter writer, ThreadPoolStats threadPoolStats) { |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/ThreadPoolMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.threadpool.ThreadPoolStats;
import org.elasticsearch.threadpool.ThreadPoolStats.Stats;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import pl.suchenia.elasticsearchPromet... | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class ThreadPoolMetricsGenerator extends MetricsGenerator<ThreadPoolStats> {
private static final Logger logger = Loggers.getLogger(ThreadPoolMetricsGenerator.class, "init");
private static final String LABEL_NAME = "threadpool";
@Over... | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | SingleValueWriter threads = writer.addGauge("es_threadpool_threads") |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/ClusterHealthMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.cluster.health.ClusterIndexHealth;
import org.elasticsearch.common.logging.Loggers;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import pl.such... | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class ClusterHealthMetricsGenerator extends MetricsGenerator<ClusterHealthResponse> {
private static final Logger logger = Loggers.getLogger(ClusterHealthMetricsGenerator.class, "init");
@Override | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | public PrometheusFormatWriter generateMetrics(PrometheusFormatWriter writer, ClusterHealthResponse clusterHealth) { |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/ClusterHealthMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.cluster.health.ClusterIndexHealth;
import org.elasticsearch.common.logging.Loggers;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import pl.such... |
//Nodes data
writer.addGauge("es_nodes")
.withHelp("Number of nodes in a cluster")
.value(clusterHealth.getNumberOfNodes());
writer.addGauge("es_data_nodes")
.withHelp("Number of data nodes in a cluster")
.value(clusterHealth.getN... | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | SingleValueWriter es_index_active_shards = writer.addGauge("es_index_active_shards") |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/CircuitBreakerMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.indices.breaker.AllCircuitBreakerStats;
import org.elasticsearch.indices.breaker.CircuitBreakerStats;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import pl.suchenia.elas... | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class CircuitBreakerMetricsGenerator extends MetricsGenerator<AllCircuitBreakerStats> {
private static final Logger logger = Loggers.getLogger(CircuitBreakerMetricsGenerator.class, "init");
private static final String LABEL_NAME = "circuit_... | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | public PrometheusFormatWriter generateMetrics(PrometheusFormatWriter writer, AllCircuitBreakerStats allStats) { |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/CircuitBreakerMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.indices.breaker.AllCircuitBreakerStats;
import org.elasticsearch.indices.breaker.CircuitBreakerStats;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import pl.suchenia.elas... | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class CircuitBreakerMetricsGenerator extends MetricsGenerator<AllCircuitBreakerStats> {
private static final Logger logger = Loggers.getLogger(CircuitBreakerMetricsGenerator.class, "init");
private static final String LABEL_NAME = "circuit_... | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | SingleValueWriter circuitBreakerLimit = writer |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/IngestMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.ingest.IngestStats;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.SingleValueWriter; | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class IngestMetricsGenerator extends MetricsGenerator<IngestStats> {
private static final Logger logger = Loggers.getLogger(IngestMetricsGenerator.class, "init");
@Override | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | public PrometheusFormatWriter generateMetrics(PrometheusFormatWriter writer, IngestStats ingestStats) { |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/IngestMetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.ingest.IngestStats;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.SingleValueWriter; | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class IngestMetricsGenerator extends MetricsGenerator<IngestStats> {
private static final Logger logger = Loggers.getLogger(IngestMetricsGenerator.class, "init");
@Override
public PrometheusFormatWriter generateMetrics(PrometheusFormat... | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | SingleValueWriter es_ingest_pipeline_count = writer.addCounter("es_ingest_pipeline_count") |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/NodeUsageGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.admin.cluster.node.usage.NodeUsage;
import org.elasticsearch.common.logging.Loggers;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.SingleValueWriter; | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class NodeUsageGenerator extends MetricsGenerator<NodeUsage> {
private static final Logger logger = Loggers.getLogger(NodeUsageGenerator.class, "init");
private static final String ENDPOINT_LABEL = "endpoint";
@Override | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | public PrometheusFormatWriter generateMetrics(PrometheusFormatWriter writer, NodeUsage nodeUsage) { |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/NodeUsageGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.admin.cluster.node.usage.NodeUsage;
import org.elasticsearch.common.logging.Loggers;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.SingleValueWriter; | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public class NodeUsageGenerator extends MetricsGenerator<NodeUsage> {
private static final Logger logger = Loggers.getLogger(NodeUsageGenerator.class, "init");
private static final String ENDPOINT_LABEL = "endpoint";
@Override
public Prom... | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | SingleValueWriter restActions = writer.addCounter("es_rest_count") |
jsuchenia/elasticsearch-prometheus-metrics | elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/generators/MetricsGenerator.java | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | import org.apache.logging.log4j.Logger;
import org.elasticsearch.common.logging.Loggers;
import pl.suchenia.elasticsearchPrometheusMetrics.writer.PrometheusFormatWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; | package pl.suchenia.elasticsearchPrometheusMetrics.generators;
public abstract class MetricsGenerator<T> {
private static final Logger logger = Loggers.getLogger(MetricsGenerator.class, "init");
static double getDynamicValue(Object obj, String methodName) {
try {
Method method = obj.getC... | // Path: elasticsearch-plugin/src/main/java/pl/suchenia/elasticsearchPrometheusMetrics/writer/PrometheusFormatWriter.java
// public class PrometheusFormatWriter {
// private final StringWriter writer = new StringWriter();
// private final Map<String, String> globalLabels;
//
// public PrometheusFormatWrite... | public abstract PrometheusFormatWriter generateMetrics(PrometheusFormatWriter writer, T inputData); |
jjenkov/butterfly-di-container | src/main/java/com/jenkov/container/impl/factory/FieldAssignmentFactory.java | // Path: src/main/java/com/jenkov/container/itf/factory/FactoryException.java
// public class FactoryException extends ContainerException {
// public FactoryException(String errorContext, String errorCode, String errorMessage) {
// super(errorContext, errorCode, errorMessage);
// }
//
// public Fac... | import com.jenkov.container.itf.factory.FactoryException;
import com.jenkov.container.itf.factory.ILocalFactory;
import java.lang.reflect.Field; | package com.jenkov.container.impl.factory;
/**
*/
public class FieldAssignmentFactory extends LocalFactoryBase implements ILocalFactory {
protected Field field = null;
protected Class fieldOwningClass = null;
protected ILocalFactory fieldAssig... | // Path: src/main/java/com/jenkov/container/itf/factory/FactoryException.java
// public class FactoryException extends ContainerException {
// public FactoryException(String errorContext, String errorCode, String errorMessage) {
// super(errorContext, errorCode, errorMessage);
// }
//
// public Fac... | throw new FactoryException( |
jjenkov/butterfly-di-container | src/test/java/com/jenkov/container/TestProduct.java | // Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
//
// /**
// * Adds a factory to the container using the given name.
// * @param name A name to identify the factory by.
// * @param factory A factory producing some component.
// */
// public void ... | import com.jenkov.container.IContainer;
import java.util.List;
import java.util.Set;
import java.net.URL; | package com.jenkov.container;
/**
* @author Jakob Jenkov - Copyright 2004-2006 Jenkov Development
*/
public class TestProduct {
public static final String FIELD_VALUE = "fieldValue";
protected TestProduct internalProduct = null;
protected String value1 = null;
protected String ... | // Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
//
// /**
// * Adds a factory to the container using the given name.
// * @param name A name to identify the factory by.
// * @param factory A factory producing some component.
// */
// public void ... | public IContainer container = null; |
jjenkov/butterfly-di-container | src/test/java/com/jenkov/container/script/InjectThreadLocalTest.java | // Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
//
// /**
// * Adds a factory to the container using the given name.
// * @param name A name to identify the factory by.
// * @param factory A factory producing some component.
// */
// public void ... | import junit.framework.TestCase;
import com.jenkov.container.IContainer;
import com.jenkov.container.Container; | package com.jenkov.container.script;
/**
*/
public class InjectThreadLocalTest extends TestCase {
public static final ThreadLocal<String> threadLocal = new ThreadLocal<String>();
protected String local3 = null;
public void testInjectThreadLocal() throws InterruptedException { | // Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
//
// /**
// * Adds a factory to the container using the given name.
// * @param name A name to identify the factory by.
// * @param factory A factory producing some component.
// */
// public void ... | final IContainer container = new Container(); |
jjenkov/butterfly-di-container | src/test/java/com/jenkov/container/script/InjectThreadLocalTest.java | // Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
//
// /**
// * Adds a factory to the container using the given name.
// * @param name A name to identify the factory by.
// * @param factory A factory producing some component.
// */
// public void ... | import junit.framework.TestCase;
import com.jenkov.container.IContainer;
import com.jenkov.container.Container; | package com.jenkov.container.script;
/**
*/
public class InjectThreadLocalTest extends TestCase {
public static final ThreadLocal<String> threadLocal = new ThreadLocal<String>();
protected String local3 = null;
public void testInjectThreadLocal() throws InterruptedException { | // Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
//
// /**
// * Adds a factory to the container using the given name.
// * @param name A name to identify the factory by.
// * @param factory A factory producing some component.
// */
// public void ... | final IContainer container = new Container(); |
jjenkov/butterfly-di-container | src/main/java/com/jenkov/container/impl/factory/FactoryBuilder.java | // Path: src/main/java/com/jenkov/container/itf/factory/ILocalFactory.java
// public interface ILocalFactory {
//
// public Class getReturnType();
//
// /**
// * This method is intended to be called *internally between* factories when creating
// * an instance of some class. It is not intended to b... | import com.jenkov.container.itf.factory.ILocalFactory;
import com.jenkov.container.script.ParserException;
import java.lang.reflect.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set; | package com.jenkov.container.impl.factory;
/**
* @author Jakob Jenkov - Copyright 2005 Jenkov Development
*/
public class FactoryBuilder {
// ConstructorFactory methods
public ILocalFactory createConstructorFactory(String className, List<ILocalFactory> constructorArgFactories, Class[] forcedArgumentTypes)... | // Path: src/main/java/com/jenkov/container/itf/factory/ILocalFactory.java
// public interface ILocalFactory {
//
// public Class getReturnType();
//
// /**
// * This method is intended to be called *internally between* factories when creating
// * an instance of some class. It is not intended to b... | throw new ParserException( |
jjenkov/butterfly-di-container | src/main/java/com/jenkov/container/impl/factory/ConstructorFactory.java | // Path: src/main/java/com/jenkov/container/itf/factory/FactoryException.java
// public class FactoryException extends ContainerException {
// public FactoryException(String errorContext, String errorCode, String errorMessage) {
// super(errorContext, errorCode, errorMessage);
// }
//
// public Fac... | import com.jenkov.container.itf.factory.FactoryException;
import com.jenkov.container.itf.factory.ILocalFactory;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.List; | this.constructor = contructor;
this.constructorArgFactories = contructorArgFactories;
}
public ConstructorFactory(Constructor constructor, ILocalFactory[] constructorArgFactories){
this.constructor = constructor;
for(ILocalFactory factory : constructorArgFactories){
... | // Path: src/main/java/com/jenkov/container/itf/factory/FactoryException.java
// public class FactoryException extends ContainerException {
// public FactoryException(String errorContext, String errorCode, String errorMessage) {
// super(errorContext, errorCode, errorMessage);
// }
//
// public Fac... | throw new FactoryException( |
jjenkov/butterfly-di-container | src/test/java/com/jenkov/container/script/Bugs.java | // Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
//
// /**
// * Adds a factory to the container using the given name.
// * @param name A name to identify the factory by.
// * @param factory A factory producing some component.
// */
// public void ... | import junit.framework.TestCase;
import com.jenkov.container.IContainer;
import com.jenkov.container.Container;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream; | package com.jenkov.container.script;
/**
*/
public class Bugs extends TestCase {
public void testExtraParanthesesErrorMessage(){ | // Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
//
// /**
// * Adds a factory to the container using the given name.
// * @param name A name to identify the factory by.
// * @param factory A factory producing some component.
// */
// public void ... | IContainer container = new Container(); |
jjenkov/butterfly-di-container | src/test/java/com/jenkov/container/script/Bugs.java | // Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
//
// /**
// * Adds a factory to the container using the given name.
// * @param name A name to identify the factory by.
// * @param factory A factory producing some component.
// */
// public void ... | import junit.framework.TestCase;
import com.jenkov.container.IContainer;
import com.jenkov.container.Container;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream; | package com.jenkov.container.script;
/**
*/
public class Bugs extends TestCase {
public void testExtraParanthesesErrorMessage(){ | // Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
//
// /**
// * Adds a factory to the container using the given name.
// * @param name A name to identify the factory by.
// * @param factory A factory producing some component.
// */
// public void ... | IContainer container = new Container(); |
jjenkov/butterfly-di-container | src/main/java/com/jenkov/container/impl/factory/FactoryUtil.java | // Path: src/main/java/com/jenkov/container/itf/factory/ILocalFactory.java
// public interface ILocalFactory {
//
// public Class getReturnType();
//
// /**
// * This method is intended to be called *internally between* factories when creating
// * an instance of some class. It is not intended to b... | import com.jenkov.container.impl.factory.convert.*;
import com.jenkov.container.itf.factory.ILocalFactory;
import java.net.URL;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.math.BigInteger;
import java.math.BigDecimal; | if("Short".equals(className)) return Short.class;
if("char".equals(className)) return char.class;
if("Character".equals(className)) return Character.class;
if("int".equals(className)) return int.class;
if("Integer".equals(className)) return Integer.class;
... | // Path: src/main/java/com/jenkov/container/itf/factory/ILocalFactory.java
// public interface ILocalFactory {
//
// public Class getReturnType();
//
// /**
// * This method is intended to be called *internally between* factories when creating
// * an instance of some class. It is not intended to b... | public static ILocalFactory createConversionFactory(ILocalFactory sourceFactory, Class returnType){ |
jjenkov/butterfly-di-container | src/main/java/com/jenkov/container/impl/factory/convert/UrlFactory.java | // Path: src/main/java/com/jenkov/container/impl/factory/LocalFactoryBase.java
// public abstract class LocalFactoryBase implements ILocalFactory {
//
// public abstract Class getReturnType();
//
// public abstract Object instance(Object[] parameters, Object[] localProducts);
// }
//
// Path: src/main/java/c... | import com.jenkov.container.impl.factory.LocalFactoryBase;
import com.jenkov.container.itf.factory.FactoryException;
import com.jenkov.container.itf.factory.ILocalFactory;
import java.net.MalformedURLException;
import java.net.URL; | package com.jenkov.container.impl.factory.convert;
/**
* @author Jakob Jenkov - Copyright 2005 Jenkov Development
*/
public class UrlFactory extends LocalFactoryBase implements ILocalFactory {
protected ILocalFactory sourceFactory = null;
public UrlFactory(ILocalFactory sourceFactory) {
this.sour... | // Path: src/main/java/com/jenkov/container/impl/factory/LocalFactoryBase.java
// public abstract class LocalFactoryBase implements ILocalFactory {
//
// public abstract Class getReturnType();
//
// public abstract Object instance(Object[] parameters, Object[] localProducts);
// }
//
// Path: src/main/java/c... | throw new FactoryException( |
jjenkov/butterfly-di-container | src/test/java/com/jenkov/container/script/TestThread.java | // Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
//
// /**
// * Adds a factory to the container using the given name.
// * @param name A name to identify the factory by.
// * @param factory A factory producing some component.
// */
// public void ... | import com.jenkov.container.IContainer; | package com.jenkov.container.script;
/**
* @author Jakob Jenkov - Copyright 2004-2006 Jenkov Development
*/
public class TestThread extends Thread{
protected Object instance1 = null;
protected Object instance2 = null;
protected String string1 = null;
protected String string2 = null;
| // Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
//
// /**
// * Adds a factory to the container using the given name.
// * @param name A name to identify the factory by.
// * @param factory A factory producing some component.
// */
// public void ... | protected IContainer container = null; |
jjenkov/butterfly-di-container | src/main/java/com/jenkov/container/impl/factory/FieldFactory.java | // Path: src/main/java/com/jenkov/container/itf/factory/FactoryException.java
// public class FactoryException extends ContainerException {
// public FactoryException(String errorContext, String errorCode, String errorMessage) {
// super(errorContext, errorCode, errorMessage);
// }
//
// public Fac... | import com.jenkov.container.itf.factory.FactoryException;
import com.jenkov.container.itf.factory.ILocalFactory;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.lang.reflect.ParameterizedType; | package com.jenkov.container.impl.factory;
/**
* @author Jakob Jenkov - Copyright 2005 Jenkov Development
*/
public class FieldFactory extends LocalFactoryBase implements ILocalFactory {
protected Field field = null;
protected Object fieldOwner = null;
protected ILocalFactory fi... | // Path: src/main/java/com/jenkov/container/itf/factory/FactoryException.java
// public class FactoryException extends ContainerException {
// public FactoryException(String errorContext, String errorCode, String errorMessage) {
// super(errorContext, errorCode, errorMessage);
// }
//
// public Fac... | throw new FactoryException( |
jjenkov/butterfly-di-container | src/main/java/com/jenkov/container/impl/factory/FlyweightKey.java | // Path: src/main/java/com/jenkov/container/itf/factory/FactoryException.java
// public class FactoryException extends ContainerException {
// public FactoryException(String errorContext, String errorCode, String errorMessage) {
// super(errorContext, errorCode, errorMessage);
// }
//
// public Fac... | import com.jenkov.container.itf.factory.FactoryException; | package com.jenkov.container.impl.factory;
/**
* @author Jakob Jenkov - Copyright 2004-2006 Jenkov Development
*/
public class FlyweightKey {
Object[] parameters = null;
int hashCode = 0;
public FlyweightKey(Object[] parameters) {
this.parameters = parameters;
for(in... | // Path: src/main/java/com/jenkov/container/itf/factory/FactoryException.java
// public class FactoryException extends ContainerException {
// public FactoryException(String errorContext, String errorCode, String errorMessage) {
// super(errorContext, errorCode, errorMessage);
// }
//
// public Fac... | if(parameters[i] == null) throw new FactoryException( |
jjenkov/butterfly-di-container | src/main/java/com/jenkov/container/impl/factory/StaticMethodFactory.java | // Path: src/main/java/com/jenkov/container/itf/factory/FactoryException.java
// public class FactoryException extends ContainerException {
// public FactoryException(String errorContext, String errorCode, String errorMessage) {
// super(errorContext, errorCode, errorMessage);
// }
//
// public Fac... | import com.jenkov.container.itf.factory.FactoryException;
import com.jenkov.container.itf.factory.ILocalFactory;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List; | package com.jenkov.container.impl.factory;
/**
*/
public class StaticMethodFactory extends LocalFactoryBase implements ILocalFactory {
protected Method method = null;
protected List<ILocalFactory> methodArgFactories = new ArrayList<ILocalFactory>();
public StaticMethodFactor... | // Path: src/main/java/com/jenkov/container/itf/factory/FactoryException.java
// public class FactoryException extends ContainerException {
// public FactoryException(String errorContext, String errorCode, String errorMessage) {
// super(errorContext, errorCode, errorMessage);
// }
//
// public Fac... | throw new FactoryException( |
jjenkov/butterfly-di-container | src/main/java/com/jenkov/container/impl/factory/LocalizedResourceFactory.java | // Path: src/main/java/com/jenkov/container/itf/factory/ILocalFactory.java
// public interface ILocalFactory {
//
// public Class getReturnType();
//
// /**
// * This method is intended to be called *internally between* factories when creating
// * an instance of some class. It is not intended to b... | import com.jenkov.container.itf.factory.ILocalFactory;
import com.jenkov.container.itf.factory.IGlobalFactory;
import java.util.Map;
import java.util.Locale; | package com.jenkov.container.impl.factory;
/**
* @author Jakob Jenkov - Copyright 2004-2006 Jenkov Development
*/
public class LocalizedResourceFactory extends LocalFactoryBase implements ILocalFactory {
protected ILocalFactory resourceMapFactory = null; | // Path: src/main/java/com/jenkov/container/itf/factory/ILocalFactory.java
// public interface ILocalFactory {
//
// public Class getReturnType();
//
// /**
// * This method is intended to be called *internally between* factories when creating
// * an instance of some class. It is not intended to b... | protected IGlobalFactory localeFactory = null; |
jjenkov/butterfly-di-container | src/test/java/com/jenkov/container/script/MathMaxTest.java | // Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
//
// /**
// * Adds a factory to the container using the given name.
// * @param name A name to identify the factory by.
// * @param factory A factory producing some component.
// */
// public void ... | import junit.framework.TestCase;
import com.jenkov.container.IContainer;
import com.jenkov.container.Container; | package com.jenkov.container.script;
/**
*/
public class MathMaxTest extends TestCase{
public void test(){ | // Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
//
// /**
// * Adds a factory to the container using the given name.
// * @param name A name to identify the factory by.
// * @param factory A factory producing some component.
// */
// public void ... | IContainer container = new Container(); |
jjenkov/butterfly-di-container | src/test/java/com/jenkov/container/script/MathMaxTest.java | // Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
//
// /**
// * Adds a factory to the container using the given name.
// * @param name A name to identify the factory by.
// * @param factory A factory producing some component.
// */
// public void ... | import junit.framework.TestCase;
import com.jenkov.container.IContainer;
import com.jenkov.container.Container; | package com.jenkov.container.script;
/**
*/
public class MathMaxTest extends TestCase{
public void test(){ | // Path: src/main/java/com/jenkov/container/IContainer.java
// public interface IContainer {
//
// /**
// * Adds a factory to the container using the given name.
// * @param name A name to identify the factory by.
// * @param factory A factory producing some component.
// */
// public void ... | IContainer container = new Container(); |
jjenkov/butterfly-di-container | src/test/java/com/jenkov/container/script/FieldGenericTypeTest.java | // Path: src/test/java/com/jenkov/container/TestProduct.java
// public class TestProduct {
//
// public static final String FIELD_VALUE = "fieldValue";
//
// protected TestProduct internalProduct = null;
// protected String value1 = null;
// protected String value2 = null;
... | import junit.framework.TestCase;
import com.jenkov.container.TestProduct;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.lang.reflect.ParameterizedType; | package com.jenkov.container.script;
/**
*/
public class FieldGenericTypeTest extends TestCase {
public void testGenericType() throws NoSuchFieldException {
| // Path: src/test/java/com/jenkov/container/TestProduct.java
// public class TestProduct {
//
// public static final String FIELD_VALUE = "fieldValue";
//
// protected TestProduct internalProduct = null;
// protected String value1 = null;
// protected String value2 = null;
... | Field listField = TestProduct.class.getField("normalList"); |
jjenkov/butterfly-di-container | src/main/java/com/jenkov/container/script/ScriptTokenizer.java | // Path: src/main/java/com/jenkov/container/script/ParserException.java
// public class ParserException extends ContainerException {
//
// public ParserException(String errorContext, String errorCode, String errorMessage) {
// super(errorContext, errorCode, errorMessage);
// }
//
// public ParserE... | import com.jenkov.container.script.ParserException; | } else {
unread(next);
return;
}
case 'F' :
case 'T' : if(token.length() == 1 && token.charAt(0) == '1'){ //if is thread singleton or flyweight.
... | // Path: src/main/java/com/jenkov/container/script/ParserException.java
// public class ParserException extends ContainerException {
//
// public ParserException(String errorContext, String errorCode, String errorMessage) {
// super(errorContext, errorCode, errorMessage);
// }
//
// public ParserE... | throw new ParserException( |
jjenkov/butterfly-di-container | src/main/java/com/jenkov/container/impl/factory/InstanceMethodFactory.java | // Path: src/main/java/com/jenkov/container/itf/factory/ILocalFactory.java
// public interface ILocalFactory {
//
// public Class getReturnType();
//
// /**
// * This method is intended to be called *internally between* factories when creating
// * an instance of some class. It is not intended to b... | import com.jenkov.container.itf.factory.ILocalFactory;
import com.jenkov.container.itf.factory.FactoryException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.ArrayList; | this.methodArgFactories = methodArgFactories;
}
public Class getReturnType() {
//if a method returns void, it should return the invocation target instead, enabling method chaining on methods returning void.
if(isVoidReturnType()){
return methodInvocationTargetFac... | // Path: src/main/java/com/jenkov/container/itf/factory/ILocalFactory.java
// public interface ILocalFactory {
//
// public Class getReturnType();
//
// /**
// * This method is intended to be called *internally between* factories when creating
// * an instance of some class. It is not intended to b... | throw new FactoryException( |
jjenkov/butterfly-di-container | src/main/java/com/jenkov/container/impl/factory/MethodFactory.java | // Path: src/main/java/com/jenkov/container/itf/factory/FactoryException.java
// public class FactoryException extends ContainerException {
// public FactoryException(String errorContext, String errorCode, String errorMessage) {
// super(errorContext, errorCode, errorMessage);
// }
//
// public Fac... | import com.jenkov.container.itf.factory.FactoryException;
import com.jenkov.container.itf.factory.ILocalFactory;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.TypeVariable;
import java.util.ArrayList;
import java.util.List; | //}
return this.method.getReturnType();
}
public Object instance(Object[] parameters, Object[] localProducts) {
Object[] arguments = FactoryUtil.toArgumentArray(this.methodArgFactories, parameters, localProducts);
try {
if(this.methodInvocationTargetFactory != null)... | // Path: src/main/java/com/jenkov/container/itf/factory/FactoryException.java
// public class FactoryException extends ContainerException {
// public FactoryException(String errorContext, String errorCode, String errorMessage) {
// super(errorContext, errorCode, errorMessage);
// }
//
// public Fac... | throw new FactoryException( |
jjenkov/butterfly-di-container | src/main/java/com/jenkov/container/script/ParserInput.java | // Path: src/main/java/com/jenkov/container/script/ParserException.java
// public class ParserException extends ContainerException {
//
// public ParserException(String errorContext, String errorCode, String errorMessage) {
// super(errorContext, errorCode, errorMessage);
// }
//
// public ParserE... | import com.jenkov.container.script.ParserException;
import java.io.*;
import java.util.Stack; | package com.jenkov.container.script;
/**
* @author Jakob Jenkov - Copyright 2004-2006 Jenkov Development
*/
public class ParserInput {
protected ScriptTokenizer scriptTokenizer = null;
protected Stack<ParserMark> marks = new Stack<ParserMark>();
/**
* @deprecated Use the constructor that takes ... | // Path: src/main/java/com/jenkov/container/script/ParserException.java
// public class ParserException extends ContainerException {
//
// public ParserException(String errorContext, String errorCode, String errorMessage) {
// super(errorContext, errorCode, errorMessage);
// }
//
// public ParserE... | throw new ParserException( |
meethai/mithai | src/main/java/edu/sjsu/mithai/export/HttpExporterTask.java | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | import edu.sjsu.mithai.config.Configuration;
import edu.sjsu.mithai.export.http.HttpExporter;
import edu.sjsu.mithai.spark.Store;
import edu.sjsu.mithai.util.StoppableRunnableTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; | package edu.sjsu.mithai.export;
public class HttpExporterTask extends StoppableRunnableTask {
private final Logger logger = LoggerFactory.getLogger(ExporterTask.class);
private static final String STOP_MESSAGE = "STOP";
| // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | private Configuration configuration; |
meethai/mithai | src/main/java/edu/sjsu/mithai/export/HttpExporterTask.java | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | import edu.sjsu.mithai.config.Configuration;
import edu.sjsu.mithai.export.http.HttpExporter;
import edu.sjsu.mithai.spark.Store;
import edu.sjsu.mithai.util.StoppableRunnableTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; | package edu.sjsu.mithai.export;
public class HttpExporterTask extends StoppableRunnableTask {
private final Logger logger = LoggerFactory.getLogger(ExporterTask.class);
private static final String STOP_MESSAGE = "STOP";
private Configuration configuration;
private IExporter exporter;
private Me... | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | exporter = new HttpExporter(); |
meethai/mithai | src/main/scala/edu/sjsu/mithai/mqtt/MQTTPublisherTask.java | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | import edu.sjsu.mithai.config.Configuration;
import edu.sjsu.mithai.export.ExporterTask;
import edu.sjsu.mithai.export.MessageStore;
import edu.sjsu.mithai.spark.Store;
import edu.sjsu.mithai.util.StoppableRunnableTask;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttSecur... | package edu.sjsu.mithai.mqtt;
public class MQTTPublisherTask extends StoppableRunnableTask {
private static final String STOP_MESSAGE = "STOP"; | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | private final Logger logger = LoggerFactory.getLogger(ExporterTask.class); |
meethai/mithai | src/main/scala/edu/sjsu/mithai/mqtt/MQTTPublisherTask.java | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | import edu.sjsu.mithai.config.Configuration;
import edu.sjsu.mithai.export.ExporterTask;
import edu.sjsu.mithai.export.MessageStore;
import edu.sjsu.mithai.spark.Store;
import edu.sjsu.mithai.util.StoppableRunnableTask;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttSecur... | package edu.sjsu.mithai.mqtt;
public class MQTTPublisherTask extends StoppableRunnableTask {
private static final String STOP_MESSAGE = "STOP";
private final Logger logger = LoggerFactory.getLogger(ExporterTask.class); | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | private Configuration configuration; |
meethai/mithai | src/main/scala/edu/sjsu/mithai/mqtt/MQTTPublisherTask.java | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | import edu.sjsu.mithai.config.Configuration;
import edu.sjsu.mithai.export.ExporterTask;
import edu.sjsu.mithai.export.MessageStore;
import edu.sjsu.mithai.spark.Store;
import edu.sjsu.mithai.util.StoppableRunnableTask;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttSecur... | package edu.sjsu.mithai.mqtt;
public class MQTTPublisherTask extends StoppableRunnableTask {
private static final String STOP_MESSAGE = "STOP";
private final Logger logger = LoggerFactory.getLogger(ExporterTask.class);
private Configuration configuration; | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | private MessageStore<Tuple2<String, String>> messageStore; |
meethai/mithai | src/test/avro/edu/sjsu/mithai/mqtt/MQTTMetaDataRecieverTaskTest.java | // Path: src/main/java/edu/sjsu/mithai/util/BaseTest.java
// public abstract class BaseTest {
//
// protected Configuration config;
//
// public BaseTest() throws IOException {
// loadConfig();
// }
//
// public abstract void test() throws Exception;
//
// public void loadConfig() throws... | import edu.sjsu.mithai.util.BaseTest;
import edu.sjsu.mithai.util.TaskManager;
import java.io.IOException; | package edu.sjsu.mithai.mqtt;
/**
* Created by kaustubh on 10/12/16.
*/
public class MQTTMetaDataRecieverTaskTest extends BaseTest{
public MQTTMetaDataRecieverTaskTest() throws IOException {
}
public static void main(String[] args) throws Exception {
new MQTTMetaDataRecieverTaskTest().test();... | // Path: src/main/java/edu/sjsu/mithai/util/BaseTest.java
// public abstract class BaseTest {
//
// protected Configuration config;
//
// public BaseTest() throws IOException {
// loadConfig();
// }
//
// public abstract void test() throws Exception;
//
// public void loadConfig() throws... | TaskManager.getInstance().submitTask(new MQTTMetaDataRecieverTask(config)); |
meethai/mithai | src/test/java/edu/sjsu/mithai/export/ExporterTaskTest.java | // Path: src/main/java/edu/sjsu/mithai/util/BaseTest.java
// public abstract class BaseTest {
//
// protected Configuration config;
//
// public BaseTest() throws IOException {
// loadConfig();
// }
//
// public abstract void test() throws Exception;
//
// public void loadConfig() throws... | import edu.sjsu.mithai.util.BaseTest;
import edu.sjsu.mithai.util.TaskManager;
import org.junit.Test;
import java.io.IOException; | package edu.sjsu.mithai.export;
public class ExporterTaskTest extends BaseTest {
public ExporterTaskTest() throws IOException {
}
@Test
@Override
public void test() throws Exception {
MessageStore messageStore = new MessageStore(10);
for (int i = 0; i < 10; i++) {
... | // Path: src/main/java/edu/sjsu/mithai/util/BaseTest.java
// public abstract class BaseTest {
//
// protected Configuration config;
//
// public BaseTest() throws IOException {
// loadConfig();
// }
//
// public abstract void test() throws Exception;
//
// public void loadConfig() throws... | TaskManager.getInstance().submitTask(new HttpExporterTask(config)); |
meethai/mithai | src/main/scala/edu/sjsu/mithai/data/AvroSerializationHelper.java | // Path: src/main/java/edu/sjsu/mithai/main/Mithai.java
// public class Mithai implements Observer {
//
// protected static Configuration configuration;
// protected SensorStore sensorStore;
//
//
// public static void main(String[] args) throws Exception {
// Mithai mithai = new Mithai();
// ... | import edu.sjsu.mithai.main.Mithai;
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericDatumReader;
import org.apache.avro.generic.GenericRecord;
import org.apache.avro.io.*;
import org.apache.avro.specific.SpecificDatumWriter;
import org.apache.log4j.Logger;
import java.io.ByteArrayOutputStream;
impo... | package edu.sjsu.mithai.data;
public class AvroSerializationHelper implements SerializationHelper<GenericRecord>{
private Schema schema;
private Logger logger = Logger.getLogger(getClass());
public void loadSchema(String schemaFile) throws IOException, URISyntaxException {
Schema.Parser parser ... | // Path: src/main/java/edu/sjsu/mithai/main/Mithai.java
// public class Mithai implements Observer {
//
// protected static Configuration configuration;
// protected SensorStore sensorStore;
//
//
// public static void main(String[] args) throws Exception {
// Mithai mithai = new Mithai();
// ... | File jarfile = new File(Mithai.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()); |
meethai/mithai | src/main/scala/edu/sjsu/mithai/data/MetadataGenerationTask.java | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import edu.sjsu.mithai.config.Configuration;
import edu.sjsu.mithai.config.MithaiProperties;
import edu.sjsu.mithai.mqtt.MQTTPublisher;
import edu.sjsu.mithai.mqtt.MqttService;
import edu.sjsu.mithai.util.StoppableExecut... | package edu.sjsu.mithai.data;
public class MetadataGenerationTask extends StoppableExecutableTask {
private static final String TOPIC = "metadata";
private final Gson gson; | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | private Configuration configuration; |
meethai/mithai | src/main/scala/edu/sjsu/mithai/data/MetadataGenerationTask.java | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import edu.sjsu.mithai.config.Configuration;
import edu.sjsu.mithai.config.MithaiProperties;
import edu.sjsu.mithai.mqtt.MQTTPublisher;
import edu.sjsu.mithai.mqtt.MqttService;
import edu.sjsu.mithai.util.StoppableExecut... | package edu.sjsu.mithai.data;
public class MetadataGenerationTask extends StoppableExecutableTask {
private static final String TOPIC = "metadata";
private final Gson gson;
private Configuration configuration;
private MQTTPublisher publisher;
private int sendCount;
private AvroMetadataSeriali... | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | this.publisher = MqttService.getPublisher(configuration); |
meethai/mithai | src/main/scala/edu/sjsu/mithai/data/MetadataGenerationTask.java | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import edu.sjsu.mithai.config.Configuration;
import edu.sjsu.mithai.config.MithaiProperties;
import edu.sjsu.mithai.mqtt.MQTTPublisher;
import edu.sjsu.mithai.mqtt.MqttService;
import edu.sjsu.mithai.util.StoppableExecut... | package edu.sjsu.mithai.data;
public class MetadataGenerationTask extends StoppableExecutableTask {
private static final String TOPIC = "metadata";
private final Gson gson;
private Configuration configuration;
private MQTTPublisher publisher;
private int sendCount;
private AvroMetadataSeriali... | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | if (++sendCount >= Integer.parseInt(configuration.getProperty(MithaiProperties.RESEND_COUNT))) { |
meethai/mithai | src/main/scala/edu/sjsu/mithai/mqtt/MqttService.java | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | import edu.sjsu.mithai.config.Configuration;
import edu.sjsu.mithai.config.MithaiProperties; | package edu.sjsu.mithai.mqtt;
public class MqttService {
private static MQTTPublisher publisher;
private MqttService() {
}
| // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | public static MQTTPublisher getPublisher(Configuration configuration) { |
meethai/mithai | src/main/scala/edu/sjsu/mithai/mqtt/MqttService.java | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | import edu.sjsu.mithai.config.Configuration;
import edu.sjsu.mithai.config.MithaiProperties; | package edu.sjsu.mithai.mqtt;
public class MqttService {
private static MQTTPublisher publisher;
private MqttService() {
}
public static MQTTPublisher getPublisher(Configuration configuration) {
if (publisher == null) { | // Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
//
// protected String propertyFile;
// protected Properties properties;
//
// public Configuration(String propertyFile) throws IOException {
// this.propertyFile = propertyFile;
// this.proper... | publisher = new MQTTPublisher(configuration.getProperty(MithaiProperties.MQTT_BROKER)); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.