Commit 7227f61b by amir

fix packages and add set/get port and domain in restclient,

inc version to 1.1.0
parent 03ecadaf
Showing with 133 additions and 79 deletions
group 'com.ipgallery.common'
version '1.0.0'
version '1.1.0'
apply plugin: 'java'
apply plugin: 'maven-publish'
......@@ -18,7 +18,8 @@ dependencies {
compile 'redis.clients:jedis:2.4.2'
compile 'com.fasterxml.jackson.core:jackson-databind:2.2.3'
compile 'com.googlecode.libphonenumber:libphonenumber:5.8'
compile 'com.google.gdata:gdata-core-1.0:1.36.0'
compile group: 'com.google.gdata', name: 'core', version: '1.47.1'
// compile 'com.google.gdata:gdata-core-1.0:1.36.0'
compile 'org.apache.httpcomponents:httpclient:4.1'
compile 'org.apache.httpcomponents:httpmime:4.1'
compile 'javax.ws.rs:javax.ws.rs-api:2.0'
......
package utils.common;
package common;
public interface CacheClient
{
......
package utils.common;
package common;
import java.util.Map.Entry;
import java.io.FileInputStream;
......
package utils.common;
package common;
import java.sql.Timestamp;
import java.text.DateFormat;
......
package common;
/**
* Created by amir on 09/06/16.
* this cache client is not persist, thus faster then redis
*/
public class GuavaCacheClient implements CacheClient{
public GuavaCacheClient() {
}
@Override
public void set(String key, String value) {
}
@Override
public void set(String key, String value, int expiration) {
}
@Override
public void setExpiration(String key, int expiration) {
}
@Override
public String get(String key) {
return null;
}
@Override
public void delete(String key) {
}
@Override
public void deleteByPattern(String pattern) {
}
@Override
public String[] getByPattern(String pattern) {
return new String[0];
}
}
package utils.common;
package common;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
......
package utils.common;
package common;
import java.io.File;
import java.util.Date;
import org.apache.commons.io.monitor.FileAlterationListener;
import org.apache.commons.io.monitor.FileAlterationObserver;
/**
* @author ziv
*
*/
public class Log4jFileAlterationListenerImpl implements FileAlterationListener {
......@@ -63,8 +64,7 @@ public class Log4jFileAlterationListenerImpl implements FileAlterationListener {
@Override
public void onFileChange(final File file) {
String fileName = file.getAbsolutePath();
if ( !fileName.endsWith("~") )
{//don't allow changes from the linux automatic backup file
if (!fileName.endsWith("~")) {//don't allow changes from the linux automatic backup file
// logger.debug(fileName + " was modified.");
// logger.debug("----------> length: " + file.length());
// logger.debug("----------> last modified: " + new Date(file.lastModified()));
......@@ -73,8 +73,8 @@ public class Log4jFileAlterationListenerImpl implements FileAlterationListener {
// logger.debug("----------> executable: " + file.canExecute());
try {
org.apache.log4j.xml.DOMConfigurator.configure(fileName);
logger.warning( "Log4j configuration has been reloaded from file < "+ fileName + " >.");
}catch(Exception e) {
logger.warning("Log4j configuration has been reloaded from file < " + fileName + " >.");
} catch (Exception e) {
logger.debug("Failed to load XML File with exception: " + e);
}
}
......
package utils.common;
package common;
import java.io.File;
......
package utils.common;
package common;
import java.io.File;
......
package utils.common;
package common;
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
......
package utils.common;
package common;
import org.apache.log4j.FileAppender;
import org.apache.log4j.LogManager;
......
package utils.common;
package common;
import java.net.InetAddress;
import java.net.UnknownHostException;
......
package utils.common;
package common;
import java.util.Set;
......
package utils.common;
package common;
import java.io.IOException;
import java.util.logging.FileHandler;
......
package utils.common;
package common;
import java.io.File;
import java.io.IOException;
......
package utils.common.configuration;
package common.configuration;
import java.io.File;
import java.io.FileInputStream;
......
package utils.common.configuration;
package common.configuration;
public interface ConfigPropertiesChangeListener
{
......
package utils.common.configuration;
package common.configuration;
/**
* Created by amir on 04/04/16.
......
package utils.common.configuration;
package common.configuration;
import java.util.List;
import java.util.Map;
......
package utils.common.configuration;
package common.configuration;
/**
* Created by amir on 04/04/16.
......
/**
*
*/
/**
* @author adi
*
*/
package utils.common;
\ No newline at end of file
package utils.common;
package common;
import java.util.UUID;
......
package utils.http;
package http;
public class HttpConst {
......
package utils.http;
package http;
public class StringResponse {
......
package utils.http.simpleHttpClient;
package http.simpleHttpClient;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
//import javax.ws.rs.core.HttpHeaders;
//import javax.ws.rs.core.MediaType;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.List;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.client.CookieStore;
//import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
......@@ -22,8 +11,17 @@ import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.cookie.Cookie;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import utils.http.simpleHttpClient.SimpleHttpRequest;
import utils.http.simpleHttpClient.SimpleHttpResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.List;
//import javax.ws.rs.core.HttpHeaders;
//import javax.ws.rs.core.MediaType;
//import org.apache.http.client.methods.HttpGet;
public class SimpleHttpClient {
......
package utils.http.simpleHttpClient;
package http.simpleHttpClient;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
......
package utils.http.simpleHttpClient;
package http.simpleHttpClient;
import java.util.List;
import java.util.Map;
......
package utils.http.simpleRestClient;
package http.simpleRestClient;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
......@@ -9,10 +9,10 @@ import java.util.Map.Entry;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import utils.http.StringResponse;
import utils.http.simpleHttpClient.SimpleHttpClient;
import utils.http.simpleHttpClient.SimpleHttpRequest;
import utils.http.simpleHttpClient.SimpleHttpResponse;
import http.StringResponse;
import http.simpleHttpClient.SimpleHttpClient;
import http.simpleHttpClient.SimpleHttpRequest;
import http.simpleHttpClient.SimpleHttpResponse;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.JsonParser;
......@@ -49,6 +49,23 @@ import com.google.gdata.util.common.base.PercentEscaper;
this.headers = new HashMap<String, String>();
this.headers.put(headerName, headerValue);
}
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
/******************************************************************************
*
* HTTP get methods
......
package utils.http.simpleRestClient;
package http.simpleRestClient;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
......
package utils.itm;
package itm;
/*
*
......@@ -12,7 +12,7 @@ import java.util.List;
import java.util.logging.Level;
import java.util.concurrent.Semaphore;
import utils.common.SimpleLogger;
import common.SimpleLogger;
import itc.ItcMessage;
import itc.ItcMessageQueue;
......
package utils.itm;
package itm;
import java.io.Serializable;
......
package utils.itm;
package itm;
import java.io.IOException;
import java.util.concurrent.Semaphore;
......@@ -6,7 +6,7 @@ import java.util.logging.Level;
import com.fasterxml.jackson.core.JsonParseException;
import utils.common.SimpleLogger;
import common.SimpleLogger;
import itc.ItcMessage;
import itc.ItcMessageQueue;
......
package utils.mtqm;
package mtqm;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import utils.common.Log4jHandler;
import common.Log4jHandler;
public class MultiThreadQueueHander
......
package utils.mtqm;
package mtqm;
import itc.ItcMessage;
import itc.ItcMessageQueue;
......@@ -7,7 +7,7 @@ import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import utils.common.Log4jHandler;
import common.Log4jHandler;
/**
* this manager holds thread that handle async jobs
......@@ -187,7 +187,7 @@ public class MultiThreadQueueManager
public int getQueueNumber(String key)
{
return (utils.common.General.abs(key.hashCode()) % this.mNumOfThreads);
return (common.General.abs(key.hashCode()) % this.mNumOfThreads);
}
/**
......
package utils.otm;
package otm;
public abstract class IOfflineTaskJob implements Runnable
{
......
package utils.otm;
package otm;
import java.util.TimerTask;
......
package utils.otm;
package otm;
import itc.ItcMessage;
import itc.ItcMessageQueue;
......@@ -11,8 +11,8 @@ import java.util.Set;
import java.util.Timer;
import java.util.concurrent.atomic.AtomicInteger;
import utils.common.Log4jHandler;
import utils.mtqm.MultiThreadQueueManager;
import common.Log4jHandler;
import mtqm.MultiThreadQueueManager;
/**
* need to change to ScheduledThreadPoolExecutor and concurrent hash map
......
package utils.timerManager;
package timerManager;
public interface ITimerEventListener
{
......
package utils.timerManager;
package timerManager;
import java.util.Map;
import java.util.UUID;
import utils.common.Log4jHandler;
import utils.otm.IOfflineTaskJob;
import utils.otm.OfflineTaskManager;
import common.Log4jHandler;
import otm.IOfflineTaskJob;
import otm.OfflineTaskManager;
/**
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment