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 |
|---|---|---|---|---|---|---|
jenkinsci/disk-usage-plugin | src/main/java/hudson/plugins/disk_usage/DiskUsageJenkinsAction.java | // Path: src/main/java/hudson/plugins/disk_usage/unused/DiskUsageNotUsedDataCalculationThread.java
// @Extension
// public class DiskUsageNotUsedDataCalculationThread extends DiskUsageCalculation {
//
// //last scheduled task;
// private static DiskUsageCalculation currentTask;
//
// public DiskUsageNotUsedDataCalculationThread(){
// super("Calculation of not used data");
// }
//
// @Override
// public DiskUsageCalculation getLastTask() {
// return currentTask;
// }
//
// public CronTab getCronTab() throws ANTLRException{
// if(!DiskUsageProjectActionFactory.DESCRIPTOR.isCalculationNotUsedDataEnabled()){
// return new CronTab("0 1 * * 7");
// }
// String cron = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class).getConfiguration().getCountIntervalForNotUsedData();
// CronTab tab = new CronTab(cron);
// return tab;
// }
//
// @Override
// protected void execute(TaskListener tl) throws IOException, InterruptedException {
// if(!isCancelled() && startExecution()){
// for(Item item : Jenkins.getInstance().getItems()){
// if(item instanceof AbstractProject){
// ProjectBuildChecker.valideBuildData((AbstractProject)item);
// }
// }
// }
// DiskUsageUtil.calculateDiskUsageNotLoadedJobs(Jenkins.getInstance());
// DiskUsageJenkinsAction.getInstance().actualizeCashedNotLoadedJobsData();
// // plugin.getNotUsedDataDiskUsage().save();
// }
//
//
//
// @Override
// public AperiodicWork getNewInstance() {
// if(currentTask!=null){
// currentTask.cancel();
// }
// else{
// cancel();
// }
// currentTask = new DiskUsageNotUsedDataCalculationThread();
// return currentTask;
// }
//
// private boolean startExecution(){
// DiskUsagePlugin plugin = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class);
// if(!plugin.getConfiguration().isCalculationNotUsedDataEnabled())
// return false;
// return !isExecutingMoreThenOneTimes();
// }
//
//
//
// }
| import hudson.Extension;
import hudson.model.Action;
import hudson.model.AperiodicWork;
import hudson.model.RootAction;
import hudson.plugins.disk_usage.unused.DiskUsageNotUsedDataCalculationThread;
import hudson.util.Graph;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import javax.servlet.ServletException;
import jenkins.model.Jenkins;
import org.jfree.data.category.DefaultCategoryDataset;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse; | datasetW.addValue(((Long) usage.getNonSlaveWorkspacesUsage()) / baseWorkspace, "non slave workspaces", label);
}
//add current state
if(getConfiguration().getShowFreeSpaceForJobDirectory()){
dataset.addValue(((Long) jobsDir.getTotalSpace()) / base, "space for jobs directory", "current");
}
dataset.addValue(((Long) getAllDiskUsage(true)) / base, "all jobs", "current");
dataset.addValue(((Long) getBuildsDiskUsage(null, null, true).get("all")) / base, "all builds", "current");
datasetW.addValue(((Long) getAllDiskUsageWorkspace(true)) / baseWorkspace, "slave workspaces", "current");
datasetW.addValue(((Long) getAllCustomOrNonSlaveWorkspaces(true)) / baseWorkspace, "non slave workspaces", "current");
return new DiskUsageGraph(dataset, unit, datasetW, unitWorkspace);
}
public DiskUsageProjectActionFactory.DescriptorImpl getConfiguration(){
return DiskUsageProjectActionFactory.DESCRIPTOR;
}
public BuildDiskUsageCalculationThread getBuildsDiskUsageThread(){
return AperiodicWork.all().get(BuildDiskUsageCalculationThread.class);
}
public JobWithoutBuildsDiskUsageCalculation getJobsDiskUsageThread(){
return AperiodicWork.all().get(JobWithoutBuildsDiskUsageCalculation.class);
}
public WorkspaceDiskUsageCalculationThread getWorkspaceDiskUsageThread(){
return AperiodicWork.all().get(WorkspaceDiskUsageCalculationThread.class);
}
| // Path: src/main/java/hudson/plugins/disk_usage/unused/DiskUsageNotUsedDataCalculationThread.java
// @Extension
// public class DiskUsageNotUsedDataCalculationThread extends DiskUsageCalculation {
//
// //last scheduled task;
// private static DiskUsageCalculation currentTask;
//
// public DiskUsageNotUsedDataCalculationThread(){
// super("Calculation of not used data");
// }
//
// @Override
// public DiskUsageCalculation getLastTask() {
// return currentTask;
// }
//
// public CronTab getCronTab() throws ANTLRException{
// if(!DiskUsageProjectActionFactory.DESCRIPTOR.isCalculationNotUsedDataEnabled()){
// return new CronTab("0 1 * * 7");
// }
// String cron = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class).getConfiguration().getCountIntervalForNotUsedData();
// CronTab tab = new CronTab(cron);
// return tab;
// }
//
// @Override
// protected void execute(TaskListener tl) throws IOException, InterruptedException {
// if(!isCancelled() && startExecution()){
// for(Item item : Jenkins.getInstance().getItems()){
// if(item instanceof AbstractProject){
// ProjectBuildChecker.valideBuildData((AbstractProject)item);
// }
// }
// }
// DiskUsageUtil.calculateDiskUsageNotLoadedJobs(Jenkins.getInstance());
// DiskUsageJenkinsAction.getInstance().actualizeCashedNotLoadedJobsData();
// // plugin.getNotUsedDataDiskUsage().save();
// }
//
//
//
// @Override
// public AperiodicWork getNewInstance() {
// if(currentTask!=null){
// currentTask.cancel();
// }
// else{
// cancel();
// }
// currentTask = new DiskUsageNotUsedDataCalculationThread();
// return currentTask;
// }
//
// private boolean startExecution(){
// DiskUsagePlugin plugin = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class);
// if(!plugin.getConfiguration().isCalculationNotUsedDataEnabled())
// return false;
// return !isExecutingMoreThenOneTimes();
// }
//
//
//
// }
// Path: src/main/java/hudson/plugins/disk_usage/DiskUsageJenkinsAction.java
import hudson.Extension;
import hudson.model.Action;
import hudson.model.AperiodicWork;
import hudson.model.RootAction;
import hudson.plugins.disk_usage.unused.DiskUsageNotUsedDataCalculationThread;
import hudson.util.Graph;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import javax.servlet.ServletException;
import jenkins.model.Jenkins;
import org.jfree.data.category.DefaultCategoryDataset;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
datasetW.addValue(((Long) usage.getNonSlaveWorkspacesUsage()) / baseWorkspace, "non slave workspaces", label);
}
//add current state
if(getConfiguration().getShowFreeSpaceForJobDirectory()){
dataset.addValue(((Long) jobsDir.getTotalSpace()) / base, "space for jobs directory", "current");
}
dataset.addValue(((Long) getAllDiskUsage(true)) / base, "all jobs", "current");
dataset.addValue(((Long) getBuildsDiskUsage(null, null, true).get("all")) / base, "all builds", "current");
datasetW.addValue(((Long) getAllDiskUsageWorkspace(true)) / baseWorkspace, "slave workspaces", "current");
datasetW.addValue(((Long) getAllCustomOrNonSlaveWorkspaces(true)) / baseWorkspace, "non slave workspaces", "current");
return new DiskUsageGraph(dataset, unit, datasetW, unitWorkspace);
}
public DiskUsageProjectActionFactory.DescriptorImpl getConfiguration(){
return DiskUsageProjectActionFactory.DESCRIPTOR;
}
public BuildDiskUsageCalculationThread getBuildsDiskUsageThread(){
return AperiodicWork.all().get(BuildDiskUsageCalculationThread.class);
}
public JobWithoutBuildsDiskUsageCalculation getJobsDiskUsageThread(){
return AperiodicWork.all().get(JobWithoutBuildsDiskUsageCalculation.class);
}
public WorkspaceDiskUsageCalculationThread getWorkspaceDiskUsageThread(){
return AperiodicWork.all().get(WorkspaceDiskUsageCalculationThread.class);
}
| public DiskUsageNotUsedDataCalculationThread getNotUsedDataDiskUsageThread(){ |
jenkinsci/disk-usage-plugin | src/main/java/hudson/plugins/disk_usage/configuration/BuildConfiguration.java | // Path: src/main/java/hudson/plugins/disk_usage/BuildDiskUsageCalculationThread.java
// @Extension
// public class BuildDiskUsageCalculationThread extends DiskUsageCalculation {
//
// //last scheduled task;
// private static DiskUsageCalculation currentTask;
//
// public BuildDiskUsageCalculationThread(){
// super("Calculation of builds disk usage");
// }
//
// @Override
// public void execute(TaskListener listener) throws IOException, InterruptedException {
// if(!isCancelled() && startExecution()){
// try{
// List<Item> items = new ArrayList<Item>();
// ItemGroup<? extends Item> itemGroup = Jenkins.getInstance();
// items.addAll(DiskUsageUtil.getAllProjects(itemGroup));
// for (Object item : items) {
// if (item instanceof AbstractProject) {
// AbstractProject project = (AbstractProject) item;
// // if (!project.isBuilding()) {
// DiskUsageProperty property = DiskUsageUtil.getDiskUsageProperty(project);
// ProjectDiskUsage diskUsage = property.getProjectDiskUsage();
// if(DiskUsageProjectActionFactory.DESCRIPTOR.getConfiguration().getJobConfiguration().getBuildConfiguration().isInfoAboutBuildsExact()){
// for(DiskUsageBuildInformation information: diskUsage.getBuildDiskUsage(true)){
// Map<Integer,AbstractBuild> loadedBuilds = project._getRuns().getLoadedBuilds();
// AbstractBuild build = loadedBuilds.get(information.getNumber());
// //do not calculat builds in progress
// if(build!=null && build.isBuilding()){
// continue;
// }
// try{
// DiskUsageUtil.calculateDiskUsageForBuild(information.getId(), project);
// }
// catch(Exception e){
// logger.log(Level.WARNING, "Error when recording disk usage for " + project.getName(), e);
// }
// }
//
// }
// else{
// File buildDir = project.getBuildDir();
// for(File build : buildDir.listFiles()){
// if(DiskUsageUtil.isBuildDirName(build)){
// DiskUsageBuildInformation info = diskUsage.getDiskUsageBuildInformation(build.getName());
// if(info==null){
// info = new DiskUsageBuildInformation(build.getName());
// diskUsage.addNotExactBuildInformation(info);
//
// }
// Map<Integer,Run> loadedBuilds = project._getRuns().getLoadedBuilds();
// for(Run run : loadedBuilds.values()){
// if(run.getRootDir().getAbsolutePath().equals(build.getAbsolutePath())){
// info.obtainInformation(run);
// }
// }
// DiskUsageUtil.calculateDiskUsageForBuild(build.getName(), project);
// }
// else{
// diskUsage.addNotLoadedBuild(build,DiskUsageUtil.getFileSize(build, Collections.EMPTY_LIST));
// }
// }
// }
// }
// }
// } catch (Exception ex) {
// logger.log(Level.WARNING, "Error when recording disk usage for builds", ex);
// }
// DiskUsageJenkinsAction.getInstance().actualizeCashedBuildsData();
// }
// else{
// DiskUsagePlugin plugin = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class);
// if(plugin.getConfiguration().isCalculationBuildsEnabled()){
// logger.log(Level.FINER, "Calculation of builds is already in progress.");
// }
// else{
// logger.log(Level.FINER, "Calculation of builds is disabled.");
// }
// }
// }
//
// public CronTab getCronTab() throws ANTLRException{
// if(!DiskUsageProjectActionFactory.DESCRIPTOR.isCalculationBuildsEnabled()){
// return new CronTab("0 1 * * 7");
// }
// String cron = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class).getConfiguration().getCountIntervalForBuilds();
// CronTab tab = new CronTab(cron);
// return tab;
// }
//
// @Override
// public AperiodicWork getNewInstance() {
// if(currentTask!=null){
// currentTask.cancel();
// }
// else{
// cancel();
// }
// currentTask = new BuildDiskUsageCalculationThread();
// return currentTask;
// }
//
// @Override
// public DiskUsageCalculation getLastTask() {
// return currentTask;
// }
//
// private boolean startExecution(){
// DiskUsagePlugin plugin = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class);
// if(!plugin.getConfiguration().isCalculationBuildsEnabled()) {
// return false;
// }
// return !isExecutingMoreThenOneTimes();
// }
//
// }
| import hudson.model.AperiodicWork;
import hudson.plugins.disk_usage.BuildDiskUsageCalculationThread;
import net.sf.json.JSONObject; | }
public boolean isInfoAboutBuildsExact(){
return exactInfoAboutBuilds;
}
public boolean isBuildsCalculated(){
return countIntervalBuilds!=null;
}
public boolean areBuildsRecalculated(){
return countIntervalBuilds!=null;
}
public String getCalculationInterval(){
return countIntervalBuilds;
}
public void enableRecalculation(){
countIntervalBuilds = "0 */6 * * *";
}
public void disableRecalculation(){
countIntervalBuilds = null;
}
public static BuildConfiguration configureBuildsCalculation(JSONObject form, BuildConfiguration oldConfiguration){
if(form==null || form.isNullObject()){ | // Path: src/main/java/hudson/plugins/disk_usage/BuildDiskUsageCalculationThread.java
// @Extension
// public class BuildDiskUsageCalculationThread extends DiskUsageCalculation {
//
// //last scheduled task;
// private static DiskUsageCalculation currentTask;
//
// public BuildDiskUsageCalculationThread(){
// super("Calculation of builds disk usage");
// }
//
// @Override
// public void execute(TaskListener listener) throws IOException, InterruptedException {
// if(!isCancelled() && startExecution()){
// try{
// List<Item> items = new ArrayList<Item>();
// ItemGroup<? extends Item> itemGroup = Jenkins.getInstance();
// items.addAll(DiskUsageUtil.getAllProjects(itemGroup));
// for (Object item : items) {
// if (item instanceof AbstractProject) {
// AbstractProject project = (AbstractProject) item;
// // if (!project.isBuilding()) {
// DiskUsageProperty property = DiskUsageUtil.getDiskUsageProperty(project);
// ProjectDiskUsage diskUsage = property.getProjectDiskUsage();
// if(DiskUsageProjectActionFactory.DESCRIPTOR.getConfiguration().getJobConfiguration().getBuildConfiguration().isInfoAboutBuildsExact()){
// for(DiskUsageBuildInformation information: diskUsage.getBuildDiskUsage(true)){
// Map<Integer,AbstractBuild> loadedBuilds = project._getRuns().getLoadedBuilds();
// AbstractBuild build = loadedBuilds.get(information.getNumber());
// //do not calculat builds in progress
// if(build!=null && build.isBuilding()){
// continue;
// }
// try{
// DiskUsageUtil.calculateDiskUsageForBuild(information.getId(), project);
// }
// catch(Exception e){
// logger.log(Level.WARNING, "Error when recording disk usage for " + project.getName(), e);
// }
// }
//
// }
// else{
// File buildDir = project.getBuildDir();
// for(File build : buildDir.listFiles()){
// if(DiskUsageUtil.isBuildDirName(build)){
// DiskUsageBuildInformation info = diskUsage.getDiskUsageBuildInformation(build.getName());
// if(info==null){
// info = new DiskUsageBuildInformation(build.getName());
// diskUsage.addNotExactBuildInformation(info);
//
// }
// Map<Integer,Run> loadedBuilds = project._getRuns().getLoadedBuilds();
// for(Run run : loadedBuilds.values()){
// if(run.getRootDir().getAbsolutePath().equals(build.getAbsolutePath())){
// info.obtainInformation(run);
// }
// }
// DiskUsageUtil.calculateDiskUsageForBuild(build.getName(), project);
// }
// else{
// diskUsage.addNotLoadedBuild(build,DiskUsageUtil.getFileSize(build, Collections.EMPTY_LIST));
// }
// }
// }
// }
// }
// } catch (Exception ex) {
// logger.log(Level.WARNING, "Error when recording disk usage for builds", ex);
// }
// DiskUsageJenkinsAction.getInstance().actualizeCashedBuildsData();
// }
// else{
// DiskUsagePlugin plugin = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class);
// if(plugin.getConfiguration().isCalculationBuildsEnabled()){
// logger.log(Level.FINER, "Calculation of builds is already in progress.");
// }
// else{
// logger.log(Level.FINER, "Calculation of builds is disabled.");
// }
// }
// }
//
// public CronTab getCronTab() throws ANTLRException{
// if(!DiskUsageProjectActionFactory.DESCRIPTOR.isCalculationBuildsEnabled()){
// return new CronTab("0 1 * * 7");
// }
// String cron = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class).getConfiguration().getCountIntervalForBuilds();
// CronTab tab = new CronTab(cron);
// return tab;
// }
//
// @Override
// public AperiodicWork getNewInstance() {
// if(currentTask!=null){
// currentTask.cancel();
// }
// else{
// cancel();
// }
// currentTask = new BuildDiskUsageCalculationThread();
// return currentTask;
// }
//
// @Override
// public DiskUsageCalculation getLastTask() {
// return currentTask;
// }
//
// private boolean startExecution(){
// DiskUsagePlugin plugin = Jenkins.getInstance().getPlugin(DiskUsagePlugin.class);
// if(!plugin.getConfiguration().isCalculationBuildsEnabled()) {
// return false;
// }
// return !isExecutingMoreThenOneTimes();
// }
//
// }
// Path: src/main/java/hudson/plugins/disk_usage/configuration/BuildConfiguration.java
import hudson.model.AperiodicWork;
import hudson.plugins.disk_usage.BuildDiskUsageCalculationThread;
import net.sf.json.JSONObject;
}
public boolean isInfoAboutBuildsExact(){
return exactInfoAboutBuilds;
}
public boolean isBuildsCalculated(){
return countIntervalBuilds!=null;
}
public boolean areBuildsRecalculated(){
return countIntervalBuilds!=null;
}
public String getCalculationInterval(){
return countIntervalBuilds;
}
public void enableRecalculation(){
countIntervalBuilds = "0 */6 * * *";
}
public void disableRecalculation(){
countIntervalBuilds = null;
}
public static BuildConfiguration configureBuildsCalculation(JSONObject form, BuildConfiguration oldConfiguration){
if(form==null || form.isNullObject()){ | AperiodicWork.all().get(BuildDiskUsageCalculationThread.class).cancel(); |
jenkinsci/disk-usage-plugin | src/main/java/hudson/plugins/disk_usage/DiskUsageBuildListener.java | // Path: src/main/java/hudson/plugins/disk_usage/project/DiskUsagePostBuildCalculation.java
// public class DiskUsagePostBuildCalculation extends Recorder{
//
// public DiskUsagePostBuildCalculation(){
// }
//
// @Override
// public boolean perform(Build<?, ?> build, Launcher launcher, BuildListener listener){
// listener.getLogger().println("append disk usage");
// DiskUsageUtil.calculationDiskUsageOfBuild(build, listener);
// DiskUsageJenkinsAction.getInstance().actualizeCashedBuildsData();
// return true;
// }
//
//
//
// @Override
// public BuildStepMonitor getRequiredMonitorService() {
// return BuildStepMonitor.NONE;
// }
//
//
// @Extension
// public static class DescriptorImpl extends BuildStepDescriptor<Publisher> {
// public String getDisplayName() {
// return "Calculate disk usage of build";
// }
//
// @Override
// public DiskUsagePostBuildCalculation newInstance(StaplerRequest req, JSONObject formData) throws FormException {
// return new DiskUsagePostBuildCalculation();
// }
//
// @Override
// public boolean isApplicable(Class<? extends AbstractProject> jobType) {
// return true;
// }
// }
//
// }
| import hudson.Extension;
import hudson.model.AbstractBuild;
import hudson.model.TaskListener;
import hudson.model.listeners.RunListener;
import hudson.plugins.disk_usage.project.DiskUsagePostBuildCalculation;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger; | package hudson.plugins.disk_usage;
/**
* Build listener for calculation build disk usage
*
* @author Lucie Votypkova
*/
@Extension
public class DiskUsageBuildListener extends RunListener<AbstractBuild>{
@Override
public void onCompleted(AbstractBuild build, TaskListener listener){
Long diskUsage = build.getAction(BuildDiskUsageAction.class).getDiskUsage(); | // Path: src/main/java/hudson/plugins/disk_usage/project/DiskUsagePostBuildCalculation.java
// public class DiskUsagePostBuildCalculation extends Recorder{
//
// public DiskUsagePostBuildCalculation(){
// }
//
// @Override
// public boolean perform(Build<?, ?> build, Launcher launcher, BuildListener listener){
// listener.getLogger().println("append disk usage");
// DiskUsageUtil.calculationDiskUsageOfBuild(build, listener);
// DiskUsageJenkinsAction.getInstance().actualizeCashedBuildsData();
// return true;
// }
//
//
//
// @Override
// public BuildStepMonitor getRequiredMonitorService() {
// return BuildStepMonitor.NONE;
// }
//
//
// @Extension
// public static class DescriptorImpl extends BuildStepDescriptor<Publisher> {
// public String getDisplayName() {
// return "Calculate disk usage of build";
// }
//
// @Override
// public DiskUsagePostBuildCalculation newInstance(StaplerRequest req, JSONObject formData) throws FormException {
// return new DiskUsagePostBuildCalculation();
// }
//
// @Override
// public boolean isApplicable(Class<? extends AbstractProject> jobType) {
// return true;
// }
// }
//
// }
// Path: src/main/java/hudson/plugins/disk_usage/DiskUsageBuildListener.java
import hudson.Extension;
import hudson.model.AbstractBuild;
import hudson.model.TaskListener;
import hudson.model.listeners.RunListener;
import hudson.plugins.disk_usage.project.DiskUsagePostBuildCalculation;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
package hudson.plugins.disk_usage;
/**
* Build listener for calculation build disk usage
*
* @author Lucie Votypkova
*/
@Extension
public class DiskUsageBuildListener extends RunListener<AbstractBuild>{
@Override
public void onCompleted(AbstractBuild build, TaskListener listener){
Long diskUsage = build.getAction(BuildDiskUsageAction.class).getDiskUsage(); | if(build.getProject().getPublishersList().get(DiskUsagePostBuildCalculation.class)==null || diskUsage==0){ |
umanx/DashNotifier | src/com/umang/dashnotifier/DashNotifierExtension.java | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
| import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider; | package com.umang.dashnotifier;
public class DashNotifierExtension extends DashClockExtension {
static final String extNumber= "1";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
// Path: src/com/umang/dashnotifier/DashNotifierExtension.java
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider;
package com.umang.dashnotifier;
public class DashNotifierExtension extends DashClockExtension {
static final String extNumber= "1";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | addWatchContentUris(new String[]{NotificationProvider.CONTENT_URI.toString()}); |
umanx/DashNotifier | src/com/umang/dashnotifier/DashNotifierExtension3.java | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
| import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider; | package com.umang.dashnotifier;
public class DashNotifierExtension3 extends DashClockExtension {
static final String extNumber= "3";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
// Path: src/com/umang/dashnotifier/DashNotifierExtension3.java
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider;
package com.umang.dashnotifier;
public class DashNotifierExtension3 extends DashClockExtension {
static final String extNumber= "3";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | addWatchContentUris(new String[]{NotificationProvider.CONTENT_URI.toString()}); |
umanx/DashNotifier | src/com/umang/dashnotifier/DashNotifierExtension5.java | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
| import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider; | package com.umang.dashnotifier;
public class DashNotifierExtension5 extends DashClockExtension {
static final String extNumber= "5";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
// Path: src/com/umang/dashnotifier/DashNotifierExtension5.java
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider;
package com.umang.dashnotifier;
public class DashNotifierExtension5 extends DashClockExtension {
static final String extNumber= "5";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | addWatchContentUris(new String[]{NotificationProvider.CONTENT_URI.toString()}); |
umanx/DashNotifier | src/com/umang/dashnotifier/DashNotifierExtension9.java | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
| import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider; | package com.umang.dashnotifier;
public class DashNotifierExtension9 extends DashClockExtension {
static final String extNumber= "9";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
// Path: src/com/umang/dashnotifier/DashNotifierExtension9.java
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider;
package com.umang.dashnotifier;
public class DashNotifierExtension9 extends DashClockExtension {
static final String extNumber= "9";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | addWatchContentUris(new String[]{NotificationProvider.CONTENT_URI.toString()}); |
umanx/DashNotifier | src/com/umang/dashnotifier/DashNotifierExtension2.java | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
| import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider; | package com.umang.dashnotifier;
public class DashNotifierExtension2 extends DashClockExtension {
static final String extNumber= "2";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
// Path: src/com/umang/dashnotifier/DashNotifierExtension2.java
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider;
package com.umang.dashnotifier;
public class DashNotifierExtension2 extends DashClockExtension {
static final String extNumber= "2";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | addWatchContentUris(new String[]{NotificationProvider.CONTENT_URI.toString()}); |
umanx/DashNotifier | src/com/umang/dashnotifier/DashNotifierExtension6.java | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
| import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider; | package com.umang.dashnotifier;
public class DashNotifierExtension6 extends DashClockExtension {
static final String extNumber= "6";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
// Path: src/com/umang/dashnotifier/DashNotifierExtension6.java
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider;
package com.umang.dashnotifier;
public class DashNotifierExtension6 extends DashClockExtension {
static final String extNumber= "6";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | addWatchContentUris(new String[]{NotificationProvider.CONTENT_URI.toString()}); |
umanx/DashNotifier | src/com/umang/dashnotifier/DashNotifierExtension10.java | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
| import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider; | package com.umang.dashnotifier;
public class DashNotifierExtension10 extends DashClockExtension {
static final String extNumber= "10";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
// Path: src/com/umang/dashnotifier/DashNotifierExtension10.java
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider;
package com.umang.dashnotifier;
public class DashNotifierExtension10 extends DashClockExtension {
static final String extNumber= "10";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | addWatchContentUris(new String[]{NotificationProvider.CONTENT_URI.toString()}); |
umanx/DashNotifier | src/com/umang/dashnotifier/DashNotifierExtension11.java | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
| import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider; | package com.umang.dashnotifier;
public class DashNotifierExtension11 extends DashClockExtension {
static final String extNumber= "11";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
// Path: src/com/umang/dashnotifier/DashNotifierExtension11.java
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider;
package com.umang.dashnotifier;
public class DashNotifierExtension11 extends DashClockExtension {
static final String extNumber= "11";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | addWatchContentUris(new String[]{NotificationProvider.CONTENT_URI.toString()}); |
umanx/DashNotifier | src/com/umang/dashnotifier/DashNotifierExtension4.java | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
| import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider; | package com.umang.dashnotifier;
public class DashNotifierExtension4 extends DashClockExtension {
static final String extNumber= "4";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
// Path: src/com/umang/dashnotifier/DashNotifierExtension4.java
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider;
package com.umang.dashnotifier;
public class DashNotifierExtension4 extends DashClockExtension {
static final String extNumber= "4";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | addWatchContentUris(new String[]{NotificationProvider.CONTENT_URI.toString()}); |
umanx/DashNotifier | src/com/umang/dashnotifier/DashNotifierExtension8.java | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
| import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider; | package com.umang.dashnotifier;
public class DashNotifierExtension8 extends DashClockExtension {
static final String extNumber= "8";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
// Path: src/com/umang/dashnotifier/DashNotifierExtension8.java
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider;
package com.umang.dashnotifier;
public class DashNotifierExtension8 extends DashClockExtension {
static final String extNumber= "8";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | addWatchContentUris(new String[]{NotificationProvider.CONTENT_URI.toString()}); |
umanx/DashNotifier | src/com/umang/dashnotifier/DashNotifierExtension7.java | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
| import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider; | package com.umang.dashnotifier;
public class DashNotifierExtension7 extends DashClockExtension {
static final String extNumber= "7";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | // Path: src/com/umang/dashnotifier/provider/NotificationProvider.java
// public class NotificationProvider extends ContentProvider {
// private static final String TAG = "NotificationProvider";
// private NotificationStore db;
// // Used for the UriMacher
// private static final int NOTIFICATIONS = 10;
// private static final int NOTIFICATION_ID = 20;
//
// // public constants for client development
// public static final String AUTHORITY = "com.umang.provider.dashnotifier";
// private static final String BASE_PATH = "notifications";
// public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
// public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
// + "/notifications";
// public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
// + "/notification";
//
// private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
// static {
// sURIMatcher.addURI(AUTHORITY, BASE_PATH, NOTIFICATIONS);
// sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", NOTIFICATION_ID);
// }
// // helper constants for use with the UriMatcher
//
// //private static final UriMatcher URI_MATCHER;
// public boolean check(){
// return true;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsDeleted = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsDeleted = db.removeNotification(id);
// } else {
// rowsDeleted = db.removeNotification(selection, selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsDeleted > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsDeleted;
// }
//
// @Override
// public String getType(Uri arg0) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues notif) {
//
// int uriType = sURIMatcher.match(uri);
// long id = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// id = db.storeNotification(notif);
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// getContext().getContentResolver().notifyChange(uri, null);
// return Uri.parse(BASE_PATH + "/" + id);
// }
//
// @Override
// public boolean onCreate() {
// Log.d(TAG,"ContentProvider created");
// this.db = new NotificationStore(this.getContext());
// db.open();
// if (this.db == null) {
// return false;
// }
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
//
// return db.query(projection, selection, selectionArgs, sortOrder);
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
// int uriType = sURIMatcher.match(uri);
// int rowsUpdated = 0;
// switch (uriType) {
// case NOTIFICATIONS:
// rowsUpdated = db.updateNotification(
// values,
// selection,
// selectionArgs);
// break;
// case NOTIFICATION_ID:
// String id = uri.getLastPathSegment();
// if (TextUtils.isEmpty(selection)) {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id,
// null);
// } else {
// rowsUpdated = db.updateNotification(
// values,
// NotifSQLiteHelper.COL_ID + "=" + id
// + " and "
// + selection,
// selectionArgs);
// }
// break;
// default:
// throw new IllegalArgumentException("Unknown URI: " + uri);
// }
// if (rowsUpdated > 0)
// getContext().getContentResolver().notifyChange(uri, null);
// return rowsUpdated;
//
// }
//
// }
// Path: src/com/umang/dashnotifier/DashNotifierExtension7.java
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.preference.PreferenceManager;
import com.google.android.apps.dashclock.api.DashClockExtension;
import com.google.android.apps.dashclock.api.ExtensionData;
import com.umang.dashnotifier.provider.NotificationProvider;
package com.umang.dashnotifier;
public class DashNotifierExtension7 extends DashClockExtension {
static final String extNumber= "7";
SharedPreferences preferences;
PackageManager pm ;
String packageName ;
Cursor result;
String[] prefValues;
@Override
public void onCreate(){
super.onCreate();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
pm = getPackageManager();
prefValues = getResources().getStringArray(R.array.entryvalues_list_preference);
}
@Override
protected void onUpdateData(int arg0) {
ExtensionData data = Commons.publishOrPerish(this, extNumber, preferences, pm, prefValues);
publishUpdate(data);
}
@Override
protected void onInitialize(boolean isReconnect) {
super.onInitialize(isReconnect);
if (!isReconnect) { | addWatchContentUris(new String[]{NotificationProvider.CONTENT_URI.toString()}); |
xushaomin/apple-ums-server | apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/controller/AppUpdateController.java | // Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/request/AppUpdateRequest.java
// public class AppUpdateRequest extends AbstractRestRequest {
//
// private String appKey;
// private String versionCode;
//
// public String getAppKey() {
// return appKey;
// }
//
// public void setAppKey(String appKey) {
// this.appKey = appKey;
// }
//
// public String getVersionCode() {
// return versionCode;
// }
//
// public void setVersionCode(String versionCode) {
// this.versionCode = versionCode;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/ApplicationUpdate.java
// public class ApplicationUpdate extends SuccessResponse {
//
// private String fileUrl;
// private String forceupdate;
// private String description;
// private String versionName;
//
// public String getFileUrl() {
// return fileUrl;
// }
//
// public void setFileUrl(String fileUrl) {
// this.fileUrl = fileUrl;
// }
//
// public String getForceupdate() {
// return forceupdate;
// }
//
// public void setForceupdate(String forceupdate) {
// this.forceupdate = forceupdate;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getVersionName() {
// return versionName;
// }
//
// public void setVersionName(String versionName) {
// this.versionName = versionName;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/ApplicationUpdateResponse.java
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlRootElement(name = "applicationUpdateResponse")
// public class ApplicationUpdateResponse {
//
// private ApplicationUpdate reply;
//
// public ApplicationUpdate getReply() {
// return reply;
// }
//
// public void setReply(ApplicationUpdate reply) {
// this.reply = reply;
// }
//
// }
| import com.appleframework.rest.annotation.ServiceMethod;
import com.appleframework.rest.annotation.ServiceMethodBean;
import com.appleframework.ums.server.collector.request.AppUpdateRequest;
import com.appleframework.ums.server.collector.response.ApplicationUpdate;
import com.appleframework.ums.server.collector.response.ApplicationUpdateResponse;
| package com.appleframework.ums.server.collector.controller;
/**
* <pre>
* 功能说明:
* </pre>
*
* @author 徐少敏
* @version 1.0
*/
@ServiceMethodBean
public class AppUpdateController extends BaseController {
//private static Logger logger = Logger.getLogger(UsinglogController.class);
@ServiceMethod(method = "/ums/appupdate")
| // Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/request/AppUpdateRequest.java
// public class AppUpdateRequest extends AbstractRestRequest {
//
// private String appKey;
// private String versionCode;
//
// public String getAppKey() {
// return appKey;
// }
//
// public void setAppKey(String appKey) {
// this.appKey = appKey;
// }
//
// public String getVersionCode() {
// return versionCode;
// }
//
// public void setVersionCode(String versionCode) {
// this.versionCode = versionCode;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/ApplicationUpdate.java
// public class ApplicationUpdate extends SuccessResponse {
//
// private String fileUrl;
// private String forceupdate;
// private String description;
// private String versionName;
//
// public String getFileUrl() {
// return fileUrl;
// }
//
// public void setFileUrl(String fileUrl) {
// this.fileUrl = fileUrl;
// }
//
// public String getForceupdate() {
// return forceupdate;
// }
//
// public void setForceupdate(String forceupdate) {
// this.forceupdate = forceupdate;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getVersionName() {
// return versionName;
// }
//
// public void setVersionName(String versionName) {
// this.versionName = versionName;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/ApplicationUpdateResponse.java
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlRootElement(name = "applicationUpdateResponse")
// public class ApplicationUpdateResponse {
//
// private ApplicationUpdate reply;
//
// public ApplicationUpdate getReply() {
// return reply;
// }
//
// public void setReply(ApplicationUpdate reply) {
// this.reply = reply;
// }
//
// }
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/controller/AppUpdateController.java
import com.appleframework.rest.annotation.ServiceMethod;
import com.appleframework.rest.annotation.ServiceMethodBean;
import com.appleframework.ums.server.collector.request.AppUpdateRequest;
import com.appleframework.ums.server.collector.response.ApplicationUpdate;
import com.appleframework.ums.server.collector.response.ApplicationUpdateResponse;
package com.appleframework.ums.server.collector.controller;
/**
* <pre>
* 功能说明:
* </pre>
*
* @author 徐少敏
* @version 1.0
*/
@ServiceMethodBean
public class AppUpdateController extends BaseController {
//private static Logger logger = Logger.getLogger(UsinglogController.class);
@ServiceMethod(method = "/ums/appupdate")
| public Object appupdate(AppUpdateRequest request) {
|
xushaomin/apple-ums-server | apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/controller/AppUpdateController.java | // Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/request/AppUpdateRequest.java
// public class AppUpdateRequest extends AbstractRestRequest {
//
// private String appKey;
// private String versionCode;
//
// public String getAppKey() {
// return appKey;
// }
//
// public void setAppKey(String appKey) {
// this.appKey = appKey;
// }
//
// public String getVersionCode() {
// return versionCode;
// }
//
// public void setVersionCode(String versionCode) {
// this.versionCode = versionCode;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/ApplicationUpdate.java
// public class ApplicationUpdate extends SuccessResponse {
//
// private String fileUrl;
// private String forceupdate;
// private String description;
// private String versionName;
//
// public String getFileUrl() {
// return fileUrl;
// }
//
// public void setFileUrl(String fileUrl) {
// this.fileUrl = fileUrl;
// }
//
// public String getForceupdate() {
// return forceupdate;
// }
//
// public void setForceupdate(String forceupdate) {
// this.forceupdate = forceupdate;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getVersionName() {
// return versionName;
// }
//
// public void setVersionName(String versionName) {
// this.versionName = versionName;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/ApplicationUpdateResponse.java
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlRootElement(name = "applicationUpdateResponse")
// public class ApplicationUpdateResponse {
//
// private ApplicationUpdate reply;
//
// public ApplicationUpdate getReply() {
// return reply;
// }
//
// public void setReply(ApplicationUpdate reply) {
// this.reply = reply;
// }
//
// }
| import com.appleframework.rest.annotation.ServiceMethod;
import com.appleframework.rest.annotation.ServiceMethodBean;
import com.appleframework.ums.server.collector.request.AppUpdateRequest;
import com.appleframework.ums.server.collector.response.ApplicationUpdate;
import com.appleframework.ums.server.collector.response.ApplicationUpdateResponse;
| package com.appleframework.ums.server.collector.controller;
/**
* <pre>
* 功能说明:
* </pre>
*
* @author 徐少敏
* @version 1.0
*/
@ServiceMethodBean
public class AppUpdateController extends BaseController {
//private static Logger logger = Logger.getLogger(UsinglogController.class);
@ServiceMethod(method = "/ums/appupdate")
public Object appupdate(AppUpdateRequest request) {
| // Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/request/AppUpdateRequest.java
// public class AppUpdateRequest extends AbstractRestRequest {
//
// private String appKey;
// private String versionCode;
//
// public String getAppKey() {
// return appKey;
// }
//
// public void setAppKey(String appKey) {
// this.appKey = appKey;
// }
//
// public String getVersionCode() {
// return versionCode;
// }
//
// public void setVersionCode(String versionCode) {
// this.versionCode = versionCode;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/ApplicationUpdate.java
// public class ApplicationUpdate extends SuccessResponse {
//
// private String fileUrl;
// private String forceupdate;
// private String description;
// private String versionName;
//
// public String getFileUrl() {
// return fileUrl;
// }
//
// public void setFileUrl(String fileUrl) {
// this.fileUrl = fileUrl;
// }
//
// public String getForceupdate() {
// return forceupdate;
// }
//
// public void setForceupdate(String forceupdate) {
// this.forceupdate = forceupdate;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getVersionName() {
// return versionName;
// }
//
// public void setVersionName(String versionName) {
// this.versionName = versionName;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/ApplicationUpdateResponse.java
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlRootElement(name = "applicationUpdateResponse")
// public class ApplicationUpdateResponse {
//
// private ApplicationUpdate reply;
//
// public ApplicationUpdate getReply() {
// return reply;
// }
//
// public void setReply(ApplicationUpdate reply) {
// this.reply = reply;
// }
//
// }
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/controller/AppUpdateController.java
import com.appleframework.rest.annotation.ServiceMethod;
import com.appleframework.rest.annotation.ServiceMethodBean;
import com.appleframework.ums.server.collector.request.AppUpdateRequest;
import com.appleframework.ums.server.collector.response.ApplicationUpdate;
import com.appleframework.ums.server.collector.response.ApplicationUpdateResponse;
package com.appleframework.ums.server.collector.controller;
/**
* <pre>
* 功能说明:
* </pre>
*
* @author 徐少敏
* @version 1.0
*/
@ServiceMethodBean
public class AppUpdateController extends BaseController {
//private static Logger logger = Logger.getLogger(UsinglogController.class);
@ServiceMethod(method = "/ums/appupdate")
public Object appupdate(AppUpdateRequest request) {
| ApplicationUpdateResponse response = new ApplicationUpdateResponse();
|
xushaomin/apple-ums-server | apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/controller/AppUpdateController.java | // Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/request/AppUpdateRequest.java
// public class AppUpdateRequest extends AbstractRestRequest {
//
// private String appKey;
// private String versionCode;
//
// public String getAppKey() {
// return appKey;
// }
//
// public void setAppKey(String appKey) {
// this.appKey = appKey;
// }
//
// public String getVersionCode() {
// return versionCode;
// }
//
// public void setVersionCode(String versionCode) {
// this.versionCode = versionCode;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/ApplicationUpdate.java
// public class ApplicationUpdate extends SuccessResponse {
//
// private String fileUrl;
// private String forceupdate;
// private String description;
// private String versionName;
//
// public String getFileUrl() {
// return fileUrl;
// }
//
// public void setFileUrl(String fileUrl) {
// this.fileUrl = fileUrl;
// }
//
// public String getForceupdate() {
// return forceupdate;
// }
//
// public void setForceupdate(String forceupdate) {
// this.forceupdate = forceupdate;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getVersionName() {
// return versionName;
// }
//
// public void setVersionName(String versionName) {
// this.versionName = versionName;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/ApplicationUpdateResponse.java
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlRootElement(name = "applicationUpdateResponse")
// public class ApplicationUpdateResponse {
//
// private ApplicationUpdate reply;
//
// public ApplicationUpdate getReply() {
// return reply;
// }
//
// public void setReply(ApplicationUpdate reply) {
// this.reply = reply;
// }
//
// }
| import com.appleframework.rest.annotation.ServiceMethod;
import com.appleframework.rest.annotation.ServiceMethodBean;
import com.appleframework.ums.server.collector.request.AppUpdateRequest;
import com.appleframework.ums.server.collector.response.ApplicationUpdate;
import com.appleframework.ums.server.collector.response.ApplicationUpdateResponse;
| package com.appleframework.ums.server.collector.controller;
/**
* <pre>
* 功能说明:
* </pre>
*
* @author 徐少敏
* @version 1.0
*/
@ServiceMethodBean
public class AppUpdateController extends BaseController {
//private static Logger logger = Logger.getLogger(UsinglogController.class);
@ServiceMethod(method = "/ums/appupdate")
public Object appupdate(AppUpdateRequest request) {
ApplicationUpdateResponse response = new ApplicationUpdateResponse();
| // Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/request/AppUpdateRequest.java
// public class AppUpdateRequest extends AbstractRestRequest {
//
// private String appKey;
// private String versionCode;
//
// public String getAppKey() {
// return appKey;
// }
//
// public void setAppKey(String appKey) {
// this.appKey = appKey;
// }
//
// public String getVersionCode() {
// return versionCode;
// }
//
// public void setVersionCode(String versionCode) {
// this.versionCode = versionCode;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/ApplicationUpdate.java
// public class ApplicationUpdate extends SuccessResponse {
//
// private String fileUrl;
// private String forceupdate;
// private String description;
// private String versionName;
//
// public String getFileUrl() {
// return fileUrl;
// }
//
// public void setFileUrl(String fileUrl) {
// this.fileUrl = fileUrl;
// }
//
// public String getForceupdate() {
// return forceupdate;
// }
//
// public void setForceupdate(String forceupdate) {
// this.forceupdate = forceupdate;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getVersionName() {
// return versionName;
// }
//
// public void setVersionName(String versionName) {
// this.versionName = versionName;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/ApplicationUpdateResponse.java
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlRootElement(name = "applicationUpdateResponse")
// public class ApplicationUpdateResponse {
//
// private ApplicationUpdate reply;
//
// public ApplicationUpdate getReply() {
// return reply;
// }
//
// public void setReply(ApplicationUpdate reply) {
// this.reply = reply;
// }
//
// }
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/controller/AppUpdateController.java
import com.appleframework.rest.annotation.ServiceMethod;
import com.appleframework.rest.annotation.ServiceMethodBean;
import com.appleframework.ums.server.collector.request.AppUpdateRequest;
import com.appleframework.ums.server.collector.response.ApplicationUpdate;
import com.appleframework.ums.server.collector.response.ApplicationUpdateResponse;
package com.appleframework.ums.server.collector.controller;
/**
* <pre>
* 功能说明:
* </pre>
*
* @author 徐少敏
* @version 1.0
*/
@ServiceMethodBean
public class AppUpdateController extends BaseController {
//private static Logger logger = Logger.getLogger(UsinglogController.class);
@ServiceMethod(method = "/ums/appupdate")
public Object appupdate(AppUpdateRequest request) {
ApplicationUpdateResponse response = new ApplicationUpdateResponse();
| ApplicationUpdate reply = new ApplicationUpdate();
|
xushaomin/apple-ums-server | apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDataEntityMapper.java | // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDataEntity.java
// public class EventDataEntity implements Serializable {
// private Integer id;
//
// private String deviceid;
//
// private String category;
//
// private String event;
//
// private String label;
//
// private String attachment;
//
// private Date clientdate;
//
// private String productkey;
//
// private Integer num;
//
// private Integer eventId;
//
// private String version;
//
// private String useridentifier;
//
// private String sessionId;
//
// private String libVersion;
//
// private Date insertdate;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getDeviceid() {
// return deviceid;
// }
//
// public void setDeviceid(String deviceid) {
// this.deviceid = deviceid == null ? null : deviceid.trim();
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category == null ? null : category.trim();
// }
//
// public String getEvent() {
// return event;
// }
//
// public void setEvent(String event) {
// this.event = event == null ? null : event.trim();
// }
//
// public String getLabel() {
// return label;
// }
//
// public void setLabel(String label) {
// this.label = label == null ? null : label.trim();
// }
//
// public String getAttachment() {
// return attachment;
// }
//
// public void setAttachment(String attachment) {
// this.attachment = attachment == null ? null : attachment.trim();
// }
//
// public Date getClientdate() {
// return clientdate;
// }
//
// public void setClientdate(Date clientdate) {
// this.clientdate = clientdate;
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public Integer getNum() {
// return num;
// }
//
// public void setNum(Integer num) {
// this.num = num;
// }
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getVersion() {
// return version;
// }
//
// public void setVersion(String version) {
// this.version = version == null ? null : version.trim();
// }
//
// public String getUseridentifier() {
// return useridentifier;
// }
//
// public void setUseridentifier(String useridentifier) {
// this.useridentifier = useridentifier == null ? null : useridentifier.trim();
// }
//
// public String getSessionId() {
// return sessionId;
// }
//
// public void setSessionId(String sessionId) {
// this.sessionId = sessionId == null ? null : sessionId.trim();
// }
//
// public String getLibVersion() {
// return libVersion;
// }
//
// public void setLibVersion(String libVersion) {
// this.libVersion = libVersion == null ? null : libVersion.trim();
// }
//
// public Date getInsertdate() {
// return insertdate;
// }
//
// public void setInsertdate(Date insertdate) {
// this.insertdate = insertdate;
// }
// }
| import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.EventDataEntity;
| package com.appleframework.ums.server.storage.mapper;
@Repository
public interface EventDataEntityMapper {
int deleteByPrimaryKey(Integer id);
| // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDataEntity.java
// public class EventDataEntity implements Serializable {
// private Integer id;
//
// private String deviceid;
//
// private String category;
//
// private String event;
//
// private String label;
//
// private String attachment;
//
// private Date clientdate;
//
// private String productkey;
//
// private Integer num;
//
// private Integer eventId;
//
// private String version;
//
// private String useridentifier;
//
// private String sessionId;
//
// private String libVersion;
//
// private Date insertdate;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getDeviceid() {
// return deviceid;
// }
//
// public void setDeviceid(String deviceid) {
// this.deviceid = deviceid == null ? null : deviceid.trim();
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category == null ? null : category.trim();
// }
//
// public String getEvent() {
// return event;
// }
//
// public void setEvent(String event) {
// this.event = event == null ? null : event.trim();
// }
//
// public String getLabel() {
// return label;
// }
//
// public void setLabel(String label) {
// this.label = label == null ? null : label.trim();
// }
//
// public String getAttachment() {
// return attachment;
// }
//
// public void setAttachment(String attachment) {
// this.attachment = attachment == null ? null : attachment.trim();
// }
//
// public Date getClientdate() {
// return clientdate;
// }
//
// public void setClientdate(Date clientdate) {
// this.clientdate = clientdate;
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public Integer getNum() {
// return num;
// }
//
// public void setNum(Integer num) {
// this.num = num;
// }
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getVersion() {
// return version;
// }
//
// public void setVersion(String version) {
// this.version = version == null ? null : version.trim();
// }
//
// public String getUseridentifier() {
// return useridentifier;
// }
//
// public void setUseridentifier(String useridentifier) {
// this.useridentifier = useridentifier == null ? null : useridentifier.trim();
// }
//
// public String getSessionId() {
// return sessionId;
// }
//
// public void setSessionId(String sessionId) {
// this.sessionId = sessionId == null ? null : sessionId.trim();
// }
//
// public String getLibVersion() {
// return libVersion;
// }
//
// public void setLibVersion(String libVersion) {
// this.libVersion = libVersion == null ? null : libVersion.trim();
// }
//
// public Date getInsertdate() {
// return insertdate;
// }
//
// public void setInsertdate(Date insertdate) {
// this.insertdate = insertdate;
// }
// }
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDataEntityMapper.java
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.EventDataEntity;
package com.appleframework.ums.server.storage.mapper;
@Repository
public interface EventDataEntityMapper {
int deleteByPrimaryKey(Integer id);
| int insert(EventDataEntity record);
|
xushaomin/apple-ums-server | apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDefinationEntityMapper.java | // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDefinationEntity.java
// public class EventDefinationEntity implements Serializable {
// private Integer eventId;
//
// private String eventIdentifier;
//
// private String productkey;
//
// private String eventName;
//
// private Integer channelId;
//
// private Integer productId;
//
// private Integer userId;
//
// private Date createDate;
//
// private Integer active;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getEventIdentifier() {
// return eventIdentifier;
// }
//
// public void setEventIdentifier(String eventIdentifier) {
// this.eventIdentifier = eventIdentifier == null ? null : eventIdentifier.trim();
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public String getEventName() {
// return eventName;
// }
//
// public void setEventName(String eventName) {
// this.eventName = eventName == null ? null : eventName.trim();
// }
//
// public Integer getChannelId() {
// return channelId;
// }
//
// public void setChannelId(Integer channelId) {
// this.channelId = channelId;
// }
//
// public Integer getProductId() {
// return productId;
// }
//
// public void setProductId(Integer productId) {
// this.productId = productId;
// }
//
// public Integer getUserId() {
// return userId;
// }
//
// public void setUserId(Integer userId) {
// this.userId = userId;
// }
//
// public Date getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(Date createDate) {
// this.createDate = createDate;
// }
//
// public Integer getActive() {
// return active;
// }
//
// public void setActive(Integer active) {
// this.active = active;
// }
// }
| import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.EventDefinationEntity;
| package com.appleframework.ums.server.storage.mapper;
@Repository
public interface EventDefinationEntityMapper {
int deleteByPrimaryKey(Integer eventId);
| // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDefinationEntity.java
// public class EventDefinationEntity implements Serializable {
// private Integer eventId;
//
// private String eventIdentifier;
//
// private String productkey;
//
// private String eventName;
//
// private Integer channelId;
//
// private Integer productId;
//
// private Integer userId;
//
// private Date createDate;
//
// private Integer active;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getEventIdentifier() {
// return eventIdentifier;
// }
//
// public void setEventIdentifier(String eventIdentifier) {
// this.eventIdentifier = eventIdentifier == null ? null : eventIdentifier.trim();
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public String getEventName() {
// return eventName;
// }
//
// public void setEventName(String eventName) {
// this.eventName = eventName == null ? null : eventName.trim();
// }
//
// public Integer getChannelId() {
// return channelId;
// }
//
// public void setChannelId(Integer channelId) {
// this.channelId = channelId;
// }
//
// public Integer getProductId() {
// return productId;
// }
//
// public void setProductId(Integer productId) {
// this.productId = productId;
// }
//
// public Integer getUserId() {
// return userId;
// }
//
// public void setUserId(Integer userId) {
// this.userId = userId;
// }
//
// public Date getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(Date createDate) {
// this.createDate = createDate;
// }
//
// public Integer getActive() {
// return active;
// }
//
// public void setActive(Integer active) {
// this.active = active;
// }
// }
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDefinationEntityMapper.java
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.EventDefinationEntity;
package com.appleframework.ums.server.storage.mapper;
@Repository
public interface EventDefinationEntityMapper {
int deleteByPrimaryKey(Integer eventId);
| int insert(EventDefinationEntity record);
|
xushaomin/apple-ums-server | apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/ClientUsingLogEntityMapper.java | // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/ClientUsingLogEntity.java
// public class ClientUsingLogEntity implements Serializable {
//
// private Integer id;
//
// private String sessionId;
//
// private Date startMillis;
//
// private Date endMillis;
//
// private Integer duration;
//
// private String activities;
//
// private String appkey;
//
// private String version;
//
// private String deviceid;
//
// private String useridentifier;
//
// private String libVersion;
//
// private Date insertdate;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getSessionId() {
// return sessionId;
// }
//
// public void setSessionId(String sessionId) {
// this.sessionId = sessionId == null ? null : sessionId.trim();
// }
//
// public Date getStartMillis() {
// return startMillis;
// }
//
// public void setStartMillis(Date startMillis) {
// this.startMillis = startMillis;
// }
//
// public Date getEndMillis() {
// return endMillis;
// }
//
// public void setEndMillis(Date endMillis) {
// this.endMillis = endMillis;
// }
//
// public Integer getDuration() {
// return duration;
// }
//
// public void setDuration(Integer duration) {
// this.duration = duration;
// }
//
// public String getActivities() {
// return activities;
// }
//
// public void setActivities(String activities) {
// this.activities = activities == null ? null : activities.trim();
// }
//
// public String getAppkey() {
// return appkey;
// }
//
// public void setAppkey(String appkey) {
// this.appkey = appkey == null ? null : appkey.trim();
// }
//
// public String getVersion() {
// return version;
// }
//
// public void setVersion(String version) {
// this.version = version == null ? null : version.trim();
// }
//
// public String getDeviceid() {
// return deviceid;
// }
//
// public void setDeviceid(String deviceid) {
// this.deviceid = deviceid == null ? null : deviceid.trim();
// }
//
// public String getUseridentifier() {
// return useridentifier;
// }
//
// public void setUseridentifier(String useridentifier) {
// this.useridentifier = useridentifier == null ? null : useridentifier.trim();
// }
//
// public String getLibVersion() {
// return libVersion;
// }
//
// public void setLibVersion(String libVersion) {
// this.libVersion = libVersion == null ? null : libVersion.trim();
// }
//
// public Date getInsertdate() {
// return insertdate;
// }
//
// public void setInsertdate(Date insertdate) {
// this.insertdate = insertdate;
// }
// }
| import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.ClientUsingLogEntity;
| package com.appleframework.ums.server.storage.mapper;
@Repository
public interface ClientUsingLogEntityMapper {
int deleteByPrimaryKey(Integer id);
| // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/ClientUsingLogEntity.java
// public class ClientUsingLogEntity implements Serializable {
//
// private Integer id;
//
// private String sessionId;
//
// private Date startMillis;
//
// private Date endMillis;
//
// private Integer duration;
//
// private String activities;
//
// private String appkey;
//
// private String version;
//
// private String deviceid;
//
// private String useridentifier;
//
// private String libVersion;
//
// private Date insertdate;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getSessionId() {
// return sessionId;
// }
//
// public void setSessionId(String sessionId) {
// this.sessionId = sessionId == null ? null : sessionId.trim();
// }
//
// public Date getStartMillis() {
// return startMillis;
// }
//
// public void setStartMillis(Date startMillis) {
// this.startMillis = startMillis;
// }
//
// public Date getEndMillis() {
// return endMillis;
// }
//
// public void setEndMillis(Date endMillis) {
// this.endMillis = endMillis;
// }
//
// public Integer getDuration() {
// return duration;
// }
//
// public void setDuration(Integer duration) {
// this.duration = duration;
// }
//
// public String getActivities() {
// return activities;
// }
//
// public void setActivities(String activities) {
// this.activities = activities == null ? null : activities.trim();
// }
//
// public String getAppkey() {
// return appkey;
// }
//
// public void setAppkey(String appkey) {
// this.appkey = appkey == null ? null : appkey.trim();
// }
//
// public String getVersion() {
// return version;
// }
//
// public void setVersion(String version) {
// this.version = version == null ? null : version.trim();
// }
//
// public String getDeviceid() {
// return deviceid;
// }
//
// public void setDeviceid(String deviceid) {
// this.deviceid = deviceid == null ? null : deviceid.trim();
// }
//
// public String getUseridentifier() {
// return useridentifier;
// }
//
// public void setUseridentifier(String useridentifier) {
// this.useridentifier = useridentifier == null ? null : useridentifier.trim();
// }
//
// public String getLibVersion() {
// return libVersion;
// }
//
// public void setLibVersion(String libVersion) {
// this.libVersion = libVersion == null ? null : libVersion.trim();
// }
//
// public Date getInsertdate() {
// return insertdate;
// }
//
// public void setInsertdate(Date insertdate) {
// this.insertdate = insertdate;
// }
// }
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/ClientUsingLogEntityMapper.java
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.ClientUsingLogEntity;
package com.appleframework.ums.server.storage.mapper;
@Repository
public interface ClientUsingLogEntityMapper {
int deleteByPrimaryKey(Integer id);
| int insert(ClientUsingLogEntity record);
|
xushaomin/apple-ums-server | apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/ClientUsingLogDao.java | // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/ClientUsingLogEntity.java
// public class ClientUsingLogEntity implements Serializable {
//
// private Integer id;
//
// private String sessionId;
//
// private Date startMillis;
//
// private Date endMillis;
//
// private Integer duration;
//
// private String activities;
//
// private String appkey;
//
// private String version;
//
// private String deviceid;
//
// private String useridentifier;
//
// private String libVersion;
//
// private Date insertdate;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getSessionId() {
// return sessionId;
// }
//
// public void setSessionId(String sessionId) {
// this.sessionId = sessionId == null ? null : sessionId.trim();
// }
//
// public Date getStartMillis() {
// return startMillis;
// }
//
// public void setStartMillis(Date startMillis) {
// this.startMillis = startMillis;
// }
//
// public Date getEndMillis() {
// return endMillis;
// }
//
// public void setEndMillis(Date endMillis) {
// this.endMillis = endMillis;
// }
//
// public Integer getDuration() {
// return duration;
// }
//
// public void setDuration(Integer duration) {
// this.duration = duration;
// }
//
// public String getActivities() {
// return activities;
// }
//
// public void setActivities(String activities) {
// this.activities = activities == null ? null : activities.trim();
// }
//
// public String getAppkey() {
// return appkey;
// }
//
// public void setAppkey(String appkey) {
// this.appkey = appkey == null ? null : appkey.trim();
// }
//
// public String getVersion() {
// return version;
// }
//
// public void setVersion(String version) {
// this.version = version == null ? null : version.trim();
// }
//
// public String getDeviceid() {
// return deviceid;
// }
//
// public void setDeviceid(String deviceid) {
// this.deviceid = deviceid == null ? null : deviceid.trim();
// }
//
// public String getUseridentifier() {
// return useridentifier;
// }
//
// public void setUseridentifier(String useridentifier) {
// this.useridentifier = useridentifier == null ? null : useridentifier.trim();
// }
//
// public String getLibVersion() {
// return libVersion;
// }
//
// public void setLibVersion(String libVersion) {
// this.libVersion = libVersion == null ? null : libVersion.trim();
// }
//
// public Date getInsertdate() {
// return insertdate;
// }
//
// public void setInsertdate(Date insertdate) {
// this.insertdate = insertdate;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/ClientUsingLogEntityMapper.java
// @Repository
// public interface ClientUsingLogEntityMapper {
//
// int deleteByPrimaryKey(Integer id);
//
// int insert(ClientUsingLogEntity record);
//
// int insertSelective(ClientUsingLogEntity record);
//
// ClientUsingLogEntity selectByPrimaryKey(Integer id);
//
// int updateByPrimaryKeySelective(ClientUsingLogEntity record);
//
// int updateByPrimaryKey(ClientUsingLogEntity record);
// }
| import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.ClientUsingLogEntity;
import com.appleframework.ums.server.storage.mapper.ClientUsingLogEntityMapper;
| package com.appleframework.ums.server.storage.dao;
@Repository("clientUsingLogDao")
public class ClientUsingLogDao {
@Resource
| // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/ClientUsingLogEntity.java
// public class ClientUsingLogEntity implements Serializable {
//
// private Integer id;
//
// private String sessionId;
//
// private Date startMillis;
//
// private Date endMillis;
//
// private Integer duration;
//
// private String activities;
//
// private String appkey;
//
// private String version;
//
// private String deviceid;
//
// private String useridentifier;
//
// private String libVersion;
//
// private Date insertdate;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getSessionId() {
// return sessionId;
// }
//
// public void setSessionId(String sessionId) {
// this.sessionId = sessionId == null ? null : sessionId.trim();
// }
//
// public Date getStartMillis() {
// return startMillis;
// }
//
// public void setStartMillis(Date startMillis) {
// this.startMillis = startMillis;
// }
//
// public Date getEndMillis() {
// return endMillis;
// }
//
// public void setEndMillis(Date endMillis) {
// this.endMillis = endMillis;
// }
//
// public Integer getDuration() {
// return duration;
// }
//
// public void setDuration(Integer duration) {
// this.duration = duration;
// }
//
// public String getActivities() {
// return activities;
// }
//
// public void setActivities(String activities) {
// this.activities = activities == null ? null : activities.trim();
// }
//
// public String getAppkey() {
// return appkey;
// }
//
// public void setAppkey(String appkey) {
// this.appkey = appkey == null ? null : appkey.trim();
// }
//
// public String getVersion() {
// return version;
// }
//
// public void setVersion(String version) {
// this.version = version == null ? null : version.trim();
// }
//
// public String getDeviceid() {
// return deviceid;
// }
//
// public void setDeviceid(String deviceid) {
// this.deviceid = deviceid == null ? null : deviceid.trim();
// }
//
// public String getUseridentifier() {
// return useridentifier;
// }
//
// public void setUseridentifier(String useridentifier) {
// this.useridentifier = useridentifier == null ? null : useridentifier.trim();
// }
//
// public String getLibVersion() {
// return libVersion;
// }
//
// public void setLibVersion(String libVersion) {
// this.libVersion = libVersion == null ? null : libVersion.trim();
// }
//
// public Date getInsertdate() {
// return insertdate;
// }
//
// public void setInsertdate(Date insertdate) {
// this.insertdate = insertdate;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/ClientUsingLogEntityMapper.java
// @Repository
// public interface ClientUsingLogEntityMapper {
//
// int deleteByPrimaryKey(Integer id);
//
// int insert(ClientUsingLogEntity record);
//
// int insertSelective(ClientUsingLogEntity record);
//
// ClientUsingLogEntity selectByPrimaryKey(Integer id);
//
// int updateByPrimaryKeySelective(ClientUsingLogEntity record);
//
// int updateByPrimaryKey(ClientUsingLogEntity record);
// }
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/ClientUsingLogDao.java
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.ClientUsingLogEntity;
import com.appleframework.ums.server.storage.mapper.ClientUsingLogEntityMapper;
package com.appleframework.ums.server.storage.dao;
@Repository("clientUsingLogDao")
public class ClientUsingLogDao {
@Resource
| private ClientUsingLogEntityMapper clientUsingLogEntityMapper;
|
xushaomin/apple-ums-server | apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/ClientUsingLogDao.java | // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/ClientUsingLogEntity.java
// public class ClientUsingLogEntity implements Serializable {
//
// private Integer id;
//
// private String sessionId;
//
// private Date startMillis;
//
// private Date endMillis;
//
// private Integer duration;
//
// private String activities;
//
// private String appkey;
//
// private String version;
//
// private String deviceid;
//
// private String useridentifier;
//
// private String libVersion;
//
// private Date insertdate;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getSessionId() {
// return sessionId;
// }
//
// public void setSessionId(String sessionId) {
// this.sessionId = sessionId == null ? null : sessionId.trim();
// }
//
// public Date getStartMillis() {
// return startMillis;
// }
//
// public void setStartMillis(Date startMillis) {
// this.startMillis = startMillis;
// }
//
// public Date getEndMillis() {
// return endMillis;
// }
//
// public void setEndMillis(Date endMillis) {
// this.endMillis = endMillis;
// }
//
// public Integer getDuration() {
// return duration;
// }
//
// public void setDuration(Integer duration) {
// this.duration = duration;
// }
//
// public String getActivities() {
// return activities;
// }
//
// public void setActivities(String activities) {
// this.activities = activities == null ? null : activities.trim();
// }
//
// public String getAppkey() {
// return appkey;
// }
//
// public void setAppkey(String appkey) {
// this.appkey = appkey == null ? null : appkey.trim();
// }
//
// public String getVersion() {
// return version;
// }
//
// public void setVersion(String version) {
// this.version = version == null ? null : version.trim();
// }
//
// public String getDeviceid() {
// return deviceid;
// }
//
// public void setDeviceid(String deviceid) {
// this.deviceid = deviceid == null ? null : deviceid.trim();
// }
//
// public String getUseridentifier() {
// return useridentifier;
// }
//
// public void setUseridentifier(String useridentifier) {
// this.useridentifier = useridentifier == null ? null : useridentifier.trim();
// }
//
// public String getLibVersion() {
// return libVersion;
// }
//
// public void setLibVersion(String libVersion) {
// this.libVersion = libVersion == null ? null : libVersion.trim();
// }
//
// public Date getInsertdate() {
// return insertdate;
// }
//
// public void setInsertdate(Date insertdate) {
// this.insertdate = insertdate;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/ClientUsingLogEntityMapper.java
// @Repository
// public interface ClientUsingLogEntityMapper {
//
// int deleteByPrimaryKey(Integer id);
//
// int insert(ClientUsingLogEntity record);
//
// int insertSelective(ClientUsingLogEntity record);
//
// ClientUsingLogEntity selectByPrimaryKey(Integer id);
//
// int updateByPrimaryKeySelective(ClientUsingLogEntity record);
//
// int updateByPrimaryKey(ClientUsingLogEntity record);
// }
| import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.ClientUsingLogEntity;
import com.appleframework.ums.server.storage.mapper.ClientUsingLogEntityMapper;
| package com.appleframework.ums.server.storage.dao;
@Repository("clientUsingLogDao")
public class ClientUsingLogDao {
@Resource
private ClientUsingLogEntityMapper clientUsingLogEntityMapper;
| // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/ClientUsingLogEntity.java
// public class ClientUsingLogEntity implements Serializable {
//
// private Integer id;
//
// private String sessionId;
//
// private Date startMillis;
//
// private Date endMillis;
//
// private Integer duration;
//
// private String activities;
//
// private String appkey;
//
// private String version;
//
// private String deviceid;
//
// private String useridentifier;
//
// private String libVersion;
//
// private Date insertdate;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getSessionId() {
// return sessionId;
// }
//
// public void setSessionId(String sessionId) {
// this.sessionId = sessionId == null ? null : sessionId.trim();
// }
//
// public Date getStartMillis() {
// return startMillis;
// }
//
// public void setStartMillis(Date startMillis) {
// this.startMillis = startMillis;
// }
//
// public Date getEndMillis() {
// return endMillis;
// }
//
// public void setEndMillis(Date endMillis) {
// this.endMillis = endMillis;
// }
//
// public Integer getDuration() {
// return duration;
// }
//
// public void setDuration(Integer duration) {
// this.duration = duration;
// }
//
// public String getActivities() {
// return activities;
// }
//
// public void setActivities(String activities) {
// this.activities = activities == null ? null : activities.trim();
// }
//
// public String getAppkey() {
// return appkey;
// }
//
// public void setAppkey(String appkey) {
// this.appkey = appkey == null ? null : appkey.trim();
// }
//
// public String getVersion() {
// return version;
// }
//
// public void setVersion(String version) {
// this.version = version == null ? null : version.trim();
// }
//
// public String getDeviceid() {
// return deviceid;
// }
//
// public void setDeviceid(String deviceid) {
// this.deviceid = deviceid == null ? null : deviceid.trim();
// }
//
// public String getUseridentifier() {
// return useridentifier;
// }
//
// public void setUseridentifier(String useridentifier) {
// this.useridentifier = useridentifier == null ? null : useridentifier.trim();
// }
//
// public String getLibVersion() {
// return libVersion;
// }
//
// public void setLibVersion(String libVersion) {
// this.libVersion = libVersion == null ? null : libVersion.trim();
// }
//
// public Date getInsertdate() {
// return insertdate;
// }
//
// public void setInsertdate(Date insertdate) {
// this.insertdate = insertdate;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/ClientUsingLogEntityMapper.java
// @Repository
// public interface ClientUsingLogEntityMapper {
//
// int deleteByPrimaryKey(Integer id);
//
// int insert(ClientUsingLogEntity record);
//
// int insertSelective(ClientUsingLogEntity record);
//
// ClientUsingLogEntity selectByPrimaryKey(Integer id);
//
// int updateByPrimaryKeySelective(ClientUsingLogEntity record);
//
// int updateByPrimaryKey(ClientUsingLogEntity record);
// }
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/ClientUsingLogDao.java
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.ClientUsingLogEntity;
import com.appleframework.ums.server.storage.mapper.ClientUsingLogEntityMapper;
package com.appleframework.ums.server.storage.dao;
@Repository("clientUsingLogDao")
public class ClientUsingLogDao {
@Resource
private ClientUsingLogEntityMapper clientUsingLogEntityMapper;
| public void save(ClientUsingLogEntity record) {
|
xushaomin/apple-ums-server | apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/service/impl/EventDefinationServiceImpl.java | // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDefinationEntity.java
// public class EventDefinationEntity implements Serializable {
// private Integer eventId;
//
// private String eventIdentifier;
//
// private String productkey;
//
// private String eventName;
//
// private Integer channelId;
//
// private Integer productId;
//
// private Integer userId;
//
// private Date createDate;
//
// private Integer active;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getEventIdentifier() {
// return eventIdentifier;
// }
//
// public void setEventIdentifier(String eventIdentifier) {
// this.eventIdentifier = eventIdentifier == null ? null : eventIdentifier.trim();
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public String getEventName() {
// return eventName;
// }
//
// public void setEventName(String eventName) {
// this.eventName = eventName == null ? null : eventName.trim();
// }
//
// public Integer getChannelId() {
// return channelId;
// }
//
// public void setChannelId(Integer channelId) {
// this.channelId = channelId;
// }
//
// public Integer getProductId() {
// return productId;
// }
//
// public void setProductId(Integer productId) {
// this.productId = productId;
// }
//
// public Integer getUserId() {
// return userId;
// }
//
// public void setUserId(Integer userId) {
// this.userId = userId;
// }
//
// public Date getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(Date createDate) {
// this.createDate = createDate;
// }
//
// public Integer getActive() {
// return active;
// }
//
// public void setActive(Integer active) {
// this.active = active;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/EventDefinationEntityDao.java
// @Repository("eventDefinationEntityDao")
// public class EventDefinationEntityDao {
//
// @Resource
// private EventDefinationEntityMapper eventDefinationEntityMapper;
//
// @Resource
// private EventDefinationExtendMapper eventDefinationExtendMapper;
//
// public EventDefinationEntity getByProductkeyAndEventIdentifier(String productkey, String eventIdentifier) {
// return eventDefinationExtendMapper.selectByProductkeyAndEventIdentifier(productkey, eventIdentifier);
// }
//
// public void save(EventDefinationEntity record) {
// record.setCreateDate(new Date());
// eventDefinationEntityMapper.insert(record);
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/service/EventDefinationService.java
// public interface EventDefinationService {
//
// public EventDefinationEntity getByProductkeyAndEventIdentifier(String productkey, String eventIdentifier);
//
// public EventDefinationEntity gainByProductkeyAndEventIdentifier(String productkey, String eventIdentifier);
//
// }
| import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.appleframework.ums.server.core.entity.EventDefinationEntity;
import com.appleframework.ums.server.storage.dao.EventDefinationEntityDao;
import com.appleframework.ums.server.storage.service.EventDefinationService;
| package com.appleframework.ums.server.storage.service.impl;
@Service("eventDefinationService")
public class EventDefinationServiceImpl implements EventDefinationService {
@Resource
| // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDefinationEntity.java
// public class EventDefinationEntity implements Serializable {
// private Integer eventId;
//
// private String eventIdentifier;
//
// private String productkey;
//
// private String eventName;
//
// private Integer channelId;
//
// private Integer productId;
//
// private Integer userId;
//
// private Date createDate;
//
// private Integer active;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getEventIdentifier() {
// return eventIdentifier;
// }
//
// public void setEventIdentifier(String eventIdentifier) {
// this.eventIdentifier = eventIdentifier == null ? null : eventIdentifier.trim();
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public String getEventName() {
// return eventName;
// }
//
// public void setEventName(String eventName) {
// this.eventName = eventName == null ? null : eventName.trim();
// }
//
// public Integer getChannelId() {
// return channelId;
// }
//
// public void setChannelId(Integer channelId) {
// this.channelId = channelId;
// }
//
// public Integer getProductId() {
// return productId;
// }
//
// public void setProductId(Integer productId) {
// this.productId = productId;
// }
//
// public Integer getUserId() {
// return userId;
// }
//
// public void setUserId(Integer userId) {
// this.userId = userId;
// }
//
// public Date getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(Date createDate) {
// this.createDate = createDate;
// }
//
// public Integer getActive() {
// return active;
// }
//
// public void setActive(Integer active) {
// this.active = active;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/EventDefinationEntityDao.java
// @Repository("eventDefinationEntityDao")
// public class EventDefinationEntityDao {
//
// @Resource
// private EventDefinationEntityMapper eventDefinationEntityMapper;
//
// @Resource
// private EventDefinationExtendMapper eventDefinationExtendMapper;
//
// public EventDefinationEntity getByProductkeyAndEventIdentifier(String productkey, String eventIdentifier) {
// return eventDefinationExtendMapper.selectByProductkeyAndEventIdentifier(productkey, eventIdentifier);
// }
//
// public void save(EventDefinationEntity record) {
// record.setCreateDate(new Date());
// eventDefinationEntityMapper.insert(record);
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/service/EventDefinationService.java
// public interface EventDefinationService {
//
// public EventDefinationEntity getByProductkeyAndEventIdentifier(String productkey, String eventIdentifier);
//
// public EventDefinationEntity gainByProductkeyAndEventIdentifier(String productkey, String eventIdentifier);
//
// }
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/service/impl/EventDefinationServiceImpl.java
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.appleframework.ums.server.core.entity.EventDefinationEntity;
import com.appleframework.ums.server.storage.dao.EventDefinationEntityDao;
import com.appleframework.ums.server.storage.service.EventDefinationService;
package com.appleframework.ums.server.storage.service.impl;
@Service("eventDefinationService")
public class EventDefinationServiceImpl implements EventDefinationService {
@Resource
| private EventDefinationEntityDao eventDefinationEntityDao;
|
xushaomin/apple-ums-server | apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/service/impl/EventDefinationServiceImpl.java | // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDefinationEntity.java
// public class EventDefinationEntity implements Serializable {
// private Integer eventId;
//
// private String eventIdentifier;
//
// private String productkey;
//
// private String eventName;
//
// private Integer channelId;
//
// private Integer productId;
//
// private Integer userId;
//
// private Date createDate;
//
// private Integer active;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getEventIdentifier() {
// return eventIdentifier;
// }
//
// public void setEventIdentifier(String eventIdentifier) {
// this.eventIdentifier = eventIdentifier == null ? null : eventIdentifier.trim();
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public String getEventName() {
// return eventName;
// }
//
// public void setEventName(String eventName) {
// this.eventName = eventName == null ? null : eventName.trim();
// }
//
// public Integer getChannelId() {
// return channelId;
// }
//
// public void setChannelId(Integer channelId) {
// this.channelId = channelId;
// }
//
// public Integer getProductId() {
// return productId;
// }
//
// public void setProductId(Integer productId) {
// this.productId = productId;
// }
//
// public Integer getUserId() {
// return userId;
// }
//
// public void setUserId(Integer userId) {
// this.userId = userId;
// }
//
// public Date getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(Date createDate) {
// this.createDate = createDate;
// }
//
// public Integer getActive() {
// return active;
// }
//
// public void setActive(Integer active) {
// this.active = active;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/EventDefinationEntityDao.java
// @Repository("eventDefinationEntityDao")
// public class EventDefinationEntityDao {
//
// @Resource
// private EventDefinationEntityMapper eventDefinationEntityMapper;
//
// @Resource
// private EventDefinationExtendMapper eventDefinationExtendMapper;
//
// public EventDefinationEntity getByProductkeyAndEventIdentifier(String productkey, String eventIdentifier) {
// return eventDefinationExtendMapper.selectByProductkeyAndEventIdentifier(productkey, eventIdentifier);
// }
//
// public void save(EventDefinationEntity record) {
// record.setCreateDate(new Date());
// eventDefinationEntityMapper.insert(record);
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/service/EventDefinationService.java
// public interface EventDefinationService {
//
// public EventDefinationEntity getByProductkeyAndEventIdentifier(String productkey, String eventIdentifier);
//
// public EventDefinationEntity gainByProductkeyAndEventIdentifier(String productkey, String eventIdentifier);
//
// }
| import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.appleframework.ums.server.core.entity.EventDefinationEntity;
import com.appleframework.ums.server.storage.dao.EventDefinationEntityDao;
import com.appleframework.ums.server.storage.service.EventDefinationService;
| package com.appleframework.ums.server.storage.service.impl;
@Service("eventDefinationService")
public class EventDefinationServiceImpl implements EventDefinationService {
@Resource
private EventDefinationEntityDao eventDefinationEntityDao;
@Override
| // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDefinationEntity.java
// public class EventDefinationEntity implements Serializable {
// private Integer eventId;
//
// private String eventIdentifier;
//
// private String productkey;
//
// private String eventName;
//
// private Integer channelId;
//
// private Integer productId;
//
// private Integer userId;
//
// private Date createDate;
//
// private Integer active;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getEventIdentifier() {
// return eventIdentifier;
// }
//
// public void setEventIdentifier(String eventIdentifier) {
// this.eventIdentifier = eventIdentifier == null ? null : eventIdentifier.trim();
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public String getEventName() {
// return eventName;
// }
//
// public void setEventName(String eventName) {
// this.eventName = eventName == null ? null : eventName.trim();
// }
//
// public Integer getChannelId() {
// return channelId;
// }
//
// public void setChannelId(Integer channelId) {
// this.channelId = channelId;
// }
//
// public Integer getProductId() {
// return productId;
// }
//
// public void setProductId(Integer productId) {
// this.productId = productId;
// }
//
// public Integer getUserId() {
// return userId;
// }
//
// public void setUserId(Integer userId) {
// this.userId = userId;
// }
//
// public Date getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(Date createDate) {
// this.createDate = createDate;
// }
//
// public Integer getActive() {
// return active;
// }
//
// public void setActive(Integer active) {
// this.active = active;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/EventDefinationEntityDao.java
// @Repository("eventDefinationEntityDao")
// public class EventDefinationEntityDao {
//
// @Resource
// private EventDefinationEntityMapper eventDefinationEntityMapper;
//
// @Resource
// private EventDefinationExtendMapper eventDefinationExtendMapper;
//
// public EventDefinationEntity getByProductkeyAndEventIdentifier(String productkey, String eventIdentifier) {
// return eventDefinationExtendMapper.selectByProductkeyAndEventIdentifier(productkey, eventIdentifier);
// }
//
// public void save(EventDefinationEntity record) {
// record.setCreateDate(new Date());
// eventDefinationEntityMapper.insert(record);
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/service/EventDefinationService.java
// public interface EventDefinationService {
//
// public EventDefinationEntity getByProductkeyAndEventIdentifier(String productkey, String eventIdentifier);
//
// public EventDefinationEntity gainByProductkeyAndEventIdentifier(String productkey, String eventIdentifier);
//
// }
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/service/impl/EventDefinationServiceImpl.java
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.appleframework.ums.server.core.entity.EventDefinationEntity;
import com.appleframework.ums.server.storage.dao.EventDefinationEntityDao;
import com.appleframework.ums.server.storage.service.EventDefinationService;
package com.appleframework.ums.server.storage.service.impl;
@Service("eventDefinationService")
public class EventDefinationServiceImpl implements EventDefinationService {
@Resource
private EventDefinationEntityDao eventDefinationEntityDao;
@Override
| public EventDefinationEntity getByProductkeyAndEventIdentifier(String productkey, String eventIdentifier) {
|
xushaomin/apple-ums-server | apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/EventDataEntityDao.java | // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDataEntity.java
// public class EventDataEntity implements Serializable {
// private Integer id;
//
// private String deviceid;
//
// private String category;
//
// private String event;
//
// private String label;
//
// private String attachment;
//
// private Date clientdate;
//
// private String productkey;
//
// private Integer num;
//
// private Integer eventId;
//
// private String version;
//
// private String useridentifier;
//
// private String sessionId;
//
// private String libVersion;
//
// private Date insertdate;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getDeviceid() {
// return deviceid;
// }
//
// public void setDeviceid(String deviceid) {
// this.deviceid = deviceid == null ? null : deviceid.trim();
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category == null ? null : category.trim();
// }
//
// public String getEvent() {
// return event;
// }
//
// public void setEvent(String event) {
// this.event = event == null ? null : event.trim();
// }
//
// public String getLabel() {
// return label;
// }
//
// public void setLabel(String label) {
// this.label = label == null ? null : label.trim();
// }
//
// public String getAttachment() {
// return attachment;
// }
//
// public void setAttachment(String attachment) {
// this.attachment = attachment == null ? null : attachment.trim();
// }
//
// public Date getClientdate() {
// return clientdate;
// }
//
// public void setClientdate(Date clientdate) {
// this.clientdate = clientdate;
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public Integer getNum() {
// return num;
// }
//
// public void setNum(Integer num) {
// this.num = num;
// }
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getVersion() {
// return version;
// }
//
// public void setVersion(String version) {
// this.version = version == null ? null : version.trim();
// }
//
// public String getUseridentifier() {
// return useridentifier;
// }
//
// public void setUseridentifier(String useridentifier) {
// this.useridentifier = useridentifier == null ? null : useridentifier.trim();
// }
//
// public String getSessionId() {
// return sessionId;
// }
//
// public void setSessionId(String sessionId) {
// this.sessionId = sessionId == null ? null : sessionId.trim();
// }
//
// public String getLibVersion() {
// return libVersion;
// }
//
// public void setLibVersion(String libVersion) {
// this.libVersion = libVersion == null ? null : libVersion.trim();
// }
//
// public Date getInsertdate() {
// return insertdate;
// }
//
// public void setInsertdate(Date insertdate) {
// this.insertdate = insertdate;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDataEntityMapper.java
// @Repository
// public interface EventDataEntityMapper {
//
// int deleteByPrimaryKey(Integer id);
//
// int insert(EventDataEntity record);
//
// int insertSelective(EventDataEntity record);
//
// EventDataEntity selectByPrimaryKey(Integer id);
//
// int updateByPrimaryKeySelective(EventDataEntity record);
//
// int updateByPrimaryKey(EventDataEntity record);
// }
| import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.EventDataEntity;
import com.appleframework.ums.server.storage.mapper.EventDataEntityMapper;
| package com.appleframework.ums.server.storage.dao;
@Repository("eventDataEntityDao")
public class EventDataEntityDao {
@Resource
| // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDataEntity.java
// public class EventDataEntity implements Serializable {
// private Integer id;
//
// private String deviceid;
//
// private String category;
//
// private String event;
//
// private String label;
//
// private String attachment;
//
// private Date clientdate;
//
// private String productkey;
//
// private Integer num;
//
// private Integer eventId;
//
// private String version;
//
// private String useridentifier;
//
// private String sessionId;
//
// private String libVersion;
//
// private Date insertdate;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getDeviceid() {
// return deviceid;
// }
//
// public void setDeviceid(String deviceid) {
// this.deviceid = deviceid == null ? null : deviceid.trim();
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category == null ? null : category.trim();
// }
//
// public String getEvent() {
// return event;
// }
//
// public void setEvent(String event) {
// this.event = event == null ? null : event.trim();
// }
//
// public String getLabel() {
// return label;
// }
//
// public void setLabel(String label) {
// this.label = label == null ? null : label.trim();
// }
//
// public String getAttachment() {
// return attachment;
// }
//
// public void setAttachment(String attachment) {
// this.attachment = attachment == null ? null : attachment.trim();
// }
//
// public Date getClientdate() {
// return clientdate;
// }
//
// public void setClientdate(Date clientdate) {
// this.clientdate = clientdate;
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public Integer getNum() {
// return num;
// }
//
// public void setNum(Integer num) {
// this.num = num;
// }
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getVersion() {
// return version;
// }
//
// public void setVersion(String version) {
// this.version = version == null ? null : version.trim();
// }
//
// public String getUseridentifier() {
// return useridentifier;
// }
//
// public void setUseridentifier(String useridentifier) {
// this.useridentifier = useridentifier == null ? null : useridentifier.trim();
// }
//
// public String getSessionId() {
// return sessionId;
// }
//
// public void setSessionId(String sessionId) {
// this.sessionId = sessionId == null ? null : sessionId.trim();
// }
//
// public String getLibVersion() {
// return libVersion;
// }
//
// public void setLibVersion(String libVersion) {
// this.libVersion = libVersion == null ? null : libVersion.trim();
// }
//
// public Date getInsertdate() {
// return insertdate;
// }
//
// public void setInsertdate(Date insertdate) {
// this.insertdate = insertdate;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDataEntityMapper.java
// @Repository
// public interface EventDataEntityMapper {
//
// int deleteByPrimaryKey(Integer id);
//
// int insert(EventDataEntity record);
//
// int insertSelective(EventDataEntity record);
//
// EventDataEntity selectByPrimaryKey(Integer id);
//
// int updateByPrimaryKeySelective(EventDataEntity record);
//
// int updateByPrimaryKey(EventDataEntity record);
// }
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/EventDataEntityDao.java
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.EventDataEntity;
import com.appleframework.ums.server.storage.mapper.EventDataEntityMapper;
package com.appleframework.ums.server.storage.dao;
@Repository("eventDataEntityDao")
public class EventDataEntityDao {
@Resource
| private EventDataEntityMapper eventDataEntityMapper;
|
xushaomin/apple-ums-server | apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/EventDataEntityDao.java | // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDataEntity.java
// public class EventDataEntity implements Serializable {
// private Integer id;
//
// private String deviceid;
//
// private String category;
//
// private String event;
//
// private String label;
//
// private String attachment;
//
// private Date clientdate;
//
// private String productkey;
//
// private Integer num;
//
// private Integer eventId;
//
// private String version;
//
// private String useridentifier;
//
// private String sessionId;
//
// private String libVersion;
//
// private Date insertdate;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getDeviceid() {
// return deviceid;
// }
//
// public void setDeviceid(String deviceid) {
// this.deviceid = deviceid == null ? null : deviceid.trim();
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category == null ? null : category.trim();
// }
//
// public String getEvent() {
// return event;
// }
//
// public void setEvent(String event) {
// this.event = event == null ? null : event.trim();
// }
//
// public String getLabel() {
// return label;
// }
//
// public void setLabel(String label) {
// this.label = label == null ? null : label.trim();
// }
//
// public String getAttachment() {
// return attachment;
// }
//
// public void setAttachment(String attachment) {
// this.attachment = attachment == null ? null : attachment.trim();
// }
//
// public Date getClientdate() {
// return clientdate;
// }
//
// public void setClientdate(Date clientdate) {
// this.clientdate = clientdate;
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public Integer getNum() {
// return num;
// }
//
// public void setNum(Integer num) {
// this.num = num;
// }
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getVersion() {
// return version;
// }
//
// public void setVersion(String version) {
// this.version = version == null ? null : version.trim();
// }
//
// public String getUseridentifier() {
// return useridentifier;
// }
//
// public void setUseridentifier(String useridentifier) {
// this.useridentifier = useridentifier == null ? null : useridentifier.trim();
// }
//
// public String getSessionId() {
// return sessionId;
// }
//
// public void setSessionId(String sessionId) {
// this.sessionId = sessionId == null ? null : sessionId.trim();
// }
//
// public String getLibVersion() {
// return libVersion;
// }
//
// public void setLibVersion(String libVersion) {
// this.libVersion = libVersion == null ? null : libVersion.trim();
// }
//
// public Date getInsertdate() {
// return insertdate;
// }
//
// public void setInsertdate(Date insertdate) {
// this.insertdate = insertdate;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDataEntityMapper.java
// @Repository
// public interface EventDataEntityMapper {
//
// int deleteByPrimaryKey(Integer id);
//
// int insert(EventDataEntity record);
//
// int insertSelective(EventDataEntity record);
//
// EventDataEntity selectByPrimaryKey(Integer id);
//
// int updateByPrimaryKeySelective(EventDataEntity record);
//
// int updateByPrimaryKey(EventDataEntity record);
// }
| import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.EventDataEntity;
import com.appleframework.ums.server.storage.mapper.EventDataEntityMapper;
| package com.appleframework.ums.server.storage.dao;
@Repository("eventDataEntityDao")
public class EventDataEntityDao {
@Resource
private EventDataEntityMapper eventDataEntityMapper;
| // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDataEntity.java
// public class EventDataEntity implements Serializable {
// private Integer id;
//
// private String deviceid;
//
// private String category;
//
// private String event;
//
// private String label;
//
// private String attachment;
//
// private Date clientdate;
//
// private String productkey;
//
// private Integer num;
//
// private Integer eventId;
//
// private String version;
//
// private String useridentifier;
//
// private String sessionId;
//
// private String libVersion;
//
// private Date insertdate;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getDeviceid() {
// return deviceid;
// }
//
// public void setDeviceid(String deviceid) {
// this.deviceid = deviceid == null ? null : deviceid.trim();
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category == null ? null : category.trim();
// }
//
// public String getEvent() {
// return event;
// }
//
// public void setEvent(String event) {
// this.event = event == null ? null : event.trim();
// }
//
// public String getLabel() {
// return label;
// }
//
// public void setLabel(String label) {
// this.label = label == null ? null : label.trim();
// }
//
// public String getAttachment() {
// return attachment;
// }
//
// public void setAttachment(String attachment) {
// this.attachment = attachment == null ? null : attachment.trim();
// }
//
// public Date getClientdate() {
// return clientdate;
// }
//
// public void setClientdate(Date clientdate) {
// this.clientdate = clientdate;
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public Integer getNum() {
// return num;
// }
//
// public void setNum(Integer num) {
// this.num = num;
// }
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getVersion() {
// return version;
// }
//
// public void setVersion(String version) {
// this.version = version == null ? null : version.trim();
// }
//
// public String getUseridentifier() {
// return useridentifier;
// }
//
// public void setUseridentifier(String useridentifier) {
// this.useridentifier = useridentifier == null ? null : useridentifier.trim();
// }
//
// public String getSessionId() {
// return sessionId;
// }
//
// public void setSessionId(String sessionId) {
// this.sessionId = sessionId == null ? null : sessionId.trim();
// }
//
// public String getLibVersion() {
// return libVersion;
// }
//
// public void setLibVersion(String libVersion) {
// this.libVersion = libVersion == null ? null : libVersion.trim();
// }
//
// public Date getInsertdate() {
// return insertdate;
// }
//
// public void setInsertdate(Date insertdate) {
// this.insertdate = insertdate;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDataEntityMapper.java
// @Repository
// public interface EventDataEntityMapper {
//
// int deleteByPrimaryKey(Integer id);
//
// int insert(EventDataEntity record);
//
// int insertSelective(EventDataEntity record);
//
// EventDataEntity selectByPrimaryKey(Integer id);
//
// int updateByPrimaryKeySelective(EventDataEntity record);
//
// int updateByPrimaryKey(EventDataEntity record);
// }
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/EventDataEntityDao.java
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.EventDataEntity;
import com.appleframework.ums.server.storage.mapper.EventDataEntityMapper;
package com.appleframework.ums.server.storage.dao;
@Repository("eventDataEntityDao")
public class EventDataEntityDao {
@Resource
private EventDataEntityMapper eventDataEntityMapper;
| public void save(EventDataEntity record) {
|
xushaomin/apple-ums-server | apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDefinationExtendMapper.java | // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDefinationEntity.java
// public class EventDefinationEntity implements Serializable {
// private Integer eventId;
//
// private String eventIdentifier;
//
// private String productkey;
//
// private String eventName;
//
// private Integer channelId;
//
// private Integer productId;
//
// private Integer userId;
//
// private Date createDate;
//
// private Integer active;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getEventIdentifier() {
// return eventIdentifier;
// }
//
// public void setEventIdentifier(String eventIdentifier) {
// this.eventIdentifier = eventIdentifier == null ? null : eventIdentifier.trim();
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public String getEventName() {
// return eventName;
// }
//
// public void setEventName(String eventName) {
// this.eventName = eventName == null ? null : eventName.trim();
// }
//
// public Integer getChannelId() {
// return channelId;
// }
//
// public void setChannelId(Integer channelId) {
// this.channelId = channelId;
// }
//
// public Integer getProductId() {
// return productId;
// }
//
// public void setProductId(Integer productId) {
// this.productId = productId;
// }
//
// public Integer getUserId() {
// return userId;
// }
//
// public void setUserId(Integer userId) {
// this.userId = userId;
// }
//
// public Date getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(Date createDate) {
// this.createDate = createDate;
// }
//
// public Integer getActive() {
// return active;
// }
//
// public void setActive(Integer active) {
// this.active = active;
// }
// }
| import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.EventDefinationEntity;
| package com.appleframework.ums.server.storage.mapper;
@Repository
public interface EventDefinationExtendMapper {
| // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDefinationEntity.java
// public class EventDefinationEntity implements Serializable {
// private Integer eventId;
//
// private String eventIdentifier;
//
// private String productkey;
//
// private String eventName;
//
// private Integer channelId;
//
// private Integer productId;
//
// private Integer userId;
//
// private Date createDate;
//
// private Integer active;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getEventIdentifier() {
// return eventIdentifier;
// }
//
// public void setEventIdentifier(String eventIdentifier) {
// this.eventIdentifier = eventIdentifier == null ? null : eventIdentifier.trim();
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public String getEventName() {
// return eventName;
// }
//
// public void setEventName(String eventName) {
// this.eventName = eventName == null ? null : eventName.trim();
// }
//
// public Integer getChannelId() {
// return channelId;
// }
//
// public void setChannelId(Integer channelId) {
// this.channelId = channelId;
// }
//
// public Integer getProductId() {
// return productId;
// }
//
// public void setProductId(Integer productId) {
// this.productId = productId;
// }
//
// public Integer getUserId() {
// return userId;
// }
//
// public void setUserId(Integer userId) {
// this.userId = userId;
// }
//
// public Date getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(Date createDate) {
// this.createDate = createDate;
// }
//
// public Integer getActive() {
// return active;
// }
//
// public void setActive(Integer active) {
// this.active = active;
// }
// }
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDefinationExtendMapper.java
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.EventDefinationEntity;
package com.appleframework.ums.server.storage.mapper;
@Repository
public interface EventDefinationExtendMapper {
| public EventDefinationEntity selectByProductkeyAndEventIdentifier(@Param("productkey") String productkey,
|
xushaomin/apple-ums-server | apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/controller/PushPolicyQueryController.java | // Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/request/PushPolicyQueryRequest.java
// public class PushPolicyQueryRequest extends AbstractRestRequest {
//
// private String appKey;
//
// public String getAppKey() {
// return appKey;
// }
//
// public void setAppKey(String appKey) {
// this.appKey = appKey;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/PushPolicyQuery.java
// public class PushPolicyQuery {
//
// private Integer autoGetLocation = 1; // 是否获取location
// private Integer updateOnlyWifi = 0; // 只在wifi状态下更新
// private Integer reportPolicy = 1; // 数据发送模式
// private Integer sessionMillis = 30; // 获取到的单位为 秒 默认30秒
// private Integer intervalTime = 1; // 获取到的数据单位为分钟 默认1分钟
// private Integer fileSize = 1; // 缓存文件大小 服务端为M ,此处转为字节保存之
//
// public Integer getAutoGetLocation() {
// return autoGetLocation;
// }
//
// public void setAutoGetLocation(Integer autoGetLocation) {
// this.autoGetLocation = autoGetLocation;
// }
//
// public Integer getUpdateOnlyWifi() {
// return updateOnlyWifi;
// }
//
// public void setUpdateOnlyWifi(Integer updateOnlyWifi) {
// this.updateOnlyWifi = updateOnlyWifi;
// }
//
// public Integer getReportPolicy() {
// return reportPolicy;
// }
//
// public void setReportPolicy(Integer reportPolicy) {
// this.reportPolicy = reportPolicy;
// }
//
// public Integer getSessionMillis() {
// return sessionMillis;
// }
//
// public void setSessionMillis(Integer sessionMillis) {
// this.sessionMillis = sessionMillis;
// }
//
// public Integer getIntervalTime() {
// return intervalTime;
// }
//
// public void setIntervalTime(Integer intervalTime) {
// this.intervalTime = intervalTime;
// }
//
// public Integer getFileSize() {
// return fileSize;
// }
//
// public void setFileSize(Integer fileSize) {
// this.fileSize = fileSize;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/PushPolicyQueryResponse.java
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlRootElement(name = "pushPolicyQueryResponse")
// public class PushPolicyQueryResponse {
//
// private PushPolicyQuery reply;
//
// public PushPolicyQuery getReply() {
// return reply;
// }
//
// public void setReply(PushPolicyQuery reply) {
// this.reply = reply;
// }
//
// }
| import com.appleframework.rest.annotation.ServiceMethod;
import com.appleframework.rest.annotation.ServiceMethodBean;
import com.appleframework.ums.server.collector.request.PushPolicyQueryRequest;
import com.appleframework.ums.server.collector.response.PushPolicyQuery;
import com.appleframework.ums.server.collector.response.PushPolicyQueryResponse;
| package com.appleframework.ums.server.collector.controller;
/**
* <pre>
* 功能说明:
* </pre>
*
* @author 徐少敏
* @version 1.0
*/
@ServiceMethodBean
public class PushPolicyQueryController extends BaseController {
//private static Logger logger = Logger.getLogger(UsingLogController.class);
@ServiceMethod(method = "/ums/pushpolicyquery")
| // Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/request/PushPolicyQueryRequest.java
// public class PushPolicyQueryRequest extends AbstractRestRequest {
//
// private String appKey;
//
// public String getAppKey() {
// return appKey;
// }
//
// public void setAppKey(String appKey) {
// this.appKey = appKey;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/PushPolicyQuery.java
// public class PushPolicyQuery {
//
// private Integer autoGetLocation = 1; // 是否获取location
// private Integer updateOnlyWifi = 0; // 只在wifi状态下更新
// private Integer reportPolicy = 1; // 数据发送模式
// private Integer sessionMillis = 30; // 获取到的单位为 秒 默认30秒
// private Integer intervalTime = 1; // 获取到的数据单位为分钟 默认1分钟
// private Integer fileSize = 1; // 缓存文件大小 服务端为M ,此处转为字节保存之
//
// public Integer getAutoGetLocation() {
// return autoGetLocation;
// }
//
// public void setAutoGetLocation(Integer autoGetLocation) {
// this.autoGetLocation = autoGetLocation;
// }
//
// public Integer getUpdateOnlyWifi() {
// return updateOnlyWifi;
// }
//
// public void setUpdateOnlyWifi(Integer updateOnlyWifi) {
// this.updateOnlyWifi = updateOnlyWifi;
// }
//
// public Integer getReportPolicy() {
// return reportPolicy;
// }
//
// public void setReportPolicy(Integer reportPolicy) {
// this.reportPolicy = reportPolicy;
// }
//
// public Integer getSessionMillis() {
// return sessionMillis;
// }
//
// public void setSessionMillis(Integer sessionMillis) {
// this.sessionMillis = sessionMillis;
// }
//
// public Integer getIntervalTime() {
// return intervalTime;
// }
//
// public void setIntervalTime(Integer intervalTime) {
// this.intervalTime = intervalTime;
// }
//
// public Integer getFileSize() {
// return fileSize;
// }
//
// public void setFileSize(Integer fileSize) {
// this.fileSize = fileSize;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/PushPolicyQueryResponse.java
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlRootElement(name = "pushPolicyQueryResponse")
// public class PushPolicyQueryResponse {
//
// private PushPolicyQuery reply;
//
// public PushPolicyQuery getReply() {
// return reply;
// }
//
// public void setReply(PushPolicyQuery reply) {
// this.reply = reply;
// }
//
// }
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/controller/PushPolicyQueryController.java
import com.appleframework.rest.annotation.ServiceMethod;
import com.appleframework.rest.annotation.ServiceMethodBean;
import com.appleframework.ums.server.collector.request.PushPolicyQueryRequest;
import com.appleframework.ums.server.collector.response.PushPolicyQuery;
import com.appleframework.ums.server.collector.response.PushPolicyQueryResponse;
package com.appleframework.ums.server.collector.controller;
/**
* <pre>
* 功能说明:
* </pre>
*
* @author 徐少敏
* @version 1.0
*/
@ServiceMethodBean
public class PushPolicyQueryController extends BaseController {
//private static Logger logger = Logger.getLogger(UsingLogController.class);
@ServiceMethod(method = "/ums/pushpolicyquery")
| public Object pushpolicyquery(PushPolicyQueryRequest request) {
|
xushaomin/apple-ums-server | apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/controller/PushPolicyQueryController.java | // Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/request/PushPolicyQueryRequest.java
// public class PushPolicyQueryRequest extends AbstractRestRequest {
//
// private String appKey;
//
// public String getAppKey() {
// return appKey;
// }
//
// public void setAppKey(String appKey) {
// this.appKey = appKey;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/PushPolicyQuery.java
// public class PushPolicyQuery {
//
// private Integer autoGetLocation = 1; // 是否获取location
// private Integer updateOnlyWifi = 0; // 只在wifi状态下更新
// private Integer reportPolicy = 1; // 数据发送模式
// private Integer sessionMillis = 30; // 获取到的单位为 秒 默认30秒
// private Integer intervalTime = 1; // 获取到的数据单位为分钟 默认1分钟
// private Integer fileSize = 1; // 缓存文件大小 服务端为M ,此处转为字节保存之
//
// public Integer getAutoGetLocation() {
// return autoGetLocation;
// }
//
// public void setAutoGetLocation(Integer autoGetLocation) {
// this.autoGetLocation = autoGetLocation;
// }
//
// public Integer getUpdateOnlyWifi() {
// return updateOnlyWifi;
// }
//
// public void setUpdateOnlyWifi(Integer updateOnlyWifi) {
// this.updateOnlyWifi = updateOnlyWifi;
// }
//
// public Integer getReportPolicy() {
// return reportPolicy;
// }
//
// public void setReportPolicy(Integer reportPolicy) {
// this.reportPolicy = reportPolicy;
// }
//
// public Integer getSessionMillis() {
// return sessionMillis;
// }
//
// public void setSessionMillis(Integer sessionMillis) {
// this.sessionMillis = sessionMillis;
// }
//
// public Integer getIntervalTime() {
// return intervalTime;
// }
//
// public void setIntervalTime(Integer intervalTime) {
// this.intervalTime = intervalTime;
// }
//
// public Integer getFileSize() {
// return fileSize;
// }
//
// public void setFileSize(Integer fileSize) {
// this.fileSize = fileSize;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/PushPolicyQueryResponse.java
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlRootElement(name = "pushPolicyQueryResponse")
// public class PushPolicyQueryResponse {
//
// private PushPolicyQuery reply;
//
// public PushPolicyQuery getReply() {
// return reply;
// }
//
// public void setReply(PushPolicyQuery reply) {
// this.reply = reply;
// }
//
// }
| import com.appleframework.rest.annotation.ServiceMethod;
import com.appleframework.rest.annotation.ServiceMethodBean;
import com.appleframework.ums.server.collector.request.PushPolicyQueryRequest;
import com.appleframework.ums.server.collector.response.PushPolicyQuery;
import com.appleframework.ums.server.collector.response.PushPolicyQueryResponse;
| package com.appleframework.ums.server.collector.controller;
/**
* <pre>
* 功能说明:
* </pre>
*
* @author 徐少敏
* @version 1.0
*/
@ServiceMethodBean
public class PushPolicyQueryController extends BaseController {
//private static Logger logger = Logger.getLogger(UsingLogController.class);
@ServiceMethod(method = "/ums/pushpolicyquery")
public Object pushpolicyquery(PushPolicyQueryRequest request) {
| // Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/request/PushPolicyQueryRequest.java
// public class PushPolicyQueryRequest extends AbstractRestRequest {
//
// private String appKey;
//
// public String getAppKey() {
// return appKey;
// }
//
// public void setAppKey(String appKey) {
// this.appKey = appKey;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/PushPolicyQuery.java
// public class PushPolicyQuery {
//
// private Integer autoGetLocation = 1; // 是否获取location
// private Integer updateOnlyWifi = 0; // 只在wifi状态下更新
// private Integer reportPolicy = 1; // 数据发送模式
// private Integer sessionMillis = 30; // 获取到的单位为 秒 默认30秒
// private Integer intervalTime = 1; // 获取到的数据单位为分钟 默认1分钟
// private Integer fileSize = 1; // 缓存文件大小 服务端为M ,此处转为字节保存之
//
// public Integer getAutoGetLocation() {
// return autoGetLocation;
// }
//
// public void setAutoGetLocation(Integer autoGetLocation) {
// this.autoGetLocation = autoGetLocation;
// }
//
// public Integer getUpdateOnlyWifi() {
// return updateOnlyWifi;
// }
//
// public void setUpdateOnlyWifi(Integer updateOnlyWifi) {
// this.updateOnlyWifi = updateOnlyWifi;
// }
//
// public Integer getReportPolicy() {
// return reportPolicy;
// }
//
// public void setReportPolicy(Integer reportPolicy) {
// this.reportPolicy = reportPolicy;
// }
//
// public Integer getSessionMillis() {
// return sessionMillis;
// }
//
// public void setSessionMillis(Integer sessionMillis) {
// this.sessionMillis = sessionMillis;
// }
//
// public Integer getIntervalTime() {
// return intervalTime;
// }
//
// public void setIntervalTime(Integer intervalTime) {
// this.intervalTime = intervalTime;
// }
//
// public Integer getFileSize() {
// return fileSize;
// }
//
// public void setFileSize(Integer fileSize) {
// this.fileSize = fileSize;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/PushPolicyQueryResponse.java
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlRootElement(name = "pushPolicyQueryResponse")
// public class PushPolicyQueryResponse {
//
// private PushPolicyQuery reply;
//
// public PushPolicyQuery getReply() {
// return reply;
// }
//
// public void setReply(PushPolicyQuery reply) {
// this.reply = reply;
// }
//
// }
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/controller/PushPolicyQueryController.java
import com.appleframework.rest.annotation.ServiceMethod;
import com.appleframework.rest.annotation.ServiceMethodBean;
import com.appleframework.ums.server.collector.request.PushPolicyQueryRequest;
import com.appleframework.ums.server.collector.response.PushPolicyQuery;
import com.appleframework.ums.server.collector.response.PushPolicyQueryResponse;
package com.appleframework.ums.server.collector.controller;
/**
* <pre>
* 功能说明:
* </pre>
*
* @author 徐少敏
* @version 1.0
*/
@ServiceMethodBean
public class PushPolicyQueryController extends BaseController {
//private static Logger logger = Logger.getLogger(UsingLogController.class);
@ServiceMethod(method = "/ums/pushpolicyquery")
public Object pushpolicyquery(PushPolicyQueryRequest request) {
| PushPolicyQueryResponse response = new PushPolicyQueryResponse();
|
xushaomin/apple-ums-server | apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/controller/PushPolicyQueryController.java | // Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/request/PushPolicyQueryRequest.java
// public class PushPolicyQueryRequest extends AbstractRestRequest {
//
// private String appKey;
//
// public String getAppKey() {
// return appKey;
// }
//
// public void setAppKey(String appKey) {
// this.appKey = appKey;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/PushPolicyQuery.java
// public class PushPolicyQuery {
//
// private Integer autoGetLocation = 1; // 是否获取location
// private Integer updateOnlyWifi = 0; // 只在wifi状态下更新
// private Integer reportPolicy = 1; // 数据发送模式
// private Integer sessionMillis = 30; // 获取到的单位为 秒 默认30秒
// private Integer intervalTime = 1; // 获取到的数据单位为分钟 默认1分钟
// private Integer fileSize = 1; // 缓存文件大小 服务端为M ,此处转为字节保存之
//
// public Integer getAutoGetLocation() {
// return autoGetLocation;
// }
//
// public void setAutoGetLocation(Integer autoGetLocation) {
// this.autoGetLocation = autoGetLocation;
// }
//
// public Integer getUpdateOnlyWifi() {
// return updateOnlyWifi;
// }
//
// public void setUpdateOnlyWifi(Integer updateOnlyWifi) {
// this.updateOnlyWifi = updateOnlyWifi;
// }
//
// public Integer getReportPolicy() {
// return reportPolicy;
// }
//
// public void setReportPolicy(Integer reportPolicy) {
// this.reportPolicy = reportPolicy;
// }
//
// public Integer getSessionMillis() {
// return sessionMillis;
// }
//
// public void setSessionMillis(Integer sessionMillis) {
// this.sessionMillis = sessionMillis;
// }
//
// public Integer getIntervalTime() {
// return intervalTime;
// }
//
// public void setIntervalTime(Integer intervalTime) {
// this.intervalTime = intervalTime;
// }
//
// public Integer getFileSize() {
// return fileSize;
// }
//
// public void setFileSize(Integer fileSize) {
// this.fileSize = fileSize;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/PushPolicyQueryResponse.java
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlRootElement(name = "pushPolicyQueryResponse")
// public class PushPolicyQueryResponse {
//
// private PushPolicyQuery reply;
//
// public PushPolicyQuery getReply() {
// return reply;
// }
//
// public void setReply(PushPolicyQuery reply) {
// this.reply = reply;
// }
//
// }
| import com.appleframework.rest.annotation.ServiceMethod;
import com.appleframework.rest.annotation.ServiceMethodBean;
import com.appleframework.ums.server.collector.request.PushPolicyQueryRequest;
import com.appleframework.ums.server.collector.response.PushPolicyQuery;
import com.appleframework.ums.server.collector.response.PushPolicyQueryResponse;
| package com.appleframework.ums.server.collector.controller;
/**
* <pre>
* 功能说明:
* </pre>
*
* @author 徐少敏
* @version 1.0
*/
@ServiceMethodBean
public class PushPolicyQueryController extends BaseController {
//private static Logger logger = Logger.getLogger(UsingLogController.class);
@ServiceMethod(method = "/ums/pushpolicyquery")
public Object pushpolicyquery(PushPolicyQueryRequest request) {
PushPolicyQueryResponse response = new PushPolicyQueryResponse();
| // Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/request/PushPolicyQueryRequest.java
// public class PushPolicyQueryRequest extends AbstractRestRequest {
//
// private String appKey;
//
// public String getAppKey() {
// return appKey;
// }
//
// public void setAppKey(String appKey) {
// this.appKey = appKey;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/PushPolicyQuery.java
// public class PushPolicyQuery {
//
// private Integer autoGetLocation = 1; // 是否获取location
// private Integer updateOnlyWifi = 0; // 只在wifi状态下更新
// private Integer reportPolicy = 1; // 数据发送模式
// private Integer sessionMillis = 30; // 获取到的单位为 秒 默认30秒
// private Integer intervalTime = 1; // 获取到的数据单位为分钟 默认1分钟
// private Integer fileSize = 1; // 缓存文件大小 服务端为M ,此处转为字节保存之
//
// public Integer getAutoGetLocation() {
// return autoGetLocation;
// }
//
// public void setAutoGetLocation(Integer autoGetLocation) {
// this.autoGetLocation = autoGetLocation;
// }
//
// public Integer getUpdateOnlyWifi() {
// return updateOnlyWifi;
// }
//
// public void setUpdateOnlyWifi(Integer updateOnlyWifi) {
// this.updateOnlyWifi = updateOnlyWifi;
// }
//
// public Integer getReportPolicy() {
// return reportPolicy;
// }
//
// public void setReportPolicy(Integer reportPolicy) {
// this.reportPolicy = reportPolicy;
// }
//
// public Integer getSessionMillis() {
// return sessionMillis;
// }
//
// public void setSessionMillis(Integer sessionMillis) {
// this.sessionMillis = sessionMillis;
// }
//
// public Integer getIntervalTime() {
// return intervalTime;
// }
//
// public void setIntervalTime(Integer intervalTime) {
// this.intervalTime = intervalTime;
// }
//
// public Integer getFileSize() {
// return fileSize;
// }
//
// public void setFileSize(Integer fileSize) {
// this.fileSize = fileSize;
// }
//
// }
//
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/response/PushPolicyQueryResponse.java
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlRootElement(name = "pushPolicyQueryResponse")
// public class PushPolicyQueryResponse {
//
// private PushPolicyQuery reply;
//
// public PushPolicyQuery getReply() {
// return reply;
// }
//
// public void setReply(PushPolicyQuery reply) {
// this.reply = reply;
// }
//
// }
// Path: apple-ums-server-collector/src/main/java/com/appleframework/ums/server/collector/controller/PushPolicyQueryController.java
import com.appleframework.rest.annotation.ServiceMethod;
import com.appleframework.rest.annotation.ServiceMethodBean;
import com.appleframework.ums.server.collector.request.PushPolicyQueryRequest;
import com.appleframework.ums.server.collector.response.PushPolicyQuery;
import com.appleframework.ums.server.collector.response.PushPolicyQueryResponse;
package com.appleframework.ums.server.collector.controller;
/**
* <pre>
* 功能说明:
* </pre>
*
* @author 徐少敏
* @version 1.0
*/
@ServiceMethodBean
public class PushPolicyQueryController extends BaseController {
//private static Logger logger = Logger.getLogger(UsingLogController.class);
@ServiceMethod(method = "/ums/pushpolicyquery")
public Object pushpolicyquery(PushPolicyQueryRequest request) {
PushPolicyQueryResponse response = new PushPolicyQueryResponse();
| PushPolicyQuery reply = new PushPolicyQuery();
|
xushaomin/apple-ums-server | apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/ErrorLogEntityDao.java | // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/ErrorLogEntityWithBLOBs.java
// public class ErrorLogEntityWithBLOBs extends ErrorLogEntity implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// private String title;
//
// private String stacktrace;
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title == null ? null : title.trim();
// }
//
// public String getStacktrace() {
// return stacktrace;
// }
//
// public void setStacktrace(String stacktrace) {
// this.stacktrace = stacktrace == null ? null : stacktrace.trim();
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/ErrorLogEntityMapper.java
// @Repository
// public interface ErrorLogEntityMapper {
//
// int deleteByPrimaryKey(Integer id);
//
// int insert(ErrorLogEntityWithBLOBs record);
//
// int insertSelective(ErrorLogEntityWithBLOBs record);
//
// ErrorLogEntityWithBLOBs selectByPrimaryKey(Integer id);
//
// int updateByPrimaryKeySelective(ErrorLogEntityWithBLOBs record);
//
// int updateByPrimaryKeyWithBLOBs(ErrorLogEntityWithBLOBs record);
//
// int updateByPrimaryKey(ErrorLogEntity record);
// }
| import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.ErrorLogEntityWithBLOBs;
import com.appleframework.ums.server.storage.mapper.ErrorLogEntityMapper;
| package com.appleframework.ums.server.storage.dao;
@Repository("errorLogEntityDao")
public class ErrorLogEntityDao {
@Resource
| // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/ErrorLogEntityWithBLOBs.java
// public class ErrorLogEntityWithBLOBs extends ErrorLogEntity implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// private String title;
//
// private String stacktrace;
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title == null ? null : title.trim();
// }
//
// public String getStacktrace() {
// return stacktrace;
// }
//
// public void setStacktrace(String stacktrace) {
// this.stacktrace = stacktrace == null ? null : stacktrace.trim();
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/ErrorLogEntityMapper.java
// @Repository
// public interface ErrorLogEntityMapper {
//
// int deleteByPrimaryKey(Integer id);
//
// int insert(ErrorLogEntityWithBLOBs record);
//
// int insertSelective(ErrorLogEntityWithBLOBs record);
//
// ErrorLogEntityWithBLOBs selectByPrimaryKey(Integer id);
//
// int updateByPrimaryKeySelective(ErrorLogEntityWithBLOBs record);
//
// int updateByPrimaryKeyWithBLOBs(ErrorLogEntityWithBLOBs record);
//
// int updateByPrimaryKey(ErrorLogEntity record);
// }
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/ErrorLogEntityDao.java
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.ErrorLogEntityWithBLOBs;
import com.appleframework.ums.server.storage.mapper.ErrorLogEntityMapper;
package com.appleframework.ums.server.storage.dao;
@Repository("errorLogEntityDao")
public class ErrorLogEntityDao {
@Resource
| private ErrorLogEntityMapper errorLogEntityMapper;
|
xushaomin/apple-ums-server | apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/ErrorLogEntityDao.java | // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/ErrorLogEntityWithBLOBs.java
// public class ErrorLogEntityWithBLOBs extends ErrorLogEntity implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// private String title;
//
// private String stacktrace;
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title == null ? null : title.trim();
// }
//
// public String getStacktrace() {
// return stacktrace;
// }
//
// public void setStacktrace(String stacktrace) {
// this.stacktrace = stacktrace == null ? null : stacktrace.trim();
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/ErrorLogEntityMapper.java
// @Repository
// public interface ErrorLogEntityMapper {
//
// int deleteByPrimaryKey(Integer id);
//
// int insert(ErrorLogEntityWithBLOBs record);
//
// int insertSelective(ErrorLogEntityWithBLOBs record);
//
// ErrorLogEntityWithBLOBs selectByPrimaryKey(Integer id);
//
// int updateByPrimaryKeySelective(ErrorLogEntityWithBLOBs record);
//
// int updateByPrimaryKeyWithBLOBs(ErrorLogEntityWithBLOBs record);
//
// int updateByPrimaryKey(ErrorLogEntity record);
// }
| import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.ErrorLogEntityWithBLOBs;
import com.appleframework.ums.server.storage.mapper.ErrorLogEntityMapper;
| package com.appleframework.ums.server.storage.dao;
@Repository("errorLogEntityDao")
public class ErrorLogEntityDao {
@Resource
private ErrorLogEntityMapper errorLogEntityMapper;
| // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/ErrorLogEntityWithBLOBs.java
// public class ErrorLogEntityWithBLOBs extends ErrorLogEntity implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// private String title;
//
// private String stacktrace;
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title == null ? null : title.trim();
// }
//
// public String getStacktrace() {
// return stacktrace;
// }
//
// public void setStacktrace(String stacktrace) {
// this.stacktrace = stacktrace == null ? null : stacktrace.trim();
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/ErrorLogEntityMapper.java
// @Repository
// public interface ErrorLogEntityMapper {
//
// int deleteByPrimaryKey(Integer id);
//
// int insert(ErrorLogEntityWithBLOBs record);
//
// int insertSelective(ErrorLogEntityWithBLOBs record);
//
// ErrorLogEntityWithBLOBs selectByPrimaryKey(Integer id);
//
// int updateByPrimaryKeySelective(ErrorLogEntityWithBLOBs record);
//
// int updateByPrimaryKeyWithBLOBs(ErrorLogEntityWithBLOBs record);
//
// int updateByPrimaryKey(ErrorLogEntity record);
// }
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/ErrorLogEntityDao.java
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.ErrorLogEntityWithBLOBs;
import com.appleframework.ums.server.storage.mapper.ErrorLogEntityMapper;
package com.appleframework.ums.server.storage.dao;
@Repository("errorLogEntityDao")
public class ErrorLogEntityDao {
@Resource
private ErrorLogEntityMapper errorLogEntityMapper;
| public void save(ErrorLogEntityWithBLOBs record) {
|
xushaomin/apple-ums-server | apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/ErrorLogEntityMapper.java | // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/ErrorLogEntity.java
// public class ErrorLogEntity implements Serializable {
//
// private Integer id;
//
// private String appkey;
//
// private String device;
//
// private String osVersion;
//
// private String activity;
//
// private Date time;
//
// private String version;
//
// private Integer isfix;
//
// private Integer errorType;
//
// private String sessionId;
//
// private String useridentifier;
//
// private String libVersion;
//
// private String deviceid;
//
// private String dsymid;
//
// private String cpt;
//
// private String bim;
//
// private Date insertdate;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getAppkey() {
// return appkey;
// }
//
// public void setAppkey(String appkey) {
// this.appkey = appkey == null ? null : appkey.trim();
// }
//
// public String getDevice() {
// return device;
// }
//
// public void setDevice(String device) {
// this.device = device == null ? null : device.trim();
// }
//
// public String getOsVersion() {
// return osVersion;
// }
//
// public void setOsVersion(String osVersion) {
// this.osVersion = osVersion == null ? null : osVersion.trim();
// }
//
// public String getActivity() {
// return activity;
// }
//
// public void setActivity(String activity) {
// this.activity = activity == null ? null : activity.trim();
// }
//
// public Date getTime() {
// return time;
// }
//
// public void setTime(Date time) {
// this.time = time;
// }
//
// public String getVersion() {
// return version;
// }
//
// public void setVersion(String version) {
// this.version = version == null ? null : version.trim();
// }
//
// public Integer getIsfix() {
// return isfix;
// }
//
// public void setIsfix(Integer isfix) {
// this.isfix = isfix;
// }
//
// public Integer getErrorType() {
// return errorType;
// }
//
// public void setErrorType(Integer errorType) {
// this.errorType = errorType;
// }
//
// public String getSessionId() {
// return sessionId;
// }
//
// public void setSessionId(String sessionId) {
// this.sessionId = sessionId == null ? null : sessionId.trim();
// }
//
// public String getUseridentifier() {
// return useridentifier;
// }
//
// public void setUseridentifier(String useridentifier) {
// this.useridentifier = useridentifier == null ? null : useridentifier.trim();
// }
//
// public String getLibVersion() {
// return libVersion;
// }
//
// public void setLibVersion(String libVersion) {
// this.libVersion = libVersion == null ? null : libVersion.trim();
// }
//
// public String getDeviceid() {
// return deviceid;
// }
//
// public void setDeviceid(String deviceid) {
// this.deviceid = deviceid == null ? null : deviceid.trim();
// }
//
// public String getDsymid() {
// return dsymid;
// }
//
// public void setDsymid(String dsymid) {
// this.dsymid = dsymid == null ? null : dsymid.trim();
// }
//
// public String getCpt() {
// return cpt;
// }
//
// public void setCpt(String cpt) {
// this.cpt = cpt == null ? null : cpt.trim();
// }
//
// public String getBim() {
// return bim;
// }
//
// public void setBim(String bim) {
// this.bim = bim == null ? null : bim.trim();
// }
//
// public Date getInsertdate() {
// return insertdate;
// }
//
// public void setInsertdate(Date insertdate) {
// this.insertdate = insertdate;
// }
// }
//
// Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/ErrorLogEntityWithBLOBs.java
// public class ErrorLogEntityWithBLOBs extends ErrorLogEntity implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// private String title;
//
// private String stacktrace;
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title == null ? null : title.trim();
// }
//
// public String getStacktrace() {
// return stacktrace;
// }
//
// public void setStacktrace(String stacktrace) {
// this.stacktrace = stacktrace == null ? null : stacktrace.trim();
// }
// }
| import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.ErrorLogEntity;
import com.appleframework.ums.server.core.entity.ErrorLogEntityWithBLOBs;
| package com.appleframework.ums.server.storage.mapper;
@Repository
public interface ErrorLogEntityMapper {
int deleteByPrimaryKey(Integer id);
| // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/ErrorLogEntity.java
// public class ErrorLogEntity implements Serializable {
//
// private Integer id;
//
// private String appkey;
//
// private String device;
//
// private String osVersion;
//
// private String activity;
//
// private Date time;
//
// private String version;
//
// private Integer isfix;
//
// private Integer errorType;
//
// private String sessionId;
//
// private String useridentifier;
//
// private String libVersion;
//
// private String deviceid;
//
// private String dsymid;
//
// private String cpt;
//
// private String bim;
//
// private Date insertdate;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getAppkey() {
// return appkey;
// }
//
// public void setAppkey(String appkey) {
// this.appkey = appkey == null ? null : appkey.trim();
// }
//
// public String getDevice() {
// return device;
// }
//
// public void setDevice(String device) {
// this.device = device == null ? null : device.trim();
// }
//
// public String getOsVersion() {
// return osVersion;
// }
//
// public void setOsVersion(String osVersion) {
// this.osVersion = osVersion == null ? null : osVersion.trim();
// }
//
// public String getActivity() {
// return activity;
// }
//
// public void setActivity(String activity) {
// this.activity = activity == null ? null : activity.trim();
// }
//
// public Date getTime() {
// return time;
// }
//
// public void setTime(Date time) {
// this.time = time;
// }
//
// public String getVersion() {
// return version;
// }
//
// public void setVersion(String version) {
// this.version = version == null ? null : version.trim();
// }
//
// public Integer getIsfix() {
// return isfix;
// }
//
// public void setIsfix(Integer isfix) {
// this.isfix = isfix;
// }
//
// public Integer getErrorType() {
// return errorType;
// }
//
// public void setErrorType(Integer errorType) {
// this.errorType = errorType;
// }
//
// public String getSessionId() {
// return sessionId;
// }
//
// public void setSessionId(String sessionId) {
// this.sessionId = sessionId == null ? null : sessionId.trim();
// }
//
// public String getUseridentifier() {
// return useridentifier;
// }
//
// public void setUseridentifier(String useridentifier) {
// this.useridentifier = useridentifier == null ? null : useridentifier.trim();
// }
//
// public String getLibVersion() {
// return libVersion;
// }
//
// public void setLibVersion(String libVersion) {
// this.libVersion = libVersion == null ? null : libVersion.trim();
// }
//
// public String getDeviceid() {
// return deviceid;
// }
//
// public void setDeviceid(String deviceid) {
// this.deviceid = deviceid == null ? null : deviceid.trim();
// }
//
// public String getDsymid() {
// return dsymid;
// }
//
// public void setDsymid(String dsymid) {
// this.dsymid = dsymid == null ? null : dsymid.trim();
// }
//
// public String getCpt() {
// return cpt;
// }
//
// public void setCpt(String cpt) {
// this.cpt = cpt == null ? null : cpt.trim();
// }
//
// public String getBim() {
// return bim;
// }
//
// public void setBim(String bim) {
// this.bim = bim == null ? null : bim.trim();
// }
//
// public Date getInsertdate() {
// return insertdate;
// }
//
// public void setInsertdate(Date insertdate) {
// this.insertdate = insertdate;
// }
// }
//
// Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/ErrorLogEntityWithBLOBs.java
// public class ErrorLogEntityWithBLOBs extends ErrorLogEntity implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// private String title;
//
// private String stacktrace;
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title == null ? null : title.trim();
// }
//
// public String getStacktrace() {
// return stacktrace;
// }
//
// public void setStacktrace(String stacktrace) {
// this.stacktrace = stacktrace == null ? null : stacktrace.trim();
// }
// }
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/ErrorLogEntityMapper.java
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.ErrorLogEntity;
import com.appleframework.ums.server.core.entity.ErrorLogEntityWithBLOBs;
package com.appleframework.ums.server.storage.mapper;
@Repository
public interface ErrorLogEntityMapper {
int deleteByPrimaryKey(Integer id);
| int insert(ErrorLogEntityWithBLOBs record);
|
xushaomin/apple-ums-server | apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/EventDefinationEntityDao.java | // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDefinationEntity.java
// public class EventDefinationEntity implements Serializable {
// private Integer eventId;
//
// private String eventIdentifier;
//
// private String productkey;
//
// private String eventName;
//
// private Integer channelId;
//
// private Integer productId;
//
// private Integer userId;
//
// private Date createDate;
//
// private Integer active;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getEventIdentifier() {
// return eventIdentifier;
// }
//
// public void setEventIdentifier(String eventIdentifier) {
// this.eventIdentifier = eventIdentifier == null ? null : eventIdentifier.trim();
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public String getEventName() {
// return eventName;
// }
//
// public void setEventName(String eventName) {
// this.eventName = eventName == null ? null : eventName.trim();
// }
//
// public Integer getChannelId() {
// return channelId;
// }
//
// public void setChannelId(Integer channelId) {
// this.channelId = channelId;
// }
//
// public Integer getProductId() {
// return productId;
// }
//
// public void setProductId(Integer productId) {
// this.productId = productId;
// }
//
// public Integer getUserId() {
// return userId;
// }
//
// public void setUserId(Integer userId) {
// this.userId = userId;
// }
//
// public Date getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(Date createDate) {
// this.createDate = createDate;
// }
//
// public Integer getActive() {
// return active;
// }
//
// public void setActive(Integer active) {
// this.active = active;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDefinationEntityMapper.java
// @Repository
// public interface EventDefinationEntityMapper {
//
// int deleteByPrimaryKey(Integer eventId);
//
// int insert(EventDefinationEntity record);
//
// int insertSelective(EventDefinationEntity record);
//
// EventDefinationEntity selectByPrimaryKey(Integer eventId);
//
// int updateByPrimaryKeySelective(EventDefinationEntity record);
//
// int updateByPrimaryKey(EventDefinationEntity record);
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDefinationExtendMapper.java
// @Repository
// public interface EventDefinationExtendMapper {
//
// public EventDefinationEntity selectByProductkeyAndEventIdentifier(@Param("productkey") String productkey,
// @Param("eventIdentifier") String eventIdentifier);
// }
| import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.EventDefinationEntity;
import com.appleframework.ums.server.storage.mapper.EventDefinationEntityMapper;
import com.appleframework.ums.server.storage.mapper.EventDefinationExtendMapper;
| package com.appleframework.ums.server.storage.dao;
@Repository("eventDefinationEntityDao")
public class EventDefinationEntityDao {
@Resource
| // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDefinationEntity.java
// public class EventDefinationEntity implements Serializable {
// private Integer eventId;
//
// private String eventIdentifier;
//
// private String productkey;
//
// private String eventName;
//
// private Integer channelId;
//
// private Integer productId;
//
// private Integer userId;
//
// private Date createDate;
//
// private Integer active;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getEventIdentifier() {
// return eventIdentifier;
// }
//
// public void setEventIdentifier(String eventIdentifier) {
// this.eventIdentifier = eventIdentifier == null ? null : eventIdentifier.trim();
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public String getEventName() {
// return eventName;
// }
//
// public void setEventName(String eventName) {
// this.eventName = eventName == null ? null : eventName.trim();
// }
//
// public Integer getChannelId() {
// return channelId;
// }
//
// public void setChannelId(Integer channelId) {
// this.channelId = channelId;
// }
//
// public Integer getProductId() {
// return productId;
// }
//
// public void setProductId(Integer productId) {
// this.productId = productId;
// }
//
// public Integer getUserId() {
// return userId;
// }
//
// public void setUserId(Integer userId) {
// this.userId = userId;
// }
//
// public Date getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(Date createDate) {
// this.createDate = createDate;
// }
//
// public Integer getActive() {
// return active;
// }
//
// public void setActive(Integer active) {
// this.active = active;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDefinationEntityMapper.java
// @Repository
// public interface EventDefinationEntityMapper {
//
// int deleteByPrimaryKey(Integer eventId);
//
// int insert(EventDefinationEntity record);
//
// int insertSelective(EventDefinationEntity record);
//
// EventDefinationEntity selectByPrimaryKey(Integer eventId);
//
// int updateByPrimaryKeySelective(EventDefinationEntity record);
//
// int updateByPrimaryKey(EventDefinationEntity record);
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDefinationExtendMapper.java
// @Repository
// public interface EventDefinationExtendMapper {
//
// public EventDefinationEntity selectByProductkeyAndEventIdentifier(@Param("productkey") String productkey,
// @Param("eventIdentifier") String eventIdentifier);
// }
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/EventDefinationEntityDao.java
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.EventDefinationEntity;
import com.appleframework.ums.server.storage.mapper.EventDefinationEntityMapper;
import com.appleframework.ums.server.storage.mapper.EventDefinationExtendMapper;
package com.appleframework.ums.server.storage.dao;
@Repository("eventDefinationEntityDao")
public class EventDefinationEntityDao {
@Resource
| private EventDefinationEntityMapper eventDefinationEntityMapper;
|
xushaomin/apple-ums-server | apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/EventDefinationEntityDao.java | // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDefinationEntity.java
// public class EventDefinationEntity implements Serializable {
// private Integer eventId;
//
// private String eventIdentifier;
//
// private String productkey;
//
// private String eventName;
//
// private Integer channelId;
//
// private Integer productId;
//
// private Integer userId;
//
// private Date createDate;
//
// private Integer active;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getEventIdentifier() {
// return eventIdentifier;
// }
//
// public void setEventIdentifier(String eventIdentifier) {
// this.eventIdentifier = eventIdentifier == null ? null : eventIdentifier.trim();
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public String getEventName() {
// return eventName;
// }
//
// public void setEventName(String eventName) {
// this.eventName = eventName == null ? null : eventName.trim();
// }
//
// public Integer getChannelId() {
// return channelId;
// }
//
// public void setChannelId(Integer channelId) {
// this.channelId = channelId;
// }
//
// public Integer getProductId() {
// return productId;
// }
//
// public void setProductId(Integer productId) {
// this.productId = productId;
// }
//
// public Integer getUserId() {
// return userId;
// }
//
// public void setUserId(Integer userId) {
// this.userId = userId;
// }
//
// public Date getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(Date createDate) {
// this.createDate = createDate;
// }
//
// public Integer getActive() {
// return active;
// }
//
// public void setActive(Integer active) {
// this.active = active;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDefinationEntityMapper.java
// @Repository
// public interface EventDefinationEntityMapper {
//
// int deleteByPrimaryKey(Integer eventId);
//
// int insert(EventDefinationEntity record);
//
// int insertSelective(EventDefinationEntity record);
//
// EventDefinationEntity selectByPrimaryKey(Integer eventId);
//
// int updateByPrimaryKeySelective(EventDefinationEntity record);
//
// int updateByPrimaryKey(EventDefinationEntity record);
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDefinationExtendMapper.java
// @Repository
// public interface EventDefinationExtendMapper {
//
// public EventDefinationEntity selectByProductkeyAndEventIdentifier(@Param("productkey") String productkey,
// @Param("eventIdentifier") String eventIdentifier);
// }
| import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.EventDefinationEntity;
import com.appleframework.ums.server.storage.mapper.EventDefinationEntityMapper;
import com.appleframework.ums.server.storage.mapper.EventDefinationExtendMapper;
| package com.appleframework.ums.server.storage.dao;
@Repository("eventDefinationEntityDao")
public class EventDefinationEntityDao {
@Resource
private EventDefinationEntityMapper eventDefinationEntityMapper;
@Resource
| // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDefinationEntity.java
// public class EventDefinationEntity implements Serializable {
// private Integer eventId;
//
// private String eventIdentifier;
//
// private String productkey;
//
// private String eventName;
//
// private Integer channelId;
//
// private Integer productId;
//
// private Integer userId;
//
// private Date createDate;
//
// private Integer active;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getEventIdentifier() {
// return eventIdentifier;
// }
//
// public void setEventIdentifier(String eventIdentifier) {
// this.eventIdentifier = eventIdentifier == null ? null : eventIdentifier.trim();
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public String getEventName() {
// return eventName;
// }
//
// public void setEventName(String eventName) {
// this.eventName = eventName == null ? null : eventName.trim();
// }
//
// public Integer getChannelId() {
// return channelId;
// }
//
// public void setChannelId(Integer channelId) {
// this.channelId = channelId;
// }
//
// public Integer getProductId() {
// return productId;
// }
//
// public void setProductId(Integer productId) {
// this.productId = productId;
// }
//
// public Integer getUserId() {
// return userId;
// }
//
// public void setUserId(Integer userId) {
// this.userId = userId;
// }
//
// public Date getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(Date createDate) {
// this.createDate = createDate;
// }
//
// public Integer getActive() {
// return active;
// }
//
// public void setActive(Integer active) {
// this.active = active;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDefinationEntityMapper.java
// @Repository
// public interface EventDefinationEntityMapper {
//
// int deleteByPrimaryKey(Integer eventId);
//
// int insert(EventDefinationEntity record);
//
// int insertSelective(EventDefinationEntity record);
//
// EventDefinationEntity selectByPrimaryKey(Integer eventId);
//
// int updateByPrimaryKeySelective(EventDefinationEntity record);
//
// int updateByPrimaryKey(EventDefinationEntity record);
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDefinationExtendMapper.java
// @Repository
// public interface EventDefinationExtendMapper {
//
// public EventDefinationEntity selectByProductkeyAndEventIdentifier(@Param("productkey") String productkey,
// @Param("eventIdentifier") String eventIdentifier);
// }
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/EventDefinationEntityDao.java
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.EventDefinationEntity;
import com.appleframework.ums.server.storage.mapper.EventDefinationEntityMapper;
import com.appleframework.ums.server.storage.mapper.EventDefinationExtendMapper;
package com.appleframework.ums.server.storage.dao;
@Repository("eventDefinationEntityDao")
public class EventDefinationEntityDao {
@Resource
private EventDefinationEntityMapper eventDefinationEntityMapper;
@Resource
| private EventDefinationExtendMapper eventDefinationExtendMapper;
|
xushaomin/apple-ums-server | apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/EventDefinationEntityDao.java | // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDefinationEntity.java
// public class EventDefinationEntity implements Serializable {
// private Integer eventId;
//
// private String eventIdentifier;
//
// private String productkey;
//
// private String eventName;
//
// private Integer channelId;
//
// private Integer productId;
//
// private Integer userId;
//
// private Date createDate;
//
// private Integer active;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getEventIdentifier() {
// return eventIdentifier;
// }
//
// public void setEventIdentifier(String eventIdentifier) {
// this.eventIdentifier = eventIdentifier == null ? null : eventIdentifier.trim();
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public String getEventName() {
// return eventName;
// }
//
// public void setEventName(String eventName) {
// this.eventName = eventName == null ? null : eventName.trim();
// }
//
// public Integer getChannelId() {
// return channelId;
// }
//
// public void setChannelId(Integer channelId) {
// this.channelId = channelId;
// }
//
// public Integer getProductId() {
// return productId;
// }
//
// public void setProductId(Integer productId) {
// this.productId = productId;
// }
//
// public Integer getUserId() {
// return userId;
// }
//
// public void setUserId(Integer userId) {
// this.userId = userId;
// }
//
// public Date getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(Date createDate) {
// this.createDate = createDate;
// }
//
// public Integer getActive() {
// return active;
// }
//
// public void setActive(Integer active) {
// this.active = active;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDefinationEntityMapper.java
// @Repository
// public interface EventDefinationEntityMapper {
//
// int deleteByPrimaryKey(Integer eventId);
//
// int insert(EventDefinationEntity record);
//
// int insertSelective(EventDefinationEntity record);
//
// EventDefinationEntity selectByPrimaryKey(Integer eventId);
//
// int updateByPrimaryKeySelective(EventDefinationEntity record);
//
// int updateByPrimaryKey(EventDefinationEntity record);
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDefinationExtendMapper.java
// @Repository
// public interface EventDefinationExtendMapper {
//
// public EventDefinationEntity selectByProductkeyAndEventIdentifier(@Param("productkey") String productkey,
// @Param("eventIdentifier") String eventIdentifier);
// }
| import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.EventDefinationEntity;
import com.appleframework.ums.server.storage.mapper.EventDefinationEntityMapper;
import com.appleframework.ums.server.storage.mapper.EventDefinationExtendMapper;
| package com.appleframework.ums.server.storage.dao;
@Repository("eventDefinationEntityDao")
public class EventDefinationEntityDao {
@Resource
private EventDefinationEntityMapper eventDefinationEntityMapper;
@Resource
private EventDefinationExtendMapper eventDefinationExtendMapper;
| // Path: apple-ums-server-core/src/main/java/com/appleframework/ums/server/core/entity/EventDefinationEntity.java
// public class EventDefinationEntity implements Serializable {
// private Integer eventId;
//
// private String eventIdentifier;
//
// private String productkey;
//
// private String eventName;
//
// private Integer channelId;
//
// private Integer productId;
//
// private Integer userId;
//
// private Date createDate;
//
// private Integer active;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getEventId() {
// return eventId;
// }
//
// public void setEventId(Integer eventId) {
// this.eventId = eventId;
// }
//
// public String getEventIdentifier() {
// return eventIdentifier;
// }
//
// public void setEventIdentifier(String eventIdentifier) {
// this.eventIdentifier = eventIdentifier == null ? null : eventIdentifier.trim();
// }
//
// public String getProductkey() {
// return productkey;
// }
//
// public void setProductkey(String productkey) {
// this.productkey = productkey == null ? null : productkey.trim();
// }
//
// public String getEventName() {
// return eventName;
// }
//
// public void setEventName(String eventName) {
// this.eventName = eventName == null ? null : eventName.trim();
// }
//
// public Integer getChannelId() {
// return channelId;
// }
//
// public void setChannelId(Integer channelId) {
// this.channelId = channelId;
// }
//
// public Integer getProductId() {
// return productId;
// }
//
// public void setProductId(Integer productId) {
// this.productId = productId;
// }
//
// public Integer getUserId() {
// return userId;
// }
//
// public void setUserId(Integer userId) {
// this.userId = userId;
// }
//
// public Date getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(Date createDate) {
// this.createDate = createDate;
// }
//
// public Integer getActive() {
// return active;
// }
//
// public void setActive(Integer active) {
// this.active = active;
// }
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDefinationEntityMapper.java
// @Repository
// public interface EventDefinationEntityMapper {
//
// int deleteByPrimaryKey(Integer eventId);
//
// int insert(EventDefinationEntity record);
//
// int insertSelective(EventDefinationEntity record);
//
// EventDefinationEntity selectByPrimaryKey(Integer eventId);
//
// int updateByPrimaryKeySelective(EventDefinationEntity record);
//
// int updateByPrimaryKey(EventDefinationEntity record);
// }
//
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/mapper/EventDefinationExtendMapper.java
// @Repository
// public interface EventDefinationExtendMapper {
//
// public EventDefinationEntity selectByProductkeyAndEventIdentifier(@Param("productkey") String productkey,
// @Param("eventIdentifier") String eventIdentifier);
// }
// Path: apple-ums-server-storage/apple-ums-server-storage-db/src/main/java/com/appleframework/ums/server/storage/dao/EventDefinationEntityDao.java
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.appleframework.ums.server.core.entity.EventDefinationEntity;
import com.appleframework.ums.server.storage.mapper.EventDefinationEntityMapper;
import com.appleframework.ums.server.storage.mapper.EventDefinationExtendMapper;
package com.appleframework.ums.server.storage.dao;
@Repository("eventDefinationEntityDao")
public class EventDefinationEntityDao {
@Resource
private EventDefinationEntityMapper eventDefinationEntityMapper;
@Resource
private EventDefinationExtendMapper eventDefinationExtendMapper;
| public EventDefinationEntity getByProductkeyAndEventIdentifier(String productkey, String eventIdentifier) {
|
sonyxperiadev/XAppDbg | XAppDbgClient/src/com/sonymobile/tools/xappdbg/client/ConnectionThread.java | // Path: XAppDbgServer/src/com/sonymobile/tools/xappdbg/Packet.java
// public class Packet {
//
// private boolean mReadable;
// private boolean mWritable;
// private int mLen;
// private int mChannel;
// private byte[] mData;
// private ByteArrayOutputStream mBuff;
// private DataOutputStream mBuffOS;
// private DataOutputStream mOS;
// private DataInputStream mBuffIS;
// private DataInputStream mIS;
// private boolean mSent;
//
// public Packet(int channel, DataInputStream is, DataOutputStream os) {
// mReadable = false;
// mWritable = true;
// mChannel = channel;
// mBuff = new ByteArrayOutputStream();
// mBuffOS = new DataOutputStream(mBuff);
// mIS = is;
// mOS = os;
// }
//
// /**
// * Create an incomming packet
// */
// /* package */ Packet(DataInputStream is, DataOutputStream os) throws IOException {
// mReadable = true;
// mWritable = false;
// // Read packet size
// mLen = is.readInt();
// // Read channel
// mChannel = is.readInt();
// // Read data
// mData = new byte[mLen];
// is.readFully(mData);
// mBuffIS = new DataInputStream(new ByteArrayInputStream(mData));
// // Store the output stream for reference
// mOS = os;
// }
//
// /* package */ void send(DataOutputStream os) throws IOException {
// if (mSent) {
// throw new RuntimeException("Packet already sent, refusing to send again!");
// }
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// byte data[] = mBuff.toByteArray();
// // Write packet size
// os.writeInt(data.length);
// // Write channel
// os.writeInt(mChannel);
// // Write data
// os.write(data);
// // Make sure the data is sent
// os.flush();
// mSent = true;
// }
//
// public int getChannel() {
// return mChannel;
// }
//
// public Packet createReply() {
// return new Packet(mChannel, null, mOS);
// }
//
// private Packet getReply() throws IOException {
// return new Packet(mIS, mOS);
// }
//
// public void send() throws IOException {
// send(mOS);
// }
//
// public Packet sendAndReceive(String cmd) throws IOException {
// mOS.writeUTF(cmd);
// send(mOS);
// return getReply();
// }
//
// public int readInt() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readInt();
// }
//
// public float readFloat() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readFloat();
// }
//
// public boolean readBoolean() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readBoolean();
// }
//
// public String readUTF() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readUTF();
// }
//
// public void writeInt(int value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeInt(value);
// }
//
// public void writeFloat(float value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeFloat(value);
// }
//
// public void writeBoolean(boolean value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeBoolean(value);
// }
//
// public void writeUTF(String value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeUTF(value);
// }
//
// }
| import com.sonymobile.tools.xappdbg.Packet;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket; | mListener.showDebugControls(true);
mRunning = true;
// just wait for now
while (mRunning) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
}
@Override
public void close(boolean error) {
if (mRunning) {
try {
mIs.close();
} catch (IOException e) { }
try {
mOs.close();
} catch (IOException e) { }
mRunning = false;
if (error) {
mListener.onError("Connection failed");
}
}
}
@Override | // Path: XAppDbgServer/src/com/sonymobile/tools/xappdbg/Packet.java
// public class Packet {
//
// private boolean mReadable;
// private boolean mWritable;
// private int mLen;
// private int mChannel;
// private byte[] mData;
// private ByteArrayOutputStream mBuff;
// private DataOutputStream mBuffOS;
// private DataOutputStream mOS;
// private DataInputStream mBuffIS;
// private DataInputStream mIS;
// private boolean mSent;
//
// public Packet(int channel, DataInputStream is, DataOutputStream os) {
// mReadable = false;
// mWritable = true;
// mChannel = channel;
// mBuff = new ByteArrayOutputStream();
// mBuffOS = new DataOutputStream(mBuff);
// mIS = is;
// mOS = os;
// }
//
// /**
// * Create an incomming packet
// */
// /* package */ Packet(DataInputStream is, DataOutputStream os) throws IOException {
// mReadable = true;
// mWritable = false;
// // Read packet size
// mLen = is.readInt();
// // Read channel
// mChannel = is.readInt();
// // Read data
// mData = new byte[mLen];
// is.readFully(mData);
// mBuffIS = new DataInputStream(new ByteArrayInputStream(mData));
// // Store the output stream for reference
// mOS = os;
// }
//
// /* package */ void send(DataOutputStream os) throws IOException {
// if (mSent) {
// throw new RuntimeException("Packet already sent, refusing to send again!");
// }
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// byte data[] = mBuff.toByteArray();
// // Write packet size
// os.writeInt(data.length);
// // Write channel
// os.writeInt(mChannel);
// // Write data
// os.write(data);
// // Make sure the data is sent
// os.flush();
// mSent = true;
// }
//
// public int getChannel() {
// return mChannel;
// }
//
// public Packet createReply() {
// return new Packet(mChannel, null, mOS);
// }
//
// private Packet getReply() throws IOException {
// return new Packet(mIS, mOS);
// }
//
// public void send() throws IOException {
// send(mOS);
// }
//
// public Packet sendAndReceive(String cmd) throws IOException {
// mOS.writeUTF(cmd);
// send(mOS);
// return getReply();
// }
//
// public int readInt() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readInt();
// }
//
// public float readFloat() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readFloat();
// }
//
// public boolean readBoolean() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readBoolean();
// }
//
// public String readUTF() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readUTF();
// }
//
// public void writeInt(int value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeInt(value);
// }
//
// public void writeFloat(float value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeFloat(value);
// }
//
// public void writeBoolean(boolean value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeBoolean(value);
// }
//
// public void writeUTF(String value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeUTF(value);
// }
//
// }
// Path: XAppDbgClient/src/com/sonymobile/tools/xappdbg/client/ConnectionThread.java
import com.sonymobile.tools.xappdbg.Packet;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
mListener.showDebugControls(true);
mRunning = true;
// just wait for now
while (mRunning) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
}
@Override
public void close(boolean error) {
if (mRunning) {
try {
mIs.close();
} catch (IOException e) { }
try {
mOs.close();
} catch (IOException e) { }
mRunning = false;
if (error) {
mListener.onError("Connection failed");
}
}
}
@Override | public Packet createPacket(int channel) { |
sonyxperiadev/XAppDbg | XAppDbgClient/src/com/sonymobile/tools/xappdbg/client/XAppDbgConnection.java | // Path: XAppDbgServer/src/com/sonymobile/tools/xappdbg/Packet.java
// public class Packet {
//
// private boolean mReadable;
// private boolean mWritable;
// private int mLen;
// private int mChannel;
// private byte[] mData;
// private ByteArrayOutputStream mBuff;
// private DataOutputStream mBuffOS;
// private DataOutputStream mOS;
// private DataInputStream mBuffIS;
// private DataInputStream mIS;
// private boolean mSent;
//
// public Packet(int channel, DataInputStream is, DataOutputStream os) {
// mReadable = false;
// mWritable = true;
// mChannel = channel;
// mBuff = new ByteArrayOutputStream();
// mBuffOS = new DataOutputStream(mBuff);
// mIS = is;
// mOS = os;
// }
//
// /**
// * Create an incomming packet
// */
// /* package */ Packet(DataInputStream is, DataOutputStream os) throws IOException {
// mReadable = true;
// mWritable = false;
// // Read packet size
// mLen = is.readInt();
// // Read channel
// mChannel = is.readInt();
// // Read data
// mData = new byte[mLen];
// is.readFully(mData);
// mBuffIS = new DataInputStream(new ByteArrayInputStream(mData));
// // Store the output stream for reference
// mOS = os;
// }
//
// /* package */ void send(DataOutputStream os) throws IOException {
// if (mSent) {
// throw new RuntimeException("Packet already sent, refusing to send again!");
// }
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// byte data[] = mBuff.toByteArray();
// // Write packet size
// os.writeInt(data.length);
// // Write channel
// os.writeInt(mChannel);
// // Write data
// os.write(data);
// // Make sure the data is sent
// os.flush();
// mSent = true;
// }
//
// public int getChannel() {
// return mChannel;
// }
//
// public Packet createReply() {
// return new Packet(mChannel, null, mOS);
// }
//
// private Packet getReply() throws IOException {
// return new Packet(mIS, mOS);
// }
//
// public void send() throws IOException {
// send(mOS);
// }
//
// public Packet sendAndReceive(String cmd) throws IOException {
// mOS.writeUTF(cmd);
// send(mOS);
// return getReply();
// }
//
// public int readInt() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readInt();
// }
//
// public float readFloat() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readFloat();
// }
//
// public boolean readBoolean() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readBoolean();
// }
//
// public String readUTF() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readUTF();
// }
//
// public void writeInt(int value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeInt(value);
// }
//
// public void writeFloat(float value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeFloat(value);
// }
//
// public void writeBoolean(boolean value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeBoolean(value);
// }
//
// public void writeUTF(String value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeUTF(value);
// }
//
// }
| import com.sonymobile.tools.xappdbg.Packet; | /*
* Copyright (C) 2012 Sony Mobile Communications AB
*
* This file is part of XAppDbg.
*
* XAppDbg is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* XAppDbg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XAppDbg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sonymobile.tools.xappdbg.client;
/**
* Simple communication interface.
* It supports simple multiplexing by allowing the creation of packets with
* different channel numbers.
*/
public interface XAppDbgConnection {
/**
* Request to close the connection.
* @param error If set to true, the connection is closed due to a detected error
*/
public void close(boolean error);
/**
* Create a packet to be sent on this connection.
* @param channel The channel id
* @return The new empty packet
*/ | // Path: XAppDbgServer/src/com/sonymobile/tools/xappdbg/Packet.java
// public class Packet {
//
// private boolean mReadable;
// private boolean mWritable;
// private int mLen;
// private int mChannel;
// private byte[] mData;
// private ByteArrayOutputStream mBuff;
// private DataOutputStream mBuffOS;
// private DataOutputStream mOS;
// private DataInputStream mBuffIS;
// private DataInputStream mIS;
// private boolean mSent;
//
// public Packet(int channel, DataInputStream is, DataOutputStream os) {
// mReadable = false;
// mWritable = true;
// mChannel = channel;
// mBuff = new ByteArrayOutputStream();
// mBuffOS = new DataOutputStream(mBuff);
// mIS = is;
// mOS = os;
// }
//
// /**
// * Create an incomming packet
// */
// /* package */ Packet(DataInputStream is, DataOutputStream os) throws IOException {
// mReadable = true;
// mWritable = false;
// // Read packet size
// mLen = is.readInt();
// // Read channel
// mChannel = is.readInt();
// // Read data
// mData = new byte[mLen];
// is.readFully(mData);
// mBuffIS = new DataInputStream(new ByteArrayInputStream(mData));
// // Store the output stream for reference
// mOS = os;
// }
//
// /* package */ void send(DataOutputStream os) throws IOException {
// if (mSent) {
// throw new RuntimeException("Packet already sent, refusing to send again!");
// }
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// byte data[] = mBuff.toByteArray();
// // Write packet size
// os.writeInt(data.length);
// // Write channel
// os.writeInt(mChannel);
// // Write data
// os.write(data);
// // Make sure the data is sent
// os.flush();
// mSent = true;
// }
//
// public int getChannel() {
// return mChannel;
// }
//
// public Packet createReply() {
// return new Packet(mChannel, null, mOS);
// }
//
// private Packet getReply() throws IOException {
// return new Packet(mIS, mOS);
// }
//
// public void send() throws IOException {
// send(mOS);
// }
//
// public Packet sendAndReceive(String cmd) throws IOException {
// mOS.writeUTF(cmd);
// send(mOS);
// return getReply();
// }
//
// public int readInt() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readInt();
// }
//
// public float readFloat() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readFloat();
// }
//
// public boolean readBoolean() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readBoolean();
// }
//
// public String readUTF() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readUTF();
// }
//
// public void writeInt(int value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeInt(value);
// }
//
// public void writeFloat(float value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeFloat(value);
// }
//
// public void writeBoolean(boolean value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeBoolean(value);
// }
//
// public void writeUTF(String value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeUTF(value);
// }
//
// }
// Path: XAppDbgClient/src/com/sonymobile/tools/xappdbg/client/XAppDbgConnection.java
import com.sonymobile.tools.xappdbg.Packet;
/*
* Copyright (C) 2012 Sony Mobile Communications AB
*
* This file is part of XAppDbg.
*
* XAppDbg is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* XAppDbg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XAppDbg. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sonymobile.tools.xappdbg.client;
/**
* Simple communication interface.
* It supports simple multiplexing by allowing the creation of packets with
* different channel numbers.
*/
public interface XAppDbgConnection {
/**
* Request to close the connection.
* @param error If set to true, the connection is closed due to a detected error
*/
public void close(boolean error);
/**
* Create a packet to be sent on this connection.
* @param channel The channel id
* @return The new empty packet
*/ | public Packet createPacket(int channel); |
sonyxperiadev/XAppDbg | XAppDbgServer/src/com/sonymobile/tools/xappdbg/properties/Item.java | // Path: XAppDbgServer/src/com/sonymobile/tools/xappdbg/Packet.java
// public class Packet {
//
// private boolean mReadable;
// private boolean mWritable;
// private int mLen;
// private int mChannel;
// private byte[] mData;
// private ByteArrayOutputStream mBuff;
// private DataOutputStream mBuffOS;
// private DataOutputStream mOS;
// private DataInputStream mBuffIS;
// private DataInputStream mIS;
// private boolean mSent;
//
// public Packet(int channel, DataInputStream is, DataOutputStream os) {
// mReadable = false;
// mWritable = true;
// mChannel = channel;
// mBuff = new ByteArrayOutputStream();
// mBuffOS = new DataOutputStream(mBuff);
// mIS = is;
// mOS = os;
// }
//
// /**
// * Create an incomming packet
// */
// /* package */ Packet(DataInputStream is, DataOutputStream os) throws IOException {
// mReadable = true;
// mWritable = false;
// // Read packet size
// mLen = is.readInt();
// // Read channel
// mChannel = is.readInt();
// // Read data
// mData = new byte[mLen];
// is.readFully(mData);
// mBuffIS = new DataInputStream(new ByteArrayInputStream(mData));
// // Store the output stream for reference
// mOS = os;
// }
//
// /* package */ void send(DataOutputStream os) throws IOException {
// if (mSent) {
// throw new RuntimeException("Packet already sent, refusing to send again!");
// }
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// byte data[] = mBuff.toByteArray();
// // Write packet size
// os.writeInt(data.length);
// // Write channel
// os.writeInt(mChannel);
// // Write data
// os.write(data);
// // Make sure the data is sent
// os.flush();
// mSent = true;
// }
//
// public int getChannel() {
// return mChannel;
// }
//
// public Packet createReply() {
// return new Packet(mChannel, null, mOS);
// }
//
// private Packet getReply() throws IOException {
// return new Packet(mIS, mOS);
// }
//
// public void send() throws IOException {
// send(mOS);
// }
//
// public Packet sendAndReceive(String cmd) throws IOException {
// mOS.writeUTF(cmd);
// send(mOS);
// return getReply();
// }
//
// public int readInt() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readInt();
// }
//
// public float readFloat() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readFloat();
// }
//
// public boolean readBoolean() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readBoolean();
// }
//
// public String readUTF() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readUTF();
// }
//
// public void writeInt(int value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeInt(value);
// }
//
// public void writeFloat(float value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeFloat(value);
// }
//
// public void writeBoolean(boolean value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeBoolean(value);
// }
//
// public void writeUTF(String value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeUTF(value);
// }
//
// }
//
// Path: XAppDbgServer/src/com/sonymobile/tools/xappdbg/XAppDbgCmdIDs.java
// public class XAppDbgCmdIDs {
//
// public static final String CMD_LIST_PROP = "XAppDbg.C.ListProp";
//
// public static final String CMD_WRITE_PROP = "XAppDbg.C.WriteProp";
//
// public static final String CMD_READ_PROP = "XAppDbg.C.ReadProp";
//
// public static final String CMD_TREE = "XAppDbg.C.Tree";
//
// public static final String CMD_TREE_SELECT = "XAppDbg.C.TreeSelect";
//
// public static final String CMD_TREE_CMD = "XAppDbg.C.Do";
//
// public static final String CMD_TRIGGER = "XAppDbg.C.Trigger";
// }
| import com.sonymobile.tools.xappdbg.Packet;
import com.sonymobile.tools.xappdbg.XAppDbgCmdIDs;
import java.io.IOException; | public boolean isReadable() {
return (mRW & 1) != 0;
}
protected void setWritable() {
mRW |= 2;
}
public boolean isWritable() {
return (mRW & 2) != 0;
}
public abstract int getIntValue(Object obj);
public abstract boolean getBoolValue(Object obj);
public abstract float getFloatValue(Object obj);
public abstract String getStringValue(Object obj);
public abstract boolean setIntValue(Object obj, int value);
public abstract boolean setBoolValue(Object obj, boolean value);
public abstract boolean setFloatValue(Object obj, float value);
public abstract boolean setStringValue(Object obj, String value);
public abstract boolean setVoidValue(Object obj);
| // Path: XAppDbgServer/src/com/sonymobile/tools/xappdbg/Packet.java
// public class Packet {
//
// private boolean mReadable;
// private boolean mWritable;
// private int mLen;
// private int mChannel;
// private byte[] mData;
// private ByteArrayOutputStream mBuff;
// private DataOutputStream mBuffOS;
// private DataOutputStream mOS;
// private DataInputStream mBuffIS;
// private DataInputStream mIS;
// private boolean mSent;
//
// public Packet(int channel, DataInputStream is, DataOutputStream os) {
// mReadable = false;
// mWritable = true;
// mChannel = channel;
// mBuff = new ByteArrayOutputStream();
// mBuffOS = new DataOutputStream(mBuff);
// mIS = is;
// mOS = os;
// }
//
// /**
// * Create an incomming packet
// */
// /* package */ Packet(DataInputStream is, DataOutputStream os) throws IOException {
// mReadable = true;
// mWritable = false;
// // Read packet size
// mLen = is.readInt();
// // Read channel
// mChannel = is.readInt();
// // Read data
// mData = new byte[mLen];
// is.readFully(mData);
// mBuffIS = new DataInputStream(new ByteArrayInputStream(mData));
// // Store the output stream for reference
// mOS = os;
// }
//
// /* package */ void send(DataOutputStream os) throws IOException {
// if (mSent) {
// throw new RuntimeException("Packet already sent, refusing to send again!");
// }
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// byte data[] = mBuff.toByteArray();
// // Write packet size
// os.writeInt(data.length);
// // Write channel
// os.writeInt(mChannel);
// // Write data
// os.write(data);
// // Make sure the data is sent
// os.flush();
// mSent = true;
// }
//
// public int getChannel() {
// return mChannel;
// }
//
// public Packet createReply() {
// return new Packet(mChannel, null, mOS);
// }
//
// private Packet getReply() throws IOException {
// return new Packet(mIS, mOS);
// }
//
// public void send() throws IOException {
// send(mOS);
// }
//
// public Packet sendAndReceive(String cmd) throws IOException {
// mOS.writeUTF(cmd);
// send(mOS);
// return getReply();
// }
//
// public int readInt() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readInt();
// }
//
// public float readFloat() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readFloat();
// }
//
// public boolean readBoolean() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readBoolean();
// }
//
// public String readUTF() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readUTF();
// }
//
// public void writeInt(int value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeInt(value);
// }
//
// public void writeFloat(float value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeFloat(value);
// }
//
// public void writeBoolean(boolean value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeBoolean(value);
// }
//
// public void writeUTF(String value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeUTF(value);
// }
//
// }
//
// Path: XAppDbgServer/src/com/sonymobile/tools/xappdbg/XAppDbgCmdIDs.java
// public class XAppDbgCmdIDs {
//
// public static final String CMD_LIST_PROP = "XAppDbg.C.ListProp";
//
// public static final String CMD_WRITE_PROP = "XAppDbg.C.WriteProp";
//
// public static final String CMD_READ_PROP = "XAppDbg.C.ReadProp";
//
// public static final String CMD_TREE = "XAppDbg.C.Tree";
//
// public static final String CMD_TREE_SELECT = "XAppDbg.C.TreeSelect";
//
// public static final String CMD_TREE_CMD = "XAppDbg.C.Do";
//
// public static final String CMD_TRIGGER = "XAppDbg.C.Trigger";
// }
// Path: XAppDbgServer/src/com/sonymobile/tools/xappdbg/properties/Item.java
import com.sonymobile.tools.xappdbg.Packet;
import com.sonymobile.tools.xappdbg.XAppDbgCmdIDs;
import java.io.IOException;
public boolean isReadable() {
return (mRW & 1) != 0;
}
protected void setWritable() {
mRW |= 2;
}
public boolean isWritable() {
return (mRW & 2) != 0;
}
public abstract int getIntValue(Object obj);
public abstract boolean getBoolValue(Object obj);
public abstract float getFloatValue(Object obj);
public abstract String getStringValue(Object obj);
public abstract boolean setIntValue(Object obj, int value);
public abstract boolean setBoolValue(Object obj, boolean value);
public abstract boolean setFloatValue(Object obj, float value);
public abstract boolean setStringValue(Object obj, String value);
public abstract boolean setVoidValue(Object obj);
| public void sendToClient(Packet out) throws IOException { |
sonyxperiadev/XAppDbg | XAppDbgServer/src/com/sonymobile/tools/xappdbg/properties/Item.java | // Path: XAppDbgServer/src/com/sonymobile/tools/xappdbg/Packet.java
// public class Packet {
//
// private boolean mReadable;
// private boolean mWritable;
// private int mLen;
// private int mChannel;
// private byte[] mData;
// private ByteArrayOutputStream mBuff;
// private DataOutputStream mBuffOS;
// private DataOutputStream mOS;
// private DataInputStream mBuffIS;
// private DataInputStream mIS;
// private boolean mSent;
//
// public Packet(int channel, DataInputStream is, DataOutputStream os) {
// mReadable = false;
// mWritable = true;
// mChannel = channel;
// mBuff = new ByteArrayOutputStream();
// mBuffOS = new DataOutputStream(mBuff);
// mIS = is;
// mOS = os;
// }
//
// /**
// * Create an incomming packet
// */
// /* package */ Packet(DataInputStream is, DataOutputStream os) throws IOException {
// mReadable = true;
// mWritable = false;
// // Read packet size
// mLen = is.readInt();
// // Read channel
// mChannel = is.readInt();
// // Read data
// mData = new byte[mLen];
// is.readFully(mData);
// mBuffIS = new DataInputStream(new ByteArrayInputStream(mData));
// // Store the output stream for reference
// mOS = os;
// }
//
// /* package */ void send(DataOutputStream os) throws IOException {
// if (mSent) {
// throw new RuntimeException("Packet already sent, refusing to send again!");
// }
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// byte data[] = mBuff.toByteArray();
// // Write packet size
// os.writeInt(data.length);
// // Write channel
// os.writeInt(mChannel);
// // Write data
// os.write(data);
// // Make sure the data is sent
// os.flush();
// mSent = true;
// }
//
// public int getChannel() {
// return mChannel;
// }
//
// public Packet createReply() {
// return new Packet(mChannel, null, mOS);
// }
//
// private Packet getReply() throws IOException {
// return new Packet(mIS, mOS);
// }
//
// public void send() throws IOException {
// send(mOS);
// }
//
// public Packet sendAndReceive(String cmd) throws IOException {
// mOS.writeUTF(cmd);
// send(mOS);
// return getReply();
// }
//
// public int readInt() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readInt();
// }
//
// public float readFloat() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readFloat();
// }
//
// public boolean readBoolean() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readBoolean();
// }
//
// public String readUTF() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readUTF();
// }
//
// public void writeInt(int value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeInt(value);
// }
//
// public void writeFloat(float value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeFloat(value);
// }
//
// public void writeBoolean(boolean value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeBoolean(value);
// }
//
// public void writeUTF(String value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeUTF(value);
// }
//
// }
//
// Path: XAppDbgServer/src/com/sonymobile/tools/xappdbg/XAppDbgCmdIDs.java
// public class XAppDbgCmdIDs {
//
// public static final String CMD_LIST_PROP = "XAppDbg.C.ListProp";
//
// public static final String CMD_WRITE_PROP = "XAppDbg.C.WriteProp";
//
// public static final String CMD_READ_PROP = "XAppDbg.C.ReadProp";
//
// public static final String CMD_TREE = "XAppDbg.C.Tree";
//
// public static final String CMD_TREE_SELECT = "XAppDbg.C.TreeSelect";
//
// public static final String CMD_TREE_CMD = "XAppDbg.C.Do";
//
// public static final String CMD_TRIGGER = "XAppDbg.C.Trigger";
// }
| import com.sonymobile.tools.xappdbg.Packet;
import com.sonymobile.tools.xappdbg.XAppDbgCmdIDs;
import java.io.IOException; | setVoidValue(obj);
break;
default:
throw new IllegalArgumentException();
}
runCB();
}
public int readIntValue(Packet out) throws IOException {
Packet in = sendReadReq(out);
return in.readInt();
}
public float readFloatValue(Packet out) throws IOException {
Packet in = sendReadReq(out);
return in.readFloat();
}
public boolean readBoolValue(Packet out) throws IOException {
Packet in = sendReadReq(out);
return in.readBoolean();
}
public String readStringValue(Packet out) throws IOException {
Packet in = sendReadReq(out);
return Util.readString(in);
}
protected Packet sendReadReq(Packet out) throws IOException {
out.writeUTF(mName); | // Path: XAppDbgServer/src/com/sonymobile/tools/xappdbg/Packet.java
// public class Packet {
//
// private boolean mReadable;
// private boolean mWritable;
// private int mLen;
// private int mChannel;
// private byte[] mData;
// private ByteArrayOutputStream mBuff;
// private DataOutputStream mBuffOS;
// private DataOutputStream mOS;
// private DataInputStream mBuffIS;
// private DataInputStream mIS;
// private boolean mSent;
//
// public Packet(int channel, DataInputStream is, DataOutputStream os) {
// mReadable = false;
// mWritable = true;
// mChannel = channel;
// mBuff = new ByteArrayOutputStream();
// mBuffOS = new DataOutputStream(mBuff);
// mIS = is;
// mOS = os;
// }
//
// /**
// * Create an incomming packet
// */
// /* package */ Packet(DataInputStream is, DataOutputStream os) throws IOException {
// mReadable = true;
// mWritable = false;
// // Read packet size
// mLen = is.readInt();
// // Read channel
// mChannel = is.readInt();
// // Read data
// mData = new byte[mLen];
// is.readFully(mData);
// mBuffIS = new DataInputStream(new ByteArrayInputStream(mData));
// // Store the output stream for reference
// mOS = os;
// }
//
// /* package */ void send(DataOutputStream os) throws IOException {
// if (mSent) {
// throw new RuntimeException("Packet already sent, refusing to send again!");
// }
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// byte data[] = mBuff.toByteArray();
// // Write packet size
// os.writeInt(data.length);
// // Write channel
// os.writeInt(mChannel);
// // Write data
// os.write(data);
// // Make sure the data is sent
// os.flush();
// mSent = true;
// }
//
// public int getChannel() {
// return mChannel;
// }
//
// public Packet createReply() {
// return new Packet(mChannel, null, mOS);
// }
//
// private Packet getReply() throws IOException {
// return new Packet(mIS, mOS);
// }
//
// public void send() throws IOException {
// send(mOS);
// }
//
// public Packet sendAndReceive(String cmd) throws IOException {
// mOS.writeUTF(cmd);
// send(mOS);
// return getReply();
// }
//
// public int readInt() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readInt();
// }
//
// public float readFloat() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readFloat();
// }
//
// public boolean readBoolean() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readBoolean();
// }
//
// public String readUTF() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readUTF();
// }
//
// public void writeInt(int value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeInt(value);
// }
//
// public void writeFloat(float value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeFloat(value);
// }
//
// public void writeBoolean(boolean value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeBoolean(value);
// }
//
// public void writeUTF(String value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeUTF(value);
// }
//
// }
//
// Path: XAppDbgServer/src/com/sonymobile/tools/xappdbg/XAppDbgCmdIDs.java
// public class XAppDbgCmdIDs {
//
// public static final String CMD_LIST_PROP = "XAppDbg.C.ListProp";
//
// public static final String CMD_WRITE_PROP = "XAppDbg.C.WriteProp";
//
// public static final String CMD_READ_PROP = "XAppDbg.C.ReadProp";
//
// public static final String CMD_TREE = "XAppDbg.C.Tree";
//
// public static final String CMD_TREE_SELECT = "XAppDbg.C.TreeSelect";
//
// public static final String CMD_TREE_CMD = "XAppDbg.C.Do";
//
// public static final String CMD_TRIGGER = "XAppDbg.C.Trigger";
// }
// Path: XAppDbgServer/src/com/sonymobile/tools/xappdbg/properties/Item.java
import com.sonymobile.tools.xappdbg.Packet;
import com.sonymobile.tools.xappdbg.XAppDbgCmdIDs;
import java.io.IOException;
setVoidValue(obj);
break;
default:
throw new IllegalArgumentException();
}
runCB();
}
public int readIntValue(Packet out) throws IOException {
Packet in = sendReadReq(out);
return in.readInt();
}
public float readFloatValue(Packet out) throws IOException {
Packet in = sendReadReq(out);
return in.readFloat();
}
public boolean readBoolValue(Packet out) throws IOException {
Packet in = sendReadReq(out);
return in.readBoolean();
}
public String readStringValue(Packet out) throws IOException {
Packet in = sendReadReq(out);
return Util.readString(in);
}
protected Packet sendReadReq(Packet out) throws IOException {
out.writeUTF(mName); | Packet in = out.sendAndReceive(XAppDbgCmdIDs.CMD_READ_PROP); |
sonyxperiadev/XAppDbg | XAppDbgServer/src/com/sonymobile/tools/xappdbg/properties/FieldItem.java | // Path: XAppDbgServer/src/com/sonymobile/tools/xappdbg/Packet.java
// public class Packet {
//
// private boolean mReadable;
// private boolean mWritable;
// private int mLen;
// private int mChannel;
// private byte[] mData;
// private ByteArrayOutputStream mBuff;
// private DataOutputStream mBuffOS;
// private DataOutputStream mOS;
// private DataInputStream mBuffIS;
// private DataInputStream mIS;
// private boolean mSent;
//
// public Packet(int channel, DataInputStream is, DataOutputStream os) {
// mReadable = false;
// mWritable = true;
// mChannel = channel;
// mBuff = new ByteArrayOutputStream();
// mBuffOS = new DataOutputStream(mBuff);
// mIS = is;
// mOS = os;
// }
//
// /**
// * Create an incomming packet
// */
// /* package */ Packet(DataInputStream is, DataOutputStream os) throws IOException {
// mReadable = true;
// mWritable = false;
// // Read packet size
// mLen = is.readInt();
// // Read channel
// mChannel = is.readInt();
// // Read data
// mData = new byte[mLen];
// is.readFully(mData);
// mBuffIS = new DataInputStream(new ByteArrayInputStream(mData));
// // Store the output stream for reference
// mOS = os;
// }
//
// /* package */ void send(DataOutputStream os) throws IOException {
// if (mSent) {
// throw new RuntimeException("Packet already sent, refusing to send again!");
// }
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// byte data[] = mBuff.toByteArray();
// // Write packet size
// os.writeInt(data.length);
// // Write channel
// os.writeInt(mChannel);
// // Write data
// os.write(data);
// // Make sure the data is sent
// os.flush();
// mSent = true;
// }
//
// public int getChannel() {
// return mChannel;
// }
//
// public Packet createReply() {
// return new Packet(mChannel, null, mOS);
// }
//
// private Packet getReply() throws IOException {
// return new Packet(mIS, mOS);
// }
//
// public void send() throws IOException {
// send(mOS);
// }
//
// public Packet sendAndReceive(String cmd) throws IOException {
// mOS.writeUTF(cmd);
// send(mOS);
// return getReply();
// }
//
// public int readInt() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readInt();
// }
//
// public float readFloat() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readFloat();
// }
//
// public boolean readBoolean() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readBoolean();
// }
//
// public String readUTF() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readUTF();
// }
//
// public void writeInt(int value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeInt(value);
// }
//
// public void writeFloat(float value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeFloat(value);
// }
//
// public void writeBoolean(boolean value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeBoolean(value);
// }
//
// public void writeUTF(String value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeUTF(value);
// }
//
// }
| import com.sonymobile.tools.xappdbg.Packet;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier; | @Override
public boolean setIntValue(Object obj, int value) {
if (getType() != TYPE_INT) throw new IllegalArgumentException();
try {
mField.setInt(obj, value);
return true;
} catch (Exception e) {
e.printStackTrace();
throw new IllegalArgumentException(e);
}
}
@Override
public boolean setStringValue(Object obj, String value) {
if (getType() != TYPE_STRING) throw new IllegalArgumentException();
try {
mField.set(obj, value);
return true;
} catch (Exception e) {
e.printStackTrace();
throw new IllegalArgumentException(e);
}
}
@Override
public boolean setVoidValue(Object obj) {
throw new IllegalArgumentException();
}
@Override | // Path: XAppDbgServer/src/com/sonymobile/tools/xappdbg/Packet.java
// public class Packet {
//
// private boolean mReadable;
// private boolean mWritable;
// private int mLen;
// private int mChannel;
// private byte[] mData;
// private ByteArrayOutputStream mBuff;
// private DataOutputStream mBuffOS;
// private DataOutputStream mOS;
// private DataInputStream mBuffIS;
// private DataInputStream mIS;
// private boolean mSent;
//
// public Packet(int channel, DataInputStream is, DataOutputStream os) {
// mReadable = false;
// mWritable = true;
// mChannel = channel;
// mBuff = new ByteArrayOutputStream();
// mBuffOS = new DataOutputStream(mBuff);
// mIS = is;
// mOS = os;
// }
//
// /**
// * Create an incomming packet
// */
// /* package */ Packet(DataInputStream is, DataOutputStream os) throws IOException {
// mReadable = true;
// mWritable = false;
// // Read packet size
// mLen = is.readInt();
// // Read channel
// mChannel = is.readInt();
// // Read data
// mData = new byte[mLen];
// is.readFully(mData);
// mBuffIS = new DataInputStream(new ByteArrayInputStream(mData));
// // Store the output stream for reference
// mOS = os;
// }
//
// /* package */ void send(DataOutputStream os) throws IOException {
// if (mSent) {
// throw new RuntimeException("Packet already sent, refusing to send again!");
// }
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// byte data[] = mBuff.toByteArray();
// // Write packet size
// os.writeInt(data.length);
// // Write channel
// os.writeInt(mChannel);
// // Write data
// os.write(data);
// // Make sure the data is sent
// os.flush();
// mSent = true;
// }
//
// public int getChannel() {
// return mChannel;
// }
//
// public Packet createReply() {
// return new Packet(mChannel, null, mOS);
// }
//
// private Packet getReply() throws IOException {
// return new Packet(mIS, mOS);
// }
//
// public void send() throws IOException {
// send(mOS);
// }
//
// public Packet sendAndReceive(String cmd) throws IOException {
// mOS.writeUTF(cmd);
// send(mOS);
// return getReply();
// }
//
// public int readInt() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readInt();
// }
//
// public float readFloat() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readFloat();
// }
//
// public boolean readBoolean() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readBoolean();
// }
//
// public String readUTF() throws IOException {
// if (!mReadable) {
// throw new RuntimeException("Cannot read from a write-only packet");
// }
// return mBuffIS.readUTF();
// }
//
// public void writeInt(int value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeInt(value);
// }
//
// public void writeFloat(float value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeFloat(value);
// }
//
// public void writeBoolean(boolean value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeBoolean(value);
// }
//
// public void writeUTF(String value) throws IOException {
// if (!mWritable) {
// throw new RuntimeException("Cannot send a read-only packet");
// }
// mBuffOS.writeUTF(value);
// }
//
// }
// Path: XAppDbgServer/src/com/sonymobile/tools/xappdbg/properties/FieldItem.java
import com.sonymobile.tools.xappdbg.Packet;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
@Override
public boolean setIntValue(Object obj, int value) {
if (getType() != TYPE_INT) throw new IllegalArgumentException();
try {
mField.setInt(obj, value);
return true;
} catch (Exception e) {
e.printStackTrace();
throw new IllegalArgumentException(e);
}
}
@Override
public boolean setStringValue(Object obj, String value) {
if (getType() != TYPE_STRING) throw new IllegalArgumentException();
try {
mField.set(obj, value);
return true;
} catch (Exception e) {
e.printStackTrace();
throw new IllegalArgumentException(e);
}
}
@Override
public boolean setVoidValue(Object obj) {
throw new IllegalArgumentException();
}
@Override | public void sendToClient(Packet out) throws IOException { |
maximeflamant/waveplay | src/com/nixus/raop/player/Player.java | // Path: src/com/nixus/raop/core/Service.java
// public interface Service {
//
// /**
// * Start the Service
// * @param context the ServiceContext for this Service
// */
// public void startService(ServiceContext context);
//
// /**
// * Stop the Service
// * @param context the ServiceContext for this Service (same as was passed into start)
// */
// public void stopService(ServiceContext context);
//
// /**
// * Return the ServiceContext that was passed into {@link #startService}
// */
// public ServiceContext getContext();
//
// /**
// * Return a Map describing the state of this Service, for serialization back to any
// * client that needs to know (eg webplayer) - so values should be serializable objects,
// * eg Lists, Maps or simple objects. If no useful state, return null.
// */
// public Map<String,Object> reportState();
//
// }
//
// Path: src/com/nixus/raop/speaker/Speaker.java
// public interface Speaker extends Service {
//
// /**
// * Return the number of ms delay for this speaker, between a packet
// * being written and it being heard
// */
// public int getDelay();
//
// /**
// * Return the size of the speaker buffer in bytes.
// */
// public int getBufferSize();
//
// /**
// * Return a nice name for the Speaker for display to the user
// */
// public String getDisplayName();
//
// /**
// * Return a unique ID for the speaker
// */
// int getUniqueId();
//
// /**
// * Returns true if this speaker can have its gain adjusted
// */
// public boolean hasGain();
//
// /**
// * Set the gain of this speaker. A value of NaN means "no audio".
// * If this method fails, set the Error.
// */
// public void setGain(float gain);
//
// /**
// * Set the player for the speaker. This method should
// * call {@link Player#removeSpeaker} on the old player
// * and {@link Player#addSpeaker} on the new one, and
// * anyone moving speakers between players should call
// * this method rather than those methods directly.
// */
// public void setPlayer(Player player);
//
// /**
// * Get the Player currently assigned to this speaker
// */
// public Player getPlayer();
//
// /**
// * If this speaker has failed for some reason, return the Exception.
// * Otherwise return null.
// */
// public Exception getError();
//
// /**
// * Get the volume adjustment that applies to this speaker (+ve or -ve, 0
// * for no adjustment
// */
// public int getVolumeAdjustment();
//
// /**
// * Set the volume adjustment that applies to this speaker, which should be
// * be added to the gain for this speaker.
// */
// public void setVolumeAdjustment(int volumeadjust);
//
// /**
// * Open the Speaker and start it. Reset any error that may have been set.
// */
// public void open(float sampleRate, int sampleSizeInBits, int channels, boolean signed, boolean bigEndian);
//
// /**
// * Write data to the speaker. If it fails, set the error
// */
// public void write(byte[] buf, int off, int len);
//
// /**
// * Immediately stop the speaker and discard any cached data written to it
// * If it fails, set the error.
// */
// public void flush();
//
// /**
// * Block until the data already written to the speaker completes
// * If it fails, set the error.
// */
// public void drain();
//
// /**
// * Close the speaker, immediately stopping it and discarding any data.
// * Does not throw exception or fail.
// */
// public void close();
//
// /**
// * True after open has been called, false after close has been called
// */
// public boolean isOpen();
//
// }
| import java.util.Collection;
import com.nixus.raop.core.Service;
import com.nixus.raop.speaker.Speaker; | package com.nixus.raop.player;
/**
* A Player plays tracks to one or more speakers which may be local speaker
* (probably a {@link SourceDataLine}), an Airtunes speaker or some other type (eg RTSP, uPnP etc.)
* Each player maintains it's own playlist and tracks may be cued, reordered, skipped
* and so on as you'd expect.
*/
public interface Player extends Service {
/**
* Set the current volume
* @param volume the volume, between 0 and 100
*/
public void setVolume(int volume);
/**
* Return the current volume
* @return the volume, between 0 and 100
*/
public int getVolume();
//-------------------------------------------------------------------------------
/**
* Get the collection of speakers that could be used by this Player and that
* aren't currently in use elsewhere.
*/ | // Path: src/com/nixus/raop/core/Service.java
// public interface Service {
//
// /**
// * Start the Service
// * @param context the ServiceContext for this Service
// */
// public void startService(ServiceContext context);
//
// /**
// * Stop the Service
// * @param context the ServiceContext for this Service (same as was passed into start)
// */
// public void stopService(ServiceContext context);
//
// /**
// * Return the ServiceContext that was passed into {@link #startService}
// */
// public ServiceContext getContext();
//
// /**
// * Return a Map describing the state of this Service, for serialization back to any
// * client that needs to know (eg webplayer) - so values should be serializable objects,
// * eg Lists, Maps or simple objects. If no useful state, return null.
// */
// public Map<String,Object> reportState();
//
// }
//
// Path: src/com/nixus/raop/speaker/Speaker.java
// public interface Speaker extends Service {
//
// /**
// * Return the number of ms delay for this speaker, between a packet
// * being written and it being heard
// */
// public int getDelay();
//
// /**
// * Return the size of the speaker buffer in bytes.
// */
// public int getBufferSize();
//
// /**
// * Return a nice name for the Speaker for display to the user
// */
// public String getDisplayName();
//
// /**
// * Return a unique ID for the speaker
// */
// int getUniqueId();
//
// /**
// * Returns true if this speaker can have its gain adjusted
// */
// public boolean hasGain();
//
// /**
// * Set the gain of this speaker. A value of NaN means "no audio".
// * If this method fails, set the Error.
// */
// public void setGain(float gain);
//
// /**
// * Set the player for the speaker. This method should
// * call {@link Player#removeSpeaker} on the old player
// * and {@link Player#addSpeaker} on the new one, and
// * anyone moving speakers between players should call
// * this method rather than those methods directly.
// */
// public void setPlayer(Player player);
//
// /**
// * Get the Player currently assigned to this speaker
// */
// public Player getPlayer();
//
// /**
// * If this speaker has failed for some reason, return the Exception.
// * Otherwise return null.
// */
// public Exception getError();
//
// /**
// * Get the volume adjustment that applies to this speaker (+ve or -ve, 0
// * for no adjustment
// */
// public int getVolumeAdjustment();
//
// /**
// * Set the volume adjustment that applies to this speaker, which should be
// * be added to the gain for this speaker.
// */
// public void setVolumeAdjustment(int volumeadjust);
//
// /**
// * Open the Speaker and start it. Reset any error that may have been set.
// */
// public void open(float sampleRate, int sampleSizeInBits, int channels, boolean signed, boolean bigEndian);
//
// /**
// * Write data to the speaker. If it fails, set the error
// */
// public void write(byte[] buf, int off, int len);
//
// /**
// * Immediately stop the speaker and discard any cached data written to it
// * If it fails, set the error.
// */
// public void flush();
//
// /**
// * Block until the data already written to the speaker completes
// * If it fails, set the error.
// */
// public void drain();
//
// /**
// * Close the speaker, immediately stopping it and discarding any data.
// * Does not throw exception or fail.
// */
// public void close();
//
// /**
// * True after open has been called, false after close has been called
// */
// public boolean isOpen();
//
// }
// Path: src/com/nixus/raop/player/Player.java
import java.util.Collection;
import com.nixus.raop.core.Service;
import com.nixus.raop.speaker.Speaker;
package com.nixus.raop.player;
/**
* A Player plays tracks to one or more speakers which may be local speaker
* (probably a {@link SourceDataLine}), an Airtunes speaker or some other type (eg RTSP, uPnP etc.)
* Each player maintains it's own playlist and tracks may be cued, reordered, skipped
* and so on as you'd expect.
*/
public interface Player extends Service {
/**
* Set the current volume
* @param volume the volume, between 0 and 100
*/
public void setVolume(int volume);
/**
* Return the current volume
* @return the volume, between 0 and 100
*/
public int getVolume();
//-------------------------------------------------------------------------------
/**
* Get the collection of speakers that could be used by this Player and that
* aren't currently in use elsewhere.
*/ | public Collection<Speaker> getAvailableSpeakers(); |
maximeflamant/waveplay | src/com/nixus/raop/player/PlayerFactory.java | // Path: src/com/nixus/raop/core/Service.java
// public interface Service {
//
// /**
// * Start the Service
// * @param context the ServiceContext for this Service
// */
// public void startService(ServiceContext context);
//
// /**
// * Stop the Service
// * @param context the ServiceContext for this Service (same as was passed into start)
// */
// public void stopService(ServiceContext context);
//
// /**
// * Return the ServiceContext that was passed into {@link #startService}
// */
// public ServiceContext getContext();
//
// /**
// * Return a Map describing the state of this Service, for serialization back to any
// * client that needs to know (eg webplayer) - so values should be serializable objects,
// * eg Lists, Maps or simple objects. If no useful state, return null.
// */
// public Map<String,Object> reportState();
//
// }
//
// Path: src/com/nixus/raop/core/ServiceContext.java
// public interface ServiceContext {
//
// public void debug(String message, Throwable e);
//
// public void debug(String message);
//
// public void info(String message);
//
// public void warn(String message, Throwable e);
//
// public void error(String message, Throwable e);
//
// /**
// * Return the name and version of the Software
// */
// public String getSoftwareName();
//
// /**
// * Return the logical name of the Server
// */
// public String getServerName();
//
// /**
// * Return the build date of the Server
// */
// public Date getServerBuildDate();
//
// /**
// * Return the unique logical name of this Service
// */
// public String getServiceName();
//
// /**
// * Get the Service for this ServiceContext
// */
// public Service getService();
//
// /**
// * Get the first {@link Service} object of the specified type
// */
// public <E extends Service> E getService(Class<E> type);
//
// /**
// * Get the first {@link Service} object of the specified type
// */
//
// public <E extends Service> E getService(Class<E> type, String criteria);
//
// /**
// * Get a list of all {@link Service} objects of the specified type
// */
//
// public <E extends Service> E[] getServices(Class<E> type, String criteria);
//
// /**
// * Add a {@link Listener} to the Server, it will be notified of events
// */
// public void addListener(Listener listener);
//
// /**
// * Remove a {@link Listener} to the Server, it will be notified of events
// */
// public void removeListener(Listener listener);
//
// /**
// * Fire an event - the Listeners registered with the server will be notified.
// * Properties can be specified easily with the second parameter, which is a sequence
// * of [key, value] entries - eg
// * <pre>
// * qtunes.fireEvent("player.add, new Object[] { "track", track, "user", user });
// * </pre>
// * @param o an array of [key, value]
// */
// public void fireEvent(String name, Object[] o);
//
// /**
// * Return a list of properties of this Service
// */
// public String[] getPropertyNames();
//
// /**
// * Get a system-wide property
// */
// public String getGlobalProperty(String key);
//
// /**
// * Get a property of this Service
// */
// public String getProperty(String key);
//
// /**
// * Set a property of this Service
// */
// public void putProperty(String key, String value);
//
// public void start();
//
// public void stop();
//
// /**
// * Add a service
// */
// public ServiceContext addService(Class<?>[] classes, Service service, Map<String,String> properties, boolean permanent);
//
// /**
// * Remove a service
// */
// public void removeService();
//
// /**
// * Return the list of Service names
// */
// public String[] getServiceNames();
//
// /**
// * Return true if the Service has been started
// */
// public boolean isActive();
//
// }
//
// Path: src/com/nixus/raop/core/ServiceFactory.java
// public interface ServiceFactory extends Service {
//
// public Collection<Class<?>> getServiceClasses();
// public Service createService(Class<? extends Service> type, Map<String,String> properties);
//
// }
| import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import com.nixus.raop.core.Service;
import com.nixus.raop.core.ServiceContext;
import com.nixus.raop.core.ServiceFactory; | package com.nixus.raop.player;
public class PlayerFactory implements ServiceFactory {
private ServiceContext context;
private Class<? extends Player> productclass;
@SuppressWarnings("unchecked")
public void startService(ServiceContext context) {
this.context = context;
try {
this.productclass = (Class<? extends Player>)Class.forName(context.getProperty("product"));
} catch (Exception e) {
throw new IllegalStateException("Invalid \"product\" property \""+context.getProperty("product")+"\"", e);
}
}
public void stopService(ServiceContext context) {
}
public ServiceContext getContext() {
return context;
}
public Collection<Class<?>> getServiceClasses() {
return Collections.<Class<?>>singleton(Player.class);
}
| // Path: src/com/nixus/raop/core/Service.java
// public interface Service {
//
// /**
// * Start the Service
// * @param context the ServiceContext for this Service
// */
// public void startService(ServiceContext context);
//
// /**
// * Stop the Service
// * @param context the ServiceContext for this Service (same as was passed into start)
// */
// public void stopService(ServiceContext context);
//
// /**
// * Return the ServiceContext that was passed into {@link #startService}
// */
// public ServiceContext getContext();
//
// /**
// * Return a Map describing the state of this Service, for serialization back to any
// * client that needs to know (eg webplayer) - so values should be serializable objects,
// * eg Lists, Maps or simple objects. If no useful state, return null.
// */
// public Map<String,Object> reportState();
//
// }
//
// Path: src/com/nixus/raop/core/ServiceContext.java
// public interface ServiceContext {
//
// public void debug(String message, Throwable e);
//
// public void debug(String message);
//
// public void info(String message);
//
// public void warn(String message, Throwable e);
//
// public void error(String message, Throwable e);
//
// /**
// * Return the name and version of the Software
// */
// public String getSoftwareName();
//
// /**
// * Return the logical name of the Server
// */
// public String getServerName();
//
// /**
// * Return the build date of the Server
// */
// public Date getServerBuildDate();
//
// /**
// * Return the unique logical name of this Service
// */
// public String getServiceName();
//
// /**
// * Get the Service for this ServiceContext
// */
// public Service getService();
//
// /**
// * Get the first {@link Service} object of the specified type
// */
// public <E extends Service> E getService(Class<E> type);
//
// /**
// * Get the first {@link Service} object of the specified type
// */
//
// public <E extends Service> E getService(Class<E> type, String criteria);
//
// /**
// * Get a list of all {@link Service} objects of the specified type
// */
//
// public <E extends Service> E[] getServices(Class<E> type, String criteria);
//
// /**
// * Add a {@link Listener} to the Server, it will be notified of events
// */
// public void addListener(Listener listener);
//
// /**
// * Remove a {@link Listener} to the Server, it will be notified of events
// */
// public void removeListener(Listener listener);
//
// /**
// * Fire an event - the Listeners registered with the server will be notified.
// * Properties can be specified easily with the second parameter, which is a sequence
// * of [key, value] entries - eg
// * <pre>
// * qtunes.fireEvent("player.add, new Object[] { "track", track, "user", user });
// * </pre>
// * @param o an array of [key, value]
// */
// public void fireEvent(String name, Object[] o);
//
// /**
// * Return a list of properties of this Service
// */
// public String[] getPropertyNames();
//
// /**
// * Get a system-wide property
// */
// public String getGlobalProperty(String key);
//
// /**
// * Get a property of this Service
// */
// public String getProperty(String key);
//
// /**
// * Set a property of this Service
// */
// public void putProperty(String key, String value);
//
// public void start();
//
// public void stop();
//
// /**
// * Add a service
// */
// public ServiceContext addService(Class<?>[] classes, Service service, Map<String,String> properties, boolean permanent);
//
// /**
// * Remove a service
// */
// public void removeService();
//
// /**
// * Return the list of Service names
// */
// public String[] getServiceNames();
//
// /**
// * Return true if the Service has been started
// */
// public boolean isActive();
//
// }
//
// Path: src/com/nixus/raop/core/ServiceFactory.java
// public interface ServiceFactory extends Service {
//
// public Collection<Class<?>> getServiceClasses();
// public Service createService(Class<? extends Service> type, Map<String,String> properties);
//
// }
// Path: src/com/nixus/raop/player/PlayerFactory.java
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import com.nixus.raop.core.Service;
import com.nixus.raop.core.ServiceContext;
import com.nixus.raop.core.ServiceFactory;
package com.nixus.raop.player;
public class PlayerFactory implements ServiceFactory {
private ServiceContext context;
private Class<? extends Player> productclass;
@SuppressWarnings("unchecked")
public void startService(ServiceContext context) {
this.context = context;
try {
this.productclass = (Class<? extends Player>)Class.forName(context.getProperty("product"));
} catch (Exception e) {
throw new IllegalStateException("Invalid \"product\" property \""+context.getProperty("product")+"\"", e);
}
}
public void stopService(ServiceContext context) {
}
public ServiceContext getContext() {
return context;
}
public Collection<Class<?>> getServiceClasses() {
return Collections.<Class<?>>singleton(Player.class);
}
| public Service createService(Class<? extends Service> type, Map<String,String> properties) { |
maximeflamant/waveplay | src/com/nixus/raop/player/MultiLine.java | // Path: src/com/nixus/raop/speaker/Speaker.java
// public interface Speaker extends Service {
//
// /**
// * Return the number of ms delay for this speaker, between a packet
// * being written and it being heard
// */
// public int getDelay();
//
// /**
// * Return the size of the speaker buffer in bytes.
// */
// public int getBufferSize();
//
// /**
// * Return a nice name for the Speaker for display to the user
// */
// public String getDisplayName();
//
// /**
// * Return a unique ID for the speaker
// */
// int getUniqueId();
//
// /**
// * Returns true if this speaker can have its gain adjusted
// */
// public boolean hasGain();
//
// /**
// * Set the gain of this speaker. A value of NaN means "no audio".
// * If this method fails, set the Error.
// */
// public void setGain(float gain);
//
// /**
// * Set the player for the speaker. This method should
// * call {@link Player#removeSpeaker} on the old player
// * and {@link Player#addSpeaker} on the new one, and
// * anyone moving speakers between players should call
// * this method rather than those methods directly.
// */
// public void setPlayer(Player player);
//
// /**
// * Get the Player currently assigned to this speaker
// */
// public Player getPlayer();
//
// /**
// * If this speaker has failed for some reason, return the Exception.
// * Otherwise return null.
// */
// public Exception getError();
//
// /**
// * Get the volume adjustment that applies to this speaker (+ve or -ve, 0
// * for no adjustment
// */
// public int getVolumeAdjustment();
//
// /**
// * Set the volume adjustment that applies to this speaker, which should be
// * be added to the gain for this speaker.
// */
// public void setVolumeAdjustment(int volumeadjust);
//
// /**
// * Open the Speaker and start it. Reset any error that may have been set.
// */
// public void open(float sampleRate, int sampleSizeInBits, int channels, boolean signed, boolean bigEndian);
//
// /**
// * Write data to the speaker. If it fails, set the error
// */
// public void write(byte[] buf, int off, int len);
//
// /**
// * Immediately stop the speaker and discard any cached data written to it
// * If it fails, set the error.
// */
// public void flush();
//
// /**
// * Block until the data already written to the speaker completes
// * If it fails, set the error.
// */
// public void drain();
//
// /**
// * Close the speaker, immediately stopping it and discarding any data.
// * Does not throw exception or fail.
// */
// public void close();
//
// /**
// * True after open has been called, false after close has been called
// */
// public boolean isOpen();
//
// }
| import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.nixus.raop.speaker.Speaker; | package com.nixus.raop.player;
/**
* A Wrapper around multiple Speaker objects. Done this way
* so a Player can play to multiple unsynchronzed speakers at once,
* not sure if that's useful
*
* These methods are called from player thread:
* close drain flush write isOpen open hasSpeakers
* Other methods are called from other threads. If they need to interact they must
* do so carefully and synchronize on this(for mods involving no change to bitrate)
* or tracklock(for mods involving bitrate)
*/
class MultiLine {
// org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger("multiline");
private static class SpeakerState {
long tail = Long.MIN_VALUE;
int bytedelay;
}
private Object tracklock = new Object(); // Just for synchronizing on
private volatile int volume, msdelay;
private volatile float trackgain;
private PlayerImpl player;
private byte[] queue = new byte[704000]; // ~4 secs
private volatile long head, tail;
| // Path: src/com/nixus/raop/speaker/Speaker.java
// public interface Speaker extends Service {
//
// /**
// * Return the number of ms delay for this speaker, between a packet
// * being written and it being heard
// */
// public int getDelay();
//
// /**
// * Return the size of the speaker buffer in bytes.
// */
// public int getBufferSize();
//
// /**
// * Return a nice name for the Speaker for display to the user
// */
// public String getDisplayName();
//
// /**
// * Return a unique ID for the speaker
// */
// int getUniqueId();
//
// /**
// * Returns true if this speaker can have its gain adjusted
// */
// public boolean hasGain();
//
// /**
// * Set the gain of this speaker. A value of NaN means "no audio".
// * If this method fails, set the Error.
// */
// public void setGain(float gain);
//
// /**
// * Set the player for the speaker. This method should
// * call {@link Player#removeSpeaker} on the old player
// * and {@link Player#addSpeaker} on the new one, and
// * anyone moving speakers between players should call
// * this method rather than those methods directly.
// */
// public void setPlayer(Player player);
//
// /**
// * Get the Player currently assigned to this speaker
// */
// public Player getPlayer();
//
// /**
// * If this speaker has failed for some reason, return the Exception.
// * Otherwise return null.
// */
// public Exception getError();
//
// /**
// * Get the volume adjustment that applies to this speaker (+ve or -ve, 0
// * for no adjustment
// */
// public int getVolumeAdjustment();
//
// /**
// * Set the volume adjustment that applies to this speaker, which should be
// * be added to the gain for this speaker.
// */
// public void setVolumeAdjustment(int volumeadjust);
//
// /**
// * Open the Speaker and start it. Reset any error that may have been set.
// */
// public void open(float sampleRate, int sampleSizeInBits, int channels, boolean signed, boolean bigEndian);
//
// /**
// * Write data to the speaker. If it fails, set the error
// */
// public void write(byte[] buf, int off, int len);
//
// /**
// * Immediately stop the speaker and discard any cached data written to it
// * If it fails, set the error.
// */
// public void flush();
//
// /**
// * Block until the data already written to the speaker completes
// * If it fails, set the error.
// */
// public void drain();
//
// /**
// * Close the speaker, immediately stopping it and discarding any data.
// * Does not throw exception or fail.
// */
// public void close();
//
// /**
// * True after open has been called, false after close has been called
// */
// public boolean isOpen();
//
// }
// Path: src/com/nixus/raop/player/MultiLine.java
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.nixus.raop.speaker.Speaker;
package com.nixus.raop.player;
/**
* A Wrapper around multiple Speaker objects. Done this way
* so a Player can play to multiple unsynchronzed speakers at once,
* not sure if that's useful
*
* These methods are called from player thread:
* close drain flush write isOpen open hasSpeakers
* Other methods are called from other threads. If they need to interact they must
* do so carefully and synchronize on this(for mods involving no change to bitrate)
* or tracklock(for mods involving bitrate)
*/
class MultiLine {
// org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger("multiline");
private static class SpeakerState {
long tail = Long.MIN_VALUE;
int bytedelay;
}
private Object tracklock = new Object(); // Just for synchronizing on
private volatile int volume, msdelay;
private volatile float trackgain;
private PlayerImpl player;
private byte[] queue = new byte[704000]; // ~4 secs
private volatile long head, tail;
| private Map<Speaker,SpeakerState> speakers = new ConcurrentHashMap<Speaker,SpeakerState>(); |
maximeflamant/waveplay | src/com/nixus/raop/speaker/airport/AirtunesSpeaker.java | // Path: src/com/nixus/raop/core/ServiceContext.java
// public interface ServiceContext {
//
// public void debug(String message, Throwable e);
//
// public void debug(String message);
//
// public void info(String message);
//
// public void warn(String message, Throwable e);
//
// public void error(String message, Throwable e);
//
// /**
// * Return the name and version of the Software
// */
// public String getSoftwareName();
//
// /**
// * Return the logical name of the Server
// */
// public String getServerName();
//
// /**
// * Return the build date of the Server
// */
// public Date getServerBuildDate();
//
// /**
// * Return the unique logical name of this Service
// */
// public String getServiceName();
//
// /**
// * Get the Service for this ServiceContext
// */
// public Service getService();
//
// /**
// * Get the first {@link Service} object of the specified type
// */
// public <E extends Service> E getService(Class<E> type);
//
// /**
// * Get the first {@link Service} object of the specified type
// */
//
// public <E extends Service> E getService(Class<E> type, String criteria);
//
// /**
// * Get a list of all {@link Service} objects of the specified type
// */
//
// public <E extends Service> E[] getServices(Class<E> type, String criteria);
//
// /**
// * Add a {@link Listener} to the Server, it will be notified of events
// */
// public void addListener(Listener listener);
//
// /**
// * Remove a {@link Listener} to the Server, it will be notified of events
// */
// public void removeListener(Listener listener);
//
// /**
// * Fire an event - the Listeners registered with the server will be notified.
// * Properties can be specified easily with the second parameter, which is a sequence
// * of [key, value] entries - eg
// * <pre>
// * qtunes.fireEvent("player.add, new Object[] { "track", track, "user", user });
// * </pre>
// * @param o an array of [key, value]
// */
// public void fireEvent(String name, Object[] o);
//
// /**
// * Return a list of properties of this Service
// */
// public String[] getPropertyNames();
//
// /**
// * Get a system-wide property
// */
// public String getGlobalProperty(String key);
//
// /**
// * Get a property of this Service
// */
// public String getProperty(String key);
//
// /**
// * Set a property of this Service
// */
// public void putProperty(String key, String value);
//
// public void start();
//
// public void stop();
//
// /**
// * Add a service
// */
// public ServiceContext addService(Class<?>[] classes, Service service, Map<String,String> properties, boolean permanent);
//
// /**
// * Remove a service
// */
// public void removeService();
//
// /**
// * Return the list of Service names
// */
// public String[] getServiceNames();
//
// /**
// * Return true if the Service has been started
// */
// public boolean isActive();
//
// }
| import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.security.SecureRandom;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
import com.nixus.raop.core.ServiceContext; | package com.nixus.raop.speaker.airport;
// Disconnection can happen because of
// a) no toucho
// b) no connect
class AirtunesSpeaker {
private static final int VALIDITY = 9000, EXPIRE = 3000;
private String cipherkey, cipheriv;
private int timingport, controlport;
private volatile Exception error; | // Path: src/com/nixus/raop/core/ServiceContext.java
// public interface ServiceContext {
//
// public void debug(String message, Throwable e);
//
// public void debug(String message);
//
// public void info(String message);
//
// public void warn(String message, Throwable e);
//
// public void error(String message, Throwable e);
//
// /**
// * Return the name and version of the Software
// */
// public String getSoftwareName();
//
// /**
// * Return the logical name of the Server
// */
// public String getServerName();
//
// /**
// * Return the build date of the Server
// */
// public Date getServerBuildDate();
//
// /**
// * Return the unique logical name of this Service
// */
// public String getServiceName();
//
// /**
// * Get the Service for this ServiceContext
// */
// public Service getService();
//
// /**
// * Get the first {@link Service} object of the specified type
// */
// public <E extends Service> E getService(Class<E> type);
//
// /**
// * Get the first {@link Service} object of the specified type
// */
//
// public <E extends Service> E getService(Class<E> type, String criteria);
//
// /**
// * Get a list of all {@link Service} objects of the specified type
// */
//
// public <E extends Service> E[] getServices(Class<E> type, String criteria);
//
// /**
// * Add a {@link Listener} to the Server, it will be notified of events
// */
// public void addListener(Listener listener);
//
// /**
// * Remove a {@link Listener} to the Server, it will be notified of events
// */
// public void removeListener(Listener listener);
//
// /**
// * Fire an event - the Listeners registered with the server will be notified.
// * Properties can be specified easily with the second parameter, which is a sequence
// * of [key, value] entries - eg
// * <pre>
// * qtunes.fireEvent("player.add, new Object[] { "track", track, "user", user });
// * </pre>
// * @param o an array of [key, value]
// */
// public void fireEvent(String name, Object[] o);
//
// /**
// * Return a list of properties of this Service
// */
// public String[] getPropertyNames();
//
// /**
// * Get a system-wide property
// */
// public String getGlobalProperty(String key);
//
// /**
// * Get a property of this Service
// */
// public String getProperty(String key);
//
// /**
// * Set a property of this Service
// */
// public void putProperty(String key, String value);
//
// public void start();
//
// public void stop();
//
// /**
// * Add a service
// */
// public ServiceContext addService(Class<?>[] classes, Service service, Map<String,String> properties, boolean permanent);
//
// /**
// * Remove a service
// */
// public void removeService();
//
// /**
// * Return the list of Service names
// */
// public String[] getServiceNames();
//
// /**
// * Return true if the Service has been started
// */
// public boolean isActive();
//
// }
// Path: src/com/nixus/raop/speaker/airport/AirtunesSpeaker.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.security.SecureRandom;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
import com.nixus.raop.core.ServiceContext;
package com.nixus.raop.speaker.airport;
// Disconnection can happen because of
// a) no toucho
// b) no connect
class AirtunesSpeaker {
private static final int VALIDITY = 9000, EXPIRE = 3000;
private String cipherkey, cipheriv;
private int timingport, controlport;
private volatile Exception error; | private ServiceContext context; |
maximeflamant/waveplay | src/com/nixus/raop/speaker/airport/AirtunesManager.java | // Path: src/com/nixus/raop/core/ServiceContext.java
// public interface ServiceContext {
//
// public void debug(String message, Throwable e);
//
// public void debug(String message);
//
// public void info(String message);
//
// public void warn(String message, Throwable e);
//
// public void error(String message, Throwable e);
//
// /**
// * Return the name and version of the Software
// */
// public String getSoftwareName();
//
// /**
// * Return the logical name of the Server
// */
// public String getServerName();
//
// /**
// * Return the build date of the Server
// */
// public Date getServerBuildDate();
//
// /**
// * Return the unique logical name of this Service
// */
// public String getServiceName();
//
// /**
// * Get the Service for this ServiceContext
// */
// public Service getService();
//
// /**
// * Get the first {@link Service} object of the specified type
// */
// public <E extends Service> E getService(Class<E> type);
//
// /**
// * Get the first {@link Service} object of the specified type
// */
//
// public <E extends Service> E getService(Class<E> type, String criteria);
//
// /**
// * Get a list of all {@link Service} objects of the specified type
// */
//
// public <E extends Service> E[] getServices(Class<E> type, String criteria);
//
// /**
// * Add a {@link Listener} to the Server, it will be notified of events
// */
// public void addListener(Listener listener);
//
// /**
// * Remove a {@link Listener} to the Server, it will be notified of events
// */
// public void removeListener(Listener listener);
//
// /**
// * Fire an event - the Listeners registered with the server will be notified.
// * Properties can be specified easily with the second parameter, which is a sequence
// * of [key, value] entries - eg
// * <pre>
// * qtunes.fireEvent("player.add, new Object[] { "track", track, "user", user });
// * </pre>
// * @param o an array of [key, value]
// */
// public void fireEvent(String name, Object[] o);
//
// /**
// * Return a list of properties of this Service
// */
// public String[] getPropertyNames();
//
// /**
// * Get a system-wide property
// */
// public String getGlobalProperty(String key);
//
// /**
// * Get a property of this Service
// */
// public String getProperty(String key);
//
// /**
// * Set a property of this Service
// */
// public void putProperty(String key, String value);
//
// public void start();
//
// public void stop();
//
// /**
// * Add a service
// */
// public ServiceContext addService(Class<?>[] classes, Service service, Map<String,String> properties, boolean permanent);
//
// /**
// * Remove a service
// */
// public void removeService();
//
// /**
// * Return the list of Service names
// */
// public String[] getServiceNames();
//
// /**
// * Return true if the Service has been started
// */
// public boolean isActive();
//
// }
| import java.io.IOException;
import java.math.BigInteger;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.security.GeneralSecurityException;
import java.security.KeyFactory;
import java.security.Provider;
import java.security.PublicKey;
import java.security.SecureRandom;
import java.security.Security;
import java.security.spec.RSAPublicKeySpec;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeSet;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import com.nixus.raop.core.ServiceContext; | package com.nixus.raop.speaker.airport;
/**
* Marshalling service for one or more individual Airports.
* Protocol details: see http://blog.technologeek.org/airtunes-v2
* http://git.zx2c4.com/Airtunes2/about
*/
public class AirtunesManager {
private static final int SYNCFREQUENCY = 126, PACKETSIZE = 352, QUEUELENGTH = 100;
private static final int MSECMULT = 4294967;
private static final long PACKETSPERNANO = 352l * 1000 * 1000 * 1000 / 44100;
private static long epoch; // 2208988800l - 1281457956l;
private final String name; | // Path: src/com/nixus/raop/core/ServiceContext.java
// public interface ServiceContext {
//
// public void debug(String message, Throwable e);
//
// public void debug(String message);
//
// public void info(String message);
//
// public void warn(String message, Throwable e);
//
// public void error(String message, Throwable e);
//
// /**
// * Return the name and version of the Software
// */
// public String getSoftwareName();
//
// /**
// * Return the logical name of the Server
// */
// public String getServerName();
//
// /**
// * Return the build date of the Server
// */
// public Date getServerBuildDate();
//
// /**
// * Return the unique logical name of this Service
// */
// public String getServiceName();
//
// /**
// * Get the Service for this ServiceContext
// */
// public Service getService();
//
// /**
// * Get the first {@link Service} object of the specified type
// */
// public <E extends Service> E getService(Class<E> type);
//
// /**
// * Get the first {@link Service} object of the specified type
// */
//
// public <E extends Service> E getService(Class<E> type, String criteria);
//
// /**
// * Get a list of all {@link Service} objects of the specified type
// */
//
// public <E extends Service> E[] getServices(Class<E> type, String criteria);
//
// /**
// * Add a {@link Listener} to the Server, it will be notified of events
// */
// public void addListener(Listener listener);
//
// /**
// * Remove a {@link Listener} to the Server, it will be notified of events
// */
// public void removeListener(Listener listener);
//
// /**
// * Fire an event - the Listeners registered with the server will be notified.
// * Properties can be specified easily with the second parameter, which is a sequence
// * of [key, value] entries - eg
// * <pre>
// * qtunes.fireEvent("player.add, new Object[] { "track", track, "user", user });
// * </pre>
// * @param o an array of [key, value]
// */
// public void fireEvent(String name, Object[] o);
//
// /**
// * Return a list of properties of this Service
// */
// public String[] getPropertyNames();
//
// /**
// * Get a system-wide property
// */
// public String getGlobalProperty(String key);
//
// /**
// * Get a property of this Service
// */
// public String getProperty(String key);
//
// /**
// * Set a property of this Service
// */
// public void putProperty(String key, String value);
//
// public void start();
//
// public void stop();
//
// /**
// * Add a service
// */
// public ServiceContext addService(Class<?>[] classes, Service service, Map<String,String> properties, boolean permanent);
//
// /**
// * Remove a service
// */
// public void removeService();
//
// /**
// * Return the list of Service names
// */
// public String[] getServiceNames();
//
// /**
// * Return true if the Service has been started
// */
// public boolean isActive();
//
// }
// Path: src/com/nixus/raop/speaker/airport/AirtunesManager.java
import java.io.IOException;
import java.math.BigInteger;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.security.GeneralSecurityException;
import java.security.KeyFactory;
import java.security.Provider;
import java.security.PublicKey;
import java.security.SecureRandom;
import java.security.Security;
import java.security.spec.RSAPublicKeySpec;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeSet;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import com.nixus.raop.core.ServiceContext;
package com.nixus.raop.speaker.airport;
/**
* Marshalling service for one or more individual Airports.
* Protocol details: see http://blog.technologeek.org/airtunes-v2
* http://git.zx2c4.com/Airtunes2/about
*/
public class AirtunesManager {
private static final int SYNCFREQUENCY = 126, PACKETSIZE = 352, QUEUELENGTH = 100;
private static final int MSECMULT = 4294967;
private static final long PACKETSPERNANO = 352l * 1000 * 1000 * 1000 / 44100;
private static long epoch; // 2208988800l - 1281457956l;
private final String name; | private final ServiceContext context; |
maximeflamant/waveplay | src/com/nixus/raop/zeroconf/ZeroConfFactory.java | // Path: src/com/nixus/raop/core/Service.java
// public interface Service {
//
// /**
// * Start the Service
// * @param context the ServiceContext for this Service
// */
// public void startService(ServiceContext context);
//
// /**
// * Stop the Service
// * @param context the ServiceContext for this Service (same as was passed into start)
// */
// public void stopService(ServiceContext context);
//
// /**
// * Return the ServiceContext that was passed into {@link #startService}
// */
// public ServiceContext getContext();
//
// /**
// * Return a Map describing the state of this Service, for serialization back to any
// * client that needs to know (eg webplayer) - so values should be serializable objects,
// * eg Lists, Maps or simple objects. If no useful state, return null.
// */
// public Map<String,Object> reportState();
//
// }
//
// Path: src/com/nixus/raop/core/ServiceContext.java
// public interface ServiceContext {
//
// public void debug(String message, Throwable e);
//
// public void debug(String message);
//
// public void info(String message);
//
// public void warn(String message, Throwable e);
//
// public void error(String message, Throwable e);
//
// /**
// * Return the name and version of the Software
// */
// public String getSoftwareName();
//
// /**
// * Return the logical name of the Server
// */
// public String getServerName();
//
// /**
// * Return the build date of the Server
// */
// public Date getServerBuildDate();
//
// /**
// * Return the unique logical name of this Service
// */
// public String getServiceName();
//
// /**
// * Get the Service for this ServiceContext
// */
// public Service getService();
//
// /**
// * Get the first {@link Service} object of the specified type
// */
// public <E extends Service> E getService(Class<E> type);
//
// /**
// * Get the first {@link Service} object of the specified type
// */
//
// public <E extends Service> E getService(Class<E> type, String criteria);
//
// /**
// * Get a list of all {@link Service} objects of the specified type
// */
//
// public <E extends Service> E[] getServices(Class<E> type, String criteria);
//
// /**
// * Add a {@link Listener} to the Server, it will be notified of events
// */
// public void addListener(Listener listener);
//
// /**
// * Remove a {@link Listener} to the Server, it will be notified of events
// */
// public void removeListener(Listener listener);
//
// /**
// * Fire an event - the Listeners registered with the server will be notified.
// * Properties can be specified easily with the second parameter, which is a sequence
// * of [key, value] entries - eg
// * <pre>
// * qtunes.fireEvent("player.add, new Object[] { "track", track, "user", user });
// * </pre>
// * @param o an array of [key, value]
// */
// public void fireEvent(String name, Object[] o);
//
// /**
// * Return a list of properties of this Service
// */
// public String[] getPropertyNames();
//
// /**
// * Get a system-wide property
// */
// public String getGlobalProperty(String key);
//
// /**
// * Get a property of this Service
// */
// public String getProperty(String key);
//
// /**
// * Set a property of this Service
// */
// public void putProperty(String key, String value);
//
// public void start();
//
// public void stop();
//
// /**
// * Add a service
// */
// public ServiceContext addService(Class<?>[] classes, Service service, Map<String,String> properties, boolean permanent);
//
// /**
// * Remove a service
// */
// public void removeService();
//
// /**
// * Return the list of Service names
// */
// public String[] getServiceNames();
//
// /**
// * Return true if the Service has been started
// */
// public boolean isActive();
//
// }
//
// Path: src/com/nixus/raop/core/ServiceFactory.java
// public interface ServiceFactory extends Service {
//
// public Collection<Class<?>> getServiceClasses();
// public Service createService(Class<? extends Service> type, Map<String,String> properties);
//
// }
| import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import com.nixus.raop.core.Service;
import com.nixus.raop.core.ServiceContext;
import com.nixus.raop.core.ServiceFactory; | package com.nixus.raop.zeroconf;
public class ZeroConfFactory implements ServiceFactory {
private ServiceContext context;
public void startService(ServiceContext context) {
this.context = context;
}
public void stopService(ServiceContext context) {
}
public ServiceContext getContext() {
return context;
}
public Collection<Class<?>> getServiceClasses() {
return Collections.<Class<?>>singleton(ZeroConf.class);
}
| // Path: src/com/nixus/raop/core/Service.java
// public interface Service {
//
// /**
// * Start the Service
// * @param context the ServiceContext for this Service
// */
// public void startService(ServiceContext context);
//
// /**
// * Stop the Service
// * @param context the ServiceContext for this Service (same as was passed into start)
// */
// public void stopService(ServiceContext context);
//
// /**
// * Return the ServiceContext that was passed into {@link #startService}
// */
// public ServiceContext getContext();
//
// /**
// * Return a Map describing the state of this Service, for serialization back to any
// * client that needs to know (eg webplayer) - so values should be serializable objects,
// * eg Lists, Maps or simple objects. If no useful state, return null.
// */
// public Map<String,Object> reportState();
//
// }
//
// Path: src/com/nixus/raop/core/ServiceContext.java
// public interface ServiceContext {
//
// public void debug(String message, Throwable e);
//
// public void debug(String message);
//
// public void info(String message);
//
// public void warn(String message, Throwable e);
//
// public void error(String message, Throwable e);
//
// /**
// * Return the name and version of the Software
// */
// public String getSoftwareName();
//
// /**
// * Return the logical name of the Server
// */
// public String getServerName();
//
// /**
// * Return the build date of the Server
// */
// public Date getServerBuildDate();
//
// /**
// * Return the unique logical name of this Service
// */
// public String getServiceName();
//
// /**
// * Get the Service for this ServiceContext
// */
// public Service getService();
//
// /**
// * Get the first {@link Service} object of the specified type
// */
// public <E extends Service> E getService(Class<E> type);
//
// /**
// * Get the first {@link Service} object of the specified type
// */
//
// public <E extends Service> E getService(Class<E> type, String criteria);
//
// /**
// * Get a list of all {@link Service} objects of the specified type
// */
//
// public <E extends Service> E[] getServices(Class<E> type, String criteria);
//
// /**
// * Add a {@link Listener} to the Server, it will be notified of events
// */
// public void addListener(Listener listener);
//
// /**
// * Remove a {@link Listener} to the Server, it will be notified of events
// */
// public void removeListener(Listener listener);
//
// /**
// * Fire an event - the Listeners registered with the server will be notified.
// * Properties can be specified easily with the second parameter, which is a sequence
// * of [key, value] entries - eg
// * <pre>
// * qtunes.fireEvent("player.add, new Object[] { "track", track, "user", user });
// * </pre>
// * @param o an array of [key, value]
// */
// public void fireEvent(String name, Object[] o);
//
// /**
// * Return a list of properties of this Service
// */
// public String[] getPropertyNames();
//
// /**
// * Get a system-wide property
// */
// public String getGlobalProperty(String key);
//
// /**
// * Get a property of this Service
// */
// public String getProperty(String key);
//
// /**
// * Set a property of this Service
// */
// public void putProperty(String key, String value);
//
// public void start();
//
// public void stop();
//
// /**
// * Add a service
// */
// public ServiceContext addService(Class<?>[] classes, Service service, Map<String,String> properties, boolean permanent);
//
// /**
// * Remove a service
// */
// public void removeService();
//
// /**
// * Return the list of Service names
// */
// public String[] getServiceNames();
//
// /**
// * Return true if the Service has been started
// */
// public boolean isActive();
//
// }
//
// Path: src/com/nixus/raop/core/ServiceFactory.java
// public interface ServiceFactory extends Service {
//
// public Collection<Class<?>> getServiceClasses();
// public Service createService(Class<? extends Service> type, Map<String,String> properties);
//
// }
// Path: src/com/nixus/raop/zeroconf/ZeroConfFactory.java
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import com.nixus.raop.core.Service;
import com.nixus.raop.core.ServiceContext;
import com.nixus.raop.core.ServiceFactory;
package com.nixus.raop.zeroconf;
public class ZeroConfFactory implements ServiceFactory {
private ServiceContext context;
public void startService(ServiceContext context) {
this.context = context;
}
public void stopService(ServiceContext context) {
}
public ServiceContext getContext() {
return context;
}
public Collection<Class<?>> getServiceClasses() {
return Collections.<Class<?>>singleton(ZeroConf.class);
}
| public Service createService(Class<? extends Service> type, Map<String,String> properties) { |
maximeflamant/waveplay | src/com/nixus/raop/speaker/Speaker.java | // Path: src/com/nixus/raop/core/Service.java
// public interface Service {
//
// /**
// * Start the Service
// * @param context the ServiceContext for this Service
// */
// public void startService(ServiceContext context);
//
// /**
// * Stop the Service
// * @param context the ServiceContext for this Service (same as was passed into start)
// */
// public void stopService(ServiceContext context);
//
// /**
// * Return the ServiceContext that was passed into {@link #startService}
// */
// public ServiceContext getContext();
//
// /**
// * Return a Map describing the state of this Service, for serialization back to any
// * client that needs to know (eg webplayer) - so values should be serializable objects,
// * eg Lists, Maps or simple objects. If no useful state, return null.
// */
// public Map<String,Object> reportState();
//
// }
//
// Path: src/com/nixus/raop/player/Player.java
// public interface Player extends Service {
//
//
//
//
// /**
// * Set the current volume
// * @param volume the volume, between 0 and 100
// */
//
// public void setVolume(int volume);
//
// /**
// * Return the current volume
// * @return the volume, between 0 and 100
// */
//
// public int getVolume();
//
// //-------------------------------------------------------------------------------
//
// /**
// * Get the collection of speakers that could be used by this Player and that
// * aren't currently in use elsewhere.
// */
// public Collection<Speaker> getAvailableSpeakers();
//
// /**
// * Add a Speaker to the Player. Should only be called by {@link Speaker#setPlayer}.
// */
// public void addSpeaker(Speaker speaker);
//
// /**
// * Remove a Speaker to the Player. Should only be called by {@link Speaker#setPlayer}.
// */
// public void removeSpeaker(Speaker speaker);
//
// /**
// * Return the list of {@link Speaker} objects current in use by this Player
// */
// public Collection<Speaker> getSpeakers();
//
//
// /**
// * Return the revision number. This should be increased every time the Player's state is
// * updated.
// */
// public int getRevision();
//
// /**
// * Return a nice name for this Player for display to the user
// */
// public String getDisplayName();
//
// }
| import com.nixus.raop.core.Service;
import com.nixus.raop.player.Player; | package com.nixus.raop.speaker;
/**
* A Speaker is an output device, which may be a local JavaSound speaker,
* an Airtunes speaker, a network speaker or similar. A {@link Player} has
* one or more speakers and a {@link Speaker} may be assigned to exactly
* one Player, or unassigned. Writing to a Speaker should <b>never</b> throw
* an Exception of any sort - instead the internal {@link #getException Exception}
* should be set. This is reset when the Speaker is opened.
*/
public interface Speaker extends Service {
/**
* Return the number of ms delay for this speaker, between a packet
* being written and it being heard
*/
public int getDelay();
/**
* Return the size of the speaker buffer in bytes.
*/
public int getBufferSize();
/**
* Return a nice name for the Speaker for display to the user
*/
public String getDisplayName();
/**
* Return a unique ID for the speaker
*/
int getUniqueId();
/**
* Returns true if this speaker can have its gain adjusted
*/
public boolean hasGain();
/**
* Set the gain of this speaker. A value of NaN means "no audio".
* If this method fails, set the Error.
*/
public void setGain(float gain);
/**
* Set the player for the speaker. This method should
* call {@link Player#removeSpeaker} on the old player
* and {@link Player#addSpeaker} on the new one, and
* anyone moving speakers between players should call
* this method rather than those methods directly.
*/ | // Path: src/com/nixus/raop/core/Service.java
// public interface Service {
//
// /**
// * Start the Service
// * @param context the ServiceContext for this Service
// */
// public void startService(ServiceContext context);
//
// /**
// * Stop the Service
// * @param context the ServiceContext for this Service (same as was passed into start)
// */
// public void stopService(ServiceContext context);
//
// /**
// * Return the ServiceContext that was passed into {@link #startService}
// */
// public ServiceContext getContext();
//
// /**
// * Return a Map describing the state of this Service, for serialization back to any
// * client that needs to know (eg webplayer) - so values should be serializable objects,
// * eg Lists, Maps or simple objects. If no useful state, return null.
// */
// public Map<String,Object> reportState();
//
// }
//
// Path: src/com/nixus/raop/player/Player.java
// public interface Player extends Service {
//
//
//
//
// /**
// * Set the current volume
// * @param volume the volume, between 0 and 100
// */
//
// public void setVolume(int volume);
//
// /**
// * Return the current volume
// * @return the volume, between 0 and 100
// */
//
// public int getVolume();
//
// //-------------------------------------------------------------------------------
//
// /**
// * Get the collection of speakers that could be used by this Player and that
// * aren't currently in use elsewhere.
// */
// public Collection<Speaker> getAvailableSpeakers();
//
// /**
// * Add a Speaker to the Player. Should only be called by {@link Speaker#setPlayer}.
// */
// public void addSpeaker(Speaker speaker);
//
// /**
// * Remove a Speaker to the Player. Should only be called by {@link Speaker#setPlayer}.
// */
// public void removeSpeaker(Speaker speaker);
//
// /**
// * Return the list of {@link Speaker} objects current in use by this Player
// */
// public Collection<Speaker> getSpeakers();
//
//
// /**
// * Return the revision number. This should be increased every time the Player's state is
// * updated.
// */
// public int getRevision();
//
// /**
// * Return a nice name for this Player for display to the user
// */
// public String getDisplayName();
//
// }
// Path: src/com/nixus/raop/speaker/Speaker.java
import com.nixus.raop.core.Service;
import com.nixus.raop.player.Player;
package com.nixus.raop.speaker;
/**
* A Speaker is an output device, which may be a local JavaSound speaker,
* an Airtunes speaker, a network speaker or similar. A {@link Player} has
* one or more speakers and a {@link Speaker} may be assigned to exactly
* one Player, or unassigned. Writing to a Speaker should <b>never</b> throw
* an Exception of any sort - instead the internal {@link #getException Exception}
* should be set. This is reset when the Speaker is opened.
*/
public interface Speaker extends Service {
/**
* Return the number of ms delay for this speaker, between a packet
* being written and it being heard
*/
public int getDelay();
/**
* Return the size of the speaker buffer in bytes.
*/
public int getBufferSize();
/**
* Return a nice name for the Speaker for display to the user
*/
public String getDisplayName();
/**
* Return a unique ID for the speaker
*/
int getUniqueId();
/**
* Returns true if this speaker can have its gain adjusted
*/
public boolean hasGain();
/**
* Set the gain of this speaker. A value of NaN means "no audio".
* If this method fails, set the Error.
*/
public void setGain(float gain);
/**
* Set the player for the speaker. This method should
* call {@link Player#removeSpeaker} on the old player
* and {@link Player#addSpeaker} on the new one, and
* anyone moving speakers between players should call
* this method rather than those methods directly.
*/ | public void setPlayer(Player player); |
maximeflamant/waveplay | src/com/nixus/raop/zeroconf/spi/JmDNSZeroConf.java | // Path: src/com/nixus/raop/core/ServiceContext.java
// public interface ServiceContext {
//
// public void debug(String message, Throwable e);
//
// public void debug(String message);
//
// public void info(String message);
//
// public void warn(String message, Throwable e);
//
// public void error(String message, Throwable e);
//
// /**
// * Return the name and version of the Software
// */
// public String getSoftwareName();
//
// /**
// * Return the logical name of the Server
// */
// public String getServerName();
//
// /**
// * Return the build date of the Server
// */
// public Date getServerBuildDate();
//
// /**
// * Return the unique logical name of this Service
// */
// public String getServiceName();
//
// /**
// * Get the Service for this ServiceContext
// */
// public Service getService();
//
// /**
// * Get the first {@link Service} object of the specified type
// */
// public <E extends Service> E getService(Class<E> type);
//
// /**
// * Get the first {@link Service} object of the specified type
// */
//
// public <E extends Service> E getService(Class<E> type, String criteria);
//
// /**
// * Get a list of all {@link Service} objects of the specified type
// */
//
// public <E extends Service> E[] getServices(Class<E> type, String criteria);
//
// /**
// * Add a {@link Listener} to the Server, it will be notified of events
// */
// public void addListener(Listener listener);
//
// /**
// * Remove a {@link Listener} to the Server, it will be notified of events
// */
// public void removeListener(Listener listener);
//
// /**
// * Fire an event - the Listeners registered with the server will be notified.
// * Properties can be specified easily with the second parameter, which is a sequence
// * of [key, value] entries - eg
// * <pre>
// * qtunes.fireEvent("player.add, new Object[] { "track", track, "user", user });
// * </pre>
// * @param o an array of [key, value]
// */
// public void fireEvent(String name, Object[] o);
//
// /**
// * Return a list of properties of this Service
// */
// public String[] getPropertyNames();
//
// /**
// * Get a system-wide property
// */
// public String getGlobalProperty(String key);
//
// /**
// * Get a property of this Service
// */
// public String getProperty(String key);
//
// /**
// * Set a property of this Service
// */
// public void putProperty(String key, String value);
//
// public void start();
//
// public void stop();
//
// /**
// * Add a service
// */
// public ServiceContext addService(Class<?>[] classes, Service service, Map<String,String> properties, boolean permanent);
//
// /**
// * Remove a service
// */
// public void removeService();
//
// /**
// * Return the list of Service names
// */
// public String[] getServiceNames();
//
// /**
// * Return true if the Service has been started
// */
// public boolean isActive();
//
// }
//
// Path: src/com/nixus/raop/zeroconf/ZCService.java
// public interface ZCService {
//
// }
//
// Path: src/com/nixus/raop/zeroconf/ZCServiceInfo.java
// public interface ZCServiceInfo {
//
// public String getType();
// public String getName();
// public String getHost();
// public int getPort();
// public Map<String,String> getProperties();
// public String getProtocol();
//
// }
//
// Path: src/com/nixus/raop/zeroconf/ZeroConf.java
// public interface ZeroConf extends Service {
//
// public abstract ZCService register(String type, String name, int port, Map<String,String> properties);
//
// public abstract void unregister(ZCService service);
//
// /**
// * Search for a maximum of <i>ms</i> ms for services of the
// * specified type. If ms < 0 this method will wait forever
// */
// public abstract ZCServiceInfo[] list(String type, int ms);
//
// }
| import java.io.IOException;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.jmdns.JmDNS;
import javax.jmdns.ServiceInfo;
import com.nixus.raop.core.ServiceContext;
import com.nixus.raop.zeroconf.ZCService;
import com.nixus.raop.zeroconf.ZCServiceInfo;
import com.nixus.raop.zeroconf.ZeroConf; | package com.nixus.raop.zeroconf.spi;
public class JmDNSZeroConf implements ZeroConf {
private ServiceContext context;
private JmDNS jmdns;
@SuppressWarnings("unchecked") | // Path: src/com/nixus/raop/core/ServiceContext.java
// public interface ServiceContext {
//
// public void debug(String message, Throwable e);
//
// public void debug(String message);
//
// public void info(String message);
//
// public void warn(String message, Throwable e);
//
// public void error(String message, Throwable e);
//
// /**
// * Return the name and version of the Software
// */
// public String getSoftwareName();
//
// /**
// * Return the logical name of the Server
// */
// public String getServerName();
//
// /**
// * Return the build date of the Server
// */
// public Date getServerBuildDate();
//
// /**
// * Return the unique logical name of this Service
// */
// public String getServiceName();
//
// /**
// * Get the Service for this ServiceContext
// */
// public Service getService();
//
// /**
// * Get the first {@link Service} object of the specified type
// */
// public <E extends Service> E getService(Class<E> type);
//
// /**
// * Get the first {@link Service} object of the specified type
// */
//
// public <E extends Service> E getService(Class<E> type, String criteria);
//
// /**
// * Get a list of all {@link Service} objects of the specified type
// */
//
// public <E extends Service> E[] getServices(Class<E> type, String criteria);
//
// /**
// * Add a {@link Listener} to the Server, it will be notified of events
// */
// public void addListener(Listener listener);
//
// /**
// * Remove a {@link Listener} to the Server, it will be notified of events
// */
// public void removeListener(Listener listener);
//
// /**
// * Fire an event - the Listeners registered with the server will be notified.
// * Properties can be specified easily with the second parameter, which is a sequence
// * of [key, value] entries - eg
// * <pre>
// * qtunes.fireEvent("player.add, new Object[] { "track", track, "user", user });
// * </pre>
// * @param o an array of [key, value]
// */
// public void fireEvent(String name, Object[] o);
//
// /**
// * Return a list of properties of this Service
// */
// public String[] getPropertyNames();
//
// /**
// * Get a system-wide property
// */
// public String getGlobalProperty(String key);
//
// /**
// * Get a property of this Service
// */
// public String getProperty(String key);
//
// /**
// * Set a property of this Service
// */
// public void putProperty(String key, String value);
//
// public void start();
//
// public void stop();
//
// /**
// * Add a service
// */
// public ServiceContext addService(Class<?>[] classes, Service service, Map<String,String> properties, boolean permanent);
//
// /**
// * Remove a service
// */
// public void removeService();
//
// /**
// * Return the list of Service names
// */
// public String[] getServiceNames();
//
// /**
// * Return true if the Service has been started
// */
// public boolean isActive();
//
// }
//
// Path: src/com/nixus/raop/zeroconf/ZCService.java
// public interface ZCService {
//
// }
//
// Path: src/com/nixus/raop/zeroconf/ZCServiceInfo.java
// public interface ZCServiceInfo {
//
// public String getType();
// public String getName();
// public String getHost();
// public int getPort();
// public Map<String,String> getProperties();
// public String getProtocol();
//
// }
//
// Path: src/com/nixus/raop/zeroconf/ZeroConf.java
// public interface ZeroConf extends Service {
//
// public abstract ZCService register(String type, String name, int port, Map<String,String> properties);
//
// public abstract void unregister(ZCService service);
//
// /**
// * Search for a maximum of <i>ms</i> ms for services of the
// * specified type. If ms < 0 this method will wait forever
// */
// public abstract ZCServiceInfo[] list(String type, int ms);
//
// }
// Path: src/com/nixus/raop/zeroconf/spi/JmDNSZeroConf.java
import java.io.IOException;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.jmdns.JmDNS;
import javax.jmdns.ServiceInfo;
import com.nixus.raop.core.ServiceContext;
import com.nixus.raop.zeroconf.ZCService;
import com.nixus.raop.zeroconf.ZCServiceInfo;
import com.nixus.raop.zeroconf.ZeroConf;
package com.nixus.raop.zeroconf.spi;
public class JmDNSZeroConf implements ZeroConf {
private ServiceContext context;
private JmDNS jmdns;
@SuppressWarnings("unchecked") | public ZCService register(String type, String name, int port, Map<String,String> properties) { |
maximeflamant/waveplay | src/com/nixus/raop/zeroconf/spi/JmDNSZeroConf.java | // Path: src/com/nixus/raop/core/ServiceContext.java
// public interface ServiceContext {
//
// public void debug(String message, Throwable e);
//
// public void debug(String message);
//
// public void info(String message);
//
// public void warn(String message, Throwable e);
//
// public void error(String message, Throwable e);
//
// /**
// * Return the name and version of the Software
// */
// public String getSoftwareName();
//
// /**
// * Return the logical name of the Server
// */
// public String getServerName();
//
// /**
// * Return the build date of the Server
// */
// public Date getServerBuildDate();
//
// /**
// * Return the unique logical name of this Service
// */
// public String getServiceName();
//
// /**
// * Get the Service for this ServiceContext
// */
// public Service getService();
//
// /**
// * Get the first {@link Service} object of the specified type
// */
// public <E extends Service> E getService(Class<E> type);
//
// /**
// * Get the first {@link Service} object of the specified type
// */
//
// public <E extends Service> E getService(Class<E> type, String criteria);
//
// /**
// * Get a list of all {@link Service} objects of the specified type
// */
//
// public <E extends Service> E[] getServices(Class<E> type, String criteria);
//
// /**
// * Add a {@link Listener} to the Server, it will be notified of events
// */
// public void addListener(Listener listener);
//
// /**
// * Remove a {@link Listener} to the Server, it will be notified of events
// */
// public void removeListener(Listener listener);
//
// /**
// * Fire an event - the Listeners registered with the server will be notified.
// * Properties can be specified easily with the second parameter, which is a sequence
// * of [key, value] entries - eg
// * <pre>
// * qtunes.fireEvent("player.add, new Object[] { "track", track, "user", user });
// * </pre>
// * @param o an array of [key, value]
// */
// public void fireEvent(String name, Object[] o);
//
// /**
// * Return a list of properties of this Service
// */
// public String[] getPropertyNames();
//
// /**
// * Get a system-wide property
// */
// public String getGlobalProperty(String key);
//
// /**
// * Get a property of this Service
// */
// public String getProperty(String key);
//
// /**
// * Set a property of this Service
// */
// public void putProperty(String key, String value);
//
// public void start();
//
// public void stop();
//
// /**
// * Add a service
// */
// public ServiceContext addService(Class<?>[] classes, Service service, Map<String,String> properties, boolean permanent);
//
// /**
// * Remove a service
// */
// public void removeService();
//
// /**
// * Return the list of Service names
// */
// public String[] getServiceNames();
//
// /**
// * Return true if the Service has been started
// */
// public boolean isActive();
//
// }
//
// Path: src/com/nixus/raop/zeroconf/ZCService.java
// public interface ZCService {
//
// }
//
// Path: src/com/nixus/raop/zeroconf/ZCServiceInfo.java
// public interface ZCServiceInfo {
//
// public String getType();
// public String getName();
// public String getHost();
// public int getPort();
// public Map<String,String> getProperties();
// public String getProtocol();
//
// }
//
// Path: src/com/nixus/raop/zeroconf/ZeroConf.java
// public interface ZeroConf extends Service {
//
// public abstract ZCService register(String type, String name, int port, Map<String,String> properties);
//
// public abstract void unregister(ZCService service);
//
// /**
// * Search for a maximum of <i>ms</i> ms for services of the
// * specified type. If ms < 0 this method will wait forever
// */
// public abstract ZCServiceInfo[] list(String type, int ms);
//
// }
| import java.io.IOException;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.jmdns.JmDNS;
import javax.jmdns.ServiceInfo;
import com.nixus.raop.core.ServiceContext;
import com.nixus.raop.zeroconf.ZCService;
import com.nixus.raop.zeroconf.ZCServiceInfo;
import com.nixus.raop.zeroconf.ZeroConf; | package com.nixus.raop.zeroconf.spi;
public class JmDNSZeroConf implements ZeroConf {
private ServiceContext context;
private JmDNS jmdns;
@SuppressWarnings("unchecked")
public ZCService register(String type, String name, int port, Map<String,String> properties) {
try {
type += ".local.";
Hashtable t = properties==null ? new Hashtable() : new Hashtable(properties);
ServiceInfo info = ServiceInfo.create(type, name, port, 0, 0, t);
getJmDNS().registerService(info);
return new JmDNSService(info);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public void unregister(ZCService service) {
getJmDNS().unregisterService(((JmDNSService)service).wrapped);
}
| // Path: src/com/nixus/raop/core/ServiceContext.java
// public interface ServiceContext {
//
// public void debug(String message, Throwable e);
//
// public void debug(String message);
//
// public void info(String message);
//
// public void warn(String message, Throwable e);
//
// public void error(String message, Throwable e);
//
// /**
// * Return the name and version of the Software
// */
// public String getSoftwareName();
//
// /**
// * Return the logical name of the Server
// */
// public String getServerName();
//
// /**
// * Return the build date of the Server
// */
// public Date getServerBuildDate();
//
// /**
// * Return the unique logical name of this Service
// */
// public String getServiceName();
//
// /**
// * Get the Service for this ServiceContext
// */
// public Service getService();
//
// /**
// * Get the first {@link Service} object of the specified type
// */
// public <E extends Service> E getService(Class<E> type);
//
// /**
// * Get the first {@link Service} object of the specified type
// */
//
// public <E extends Service> E getService(Class<E> type, String criteria);
//
// /**
// * Get a list of all {@link Service} objects of the specified type
// */
//
// public <E extends Service> E[] getServices(Class<E> type, String criteria);
//
// /**
// * Add a {@link Listener} to the Server, it will be notified of events
// */
// public void addListener(Listener listener);
//
// /**
// * Remove a {@link Listener} to the Server, it will be notified of events
// */
// public void removeListener(Listener listener);
//
// /**
// * Fire an event - the Listeners registered with the server will be notified.
// * Properties can be specified easily with the second parameter, which is a sequence
// * of [key, value] entries - eg
// * <pre>
// * qtunes.fireEvent("player.add, new Object[] { "track", track, "user", user });
// * </pre>
// * @param o an array of [key, value]
// */
// public void fireEvent(String name, Object[] o);
//
// /**
// * Return a list of properties of this Service
// */
// public String[] getPropertyNames();
//
// /**
// * Get a system-wide property
// */
// public String getGlobalProperty(String key);
//
// /**
// * Get a property of this Service
// */
// public String getProperty(String key);
//
// /**
// * Set a property of this Service
// */
// public void putProperty(String key, String value);
//
// public void start();
//
// public void stop();
//
// /**
// * Add a service
// */
// public ServiceContext addService(Class<?>[] classes, Service service, Map<String,String> properties, boolean permanent);
//
// /**
// * Remove a service
// */
// public void removeService();
//
// /**
// * Return the list of Service names
// */
// public String[] getServiceNames();
//
// /**
// * Return true if the Service has been started
// */
// public boolean isActive();
//
// }
//
// Path: src/com/nixus/raop/zeroconf/ZCService.java
// public interface ZCService {
//
// }
//
// Path: src/com/nixus/raop/zeroconf/ZCServiceInfo.java
// public interface ZCServiceInfo {
//
// public String getType();
// public String getName();
// public String getHost();
// public int getPort();
// public Map<String,String> getProperties();
// public String getProtocol();
//
// }
//
// Path: src/com/nixus/raop/zeroconf/ZeroConf.java
// public interface ZeroConf extends Service {
//
// public abstract ZCService register(String type, String name, int port, Map<String,String> properties);
//
// public abstract void unregister(ZCService service);
//
// /**
// * Search for a maximum of <i>ms</i> ms for services of the
// * specified type. If ms < 0 this method will wait forever
// */
// public abstract ZCServiceInfo[] list(String type, int ms);
//
// }
// Path: src/com/nixus/raop/zeroconf/spi/JmDNSZeroConf.java
import java.io.IOException;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.jmdns.JmDNS;
import javax.jmdns.ServiceInfo;
import com.nixus.raop.core.ServiceContext;
import com.nixus.raop.zeroconf.ZCService;
import com.nixus.raop.zeroconf.ZCServiceInfo;
import com.nixus.raop.zeroconf.ZeroConf;
package com.nixus.raop.zeroconf.spi;
public class JmDNSZeroConf implements ZeroConf {
private ServiceContext context;
private JmDNS jmdns;
@SuppressWarnings("unchecked")
public ZCService register(String type, String name, int port, Map<String,String> properties) {
try {
type += ".local.";
Hashtable t = properties==null ? new Hashtable() : new Hashtable(properties);
ServiceInfo info = ServiceInfo.create(type, name, port, 0, 0, t);
getJmDNS().registerService(info);
return new JmDNSService(info);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public void unregister(ZCService service) {
getJmDNS().unregisterService(((JmDNSService)service).wrapped);
}
| public ZCServiceInfo[] list(String type, int ms) { |
felixb/smsdroid | SMSdroid/src/main/java/de/ub0r/android/smsdroid/Message.java | // Path: SMSdroid/src/main/java/org/apache/commons/io/IOUtils.java
// public class IOUtils {
// // NOTE: This class is focussed on InputStream, OutputStream, Reader and
// // Writer. Each method should take at least one of these as a parameter,
// // or return one of them.
//
// /**
// * The Unix directory separator character.
// */
// public static final char DIR_SEPARATOR_UNIX = '/';
// /**
// * The Windows directory separator character.
// */
// public static final char DIR_SEPARATOR_WINDOWS = '\\';
// /**
// * The system directory separator character.
// */
// public static final char DIR_SEPARATOR = File.separatorChar;
// /**
// * The Unix line separator string.
// */
// public static final String LINE_SEPARATOR_UNIX = "\n";
// /**
// * The Windows line separator string.
// */
// public static final String LINE_SEPARATOR_WINDOWS = "\r\n";
// /**
// * The system line separator string.
// */
// public static final String LINE_SEPARATOR;
// static {
// // avoid security issues
// StringWriter buf = new StringWriter(4);
// PrintWriter out = new PrintWriter(buf);
// out.println();
// LINE_SEPARATOR = buf.toString();
// }
//
// /**
// * The default buffer size to use.
// */
// private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
//
// /**
// * Instances should NOT be constructed in standard programming.
// */
// public IOUtils() {
// super();
// }
//
// // copy from InputStream
// // -----------------------------------------------------------------------
// /**
// * Copy bytes from an <code>InputStream</code> to an
// * <code>OutputStream</code>.
// * <p>
// * This method buffers the input internally, so there is no need to use a
// * <code>BufferedInputStream</code>.
// * <p>
// * Large streams (over 2GB) will return a bytes copied value of
// * <code>-1</code> after the copy has completed since the correct number of
// * bytes cannot be returned as an int. For large streams use the
// * <code>copyLarge(InputStream, OutputStream)</code> method.
// *
// * @param input
// * the <code>InputStream</code> to read from
// * @param output
// * the <code>OutputStream</code> to write to
// * @return the number of bytes copied
// * @throws NullPointerException
// * if the input or output is null
// * @throws IOException
// * if an I/O error occurs
// * @throws ArithmeticException
// * if the byte count is too large
// * @since Commons IO 1.1
// */
// public static int copy(final InputStream input, final OutputStream output)
// throws IOException {
// long count = copyLarge(input, output);
// if (count > Integer.MAX_VALUE) {
// return -1;
// }
// return (int) count;
// }
//
// /**
// * Copy bytes from a large (over 2GB) <code>InputStream</code> to an
// * <code>OutputStream</code>.
// * <p>
// * This method buffers the input internally, so there is no need to use a
// * <code>BufferedInputStream</code>.
// *
// * @param input
// * the <code>InputStream</code> to read from
// * @param output
// * the <code>OutputStream</code> to write to
// * @return the number of bytes copied
// * @throws NullPointerException
// * if the input or output is null
// * @throws IOException
// * if an I/O error occurs
// * @since Commons IO 1.3
// */
// public static long copyLarge(final InputStream input,
// final OutputStream output) throws IOException {
// byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
// long count = 0;
// int n;
// while (-1 != (n = input.read(buffer))) {
// output.write(buffer, 0, n);
// count += n;
// }
// return count;
// }
// }
| import org.apache.commons.io.IOUtils;
import android.Manifest;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Environment;
import android.provider.CallLog.Calls;
import android.view.View;
import android.view.View.OnLongClickListener;
import android.widget.Toast;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.LinkedHashMap;
import de.ub0r.android.logg0r.Log; | }
} else if (ct.startsWith("audio/")) {
switch (ct) {
case "audio/3gpp":
fn += "3gpp";
break;
case "audio/mpeg":
fn += "mp3";
break;
case "audio/mid":
fn += "mid";
break;
default:
fn += "wav";
break;
}
} else if (ct.startsWith("video/")) {
if (ct.equals("video/3gpp")) {
fn += "3gpp";
} else {
fn += "avi";
}
} else {
fn += "ukn";
}
final File file = Message.this.createUniqueFile(
Environment.getExternalStorageDirectory(), fn);
//noinspection ConstantConditions
InputStream in = context.getContentResolver().openInputStream(ci.getData());
OutputStream out = new FileOutputStream(file); | // Path: SMSdroid/src/main/java/org/apache/commons/io/IOUtils.java
// public class IOUtils {
// // NOTE: This class is focussed on InputStream, OutputStream, Reader and
// // Writer. Each method should take at least one of these as a parameter,
// // or return one of them.
//
// /**
// * The Unix directory separator character.
// */
// public static final char DIR_SEPARATOR_UNIX = '/';
// /**
// * The Windows directory separator character.
// */
// public static final char DIR_SEPARATOR_WINDOWS = '\\';
// /**
// * The system directory separator character.
// */
// public static final char DIR_SEPARATOR = File.separatorChar;
// /**
// * The Unix line separator string.
// */
// public static final String LINE_SEPARATOR_UNIX = "\n";
// /**
// * The Windows line separator string.
// */
// public static final String LINE_SEPARATOR_WINDOWS = "\r\n";
// /**
// * The system line separator string.
// */
// public static final String LINE_SEPARATOR;
// static {
// // avoid security issues
// StringWriter buf = new StringWriter(4);
// PrintWriter out = new PrintWriter(buf);
// out.println();
// LINE_SEPARATOR = buf.toString();
// }
//
// /**
// * The default buffer size to use.
// */
// private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
//
// /**
// * Instances should NOT be constructed in standard programming.
// */
// public IOUtils() {
// super();
// }
//
// // copy from InputStream
// // -----------------------------------------------------------------------
// /**
// * Copy bytes from an <code>InputStream</code> to an
// * <code>OutputStream</code>.
// * <p>
// * This method buffers the input internally, so there is no need to use a
// * <code>BufferedInputStream</code>.
// * <p>
// * Large streams (over 2GB) will return a bytes copied value of
// * <code>-1</code> after the copy has completed since the correct number of
// * bytes cannot be returned as an int. For large streams use the
// * <code>copyLarge(InputStream, OutputStream)</code> method.
// *
// * @param input
// * the <code>InputStream</code> to read from
// * @param output
// * the <code>OutputStream</code> to write to
// * @return the number of bytes copied
// * @throws NullPointerException
// * if the input or output is null
// * @throws IOException
// * if an I/O error occurs
// * @throws ArithmeticException
// * if the byte count is too large
// * @since Commons IO 1.1
// */
// public static int copy(final InputStream input, final OutputStream output)
// throws IOException {
// long count = copyLarge(input, output);
// if (count > Integer.MAX_VALUE) {
// return -1;
// }
// return (int) count;
// }
//
// /**
// * Copy bytes from a large (over 2GB) <code>InputStream</code> to an
// * <code>OutputStream</code>.
// * <p>
// * This method buffers the input internally, so there is no need to use a
// * <code>BufferedInputStream</code>.
// *
// * @param input
// * the <code>InputStream</code> to read from
// * @param output
// * the <code>OutputStream</code> to write to
// * @return the number of bytes copied
// * @throws NullPointerException
// * if the input or output is null
// * @throws IOException
// * if an I/O error occurs
// * @since Commons IO 1.3
// */
// public static long copyLarge(final InputStream input,
// final OutputStream output) throws IOException {
// byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
// long count = 0;
// int n;
// while (-1 != (n = input.read(buffer))) {
// output.write(buffer, 0, n);
// count += n;
// }
// return count;
// }
// }
// Path: SMSdroid/src/main/java/de/ub0r/android/smsdroid/Message.java
import org.apache.commons.io.IOUtils;
import android.Manifest;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Environment;
import android.provider.CallLog.Calls;
import android.view.View;
import android.view.View.OnLongClickListener;
import android.widget.Toast;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.LinkedHashMap;
import de.ub0r.android.logg0r.Log;
}
} else if (ct.startsWith("audio/")) {
switch (ct) {
case "audio/3gpp":
fn += "3gpp";
break;
case "audio/mpeg":
fn += "mp3";
break;
case "audio/mid":
fn += "mid";
break;
default:
fn += "wav";
break;
}
} else if (ct.startsWith("video/")) {
if (ct.equals("video/3gpp")) {
fn += "3gpp";
} else {
fn += "avi";
}
} else {
fn += "ukn";
}
final File file = Message.this.createUniqueFile(
Environment.getExternalStorageDirectory(), fn);
//noinspection ConstantConditions
InputStream in = context.getContentResolver().openInputStream(ci.getData());
OutputStream out = new FileOutputStream(file); | IOUtils.copy(in, out); |
goribun/naive-rpc | naive-test/src/main/java/com/goribum/naive/services/UserServiceImpl.java | // Path: naive-facade/src/main/java/com/goribun/navie/facade/dto/UserDTO.java
// @Accessors(chain = true)
// @Setter
// @Getter
// public class UserDTO {
// private Integer id;
// private String name;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
// }
//
// Path: naive-facade/src/main/java/com/goribun/navie/facade/intefaces/IUserService.java
// public interface IUserService {
// List<UserDTO> getUsers();
//
// void addUser(UserDTO userDTO);
// }
| import java.util.ArrayList;
import java.util.List;
import com.goribun.navie.facade.dto.UserDTO;
import com.goribun.navie.facade.intefaces.IUserService;
import com.goribun.naive.server.annotations.RpcServer;
import org.springframework.stereotype.Service; | package com.goribum.naive.services;
/**
* @author chenchuan@autohome.com.cn
* @create 2017-04-12-上午12:25
* @description
*/
@Service
@RpcServer | // Path: naive-facade/src/main/java/com/goribun/navie/facade/dto/UserDTO.java
// @Accessors(chain = true)
// @Setter
// @Getter
// public class UserDTO {
// private Integer id;
// private String name;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
// }
//
// Path: naive-facade/src/main/java/com/goribun/navie/facade/intefaces/IUserService.java
// public interface IUserService {
// List<UserDTO> getUsers();
//
// void addUser(UserDTO userDTO);
// }
// Path: naive-test/src/main/java/com/goribum/naive/services/UserServiceImpl.java
import java.util.ArrayList;
import java.util.List;
import com.goribun.navie.facade.dto.UserDTO;
import com.goribun.navie.facade.intefaces.IUserService;
import com.goribun.naive.server.annotations.RpcServer;
import org.springframework.stereotype.Service;
package com.goribum.naive.services;
/**
* @author chenchuan@autohome.com.cn
* @create 2017-04-12-上午12:25
* @description
*/
@Service
@RpcServer | public class UserServiceImpl implements IUserService { |
goribun/naive-rpc | naive-test/src/main/java/com/goribum/naive/services/UserServiceImpl.java | // Path: naive-facade/src/main/java/com/goribun/navie/facade/dto/UserDTO.java
// @Accessors(chain = true)
// @Setter
// @Getter
// public class UserDTO {
// private Integer id;
// private String name;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
// }
//
// Path: naive-facade/src/main/java/com/goribun/navie/facade/intefaces/IUserService.java
// public interface IUserService {
// List<UserDTO> getUsers();
//
// void addUser(UserDTO userDTO);
// }
| import java.util.ArrayList;
import java.util.List;
import com.goribun.navie.facade.dto.UserDTO;
import com.goribun.navie.facade.intefaces.IUserService;
import com.goribun.naive.server.annotations.RpcServer;
import org.springframework.stereotype.Service; | package com.goribum.naive.services;
/**
* @author chenchuan@autohome.com.cn
* @create 2017-04-12-上午12:25
* @description
*/
@Service
@RpcServer
public class UserServiceImpl implements IUserService { | // Path: naive-facade/src/main/java/com/goribun/navie/facade/dto/UserDTO.java
// @Accessors(chain = true)
// @Setter
// @Getter
// public class UserDTO {
// private Integer id;
// private String name;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
// }
//
// Path: naive-facade/src/main/java/com/goribun/navie/facade/intefaces/IUserService.java
// public interface IUserService {
// List<UserDTO> getUsers();
//
// void addUser(UserDTO userDTO);
// }
// Path: naive-test/src/main/java/com/goribum/naive/services/UserServiceImpl.java
import java.util.ArrayList;
import java.util.List;
import com.goribun.navie.facade.dto.UserDTO;
import com.goribun.navie.facade.intefaces.IUserService;
import com.goribun.naive.server.annotations.RpcServer;
import org.springframework.stereotype.Service;
package com.goribum.naive.services;
/**
* @author chenchuan@autohome.com.cn
* @create 2017-04-12-上午12:25
* @description
*/
@Service
@RpcServer
public class UserServiceImpl implements IUserService { | private static List<UserDTO> list = new ArrayList<UserDTO>(); |
goribun/naive-rpc | naive-server/src/main/java/com/goribun/naive/server/utils/RPCServiceScanner.java | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/Const.java
// public class Const {
//
// //扫描rpc服务的包路径配置key
// public static final String SCAN_PACKAGE_KEY_ = "scanPackage";
//
// public static final String IS_TRACE_STACK = "isTraceStack";
//
// //日期格式
// public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss SSS";
//
//
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/utils/PropertyUtil.java
// public class PropertyUtil {
//
// private static final Logger LOGGER = LoggerFactory.getLogger(PropertyUtil.class);
//
// private static Properties props;
//
// static {
// loadProps();
// }
//
// synchronized static private void loadProps() {
//
// props = new Properties();
// InputStream in = null;
// try {
// in = PropertyUtil.class.getClassLoader().getResourceAsStream("naive-rpc.properties");
// props.load(in);
// } catch (FileNotFoundException e) {
// LOGGER.warn("naive-rpc.properties not found");
// } catch (IOException e) {
// LOGGER.error("loadProps error", e);
// } finally {
// try {
// if (null != in) {
// in.close();
// }
// } catch (IOException e) {
// LOGGER.error("naive-rpc.properties close error", e);
// }
// }
// }
//
// public static String getProperty(String key) {
// if (null == props) {
// loadProps();
// }
// return props.getProperty(key);
// }
//
// public static String getProperty(String key, String defaultValue) {
// if (null == props) {
// loadProps();
// }
// return props.getProperty(key, defaultValue);
// }
//
// public static boolean getBooleanProperty(String key, boolean defaultValue) {
// if (null == props) {
// loadProps();
// }
//
// try {
// return Boolean.valueOf(props.getProperty(key));
// } catch (Exception e) {
// return defaultValue;
// }
// }
// }
| import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.goribun.naive.core.annotation.RpcService;
import com.goribun.naive.core.constants.Const;
import com.goribun.naive.core.utils.PropertyUtil;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.classreading.SimpleMetadataReaderFactory;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
import org.springframework.util.SystemPropertyUtils; | package com.goribun.naive.server.utils;
/**
* 类扫描工具
* <p>
* 可以指定包路径和注解
*
* @author wangxuesong
* @version 1.0
*/
public class RPCServiceScanner {
private RPCServiceScanner() {
}
//默认包扫描路径
private static final String DEFAULT_SCAN_PACKAGE = "cn.wangxs.crm.service.*";
public static List<Class<?>> scan() {
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
MetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory();
//优先取得自定义配置 | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/Const.java
// public class Const {
//
// //扫描rpc服务的包路径配置key
// public static final String SCAN_PACKAGE_KEY_ = "scanPackage";
//
// public static final String IS_TRACE_STACK = "isTraceStack";
//
// //日期格式
// public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss SSS";
//
//
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/utils/PropertyUtil.java
// public class PropertyUtil {
//
// private static final Logger LOGGER = LoggerFactory.getLogger(PropertyUtil.class);
//
// private static Properties props;
//
// static {
// loadProps();
// }
//
// synchronized static private void loadProps() {
//
// props = new Properties();
// InputStream in = null;
// try {
// in = PropertyUtil.class.getClassLoader().getResourceAsStream("naive-rpc.properties");
// props.load(in);
// } catch (FileNotFoundException e) {
// LOGGER.warn("naive-rpc.properties not found");
// } catch (IOException e) {
// LOGGER.error("loadProps error", e);
// } finally {
// try {
// if (null != in) {
// in.close();
// }
// } catch (IOException e) {
// LOGGER.error("naive-rpc.properties close error", e);
// }
// }
// }
//
// public static String getProperty(String key) {
// if (null == props) {
// loadProps();
// }
// return props.getProperty(key);
// }
//
// public static String getProperty(String key, String defaultValue) {
// if (null == props) {
// loadProps();
// }
// return props.getProperty(key, defaultValue);
// }
//
// public static boolean getBooleanProperty(String key, boolean defaultValue) {
// if (null == props) {
// loadProps();
// }
//
// try {
// return Boolean.valueOf(props.getProperty(key));
// } catch (Exception e) {
// return defaultValue;
// }
// }
// }
// Path: naive-server/src/main/java/com/goribun/naive/server/utils/RPCServiceScanner.java
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.goribun.naive.core.annotation.RpcService;
import com.goribun.naive.core.constants.Const;
import com.goribun.naive.core.utils.PropertyUtil;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.classreading.SimpleMetadataReaderFactory;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
import org.springframework.util.SystemPropertyUtils;
package com.goribun.naive.server.utils;
/**
* 类扫描工具
* <p>
* 可以指定包路径和注解
*
* @author wangxuesong
* @version 1.0
*/
public class RPCServiceScanner {
private RPCServiceScanner() {
}
//默认包扫描路径
private static final String DEFAULT_SCAN_PACKAGE = "cn.wangxs.crm.service.*";
public static List<Class<?>> scan() {
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
MetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory();
//优先取得自定义配置 | String pkgString = PropertyUtil.getProperty(Const.SCAN_PACKAGE_KEY_, DEFAULT_SCAN_PACKAGE); |
goribun/naive-rpc | naive-server/src/main/java/com/goribun/naive/server/utils/RPCServiceScanner.java | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/Const.java
// public class Const {
//
// //扫描rpc服务的包路径配置key
// public static final String SCAN_PACKAGE_KEY_ = "scanPackage";
//
// public static final String IS_TRACE_STACK = "isTraceStack";
//
// //日期格式
// public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss SSS";
//
//
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/utils/PropertyUtil.java
// public class PropertyUtil {
//
// private static final Logger LOGGER = LoggerFactory.getLogger(PropertyUtil.class);
//
// private static Properties props;
//
// static {
// loadProps();
// }
//
// synchronized static private void loadProps() {
//
// props = new Properties();
// InputStream in = null;
// try {
// in = PropertyUtil.class.getClassLoader().getResourceAsStream("naive-rpc.properties");
// props.load(in);
// } catch (FileNotFoundException e) {
// LOGGER.warn("naive-rpc.properties not found");
// } catch (IOException e) {
// LOGGER.error("loadProps error", e);
// } finally {
// try {
// if (null != in) {
// in.close();
// }
// } catch (IOException e) {
// LOGGER.error("naive-rpc.properties close error", e);
// }
// }
// }
//
// public static String getProperty(String key) {
// if (null == props) {
// loadProps();
// }
// return props.getProperty(key);
// }
//
// public static String getProperty(String key, String defaultValue) {
// if (null == props) {
// loadProps();
// }
// return props.getProperty(key, defaultValue);
// }
//
// public static boolean getBooleanProperty(String key, boolean defaultValue) {
// if (null == props) {
// loadProps();
// }
//
// try {
// return Boolean.valueOf(props.getProperty(key));
// } catch (Exception e) {
// return defaultValue;
// }
// }
// }
| import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.goribun.naive.core.annotation.RpcService;
import com.goribun.naive.core.constants.Const;
import com.goribun.naive.core.utils.PropertyUtil;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.classreading.SimpleMetadataReaderFactory;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
import org.springframework.util.SystemPropertyUtils; | package com.goribun.naive.server.utils;
/**
* 类扫描工具
* <p>
* 可以指定包路径和注解
*
* @author wangxuesong
* @version 1.0
*/
public class RPCServiceScanner {
private RPCServiceScanner() {
}
//默认包扫描路径
private static final String DEFAULT_SCAN_PACKAGE = "cn.wangxs.crm.service.*";
public static List<Class<?>> scan() {
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
MetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory();
//优先取得自定义配置 | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/Const.java
// public class Const {
//
// //扫描rpc服务的包路径配置key
// public static final String SCAN_PACKAGE_KEY_ = "scanPackage";
//
// public static final String IS_TRACE_STACK = "isTraceStack";
//
// //日期格式
// public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss SSS";
//
//
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/utils/PropertyUtil.java
// public class PropertyUtil {
//
// private static final Logger LOGGER = LoggerFactory.getLogger(PropertyUtil.class);
//
// private static Properties props;
//
// static {
// loadProps();
// }
//
// synchronized static private void loadProps() {
//
// props = new Properties();
// InputStream in = null;
// try {
// in = PropertyUtil.class.getClassLoader().getResourceAsStream("naive-rpc.properties");
// props.load(in);
// } catch (FileNotFoundException e) {
// LOGGER.warn("naive-rpc.properties not found");
// } catch (IOException e) {
// LOGGER.error("loadProps error", e);
// } finally {
// try {
// if (null != in) {
// in.close();
// }
// } catch (IOException e) {
// LOGGER.error("naive-rpc.properties close error", e);
// }
// }
// }
//
// public static String getProperty(String key) {
// if (null == props) {
// loadProps();
// }
// return props.getProperty(key);
// }
//
// public static String getProperty(String key, String defaultValue) {
// if (null == props) {
// loadProps();
// }
// return props.getProperty(key, defaultValue);
// }
//
// public static boolean getBooleanProperty(String key, boolean defaultValue) {
// if (null == props) {
// loadProps();
// }
//
// try {
// return Boolean.valueOf(props.getProperty(key));
// } catch (Exception e) {
// return defaultValue;
// }
// }
// }
// Path: naive-server/src/main/java/com/goribun/naive/server/utils/RPCServiceScanner.java
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.goribun.naive.core.annotation.RpcService;
import com.goribun.naive.core.constants.Const;
import com.goribun.naive.core.utils.PropertyUtil;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.classreading.SimpleMetadataReaderFactory;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
import org.springframework.util.SystemPropertyUtils;
package com.goribun.naive.server.utils;
/**
* 类扫描工具
* <p>
* 可以指定包路径和注解
*
* @author wangxuesong
* @version 1.0
*/
public class RPCServiceScanner {
private RPCServiceScanner() {
}
//默认包扫描路径
private static final String DEFAULT_SCAN_PACKAGE = "cn.wangxs.crm.service.*";
public static List<Class<?>> scan() {
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
MetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory();
//优先取得自定义配置 | String pkgString = PropertyUtil.getProperty(Const.SCAN_PACKAGE_KEY_, DEFAULT_SCAN_PACKAGE); |
goribun/naive-rpc | naive-server/src/main/java/com/goribun/naive/server/listener/NaiveAloneListener.java | // Path: naive-server/src/main/java/com/goribun/naive/server/context/ServiceContext.java
// public class ServiceContext {
//
// private ServiceContext() {
// }
//
// private static Map<String, Class<?>> serviceMap = new ConcurrentHashMap<>();
//
// public static Class<?> getServer(String className) {
// return serviceMap.get(className);
// }
//
// public static void putService(String className, Class<?> obj) {
// serviceMap.put(className, obj);
// }
// }
//
// Path: naive-server/src/main/java/com/goribun/naive/server/utils/RPCServiceScanner.java
// public class RPCServiceScanner {
//
// private RPCServiceScanner() {
// }
//
// //默认包扫描路径
// private static final String DEFAULT_SCAN_PACKAGE = "cn.wangxs.crm.service.*";
//
// public static List<Class<?>> scan() {
//
// PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
// MetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory();
//
// //优先取得自定义配置
// String pkgString = PropertyUtil.getProperty(Const.SCAN_PACKAGE_KEY_, DEFAULT_SCAN_PACKAGE);
//
// List<Class<?>> list = new ArrayList<>();
// //多个路径拆分成路径数组
// String[] pkgArray = StringUtils.tokenizeToStringArray(pkgString, ConfigurableApplicationContext
// .CONFIG_LOCATION_DELIMITERS);
//
// for (String pkg : pkgArray) {
// //类名转资源路径
// String resourcePath = ClassUtils.convertClassNameToResourcePath(SystemPropertyUtils
// .resolvePlaceholders(pkg)) + ".class";
//
// try {
// //根据资源路径取得资源数组
// Resource[] resources = resolver.getResources(ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
// + resourcePath);
//
// for (Resource resource : resources) {
// if (resource.isReadable()) {
// MetadataReader reader = readerFactory.getMetadataReader(resource);
// String className = reader.getClassMetadata().getClassName();
// Class<?> clazz = null;
// try {
// clazz = Class.forName(className);
// } catch (ClassNotFoundException e) {
// e.printStackTrace();
// }
// //判断是否带有RpcServer注解
// if (clazz != null && clazz.getAnnotation(RpcService.class) != null) {
// list.add(clazz);
// }
// }
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// return list;
// }
//
// }
| import java.util.List;
import com.goribun.naive.core.annotation.RpcService;
import com.goribun.naive.server.context.ServiceContext;
import com.goribun.naive.server.utils.RPCServiceScanner;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent; | package com.goribun.naive.server.listener;
/**
* 单独的listener,需要在web.xml进行配置
* <p>
* 加载所有@RpcService的接口信息
*
* @author chenchuan
*/
public class NaiveAloneListener implements ApplicationListener<ContextRefreshedEvent> {
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
//扫描所有服务类 | // Path: naive-server/src/main/java/com/goribun/naive/server/context/ServiceContext.java
// public class ServiceContext {
//
// private ServiceContext() {
// }
//
// private static Map<String, Class<?>> serviceMap = new ConcurrentHashMap<>();
//
// public static Class<?> getServer(String className) {
// return serviceMap.get(className);
// }
//
// public static void putService(String className, Class<?> obj) {
// serviceMap.put(className, obj);
// }
// }
//
// Path: naive-server/src/main/java/com/goribun/naive/server/utils/RPCServiceScanner.java
// public class RPCServiceScanner {
//
// private RPCServiceScanner() {
// }
//
// //默认包扫描路径
// private static final String DEFAULT_SCAN_PACKAGE = "cn.wangxs.crm.service.*";
//
// public static List<Class<?>> scan() {
//
// PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
// MetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory();
//
// //优先取得自定义配置
// String pkgString = PropertyUtil.getProperty(Const.SCAN_PACKAGE_KEY_, DEFAULT_SCAN_PACKAGE);
//
// List<Class<?>> list = new ArrayList<>();
// //多个路径拆分成路径数组
// String[] pkgArray = StringUtils.tokenizeToStringArray(pkgString, ConfigurableApplicationContext
// .CONFIG_LOCATION_DELIMITERS);
//
// for (String pkg : pkgArray) {
// //类名转资源路径
// String resourcePath = ClassUtils.convertClassNameToResourcePath(SystemPropertyUtils
// .resolvePlaceholders(pkg)) + ".class";
//
// try {
// //根据资源路径取得资源数组
// Resource[] resources = resolver.getResources(ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
// + resourcePath);
//
// for (Resource resource : resources) {
// if (resource.isReadable()) {
// MetadataReader reader = readerFactory.getMetadataReader(resource);
// String className = reader.getClassMetadata().getClassName();
// Class<?> clazz = null;
// try {
// clazz = Class.forName(className);
// } catch (ClassNotFoundException e) {
// e.printStackTrace();
// }
// //判断是否带有RpcServer注解
// if (clazz != null && clazz.getAnnotation(RpcService.class) != null) {
// list.add(clazz);
// }
// }
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// return list;
// }
//
// }
// Path: naive-server/src/main/java/com/goribun/naive/server/listener/NaiveAloneListener.java
import java.util.List;
import com.goribun.naive.core.annotation.RpcService;
import com.goribun.naive.server.context.ServiceContext;
import com.goribun.naive.server.utils.RPCServiceScanner;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
package com.goribun.naive.server.listener;
/**
* 单独的listener,需要在web.xml进行配置
* <p>
* 加载所有@RpcService的接口信息
*
* @author chenchuan
*/
public class NaiveAloneListener implements ApplicationListener<ContextRefreshedEvent> {
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
//扫描所有服务类 | List<Class<?>> serviceClassList = RPCServiceScanner.scan(); |
goribun/naive-rpc | naive-server/src/main/java/com/goribun/naive/server/listener/NaiveAloneListener.java | // Path: naive-server/src/main/java/com/goribun/naive/server/context/ServiceContext.java
// public class ServiceContext {
//
// private ServiceContext() {
// }
//
// private static Map<String, Class<?>> serviceMap = new ConcurrentHashMap<>();
//
// public static Class<?> getServer(String className) {
// return serviceMap.get(className);
// }
//
// public static void putService(String className, Class<?> obj) {
// serviceMap.put(className, obj);
// }
// }
//
// Path: naive-server/src/main/java/com/goribun/naive/server/utils/RPCServiceScanner.java
// public class RPCServiceScanner {
//
// private RPCServiceScanner() {
// }
//
// //默认包扫描路径
// private static final String DEFAULT_SCAN_PACKAGE = "cn.wangxs.crm.service.*";
//
// public static List<Class<?>> scan() {
//
// PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
// MetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory();
//
// //优先取得自定义配置
// String pkgString = PropertyUtil.getProperty(Const.SCAN_PACKAGE_KEY_, DEFAULT_SCAN_PACKAGE);
//
// List<Class<?>> list = new ArrayList<>();
// //多个路径拆分成路径数组
// String[] pkgArray = StringUtils.tokenizeToStringArray(pkgString, ConfigurableApplicationContext
// .CONFIG_LOCATION_DELIMITERS);
//
// for (String pkg : pkgArray) {
// //类名转资源路径
// String resourcePath = ClassUtils.convertClassNameToResourcePath(SystemPropertyUtils
// .resolvePlaceholders(pkg)) + ".class";
//
// try {
// //根据资源路径取得资源数组
// Resource[] resources = resolver.getResources(ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
// + resourcePath);
//
// for (Resource resource : resources) {
// if (resource.isReadable()) {
// MetadataReader reader = readerFactory.getMetadataReader(resource);
// String className = reader.getClassMetadata().getClassName();
// Class<?> clazz = null;
// try {
// clazz = Class.forName(className);
// } catch (ClassNotFoundException e) {
// e.printStackTrace();
// }
// //判断是否带有RpcServer注解
// if (clazz != null && clazz.getAnnotation(RpcService.class) != null) {
// list.add(clazz);
// }
// }
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// return list;
// }
//
// }
| import java.util.List;
import com.goribun.naive.core.annotation.RpcService;
import com.goribun.naive.server.context.ServiceContext;
import com.goribun.naive.server.utils.RPCServiceScanner;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent; | package com.goribun.naive.server.listener;
/**
* 单独的listener,需要在web.xml进行配置
* <p>
* 加载所有@RpcService的接口信息
*
* @author chenchuan
*/
public class NaiveAloneListener implements ApplicationListener<ContextRefreshedEvent> {
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
//扫描所有服务类
List<Class<?>> serviceClassList = RPCServiceScanner.scan();
//缓存service的class信息
for (Class<?> clazz : serviceClassList) {
String value = clazz.getAnnotation(RpcService.class).value();
String key = StringUtils.isNotBlank(value) ? value : clazz.getName(); | // Path: naive-server/src/main/java/com/goribun/naive/server/context/ServiceContext.java
// public class ServiceContext {
//
// private ServiceContext() {
// }
//
// private static Map<String, Class<?>> serviceMap = new ConcurrentHashMap<>();
//
// public static Class<?> getServer(String className) {
// return serviceMap.get(className);
// }
//
// public static void putService(String className, Class<?> obj) {
// serviceMap.put(className, obj);
// }
// }
//
// Path: naive-server/src/main/java/com/goribun/naive/server/utils/RPCServiceScanner.java
// public class RPCServiceScanner {
//
// private RPCServiceScanner() {
// }
//
// //默认包扫描路径
// private static final String DEFAULT_SCAN_PACKAGE = "cn.wangxs.crm.service.*";
//
// public static List<Class<?>> scan() {
//
// PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
// MetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory();
//
// //优先取得自定义配置
// String pkgString = PropertyUtil.getProperty(Const.SCAN_PACKAGE_KEY_, DEFAULT_SCAN_PACKAGE);
//
// List<Class<?>> list = new ArrayList<>();
// //多个路径拆分成路径数组
// String[] pkgArray = StringUtils.tokenizeToStringArray(pkgString, ConfigurableApplicationContext
// .CONFIG_LOCATION_DELIMITERS);
//
// for (String pkg : pkgArray) {
// //类名转资源路径
// String resourcePath = ClassUtils.convertClassNameToResourcePath(SystemPropertyUtils
// .resolvePlaceholders(pkg)) + ".class";
//
// try {
// //根据资源路径取得资源数组
// Resource[] resources = resolver.getResources(ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
// + resourcePath);
//
// for (Resource resource : resources) {
// if (resource.isReadable()) {
// MetadataReader reader = readerFactory.getMetadataReader(resource);
// String className = reader.getClassMetadata().getClassName();
// Class<?> clazz = null;
// try {
// clazz = Class.forName(className);
// } catch (ClassNotFoundException e) {
// e.printStackTrace();
// }
// //判断是否带有RpcServer注解
// if (clazz != null && clazz.getAnnotation(RpcService.class) != null) {
// list.add(clazz);
// }
// }
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// return list;
// }
//
// }
// Path: naive-server/src/main/java/com/goribun/naive/server/listener/NaiveAloneListener.java
import java.util.List;
import com.goribun.naive.core.annotation.RpcService;
import com.goribun.naive.server.context.ServiceContext;
import com.goribun.naive.server.utils.RPCServiceScanner;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
package com.goribun.naive.server.listener;
/**
* 单独的listener,需要在web.xml进行配置
* <p>
* 加载所有@RpcService的接口信息
*
* @author chenchuan
*/
public class NaiveAloneListener implements ApplicationListener<ContextRefreshedEvent> {
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
//扫描所有服务类
List<Class<?>> serviceClassList = RPCServiceScanner.scan();
//缓存service的class信息
for (Class<?> clazz : serviceClassList) {
String value = clazz.getAnnotation(RpcService.class).value();
String key = StringUtils.isNotBlank(value) ? value : clazz.getName(); | ServiceContext.putService(key, clazz); |
goribun/naive-rpc | naive-core/src/main/java/com/goribun/naive/core/utils/ClassUtil.java | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/Const.java
// public class Const {
//
// //扫描rpc服务的包路径配置key
// public static final String SCAN_PACKAGE_KEY_ = "scanPackage";
//
// public static final String IS_TRACE_STACK = "isTraceStack";
//
// //日期格式
// public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss SSS";
//
//
// }
| import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.goribun.naive.core.constants.Const; | if (object == null) {
return null;
}
if (clazz.equals(byte.class) || clazz.equals(Byte.class)) {
return ((Integer) object).byteValue();
}
if (clazz.equals(short.class) || clazz.equals(Short.class)) {
return ((Integer) object).shortValue();
}
if (clazz.equals(long.class) || clazz.equals(Long.class)) {
return long.class.cast(object);
}
if (clazz.equals(float.class) || clazz.equals(Float.class)) {
return ((BigDecimal) object).floatValue();
}
if (clazz.equals(double.class) || clazz.equals(Double.class)) {
return ((BigDecimal) object).doubleValue();
}
if (clazz.equals(char.class) || clazz.equals(Character.class)) {
return String.class.cast(object).charAt(0);
}
//日期类型
if (clazz.equals(Date.class)) { | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/Const.java
// public class Const {
//
// //扫描rpc服务的包路径配置key
// public static final String SCAN_PACKAGE_KEY_ = "scanPackage";
//
// public static final String IS_TRACE_STACK = "isTraceStack";
//
// //日期格式
// public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss SSS";
//
//
// }
// Path: naive-core/src/main/java/com/goribun/naive/core/utils/ClassUtil.java
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.goribun.naive.core.constants.Const;
if (object == null) {
return null;
}
if (clazz.equals(byte.class) || clazz.equals(Byte.class)) {
return ((Integer) object).byteValue();
}
if (clazz.equals(short.class) || clazz.equals(Short.class)) {
return ((Integer) object).shortValue();
}
if (clazz.equals(long.class) || clazz.equals(Long.class)) {
return long.class.cast(object);
}
if (clazz.equals(float.class) || clazz.equals(Float.class)) {
return ((BigDecimal) object).floatValue();
}
if (clazz.equals(double.class) || clazz.equals(Double.class)) {
return ((BigDecimal) object).doubleValue();
}
if (clazz.equals(char.class) || clazz.equals(Character.class)) {
return String.class.cast(object).charAt(0);
}
//日期类型
if (clazz.equals(Date.class)) { | SimpleDateFormat dateFormat = new SimpleDateFormat(Const.DEFAULT_DATE_FORMAT); |
goribun/naive-rpc | naive-client/src/main/java/com/goribun/naive/client/context/ServiceManager.java | // Path: naive-core/src/main/java/com/goribun/naive/core/utils/PropertyUtil.java
// public class PropertyUtil {
//
// private static final Logger LOGGER = LoggerFactory.getLogger(PropertyUtil.class);
//
// private static Properties props;
//
// static {
// loadProps();
// }
//
// synchronized static private void loadProps() {
//
// props = new Properties();
// InputStream in = null;
// try {
// in = PropertyUtil.class.getClassLoader().getResourceAsStream("naive-rpc.properties");
// props.load(in);
// } catch (FileNotFoundException e) {
// LOGGER.warn("naive-rpc.properties not found");
// } catch (IOException e) {
// LOGGER.error("loadProps error", e);
// } finally {
// try {
// if (null != in) {
// in.close();
// }
// } catch (IOException e) {
// LOGGER.error("naive-rpc.properties close error", e);
// }
// }
// }
//
// public static String getProperty(String key) {
// if (null == props) {
// loadProps();
// }
// return props.getProperty(key);
// }
//
// public static String getProperty(String key, String defaultValue) {
// if (null == props) {
// loadProps();
// }
// return props.getProperty(key, defaultValue);
// }
//
// public static boolean getBooleanProperty(String key, boolean defaultValue) {
// if (null == props) {
// loadProps();
// }
//
// try {
// return Boolean.valueOf(props.getProperty(key));
// } catch (Exception e) {
// return defaultValue;
// }
// }
// }
| import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import com.goribun.naive.core.annotation.RpcService;
import com.goribun.naive.core.utils.PropertyUtil;
import org.apache.commons.lang3.StringUtils; |
while (entrys.hasMoreElements()) {
JarEntry jarEntry = entrys.nextElement();
String entryName = jarEntry.getName();
if (entryName.endsWith(".class")) {
String className = entryName.replace("/", ".").substring(0, entryName.lastIndexOf("."));
Class<?> clazz = Class.forName(className);
if (clazz != null && clazz.getAnnotation(RpcService.class) != null) {
RpcService rpcService = clazz.getAnnotation(RpcService.class);
//服务元数据
ServiceInfo serviceInfo = new ServiceInfo();
serviceInfo.setAppName(strs[0]);
serviceInfo.setUrl(this.getUrlByAppName(strs[0]));
serviceInfo.setClazz(clazz);
//自定义路径
if (StringUtils.isNotBlank(rpcService.value())) {
serviceInfo.setServiceName(rpcService.value());
} else {
serviceInfo.setServiceName(clazz.getName());
}
serviceMap.put(clazz, serviceInfo);
}
}
}
}
//根据项目名取得请求地址
private String getUrlByAppName(String appName) { | // Path: naive-core/src/main/java/com/goribun/naive/core/utils/PropertyUtil.java
// public class PropertyUtil {
//
// private static final Logger LOGGER = LoggerFactory.getLogger(PropertyUtil.class);
//
// private static Properties props;
//
// static {
// loadProps();
// }
//
// synchronized static private void loadProps() {
//
// props = new Properties();
// InputStream in = null;
// try {
// in = PropertyUtil.class.getClassLoader().getResourceAsStream("naive-rpc.properties");
// props.load(in);
// } catch (FileNotFoundException e) {
// LOGGER.warn("naive-rpc.properties not found");
// } catch (IOException e) {
// LOGGER.error("loadProps error", e);
// } finally {
// try {
// if (null != in) {
// in.close();
// }
// } catch (IOException e) {
// LOGGER.error("naive-rpc.properties close error", e);
// }
// }
// }
//
// public static String getProperty(String key) {
// if (null == props) {
// loadProps();
// }
// return props.getProperty(key);
// }
//
// public static String getProperty(String key, String defaultValue) {
// if (null == props) {
// loadProps();
// }
// return props.getProperty(key, defaultValue);
// }
//
// public static boolean getBooleanProperty(String key, boolean defaultValue) {
// if (null == props) {
// loadProps();
// }
//
// try {
// return Boolean.valueOf(props.getProperty(key));
// } catch (Exception e) {
// return defaultValue;
// }
// }
// }
// Path: naive-client/src/main/java/com/goribun/naive/client/context/ServiceManager.java
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import com.goribun.naive.core.annotation.RpcService;
import com.goribun.naive.core.utils.PropertyUtil;
import org.apache.commons.lang3.StringUtils;
while (entrys.hasMoreElements()) {
JarEntry jarEntry = entrys.nextElement();
String entryName = jarEntry.getName();
if (entryName.endsWith(".class")) {
String className = entryName.replace("/", ".").substring(0, entryName.lastIndexOf("."));
Class<?> clazz = Class.forName(className);
if (clazz != null && clazz.getAnnotation(RpcService.class) != null) {
RpcService rpcService = clazz.getAnnotation(RpcService.class);
//服务元数据
ServiceInfo serviceInfo = new ServiceInfo();
serviceInfo.setAppName(strs[0]);
serviceInfo.setUrl(this.getUrlByAppName(strs[0]));
serviceInfo.setClazz(clazz);
//自定义路径
if (StringUtils.isNotBlank(rpcService.value())) {
serviceInfo.setServiceName(rpcService.value());
} else {
serviceInfo.setServiceName(clazz.getName());
}
serviceMap.put(clazz, serviceInfo);
}
}
}
}
//根据项目名取得请求地址
private String getUrlByAppName(String appName) { | return PropertyUtil.getProperty(appName); |
goribun/naive-rpc | naive-core/src/main/java/com/goribun/naive/core/serial/MethodCallUtil.java | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/Const.java
// public class Const {
//
// //扫描rpc服务的包路径配置key
// public static final String SCAN_PACKAGE_KEY_ = "scanPackage";
//
// public static final String IS_TRACE_STACK = "isTraceStack";
//
// //日期格式
// public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss SSS";
//
//
// }
| import com.alibaba.fastjson.JSONObject;
import com.goribun.naive.core.constants.Const; | package com.goribun.naive.core.serial;
/**
* 调用方法序列化与反序列化工具
*
* @author chenchuan
*/
public class MethodCallUtil {
public static MethodCallEntity getMethodCallEntity(String args) {
return JSONObject.parseObject(args, MethodCallEntity.class);
}
public static String getMethodCallStr(MethodCallEntity entity) { | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/Const.java
// public class Const {
//
// //扫描rpc服务的包路径配置key
// public static final String SCAN_PACKAGE_KEY_ = "scanPackage";
//
// public static final String IS_TRACE_STACK = "isTraceStack";
//
// //日期格式
// public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss SSS";
//
//
// }
// Path: naive-core/src/main/java/com/goribun/naive/core/serial/MethodCallUtil.java
import com.alibaba.fastjson.JSONObject;
import com.goribun.naive.core.constants.Const;
package com.goribun.naive.core.serial;
/**
* 调用方法序列化与反序列化工具
*
* @author chenchuan
*/
public class MethodCallUtil {
public static MethodCallEntity getMethodCallEntity(String args) {
return JSONObject.parseObject(args, MethodCallEntity.class);
}
public static String getMethodCallStr(MethodCallEntity entity) { | return JSONObject.toJSONStringWithDateFormat(entity, Const.DEFAULT_DATE_FORMAT); |
goribun/naive-rpc | naive-core/src/main/java/com/goribun/naive/core/exception/SysException.java | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/SysErCode.java
// public enum SysErCode {
// IO_ERROR(0001, "IO异常"),
// OK_HTTP_ERROR(0002, "okhttp请求错误"),
// RPC_ERROR(0003, "RPC调用失败"),
// INIT_SERVER_ERR0R(0004, "初始化服务端失败"),
// PROVIDE_ERR0R(0005, "提供rpc服务失败"),
// ZK_ERR0R(0006, "zookeeper服务失败");
// private int erCode;
// private String msg;
//
// SysErCode(int erCode, String msg) {
// this.erCode = erCode;
// this.msg = msg;
// }
//
// public int getErCode() {
// return erCode;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public SysErCode getSysErCode(int erCode) {
// for (SysErCode sys : SysErCode.values()) {
// if (sys.getErCode() == erCode) {
// return sys;
// }
// }
// return null;
// }
// }
| import com.goribun.naive.core.constants.SysErCode; | package com.goribun.naive.core.exception;
/**
* 系统级异常
*
* @author wangxuesong
*/
public class SysException extends RuntimeException {
private static final long serialVersionUID = 2363088507608422727L;
private int errorCode;
| // Path: naive-core/src/main/java/com/goribun/naive/core/constants/SysErCode.java
// public enum SysErCode {
// IO_ERROR(0001, "IO异常"),
// OK_HTTP_ERROR(0002, "okhttp请求错误"),
// RPC_ERROR(0003, "RPC调用失败"),
// INIT_SERVER_ERR0R(0004, "初始化服务端失败"),
// PROVIDE_ERR0R(0005, "提供rpc服务失败"),
// ZK_ERR0R(0006, "zookeeper服务失败");
// private int erCode;
// private String msg;
//
// SysErCode(int erCode, String msg) {
// this.erCode = erCode;
// this.msg = msg;
// }
//
// public int getErCode() {
// return erCode;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public SysErCode getSysErCode(int erCode) {
// for (SysErCode sys : SysErCode.values()) {
// if (sys.getErCode() == erCode) {
// return sys;
// }
// }
// return null;
// }
// }
// Path: naive-core/src/main/java/com/goribun/naive/core/exception/SysException.java
import com.goribun.naive.core.constants.SysErCode;
package com.goribun.naive.core.exception;
/**
* 系统级异常
*
* @author wangxuesong
*/
public class SysException extends RuntimeException {
private static final long serialVersionUID = 2363088507608422727L;
private int errorCode;
| public SysException(SysErCode sysErCode) { |
goribun/naive-rpc | naive-server/src/main/java/com/goribun/naive/server/plugings/ServerBeanWareListener.java | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/SysErCode.java
// public enum SysErCode {
// IO_ERROR(0001, "IO异常"),
// OK_HTTP_ERROR(0002, "okhttp请求错误"),
// RPC_ERROR(0003, "RPC调用失败"),
// INIT_SERVER_ERR0R(0004, "初始化服务端失败"),
// PROVIDE_ERR0R(0005, "提供rpc服务失败"),
// ZK_ERR0R(0006, "zookeeper服务失败");
// private int erCode;
// private String msg;
//
// SysErCode(int erCode, String msg) {
// this.erCode = erCode;
// this.msg = msg;
// }
//
// public int getErCode() {
// return erCode;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public SysErCode getSysErCode(int erCode) {
// for (SysErCode sys : SysErCode.values()) {
// if (sys.getErCode() == erCode) {
// return sys;
// }
// }
// return null;
// }
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/exception/SysException.java
// public class SysException extends RuntimeException {
//
// private static final long serialVersionUID = 2363088507608422727L;
//
// private int errorCode;
//
// public SysException(SysErCode sysErCode) {
// super(sysErCode.getMsg());
// this.errorCode = sysErCode.getErCode();
// }
//
// public SysException(SysErCode sysErCode, Throwable cause) {
// super(sysErCode.getMsg(), cause);
// this.errorCode = sysErCode.getErCode();
// }
// }
//
// Path: naive-manage/src/main/java/com/goribun/navie/manage/regist/IZkClient.java
// public interface IZkClient {
// void connection();
//
// void destroy();
//
// ZooKeeper getZkConnect();
// }
| import java.util.Map;
import com.google.common.base.Strings;
import com.goribun.naive.core.constants.SysErCode;
import com.goribun.naive.core.exception.SysException;
import com.goribun.naive.server.annotations.RpcServer;
import com.goribun.navie.manage.regist.IZkClient;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent; | package com.goribun.naive.server.plugings;
/**
* @author chenchuan
*/
public class ServerBeanWareListener implements ApplicationListener<ContextRefreshedEvent> {
public void onApplicationEvent(ContextRefreshedEvent event) {
ApplicationContext cxf = event.getApplicationContext();
Map<String, Object> map = cxf.getBeansWithAnnotation(RpcServer.class);
for (Map.Entry<String, Object> entry : map.entrySet()) {
// Object impl = entry.getValue();
//
// RpcServer rpcServer = impl.getClass().getAnnotation(RpcServer.class);
// Class[] interfaces = impl.getClass().getInterfaces();
// String key = Strings.isNullOrEmpty(rpcServer.value()) ? interfaces[0].getName() : rpcServer
// .value();
//
// //RPC的实现类只能实现一个接口,不能多继承接口,否则报错
// if (null == interfaces || interfaces.length > 1 || null != ServiceContext.getServer(key)) {
// throw new SysException(SysErCode.INIT_SERVER_ERR0R);
// }
//
// ServiceContext.putService(key, impl);
//
// String isRegistServer = cxf.getEnvironment().getProperty("regist.switch");
// if (isRegistServer.equalsIgnoreCase("true")) {
// IZkClient zkClient = cxf.getBean(IZkClient.class);
// String projectName = cxf.getEnvironment().getProperty("project.name");
// new RegistServerThread(zkClient, projectName).start();
// }
}
}
| // Path: naive-core/src/main/java/com/goribun/naive/core/constants/SysErCode.java
// public enum SysErCode {
// IO_ERROR(0001, "IO异常"),
// OK_HTTP_ERROR(0002, "okhttp请求错误"),
// RPC_ERROR(0003, "RPC调用失败"),
// INIT_SERVER_ERR0R(0004, "初始化服务端失败"),
// PROVIDE_ERR0R(0005, "提供rpc服务失败"),
// ZK_ERR0R(0006, "zookeeper服务失败");
// private int erCode;
// private String msg;
//
// SysErCode(int erCode, String msg) {
// this.erCode = erCode;
// this.msg = msg;
// }
//
// public int getErCode() {
// return erCode;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public SysErCode getSysErCode(int erCode) {
// for (SysErCode sys : SysErCode.values()) {
// if (sys.getErCode() == erCode) {
// return sys;
// }
// }
// return null;
// }
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/exception/SysException.java
// public class SysException extends RuntimeException {
//
// private static final long serialVersionUID = 2363088507608422727L;
//
// private int errorCode;
//
// public SysException(SysErCode sysErCode) {
// super(sysErCode.getMsg());
// this.errorCode = sysErCode.getErCode();
// }
//
// public SysException(SysErCode sysErCode, Throwable cause) {
// super(sysErCode.getMsg(), cause);
// this.errorCode = sysErCode.getErCode();
// }
// }
//
// Path: naive-manage/src/main/java/com/goribun/navie/manage/regist/IZkClient.java
// public interface IZkClient {
// void connection();
//
// void destroy();
//
// ZooKeeper getZkConnect();
// }
// Path: naive-server/src/main/java/com/goribun/naive/server/plugings/ServerBeanWareListener.java
import java.util.Map;
import com.google.common.base.Strings;
import com.goribun.naive.core.constants.SysErCode;
import com.goribun.naive.core.exception.SysException;
import com.goribun.naive.server.annotations.RpcServer;
import com.goribun.navie.manage.regist.IZkClient;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
package com.goribun.naive.server.plugings;
/**
* @author chenchuan
*/
public class ServerBeanWareListener implements ApplicationListener<ContextRefreshedEvent> {
public void onApplicationEvent(ContextRefreshedEvent event) {
ApplicationContext cxf = event.getApplicationContext();
Map<String, Object> map = cxf.getBeansWithAnnotation(RpcServer.class);
for (Map.Entry<String, Object> entry : map.entrySet()) {
// Object impl = entry.getValue();
//
// RpcServer rpcServer = impl.getClass().getAnnotation(RpcServer.class);
// Class[] interfaces = impl.getClass().getInterfaces();
// String key = Strings.isNullOrEmpty(rpcServer.value()) ? interfaces[0].getName() : rpcServer
// .value();
//
// //RPC的实现类只能实现一个接口,不能多继承接口,否则报错
// if (null == interfaces || interfaces.length > 1 || null != ServiceContext.getServer(key)) {
// throw new SysException(SysErCode.INIT_SERVER_ERR0R);
// }
//
// ServiceContext.putService(key, impl);
//
// String isRegistServer = cxf.getEnvironment().getProperty("regist.switch");
// if (isRegistServer.equalsIgnoreCase("true")) {
// IZkClient zkClient = cxf.getBean(IZkClient.class);
// String projectName = cxf.getEnvironment().getProperty("project.name");
// new RegistServerThread(zkClient, projectName).start();
// }
}
}
| public void regitServer(IZkClient client, String projectName) { |
goribun/naive-rpc | naive-server/src/main/java/com/goribun/naive/server/plugings/ServerBeanWareListener.java | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/SysErCode.java
// public enum SysErCode {
// IO_ERROR(0001, "IO异常"),
// OK_HTTP_ERROR(0002, "okhttp请求错误"),
// RPC_ERROR(0003, "RPC调用失败"),
// INIT_SERVER_ERR0R(0004, "初始化服务端失败"),
// PROVIDE_ERR0R(0005, "提供rpc服务失败"),
// ZK_ERR0R(0006, "zookeeper服务失败");
// private int erCode;
// private String msg;
//
// SysErCode(int erCode, String msg) {
// this.erCode = erCode;
// this.msg = msg;
// }
//
// public int getErCode() {
// return erCode;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public SysErCode getSysErCode(int erCode) {
// for (SysErCode sys : SysErCode.values()) {
// if (sys.getErCode() == erCode) {
// return sys;
// }
// }
// return null;
// }
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/exception/SysException.java
// public class SysException extends RuntimeException {
//
// private static final long serialVersionUID = 2363088507608422727L;
//
// private int errorCode;
//
// public SysException(SysErCode sysErCode) {
// super(sysErCode.getMsg());
// this.errorCode = sysErCode.getErCode();
// }
//
// public SysException(SysErCode sysErCode, Throwable cause) {
// super(sysErCode.getMsg(), cause);
// this.errorCode = sysErCode.getErCode();
// }
// }
//
// Path: naive-manage/src/main/java/com/goribun/navie/manage/regist/IZkClient.java
// public interface IZkClient {
// void connection();
//
// void destroy();
//
// ZooKeeper getZkConnect();
// }
| import java.util.Map;
import com.google.common.base.Strings;
import com.goribun.naive.core.constants.SysErCode;
import com.goribun.naive.core.exception.SysException;
import com.goribun.naive.server.annotations.RpcServer;
import com.goribun.navie.manage.regist.IZkClient;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent; | package com.goribun.naive.server.plugings;
/**
* @author chenchuan
*/
public class ServerBeanWareListener implements ApplicationListener<ContextRefreshedEvent> {
public void onApplicationEvent(ContextRefreshedEvent event) {
ApplicationContext cxf = event.getApplicationContext();
Map<String, Object> map = cxf.getBeansWithAnnotation(RpcServer.class);
for (Map.Entry<String, Object> entry : map.entrySet()) {
// Object impl = entry.getValue();
//
// RpcServer rpcServer = impl.getClass().getAnnotation(RpcServer.class);
// Class[] interfaces = impl.getClass().getInterfaces();
// String key = Strings.isNullOrEmpty(rpcServer.value()) ? interfaces[0].getName() : rpcServer
// .value();
//
// //RPC的实现类只能实现一个接口,不能多继承接口,否则报错
// if (null == interfaces || interfaces.length > 1 || null != ServiceContext.getServer(key)) {
// throw new SysException(SysErCode.INIT_SERVER_ERR0R);
// }
//
// ServiceContext.putService(key, impl);
//
// String isRegistServer = cxf.getEnvironment().getProperty("regist.switch");
// if (isRegistServer.equalsIgnoreCase("true")) {
// IZkClient zkClient = cxf.getBean(IZkClient.class);
// String projectName = cxf.getEnvironment().getProperty("project.name");
// new RegistServerThread(zkClient, projectName).start();
// }
}
}
public void regitServer(IZkClient client, String projectName) {
if (null == client || Strings.isNullOrEmpty(projectName)) { | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/SysErCode.java
// public enum SysErCode {
// IO_ERROR(0001, "IO异常"),
// OK_HTTP_ERROR(0002, "okhttp请求错误"),
// RPC_ERROR(0003, "RPC调用失败"),
// INIT_SERVER_ERR0R(0004, "初始化服务端失败"),
// PROVIDE_ERR0R(0005, "提供rpc服务失败"),
// ZK_ERR0R(0006, "zookeeper服务失败");
// private int erCode;
// private String msg;
//
// SysErCode(int erCode, String msg) {
// this.erCode = erCode;
// this.msg = msg;
// }
//
// public int getErCode() {
// return erCode;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public SysErCode getSysErCode(int erCode) {
// for (SysErCode sys : SysErCode.values()) {
// if (sys.getErCode() == erCode) {
// return sys;
// }
// }
// return null;
// }
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/exception/SysException.java
// public class SysException extends RuntimeException {
//
// private static final long serialVersionUID = 2363088507608422727L;
//
// private int errorCode;
//
// public SysException(SysErCode sysErCode) {
// super(sysErCode.getMsg());
// this.errorCode = sysErCode.getErCode();
// }
//
// public SysException(SysErCode sysErCode, Throwable cause) {
// super(sysErCode.getMsg(), cause);
// this.errorCode = sysErCode.getErCode();
// }
// }
//
// Path: naive-manage/src/main/java/com/goribun/navie/manage/regist/IZkClient.java
// public interface IZkClient {
// void connection();
//
// void destroy();
//
// ZooKeeper getZkConnect();
// }
// Path: naive-server/src/main/java/com/goribun/naive/server/plugings/ServerBeanWareListener.java
import java.util.Map;
import com.google.common.base.Strings;
import com.goribun.naive.core.constants.SysErCode;
import com.goribun.naive.core.exception.SysException;
import com.goribun.naive.server.annotations.RpcServer;
import com.goribun.navie.manage.regist.IZkClient;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
package com.goribun.naive.server.plugings;
/**
* @author chenchuan
*/
public class ServerBeanWareListener implements ApplicationListener<ContextRefreshedEvent> {
public void onApplicationEvent(ContextRefreshedEvent event) {
ApplicationContext cxf = event.getApplicationContext();
Map<String, Object> map = cxf.getBeansWithAnnotation(RpcServer.class);
for (Map.Entry<String, Object> entry : map.entrySet()) {
// Object impl = entry.getValue();
//
// RpcServer rpcServer = impl.getClass().getAnnotation(RpcServer.class);
// Class[] interfaces = impl.getClass().getInterfaces();
// String key = Strings.isNullOrEmpty(rpcServer.value()) ? interfaces[0].getName() : rpcServer
// .value();
//
// //RPC的实现类只能实现一个接口,不能多继承接口,否则报错
// if (null == interfaces || interfaces.length > 1 || null != ServiceContext.getServer(key)) {
// throw new SysException(SysErCode.INIT_SERVER_ERR0R);
// }
//
// ServiceContext.putService(key, impl);
//
// String isRegistServer = cxf.getEnvironment().getProperty("regist.switch");
// if (isRegistServer.equalsIgnoreCase("true")) {
// IZkClient zkClient = cxf.getBean(IZkClient.class);
// String projectName = cxf.getEnvironment().getProperty("project.name");
// new RegistServerThread(zkClient, projectName).start();
// }
}
}
public void regitServer(IZkClient client, String projectName) {
if (null == client || Strings.isNullOrEmpty(projectName)) { | throw new SysException(SysErCode.PROVIDE_ERR0R); |
goribun/naive-rpc | naive-server/src/main/java/com/goribun/naive/server/plugings/ServerBeanWareListener.java | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/SysErCode.java
// public enum SysErCode {
// IO_ERROR(0001, "IO异常"),
// OK_HTTP_ERROR(0002, "okhttp请求错误"),
// RPC_ERROR(0003, "RPC调用失败"),
// INIT_SERVER_ERR0R(0004, "初始化服务端失败"),
// PROVIDE_ERR0R(0005, "提供rpc服务失败"),
// ZK_ERR0R(0006, "zookeeper服务失败");
// private int erCode;
// private String msg;
//
// SysErCode(int erCode, String msg) {
// this.erCode = erCode;
// this.msg = msg;
// }
//
// public int getErCode() {
// return erCode;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public SysErCode getSysErCode(int erCode) {
// for (SysErCode sys : SysErCode.values()) {
// if (sys.getErCode() == erCode) {
// return sys;
// }
// }
// return null;
// }
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/exception/SysException.java
// public class SysException extends RuntimeException {
//
// private static final long serialVersionUID = 2363088507608422727L;
//
// private int errorCode;
//
// public SysException(SysErCode sysErCode) {
// super(sysErCode.getMsg());
// this.errorCode = sysErCode.getErCode();
// }
//
// public SysException(SysErCode sysErCode, Throwable cause) {
// super(sysErCode.getMsg(), cause);
// this.errorCode = sysErCode.getErCode();
// }
// }
//
// Path: naive-manage/src/main/java/com/goribun/navie/manage/regist/IZkClient.java
// public interface IZkClient {
// void connection();
//
// void destroy();
//
// ZooKeeper getZkConnect();
// }
| import java.util.Map;
import com.google.common.base.Strings;
import com.goribun.naive.core.constants.SysErCode;
import com.goribun.naive.core.exception.SysException;
import com.goribun.naive.server.annotations.RpcServer;
import com.goribun.navie.manage.regist.IZkClient;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent; | package com.goribun.naive.server.plugings;
/**
* @author chenchuan
*/
public class ServerBeanWareListener implements ApplicationListener<ContextRefreshedEvent> {
public void onApplicationEvent(ContextRefreshedEvent event) {
ApplicationContext cxf = event.getApplicationContext();
Map<String, Object> map = cxf.getBeansWithAnnotation(RpcServer.class);
for (Map.Entry<String, Object> entry : map.entrySet()) {
// Object impl = entry.getValue();
//
// RpcServer rpcServer = impl.getClass().getAnnotation(RpcServer.class);
// Class[] interfaces = impl.getClass().getInterfaces();
// String key = Strings.isNullOrEmpty(rpcServer.value()) ? interfaces[0].getName() : rpcServer
// .value();
//
// //RPC的实现类只能实现一个接口,不能多继承接口,否则报错
// if (null == interfaces || interfaces.length > 1 || null != ServiceContext.getServer(key)) {
// throw new SysException(SysErCode.INIT_SERVER_ERR0R);
// }
//
// ServiceContext.putService(key, impl);
//
// String isRegistServer = cxf.getEnvironment().getProperty("regist.switch");
// if (isRegistServer.equalsIgnoreCase("true")) {
// IZkClient zkClient = cxf.getBean(IZkClient.class);
// String projectName = cxf.getEnvironment().getProperty("project.name");
// new RegistServerThread(zkClient, projectName).start();
// }
}
}
public void regitServer(IZkClient client, String projectName) {
if (null == client || Strings.isNullOrEmpty(projectName)) { | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/SysErCode.java
// public enum SysErCode {
// IO_ERROR(0001, "IO异常"),
// OK_HTTP_ERROR(0002, "okhttp请求错误"),
// RPC_ERROR(0003, "RPC调用失败"),
// INIT_SERVER_ERR0R(0004, "初始化服务端失败"),
// PROVIDE_ERR0R(0005, "提供rpc服务失败"),
// ZK_ERR0R(0006, "zookeeper服务失败");
// private int erCode;
// private String msg;
//
// SysErCode(int erCode, String msg) {
// this.erCode = erCode;
// this.msg = msg;
// }
//
// public int getErCode() {
// return erCode;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public SysErCode getSysErCode(int erCode) {
// for (SysErCode sys : SysErCode.values()) {
// if (sys.getErCode() == erCode) {
// return sys;
// }
// }
// return null;
// }
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/exception/SysException.java
// public class SysException extends RuntimeException {
//
// private static final long serialVersionUID = 2363088507608422727L;
//
// private int errorCode;
//
// public SysException(SysErCode sysErCode) {
// super(sysErCode.getMsg());
// this.errorCode = sysErCode.getErCode();
// }
//
// public SysException(SysErCode sysErCode, Throwable cause) {
// super(sysErCode.getMsg(), cause);
// this.errorCode = sysErCode.getErCode();
// }
// }
//
// Path: naive-manage/src/main/java/com/goribun/navie/manage/regist/IZkClient.java
// public interface IZkClient {
// void connection();
//
// void destroy();
//
// ZooKeeper getZkConnect();
// }
// Path: naive-server/src/main/java/com/goribun/naive/server/plugings/ServerBeanWareListener.java
import java.util.Map;
import com.google.common.base.Strings;
import com.goribun.naive.core.constants.SysErCode;
import com.goribun.naive.core.exception.SysException;
import com.goribun.naive.server.annotations.RpcServer;
import com.goribun.navie.manage.regist.IZkClient;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
package com.goribun.naive.server.plugings;
/**
* @author chenchuan
*/
public class ServerBeanWareListener implements ApplicationListener<ContextRefreshedEvent> {
public void onApplicationEvent(ContextRefreshedEvent event) {
ApplicationContext cxf = event.getApplicationContext();
Map<String, Object> map = cxf.getBeansWithAnnotation(RpcServer.class);
for (Map.Entry<String, Object> entry : map.entrySet()) {
// Object impl = entry.getValue();
//
// RpcServer rpcServer = impl.getClass().getAnnotation(RpcServer.class);
// Class[] interfaces = impl.getClass().getInterfaces();
// String key = Strings.isNullOrEmpty(rpcServer.value()) ? interfaces[0].getName() : rpcServer
// .value();
//
// //RPC的实现类只能实现一个接口,不能多继承接口,否则报错
// if (null == interfaces || interfaces.length > 1 || null != ServiceContext.getServer(key)) {
// throw new SysException(SysErCode.INIT_SERVER_ERR0R);
// }
//
// ServiceContext.putService(key, impl);
//
// String isRegistServer = cxf.getEnvironment().getProperty("regist.switch");
// if (isRegistServer.equalsIgnoreCase("true")) {
// IZkClient zkClient = cxf.getBean(IZkClient.class);
// String projectName = cxf.getEnvironment().getProperty("project.name");
// new RegistServerThread(zkClient, projectName).start();
// }
}
}
public void regitServer(IZkClient client, String projectName) {
if (null == client || Strings.isNullOrEmpty(projectName)) { | throw new SysException(SysErCode.PROVIDE_ERR0R); |
goribun/naive-rpc | naive-manage/src/main/java/com/goribun/navie/manage/regist/ZkClient.java | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/SysErCode.java
// public enum SysErCode {
// IO_ERROR(0001, "IO异常"),
// OK_HTTP_ERROR(0002, "okhttp请求错误"),
// RPC_ERROR(0003, "RPC调用失败"),
// INIT_SERVER_ERR0R(0004, "初始化服务端失败"),
// PROVIDE_ERR0R(0005, "提供rpc服务失败"),
// ZK_ERR0R(0006, "zookeeper服务失败");
// private int erCode;
// private String msg;
//
// SysErCode(int erCode, String msg) {
// this.erCode = erCode;
// this.msg = msg;
// }
//
// public int getErCode() {
// return erCode;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public SysErCode getSysErCode(int erCode) {
// for (SysErCode sys : SysErCode.values()) {
// if (sys.getErCode() == erCode) {
// return sys;
// }
// }
// return null;
// }
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/exception/SysException.java
// public class SysException extends RuntimeException {
//
// private static final long serialVersionUID = 2363088507608422727L;
//
// private int errorCode;
//
// public SysException(SysErCode sysErCode) {
// super(sysErCode.getMsg());
// this.errorCode = sysErCode.getErCode();
// }
//
// public SysException(SysErCode sysErCode, Throwable cause) {
// super(sysErCode.getMsg(), cause);
// this.errorCode = sysErCode.getErCode();
// }
// }
| import java.util.concurrent.CountDownLatch;
import com.goribun.naive.core.constants.SysErCode;
import com.goribun.naive.core.exception.SysException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper; | package com.goribun.navie.manage.regist;
/**
* @author chenchuan@autohome.com.cn
* @create 2017-04-13-下午8:22
* @description
*/
public class ZkClient implements IZkClient, Watcher {
private static final int TIME_OUT = 3000;
private static final String HOST = "127.0.0.1:4181,127.0.0.1:4182,127.0.0.1:4183";
private CountDownLatch countDownLatch = new CountDownLatch(1);
protected ZooKeeper zooKeeper;
@Override
public void connection() {
try {
zooKeeper = new ZooKeeper(HOST, TIME_OUT, this);
countDownLatch.await();
} catch (Exception e) { | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/SysErCode.java
// public enum SysErCode {
// IO_ERROR(0001, "IO异常"),
// OK_HTTP_ERROR(0002, "okhttp请求错误"),
// RPC_ERROR(0003, "RPC调用失败"),
// INIT_SERVER_ERR0R(0004, "初始化服务端失败"),
// PROVIDE_ERR0R(0005, "提供rpc服务失败"),
// ZK_ERR0R(0006, "zookeeper服务失败");
// private int erCode;
// private String msg;
//
// SysErCode(int erCode, String msg) {
// this.erCode = erCode;
// this.msg = msg;
// }
//
// public int getErCode() {
// return erCode;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public SysErCode getSysErCode(int erCode) {
// for (SysErCode sys : SysErCode.values()) {
// if (sys.getErCode() == erCode) {
// return sys;
// }
// }
// return null;
// }
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/exception/SysException.java
// public class SysException extends RuntimeException {
//
// private static final long serialVersionUID = 2363088507608422727L;
//
// private int errorCode;
//
// public SysException(SysErCode sysErCode) {
// super(sysErCode.getMsg());
// this.errorCode = sysErCode.getErCode();
// }
//
// public SysException(SysErCode sysErCode, Throwable cause) {
// super(sysErCode.getMsg(), cause);
// this.errorCode = sysErCode.getErCode();
// }
// }
// Path: naive-manage/src/main/java/com/goribun/navie/manage/regist/ZkClient.java
import java.util.concurrent.CountDownLatch;
import com.goribun.naive.core.constants.SysErCode;
import com.goribun.naive.core.exception.SysException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
package com.goribun.navie.manage.regist;
/**
* @author chenchuan@autohome.com.cn
* @create 2017-04-13-下午8:22
* @description
*/
public class ZkClient implements IZkClient, Watcher {
private static final int TIME_OUT = 3000;
private static final String HOST = "127.0.0.1:4181,127.0.0.1:4182,127.0.0.1:4183";
private CountDownLatch countDownLatch = new CountDownLatch(1);
protected ZooKeeper zooKeeper;
@Override
public void connection() {
try {
zooKeeper = new ZooKeeper(HOST, TIME_OUT, this);
countDownLatch.await();
} catch (Exception e) { | throw (SysException) new SysException(SysErCode.ZK_ERR0R).initCause(e); |
goribun/naive-rpc | naive-manage/src/main/java/com/goribun/navie/manage/regist/ZkClient.java | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/SysErCode.java
// public enum SysErCode {
// IO_ERROR(0001, "IO异常"),
// OK_HTTP_ERROR(0002, "okhttp请求错误"),
// RPC_ERROR(0003, "RPC调用失败"),
// INIT_SERVER_ERR0R(0004, "初始化服务端失败"),
// PROVIDE_ERR0R(0005, "提供rpc服务失败"),
// ZK_ERR0R(0006, "zookeeper服务失败");
// private int erCode;
// private String msg;
//
// SysErCode(int erCode, String msg) {
// this.erCode = erCode;
// this.msg = msg;
// }
//
// public int getErCode() {
// return erCode;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public SysErCode getSysErCode(int erCode) {
// for (SysErCode sys : SysErCode.values()) {
// if (sys.getErCode() == erCode) {
// return sys;
// }
// }
// return null;
// }
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/exception/SysException.java
// public class SysException extends RuntimeException {
//
// private static final long serialVersionUID = 2363088507608422727L;
//
// private int errorCode;
//
// public SysException(SysErCode sysErCode) {
// super(sysErCode.getMsg());
// this.errorCode = sysErCode.getErCode();
// }
//
// public SysException(SysErCode sysErCode, Throwable cause) {
// super(sysErCode.getMsg(), cause);
// this.errorCode = sysErCode.getErCode();
// }
// }
| import java.util.concurrent.CountDownLatch;
import com.goribun.naive.core.constants.SysErCode;
import com.goribun.naive.core.exception.SysException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper; | package com.goribun.navie.manage.regist;
/**
* @author chenchuan@autohome.com.cn
* @create 2017-04-13-下午8:22
* @description
*/
public class ZkClient implements IZkClient, Watcher {
private static final int TIME_OUT = 3000;
private static final String HOST = "127.0.0.1:4181,127.0.0.1:4182,127.0.0.1:4183";
private CountDownLatch countDownLatch = new CountDownLatch(1);
protected ZooKeeper zooKeeper;
@Override
public void connection() {
try {
zooKeeper = new ZooKeeper(HOST, TIME_OUT, this);
countDownLatch.await();
} catch (Exception e) { | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/SysErCode.java
// public enum SysErCode {
// IO_ERROR(0001, "IO异常"),
// OK_HTTP_ERROR(0002, "okhttp请求错误"),
// RPC_ERROR(0003, "RPC调用失败"),
// INIT_SERVER_ERR0R(0004, "初始化服务端失败"),
// PROVIDE_ERR0R(0005, "提供rpc服务失败"),
// ZK_ERR0R(0006, "zookeeper服务失败");
// private int erCode;
// private String msg;
//
// SysErCode(int erCode, String msg) {
// this.erCode = erCode;
// this.msg = msg;
// }
//
// public int getErCode() {
// return erCode;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public SysErCode getSysErCode(int erCode) {
// for (SysErCode sys : SysErCode.values()) {
// if (sys.getErCode() == erCode) {
// return sys;
// }
// }
// return null;
// }
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/exception/SysException.java
// public class SysException extends RuntimeException {
//
// private static final long serialVersionUID = 2363088507608422727L;
//
// private int errorCode;
//
// public SysException(SysErCode sysErCode) {
// super(sysErCode.getMsg());
// this.errorCode = sysErCode.getErCode();
// }
//
// public SysException(SysErCode sysErCode, Throwable cause) {
// super(sysErCode.getMsg(), cause);
// this.errorCode = sysErCode.getErCode();
// }
// }
// Path: naive-manage/src/main/java/com/goribun/navie/manage/regist/ZkClient.java
import java.util.concurrent.CountDownLatch;
import com.goribun.naive.core.constants.SysErCode;
import com.goribun.naive.core.exception.SysException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
package com.goribun.navie.manage.regist;
/**
* @author chenchuan@autohome.com.cn
* @create 2017-04-13-下午8:22
* @description
*/
public class ZkClient implements IZkClient, Watcher {
private static final int TIME_OUT = 3000;
private static final String HOST = "127.0.0.1:4181,127.0.0.1:4182,127.0.0.1:4183";
private CountDownLatch countDownLatch = new CountDownLatch(1);
protected ZooKeeper zooKeeper;
@Override
public void connection() {
try {
zooKeeper = new ZooKeeper(HOST, TIME_OUT, this);
countDownLatch.await();
} catch (Exception e) { | throw (SysException) new SysException(SysErCode.ZK_ERR0R).initCause(e); |
goribun/naive-rpc | naive-test/src/test/java/com.goribun.navie/ReflectTest.java | // Path: naive-test/src/main/java/com/goribum/naive/services/UserServiceImpl.java
// @Service
// @RpcServer
// public class UserServiceImpl implements IUserService {
// private static List<UserDTO> list = new ArrayList<UserDTO>();
//
// static {
// UserDTO u1 = new UserDTO();
// u1.setId(1);
// u1.setName("陈川");
//
// UserDTO u2 = new UserDTO();
// u2.setId(2);
// u2.setName("陈小川");
//
//
// list.add(u1);
// list.add(u2);
// }
//
// public List<UserDTO> getUsers() {
// return list;
// }
//
// public void addUser(UserDTO userDTO) {
// list.add(userDTO);
// }
// }
//
// Path: naive-facade/src/main/java/com/goribun/navie/facade/dto/UserDTO.java
// @Accessors(chain = true)
// @Setter
// @Getter
// public class UserDTO {
// private Integer id;
// private String name;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
// }
//
// Path: naive-facade/src/main/java/com/goribun/navie/facade/intefaces/IUserService.java
// public interface IUserService {
// List<UserDTO> getUsers();
//
// void addUser(UserDTO userDTO);
// }
| import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import com.goribum.naive.services.UserServiceImpl;
import com.goribun.navie.facade.dto.UserDTO;
import com.goribun.navie.facade.intefaces.IUserService;
import org.junit.Ignore;
import org.junit.Test; | package com.goribun.navie;
/**
* @author chenchuan@autohome.com.cn
* @create 2017-04-12-下午5:20
* @description
*/
public class ReflectTest {
@Ignore
@Test
public void test_reflect() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException { | // Path: naive-test/src/main/java/com/goribum/naive/services/UserServiceImpl.java
// @Service
// @RpcServer
// public class UserServiceImpl implements IUserService {
// private static List<UserDTO> list = new ArrayList<UserDTO>();
//
// static {
// UserDTO u1 = new UserDTO();
// u1.setId(1);
// u1.setName("陈川");
//
// UserDTO u2 = new UserDTO();
// u2.setId(2);
// u2.setName("陈小川");
//
//
// list.add(u1);
// list.add(u2);
// }
//
// public List<UserDTO> getUsers() {
// return list;
// }
//
// public void addUser(UserDTO userDTO) {
// list.add(userDTO);
// }
// }
//
// Path: naive-facade/src/main/java/com/goribun/navie/facade/dto/UserDTO.java
// @Accessors(chain = true)
// @Setter
// @Getter
// public class UserDTO {
// private Integer id;
// private String name;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
// }
//
// Path: naive-facade/src/main/java/com/goribun/navie/facade/intefaces/IUserService.java
// public interface IUserService {
// List<UserDTO> getUsers();
//
// void addUser(UserDTO userDTO);
// }
// Path: naive-test/src/test/java/com.goribun.navie/ReflectTest.java
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import com.goribum.naive.services.UserServiceImpl;
import com.goribun.navie.facade.dto.UserDTO;
import com.goribun.navie.facade.intefaces.IUserService;
import org.junit.Ignore;
import org.junit.Test;
package com.goribun.navie;
/**
* @author chenchuan@autohome.com.cn
* @create 2017-04-12-下午5:20
* @description
*/
public class ReflectTest {
@Ignore
@Test
public void test_reflect() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException { | IUserService service = new UserServiceImpl(); |
goribun/naive-rpc | naive-test/src/test/java/com.goribun.navie/ReflectTest.java | // Path: naive-test/src/main/java/com/goribum/naive/services/UserServiceImpl.java
// @Service
// @RpcServer
// public class UserServiceImpl implements IUserService {
// private static List<UserDTO> list = new ArrayList<UserDTO>();
//
// static {
// UserDTO u1 = new UserDTO();
// u1.setId(1);
// u1.setName("陈川");
//
// UserDTO u2 = new UserDTO();
// u2.setId(2);
// u2.setName("陈小川");
//
//
// list.add(u1);
// list.add(u2);
// }
//
// public List<UserDTO> getUsers() {
// return list;
// }
//
// public void addUser(UserDTO userDTO) {
// list.add(userDTO);
// }
// }
//
// Path: naive-facade/src/main/java/com/goribun/navie/facade/dto/UserDTO.java
// @Accessors(chain = true)
// @Setter
// @Getter
// public class UserDTO {
// private Integer id;
// private String name;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
// }
//
// Path: naive-facade/src/main/java/com/goribun/navie/facade/intefaces/IUserService.java
// public interface IUserService {
// List<UserDTO> getUsers();
//
// void addUser(UserDTO userDTO);
// }
| import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import com.goribum.naive.services.UserServiceImpl;
import com.goribun.navie.facade.dto.UserDTO;
import com.goribun.navie.facade.intefaces.IUserService;
import org.junit.Ignore;
import org.junit.Test; | package com.goribun.navie;
/**
* @author chenchuan@autohome.com.cn
* @create 2017-04-12-下午5:20
* @description
*/
public class ReflectTest {
@Ignore
@Test
public void test_reflect() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException { | // Path: naive-test/src/main/java/com/goribum/naive/services/UserServiceImpl.java
// @Service
// @RpcServer
// public class UserServiceImpl implements IUserService {
// private static List<UserDTO> list = new ArrayList<UserDTO>();
//
// static {
// UserDTO u1 = new UserDTO();
// u1.setId(1);
// u1.setName("陈川");
//
// UserDTO u2 = new UserDTO();
// u2.setId(2);
// u2.setName("陈小川");
//
//
// list.add(u1);
// list.add(u2);
// }
//
// public List<UserDTO> getUsers() {
// return list;
// }
//
// public void addUser(UserDTO userDTO) {
// list.add(userDTO);
// }
// }
//
// Path: naive-facade/src/main/java/com/goribun/navie/facade/dto/UserDTO.java
// @Accessors(chain = true)
// @Setter
// @Getter
// public class UserDTO {
// private Integer id;
// private String name;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
// }
//
// Path: naive-facade/src/main/java/com/goribun/navie/facade/intefaces/IUserService.java
// public interface IUserService {
// List<UserDTO> getUsers();
//
// void addUser(UserDTO userDTO);
// }
// Path: naive-test/src/test/java/com.goribun.navie/ReflectTest.java
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import com.goribum.naive.services.UserServiceImpl;
import com.goribun.navie.facade.dto.UserDTO;
import com.goribun.navie.facade.intefaces.IUserService;
import org.junit.Ignore;
import org.junit.Test;
package com.goribun.navie;
/**
* @author chenchuan@autohome.com.cn
* @create 2017-04-12-下午5:20
* @description
*/
public class ReflectTest {
@Ignore
@Test
public void test_reflect() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException { | IUserService service = new UserServiceImpl(); |
goribun/naive-rpc | naive-test/src/test/java/com.goribun.navie/ReflectTest.java | // Path: naive-test/src/main/java/com/goribum/naive/services/UserServiceImpl.java
// @Service
// @RpcServer
// public class UserServiceImpl implements IUserService {
// private static List<UserDTO> list = new ArrayList<UserDTO>();
//
// static {
// UserDTO u1 = new UserDTO();
// u1.setId(1);
// u1.setName("陈川");
//
// UserDTO u2 = new UserDTO();
// u2.setId(2);
// u2.setName("陈小川");
//
//
// list.add(u1);
// list.add(u2);
// }
//
// public List<UserDTO> getUsers() {
// return list;
// }
//
// public void addUser(UserDTO userDTO) {
// list.add(userDTO);
// }
// }
//
// Path: naive-facade/src/main/java/com/goribun/navie/facade/dto/UserDTO.java
// @Accessors(chain = true)
// @Setter
// @Getter
// public class UserDTO {
// private Integer id;
// private String name;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
// }
//
// Path: naive-facade/src/main/java/com/goribun/navie/facade/intefaces/IUserService.java
// public interface IUserService {
// List<UserDTO> getUsers();
//
// void addUser(UserDTO userDTO);
// }
| import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import com.goribum.naive.services.UserServiceImpl;
import com.goribun.navie.facade.dto.UserDTO;
import com.goribun.navie.facade.intefaces.IUserService;
import org.junit.Ignore;
import org.junit.Test; | package com.goribun.navie;
/**
* @author chenchuan@autohome.com.cn
* @create 2017-04-12-下午5:20
* @description
*/
public class ReflectTest {
@Ignore
@Test
public void test_reflect() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {
IUserService service = new UserServiceImpl();
Class clazz = service.getClass();
Method method = clazz.getDeclaredMethod("getUsers", null);
System.out.println(method.toString());
System.out.print(method.invoke(clazz.newInstance()));
}
@Ignore
@Test
public void test_reflect_void() throws NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException {
IUserService service = new UserServiceImpl();
Class clazz = service.getClass(); | // Path: naive-test/src/main/java/com/goribum/naive/services/UserServiceImpl.java
// @Service
// @RpcServer
// public class UserServiceImpl implements IUserService {
// private static List<UserDTO> list = new ArrayList<UserDTO>();
//
// static {
// UserDTO u1 = new UserDTO();
// u1.setId(1);
// u1.setName("陈川");
//
// UserDTO u2 = new UserDTO();
// u2.setId(2);
// u2.setName("陈小川");
//
//
// list.add(u1);
// list.add(u2);
// }
//
// public List<UserDTO> getUsers() {
// return list;
// }
//
// public void addUser(UserDTO userDTO) {
// list.add(userDTO);
// }
// }
//
// Path: naive-facade/src/main/java/com/goribun/navie/facade/dto/UserDTO.java
// @Accessors(chain = true)
// @Setter
// @Getter
// public class UserDTO {
// private Integer id;
// private String name;
//
// public Integer getId() {
// return id;
// }
//
// public void setId(Integer id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
// }
//
// Path: naive-facade/src/main/java/com/goribun/navie/facade/intefaces/IUserService.java
// public interface IUserService {
// List<UserDTO> getUsers();
//
// void addUser(UserDTO userDTO);
// }
// Path: naive-test/src/test/java/com.goribun.navie/ReflectTest.java
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import com.goribum.naive.services.UserServiceImpl;
import com.goribun.navie.facade.dto.UserDTO;
import com.goribun.navie.facade.intefaces.IUserService;
import org.junit.Ignore;
import org.junit.Test;
package com.goribun.navie;
/**
* @author chenchuan@autohome.com.cn
* @create 2017-04-12-下午5:20
* @description
*/
public class ReflectTest {
@Ignore
@Test
public void test_reflect() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {
IUserService service = new UserServiceImpl();
Class clazz = service.getClass();
Method method = clazz.getDeclaredMethod("getUsers", null);
System.out.println(method.toString());
System.out.print(method.invoke(clazz.newInstance()));
}
@Ignore
@Test
public void test_reflect_void() throws NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException {
IUserService service = new UserServiceImpl();
Class clazz = service.getClass(); | UserDTO userDTO = new UserDTO(); |
goribun/naive-rpc | naive-core/src/main/java/com/goribun/naive/core/utils/ExceptionUtil.java | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/Const.java
// public class Const {
//
// //扫描rpc服务的包路径配置key
// public static final String SCAN_PACKAGE_KEY_ = "scanPackage";
//
// public static final String IS_TRACE_STACK = "isTraceStack";
//
// //日期格式
// public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss SSS";
//
//
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/exception/ExceptionDetail.java
// public class ExceptionDetail {
//
// private String name;
// private String msg;
// private ExceptionDetail cause;
// private String stack;
// private HashMap<String, ExceptionDetail> children;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public void setMsg(String msg) {
// this.msg = msg;
// }
//
// public ExceptionDetail getCause() {
// return cause;
// }
//
// public void setCause(ExceptionDetail cause) {
// this.cause = cause;
// }
//
// public String getStack() {
// return stack;
// }
//
// public void setStack(String stack) {
// this.stack = stack;
// }
//
// public HashMap<String, ExceptionDetail> getChildren() {
// return children;
// }
//
// public void setChildren(HashMap<String, ExceptionDetail> children) {
// this.children = children;
// }
// }
| import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Constructor;
import com.goribun.naive.core.constants.Const;
import com.goribun.naive.core.exception.ExceptionDetail;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; | package com.goribun.naive.core.utils;
/**
* RPC异常处理工具类
*
* @author wangxuesong
*/
public class ExceptionUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionUtil.class);
private ExceptionUtil() {
}
/**
* 构造异常信息(序列化)
*/ | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/Const.java
// public class Const {
//
// //扫描rpc服务的包路径配置key
// public static final String SCAN_PACKAGE_KEY_ = "scanPackage";
//
// public static final String IS_TRACE_STACK = "isTraceStack";
//
// //日期格式
// public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss SSS";
//
//
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/exception/ExceptionDetail.java
// public class ExceptionDetail {
//
// private String name;
// private String msg;
// private ExceptionDetail cause;
// private String stack;
// private HashMap<String, ExceptionDetail> children;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public void setMsg(String msg) {
// this.msg = msg;
// }
//
// public ExceptionDetail getCause() {
// return cause;
// }
//
// public void setCause(ExceptionDetail cause) {
// this.cause = cause;
// }
//
// public String getStack() {
// return stack;
// }
//
// public void setStack(String stack) {
// this.stack = stack;
// }
//
// public HashMap<String, ExceptionDetail> getChildren() {
// return children;
// }
//
// public void setChildren(HashMap<String, ExceptionDetail> children) {
// this.children = children;
// }
// }
// Path: naive-core/src/main/java/com/goribun/naive/core/utils/ExceptionUtil.java
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Constructor;
import com.goribun.naive.core.constants.Const;
import com.goribun.naive.core.exception.ExceptionDetail;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
package com.goribun.naive.core.utils;
/**
* RPC异常处理工具类
*
* @author wangxuesong
*/
public class ExceptionUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionUtil.class);
private ExceptionUtil() {
}
/**
* 构造异常信息(序列化)
*/ | public static ExceptionDetail formatException(Throwable throwable) { |
goribun/naive-rpc | naive-core/src/main/java/com/goribun/naive/core/utils/ExceptionUtil.java | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/Const.java
// public class Const {
//
// //扫描rpc服务的包路径配置key
// public static final String SCAN_PACKAGE_KEY_ = "scanPackage";
//
// public static final String IS_TRACE_STACK = "isTraceStack";
//
// //日期格式
// public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss SSS";
//
//
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/exception/ExceptionDetail.java
// public class ExceptionDetail {
//
// private String name;
// private String msg;
// private ExceptionDetail cause;
// private String stack;
// private HashMap<String, ExceptionDetail> children;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public void setMsg(String msg) {
// this.msg = msg;
// }
//
// public ExceptionDetail getCause() {
// return cause;
// }
//
// public void setCause(ExceptionDetail cause) {
// this.cause = cause;
// }
//
// public String getStack() {
// return stack;
// }
//
// public void setStack(String stack) {
// this.stack = stack;
// }
//
// public HashMap<String, ExceptionDetail> getChildren() {
// return children;
// }
//
// public void setChildren(HashMap<String, ExceptionDetail> children) {
// this.children = children;
// }
// }
| import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Constructor;
import com.goribun.naive.core.constants.Const;
import com.goribun.naive.core.exception.ExceptionDetail;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; | package com.goribun.naive.core.utils;
/**
* RPC异常处理工具类
*
* @author wangxuesong
*/
public class ExceptionUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionUtil.class);
private ExceptionUtil() {
}
/**
* 构造异常信息(序列化)
*/
public static ExceptionDetail formatException(Throwable throwable) {
if (throwable == null) {
return null;
}
ExceptionDetail exceptionDetail = new ExceptionDetail();
exceptionDetail.setName(throwable.getClass().getName());
exceptionDetail.setMsg(throwable.getMessage());
exceptionDetail.setCause(formatException(throwable.getCause())); | // Path: naive-core/src/main/java/com/goribun/naive/core/constants/Const.java
// public class Const {
//
// //扫描rpc服务的包路径配置key
// public static final String SCAN_PACKAGE_KEY_ = "scanPackage";
//
// public static final String IS_TRACE_STACK = "isTraceStack";
//
// //日期格式
// public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss SSS";
//
//
// }
//
// Path: naive-core/src/main/java/com/goribun/naive/core/exception/ExceptionDetail.java
// public class ExceptionDetail {
//
// private String name;
// private String msg;
// private ExceptionDetail cause;
// private String stack;
// private HashMap<String, ExceptionDetail> children;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public void setMsg(String msg) {
// this.msg = msg;
// }
//
// public ExceptionDetail getCause() {
// return cause;
// }
//
// public void setCause(ExceptionDetail cause) {
// this.cause = cause;
// }
//
// public String getStack() {
// return stack;
// }
//
// public void setStack(String stack) {
// this.stack = stack;
// }
//
// public HashMap<String, ExceptionDetail> getChildren() {
// return children;
// }
//
// public void setChildren(HashMap<String, ExceptionDetail> children) {
// this.children = children;
// }
// }
// Path: naive-core/src/main/java/com/goribun/naive/core/utils/ExceptionUtil.java
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Constructor;
import com.goribun.naive.core.constants.Const;
import com.goribun.naive.core.exception.ExceptionDetail;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
package com.goribun.naive.core.utils;
/**
* RPC异常处理工具类
*
* @author wangxuesong
*/
public class ExceptionUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionUtil.class);
private ExceptionUtil() {
}
/**
* 构造异常信息(序列化)
*/
public static ExceptionDetail formatException(Throwable throwable) {
if (throwable == null) {
return null;
}
ExceptionDetail exceptionDetail = new ExceptionDetail();
exceptionDetail.setName(throwable.getClass().getName());
exceptionDetail.setMsg(throwable.getMessage());
exceptionDetail.setCause(formatException(throwable.getCause())); | if (PropertyUtil.getBooleanProperty(Const.IS_TRACE_STACK, false)) { |
goribun/naive-rpc | naive-core/src/main/java/com/goribun/naive/core/protocol/Protocol.java | // Path: naive-core/src/main/java/com/goribun/naive/core/exception/ExceptionDetail.java
// public class ExceptionDetail {
//
// private String name;
// private String msg;
// private ExceptionDetail cause;
// private String stack;
// private HashMap<String, ExceptionDetail> children;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public void setMsg(String msg) {
// this.msg = msg;
// }
//
// public ExceptionDetail getCause() {
// return cause;
// }
//
// public void setCause(ExceptionDetail cause) {
// this.cause = cause;
// }
//
// public String getStack() {
// return stack;
// }
//
// public void setStack(String stack) {
// this.stack = stack;
// }
//
// public HashMap<String, ExceptionDetail> getChildren() {
// return children;
// }
//
// public void setChildren(HashMap<String, ExceptionDetail> children) {
// this.children = children;
// }
// }
| import java.io.Serializable;
import com.goribun.naive.core.exception.ExceptionDetail; | package com.goribun.naive.core.protocol;
/**
* @author wangxuesong
*/
public class Protocol<T> implements Serializable {
private static final long serialVersionUID = -7464366914176464832L;
//编码
private int code;
//消息
private String message;
//异常信息 | // Path: naive-core/src/main/java/com/goribun/naive/core/exception/ExceptionDetail.java
// public class ExceptionDetail {
//
// private String name;
// private String msg;
// private ExceptionDetail cause;
// private String stack;
// private HashMap<String, ExceptionDetail> children;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getMsg() {
// return msg;
// }
//
// public void setMsg(String msg) {
// this.msg = msg;
// }
//
// public ExceptionDetail getCause() {
// return cause;
// }
//
// public void setCause(ExceptionDetail cause) {
// this.cause = cause;
// }
//
// public String getStack() {
// return stack;
// }
//
// public void setStack(String stack) {
// this.stack = stack;
// }
//
// public HashMap<String, ExceptionDetail> getChildren() {
// return children;
// }
//
// public void setChildren(HashMap<String, ExceptionDetail> children) {
// this.children = children;
// }
// }
// Path: naive-core/src/main/java/com/goribun/naive/core/protocol/Protocol.java
import java.io.Serializable;
import com.goribun.naive.core.exception.ExceptionDetail;
package com.goribun.naive.core.protocol;
/**
* @author wangxuesong
*/
public class Protocol<T> implements Serializable {
private static final long serialVersionUID = -7464366914176464832L;
//编码
private int code;
//消息
private String message;
//异常信息 | private ExceptionDetail exceptionDetail; |
rubenlagus/Tsupport | TMessagesProj/src/main/java/org/telegram/ui/TrelloTokenActivity.java | // Path: TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java
// public class BuildVars {
// public static boolean DEBUG_VERSION = true;
// public static int APP_ID = 0; // YOUR API ID
// public static String APP_HASH = "YOUR-API-HASH";
// public static String HOCKEY_APP_HASH = "YOUR-HOCKEY-HASH";
//
// public static String GCM_SENDER_ID = "YOUR-GCM-SENDER-ID";
// public static String SEND_LOGS_EMAIL = "rubenlagus92@gmail.com";
// public static String TRELLO_API_KEY = "YOUR-TRELLO-API-KEY";
// public static String BING_SEARCH_KEY = "YOUR-BING-SEARCH-KEY";
// }
| import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.webkit.ValueCallback;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.FileLog;
import java.text.Normalizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern; |
WebViewClient webViewClient = new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url)
{
FileLog.d("tsupportTrello", "Request result: " + url);
if (url.toString().contains("approve")) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
view.evaluateJavascript("document.getElementsByTagName('pre')[0].innerHTML", new ValueCallback<String>() {
@Override
public void onReceiveValue(String s) {
showHTML(s);
}
});
} else {
webview.loadUrl("javascript:window.HtmlViewer.showHTML" +
"('<html>'+document.getElementsByTagName('pre')[0].innerHTML+'</html>');");
}
} else if (url.compareTo("") == 0){
endActivity("", false);
FileLog.d("tsupportTrello", "Request not approved: " + url);
} else {
FileLog.d("tsupportTrello", "Not found approve con string: " + url.toString().contains("approve"));
FileLog.d("tsupportTrello", "Not found approve: " + url.contains("approve"));
}
}
};
webview.setWebViewClient(webViewClient); | // Path: TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java
// public class BuildVars {
// public static boolean DEBUG_VERSION = true;
// public static int APP_ID = 0; // YOUR API ID
// public static String APP_HASH = "YOUR-API-HASH";
// public static String HOCKEY_APP_HASH = "YOUR-HOCKEY-HASH";
//
// public static String GCM_SENDER_ID = "YOUR-GCM-SENDER-ID";
// public static String SEND_LOGS_EMAIL = "rubenlagus92@gmail.com";
// public static String TRELLO_API_KEY = "YOUR-TRELLO-API-KEY";
// public static String BING_SEARCH_KEY = "YOUR-BING-SEARCH-KEY";
// }
// Path: TMessagesProj/src/main/java/org/telegram/ui/TrelloTokenActivity.java
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.webkit.ValueCallback;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.FileLog;
import java.text.Normalizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
WebViewClient webViewClient = new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url)
{
FileLog.d("tsupportTrello", "Request result: " + url);
if (url.toString().contains("approve")) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
view.evaluateJavascript("document.getElementsByTagName('pre')[0].innerHTML", new ValueCallback<String>() {
@Override
public void onReceiveValue(String s) {
showHTML(s);
}
});
} else {
webview.loadUrl("javascript:window.HtmlViewer.showHTML" +
"('<html>'+document.getElementsByTagName('pre')[0].innerHTML+'</html>');");
}
} else if (url.compareTo("") == 0){
endActivity("", false);
FileLog.d("tsupportTrello", "Request not approved: " + url);
} else {
FileLog.d("tsupportTrello", "Not found approve con string: " + url.toString().contains("approve"));
FileLog.d("tsupportTrello", "Not found approve: " + url.contains("approve"));
}
}
};
webview.setWebViewClient(webViewClient); | FileLog.d("tsupportTrello", "Request: " + trelloAuthURL.replace("@myapikey@", BuildVars.TRELLO_API_KEY)); |
startupheroes/startupheroes-checkstyle | startupheroes-checkstyle-sonar-plugin/src/test/java/es/startuphero/checkstyle/sonar/SonarRulesDefinitionTest.java | // Path: startupheroes-checkstyle-sonar-plugin/src/test/java/es/startuphero/checkstyle/sonar/BaseRuleTestSupport.java
// public static RulesDefinition.Repository getRepositoryOfRules() {
// SonarRulesDefinition rulesDefinition = new SonarRulesDefinition(new RulesDefinitionXmlLoader());
// RulesDefinition.Context context = new RulesDefinition.Context();
// rulesDefinition.define(context);
// return context.repository(SonarRulesDefinition.REPOSITORY_KEY);
// }
| import org.junit.Test;
import org.sonar.api.rule.Severity;
import org.sonar.api.rules.RuleType;
import org.sonar.api.server.rule.RuleParamType;
import org.sonar.api.server.rule.RulesDefinition.Param;
import org.sonar.api.server.rule.RulesDefinition.Repository;
import org.sonar.api.server.rule.RulesDefinition.Rule;
import static es.startuphero.checkstyle.sonar.BaseRuleTestSupport.getRepositoryOfRules;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; | package es.startuphero.checkstyle.sonar;
/**
* @author ozlem.ulag
*/
public class SonarRulesDefinitionTest {
@Test
public void test() { | // Path: startupheroes-checkstyle-sonar-plugin/src/test/java/es/startuphero/checkstyle/sonar/BaseRuleTestSupport.java
// public static RulesDefinition.Repository getRepositoryOfRules() {
// SonarRulesDefinition rulesDefinition = new SonarRulesDefinition(new RulesDefinitionXmlLoader());
// RulesDefinition.Context context = new RulesDefinition.Context();
// rulesDefinition.define(context);
// return context.repository(SonarRulesDefinition.REPOSITORY_KEY);
// }
// Path: startupheroes-checkstyle-sonar-plugin/src/test/java/es/startuphero/checkstyle/sonar/SonarRulesDefinitionTest.java
import org.junit.Test;
import org.sonar.api.rule.Severity;
import org.sonar.api.rules.RuleType;
import org.sonar.api.server.rule.RuleParamType;
import org.sonar.api.server.rule.RulesDefinition.Param;
import org.sonar.api.server.rule.RulesDefinition.Repository;
import org.sonar.api.server.rule.RulesDefinition.Rule;
import static es.startuphero.checkstyle.sonar.BaseRuleTestSupport.getRepositoryOfRules;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
package es.startuphero.checkstyle.sonar;
/**
* @author ozlem.ulag
*/
public class SonarRulesDefinitionTest {
@Test
public void test() { | Repository repository = getRepositoryOfRules(); |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/MissingOverrideCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static final String OVERRIDE_ANNOTATION_NAME_BY_PACKAGE = "java.lang.Override";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Boolean hasAnnotation(DetailAST ast, String fullAnnotation) {
// return CommonUtils.getSimpleAndFullNames(fullAnnotation).stream()
// .anyMatch(annotation -> AnnotationUtil.containsAnnotation(ast, annotation));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Optional<DetailAST> getClassOf(DetailAST anyAstBelowClass) {
// Optional<DetailAST> classAst = Optional.empty();
// for (DetailAST parent = anyAstBelowClass; parent != null; parent = parent.getParent()) {
// if (parent.getType() == TokenTypes.CLASS_DEF) {
// classAst = Optional.of(parent);
// break;
// }
// }
// return classAst;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Map<String, String> getImportSimpleFullNameMap(DetailAST rootAst) {
// Map<String, String> simpleFullNameMapOfImports = new LinkedHashMap<>();
// for (DetailAST sibling = rootAst; sibling != null; sibling = sibling.getNextSibling()) {
// if (sibling.getType() == TokenTypes.IMPORT) {
// simpleFullNameMapOfImports.put(CommonUtils.getSimpleName(sibling),
// CommonUtils.getFullName(sibling));
// }
// }
// return simpleFullNameMapOfImports;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getPackageName(DetailAST ast) {
// String packageName = null;
// for (DetailAST parent = ast; parent != null; parent = parent.getParent()) {
// if (parent.getType() == TokenTypes.PACKAGE_DEF) {
// packageName = getFullName(parent);
// break;
// }
// }
// return packageName;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/MethodUtils.java
// public static String getMethodName(DetailAST methodAst) {
// DetailAST type = methodAst.findFirstToken(TokenTypes.TYPE);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/MethodUtils.java
// public static Class<?>[] getParameterTypes(DetailAST methodAst,
// Map<String, String> importSimpleFullNameMap) {
// DetailAST parameters = methodAst.findFirstToken(TokenTypes.PARAMETERS);
// List<DetailAST> parameterNodes =
// CommonUtils.getChildsByType(parameters, TokenTypes.PARAMETER_DEF);
// List<Class<?>> parameterTypes = new ArrayList<>();
// for (DetailAST parameterNode : parameterNodes) {
// String paramTypeSimpleName = getParamTypeSimpleName(parameterNode);
// String paramTypeFullName =
// CommonUtils.getFullName(methodAst, importSimpleFullNameMap, paramTypeSimpleName);
// try {
// Class<?> parameterClass = Class.forName(paramTypeFullName);
// parameterTypes.add(parameterClass);
// } catch (ClassNotFoundException ignored) {
// }
// }
// return parameterTypes.stream().toArray(Class<?>[]::new);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/MethodUtils.java
// public static Boolean isMethodOverriden(Method method) {
// Class<?> declaringClass = method.getDeclaringClass();
// if (declaringClass.equals(Object.class)) {
// return false;
// }
// try {
// declaringClass.getSuperclass()
// .getDeclaredMethod(method.getName(), method.getParameterTypes());
// return true;
// } catch (NoSuchMethodException ex) {
// for (Class<?> implementedInterface : declaringClass.getInterfaces()) {
// try {
// implementedInterface.getDeclaredMethod(method.getName(), method.getParameterTypes());
// return true;
// } catch (NoSuchMethodException ignored) {
// }
// }
// return false;
// }
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.Optional;
import static es.startuphero.checkstyle.util.AnnotationUtils.OVERRIDE_ANNOTATION_NAME_BY_PACKAGE;
import static es.startuphero.checkstyle.util.AnnotationUtils.hasAnnotation;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.getClassOf;
import static es.startuphero.checkstyle.util.ClassUtils.getImportSimpleFullNameMap;
import static es.startuphero.checkstyle.util.CommonUtils.getPackageName;
import static es.startuphero.checkstyle.util.MethodUtils.getMethodName;
import static es.startuphero.checkstyle.util.MethodUtils.getParameterTypes;
import static es.startuphero.checkstyle.util.MethodUtils.isMethodOverriden; | package es.startuphero.checkstyle.checks.annotation;
/**
* @author ozlem.ulag
*/
public class MissingOverrideCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.override";
private String packageName;
private Map<String, String> importSimpleFullNameMap;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.METHOD_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void beginTree(DetailAST rootAst) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static final String OVERRIDE_ANNOTATION_NAME_BY_PACKAGE = "java.lang.Override";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Boolean hasAnnotation(DetailAST ast, String fullAnnotation) {
// return CommonUtils.getSimpleAndFullNames(fullAnnotation).stream()
// .anyMatch(annotation -> AnnotationUtil.containsAnnotation(ast, annotation));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Optional<DetailAST> getClassOf(DetailAST anyAstBelowClass) {
// Optional<DetailAST> classAst = Optional.empty();
// for (DetailAST parent = anyAstBelowClass; parent != null; parent = parent.getParent()) {
// if (parent.getType() == TokenTypes.CLASS_DEF) {
// classAst = Optional.of(parent);
// break;
// }
// }
// return classAst;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Map<String, String> getImportSimpleFullNameMap(DetailAST rootAst) {
// Map<String, String> simpleFullNameMapOfImports = new LinkedHashMap<>();
// for (DetailAST sibling = rootAst; sibling != null; sibling = sibling.getNextSibling()) {
// if (sibling.getType() == TokenTypes.IMPORT) {
// simpleFullNameMapOfImports.put(CommonUtils.getSimpleName(sibling),
// CommonUtils.getFullName(sibling));
// }
// }
// return simpleFullNameMapOfImports;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getPackageName(DetailAST ast) {
// String packageName = null;
// for (DetailAST parent = ast; parent != null; parent = parent.getParent()) {
// if (parent.getType() == TokenTypes.PACKAGE_DEF) {
// packageName = getFullName(parent);
// break;
// }
// }
// return packageName;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/MethodUtils.java
// public static String getMethodName(DetailAST methodAst) {
// DetailAST type = methodAst.findFirstToken(TokenTypes.TYPE);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/MethodUtils.java
// public static Class<?>[] getParameterTypes(DetailAST methodAst,
// Map<String, String> importSimpleFullNameMap) {
// DetailAST parameters = methodAst.findFirstToken(TokenTypes.PARAMETERS);
// List<DetailAST> parameterNodes =
// CommonUtils.getChildsByType(parameters, TokenTypes.PARAMETER_DEF);
// List<Class<?>> parameterTypes = new ArrayList<>();
// for (DetailAST parameterNode : parameterNodes) {
// String paramTypeSimpleName = getParamTypeSimpleName(parameterNode);
// String paramTypeFullName =
// CommonUtils.getFullName(methodAst, importSimpleFullNameMap, paramTypeSimpleName);
// try {
// Class<?> parameterClass = Class.forName(paramTypeFullName);
// parameterTypes.add(parameterClass);
// } catch (ClassNotFoundException ignored) {
// }
// }
// return parameterTypes.stream().toArray(Class<?>[]::new);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/MethodUtils.java
// public static Boolean isMethodOverriden(Method method) {
// Class<?> declaringClass = method.getDeclaringClass();
// if (declaringClass.equals(Object.class)) {
// return false;
// }
// try {
// declaringClass.getSuperclass()
// .getDeclaredMethod(method.getName(), method.getParameterTypes());
// return true;
// } catch (NoSuchMethodException ex) {
// for (Class<?> implementedInterface : declaringClass.getInterfaces()) {
// try {
// implementedInterface.getDeclaredMethod(method.getName(), method.getParameterTypes());
// return true;
// } catch (NoSuchMethodException ignored) {
// }
// }
// return false;
// }
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/MissingOverrideCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.Optional;
import static es.startuphero.checkstyle.util.AnnotationUtils.OVERRIDE_ANNOTATION_NAME_BY_PACKAGE;
import static es.startuphero.checkstyle.util.AnnotationUtils.hasAnnotation;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.getClassOf;
import static es.startuphero.checkstyle.util.ClassUtils.getImportSimpleFullNameMap;
import static es.startuphero.checkstyle.util.CommonUtils.getPackageName;
import static es.startuphero.checkstyle.util.MethodUtils.getMethodName;
import static es.startuphero.checkstyle.util.MethodUtils.getParameterTypes;
import static es.startuphero.checkstyle.util.MethodUtils.isMethodOverriden;
package es.startuphero.checkstyle.checks.annotation;
/**
* @author ozlem.ulag
*/
public class MissingOverrideCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.override";
private String packageName;
private Map<String, String> importSimpleFullNameMap;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.METHOD_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void beginTree(DetailAST rootAst) { | packageName = getPackageName(rootAst); |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/MissingOverrideCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static final String OVERRIDE_ANNOTATION_NAME_BY_PACKAGE = "java.lang.Override";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Boolean hasAnnotation(DetailAST ast, String fullAnnotation) {
// return CommonUtils.getSimpleAndFullNames(fullAnnotation).stream()
// .anyMatch(annotation -> AnnotationUtil.containsAnnotation(ast, annotation));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Optional<DetailAST> getClassOf(DetailAST anyAstBelowClass) {
// Optional<DetailAST> classAst = Optional.empty();
// for (DetailAST parent = anyAstBelowClass; parent != null; parent = parent.getParent()) {
// if (parent.getType() == TokenTypes.CLASS_DEF) {
// classAst = Optional.of(parent);
// break;
// }
// }
// return classAst;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Map<String, String> getImportSimpleFullNameMap(DetailAST rootAst) {
// Map<String, String> simpleFullNameMapOfImports = new LinkedHashMap<>();
// for (DetailAST sibling = rootAst; sibling != null; sibling = sibling.getNextSibling()) {
// if (sibling.getType() == TokenTypes.IMPORT) {
// simpleFullNameMapOfImports.put(CommonUtils.getSimpleName(sibling),
// CommonUtils.getFullName(sibling));
// }
// }
// return simpleFullNameMapOfImports;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getPackageName(DetailAST ast) {
// String packageName = null;
// for (DetailAST parent = ast; parent != null; parent = parent.getParent()) {
// if (parent.getType() == TokenTypes.PACKAGE_DEF) {
// packageName = getFullName(parent);
// break;
// }
// }
// return packageName;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/MethodUtils.java
// public static String getMethodName(DetailAST methodAst) {
// DetailAST type = methodAst.findFirstToken(TokenTypes.TYPE);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/MethodUtils.java
// public static Class<?>[] getParameterTypes(DetailAST methodAst,
// Map<String, String> importSimpleFullNameMap) {
// DetailAST parameters = methodAst.findFirstToken(TokenTypes.PARAMETERS);
// List<DetailAST> parameterNodes =
// CommonUtils.getChildsByType(parameters, TokenTypes.PARAMETER_DEF);
// List<Class<?>> parameterTypes = new ArrayList<>();
// for (DetailAST parameterNode : parameterNodes) {
// String paramTypeSimpleName = getParamTypeSimpleName(parameterNode);
// String paramTypeFullName =
// CommonUtils.getFullName(methodAst, importSimpleFullNameMap, paramTypeSimpleName);
// try {
// Class<?> parameterClass = Class.forName(paramTypeFullName);
// parameterTypes.add(parameterClass);
// } catch (ClassNotFoundException ignored) {
// }
// }
// return parameterTypes.stream().toArray(Class<?>[]::new);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/MethodUtils.java
// public static Boolean isMethodOverriden(Method method) {
// Class<?> declaringClass = method.getDeclaringClass();
// if (declaringClass.equals(Object.class)) {
// return false;
// }
// try {
// declaringClass.getSuperclass()
// .getDeclaredMethod(method.getName(), method.getParameterTypes());
// return true;
// } catch (NoSuchMethodException ex) {
// for (Class<?> implementedInterface : declaringClass.getInterfaces()) {
// try {
// implementedInterface.getDeclaredMethod(method.getName(), method.getParameterTypes());
// return true;
// } catch (NoSuchMethodException ignored) {
// }
// }
// return false;
// }
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.Optional;
import static es.startuphero.checkstyle.util.AnnotationUtils.OVERRIDE_ANNOTATION_NAME_BY_PACKAGE;
import static es.startuphero.checkstyle.util.AnnotationUtils.hasAnnotation;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.getClassOf;
import static es.startuphero.checkstyle.util.ClassUtils.getImportSimpleFullNameMap;
import static es.startuphero.checkstyle.util.CommonUtils.getPackageName;
import static es.startuphero.checkstyle.util.MethodUtils.getMethodName;
import static es.startuphero.checkstyle.util.MethodUtils.getParameterTypes;
import static es.startuphero.checkstyle.util.MethodUtils.isMethodOverriden; | package es.startuphero.checkstyle.checks.annotation;
/**
* @author ozlem.ulag
*/
public class MissingOverrideCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.override";
private String packageName;
private Map<String, String> importSimpleFullNameMap;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.METHOD_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void beginTree(DetailAST rootAst) {
packageName = getPackageName(rootAst); | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static final String OVERRIDE_ANNOTATION_NAME_BY_PACKAGE = "java.lang.Override";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Boolean hasAnnotation(DetailAST ast, String fullAnnotation) {
// return CommonUtils.getSimpleAndFullNames(fullAnnotation).stream()
// .anyMatch(annotation -> AnnotationUtil.containsAnnotation(ast, annotation));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Optional<DetailAST> getClassOf(DetailAST anyAstBelowClass) {
// Optional<DetailAST> classAst = Optional.empty();
// for (DetailAST parent = anyAstBelowClass; parent != null; parent = parent.getParent()) {
// if (parent.getType() == TokenTypes.CLASS_DEF) {
// classAst = Optional.of(parent);
// break;
// }
// }
// return classAst;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Map<String, String> getImportSimpleFullNameMap(DetailAST rootAst) {
// Map<String, String> simpleFullNameMapOfImports = new LinkedHashMap<>();
// for (DetailAST sibling = rootAst; sibling != null; sibling = sibling.getNextSibling()) {
// if (sibling.getType() == TokenTypes.IMPORT) {
// simpleFullNameMapOfImports.put(CommonUtils.getSimpleName(sibling),
// CommonUtils.getFullName(sibling));
// }
// }
// return simpleFullNameMapOfImports;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getPackageName(DetailAST ast) {
// String packageName = null;
// for (DetailAST parent = ast; parent != null; parent = parent.getParent()) {
// if (parent.getType() == TokenTypes.PACKAGE_DEF) {
// packageName = getFullName(parent);
// break;
// }
// }
// return packageName;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/MethodUtils.java
// public static String getMethodName(DetailAST methodAst) {
// DetailAST type = methodAst.findFirstToken(TokenTypes.TYPE);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/MethodUtils.java
// public static Class<?>[] getParameterTypes(DetailAST methodAst,
// Map<String, String> importSimpleFullNameMap) {
// DetailAST parameters = methodAst.findFirstToken(TokenTypes.PARAMETERS);
// List<DetailAST> parameterNodes =
// CommonUtils.getChildsByType(parameters, TokenTypes.PARAMETER_DEF);
// List<Class<?>> parameterTypes = new ArrayList<>();
// for (DetailAST parameterNode : parameterNodes) {
// String paramTypeSimpleName = getParamTypeSimpleName(parameterNode);
// String paramTypeFullName =
// CommonUtils.getFullName(methodAst, importSimpleFullNameMap, paramTypeSimpleName);
// try {
// Class<?> parameterClass = Class.forName(paramTypeFullName);
// parameterTypes.add(parameterClass);
// } catch (ClassNotFoundException ignored) {
// }
// }
// return parameterTypes.stream().toArray(Class<?>[]::new);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/MethodUtils.java
// public static Boolean isMethodOverriden(Method method) {
// Class<?> declaringClass = method.getDeclaringClass();
// if (declaringClass.equals(Object.class)) {
// return false;
// }
// try {
// declaringClass.getSuperclass()
// .getDeclaredMethod(method.getName(), method.getParameterTypes());
// return true;
// } catch (NoSuchMethodException ex) {
// for (Class<?> implementedInterface : declaringClass.getInterfaces()) {
// try {
// implementedInterface.getDeclaredMethod(method.getName(), method.getParameterTypes());
// return true;
// } catch (NoSuchMethodException ignored) {
// }
// }
// return false;
// }
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/MissingOverrideCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.Optional;
import static es.startuphero.checkstyle.util.AnnotationUtils.OVERRIDE_ANNOTATION_NAME_BY_PACKAGE;
import static es.startuphero.checkstyle.util.AnnotationUtils.hasAnnotation;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.getClassOf;
import static es.startuphero.checkstyle.util.ClassUtils.getImportSimpleFullNameMap;
import static es.startuphero.checkstyle.util.CommonUtils.getPackageName;
import static es.startuphero.checkstyle.util.MethodUtils.getMethodName;
import static es.startuphero.checkstyle.util.MethodUtils.getParameterTypes;
import static es.startuphero.checkstyle.util.MethodUtils.isMethodOverriden;
package es.startuphero.checkstyle.checks.annotation;
/**
* @author ozlem.ulag
*/
public class MissingOverrideCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.override";
private String packageName;
private Map<String, String> importSimpleFullNameMap;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.METHOD_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void beginTree(DetailAST rootAst) {
packageName = getPackageName(rootAst); | importSimpleFullNameMap = getImportSimpleFullNameMap(rootAst); |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/naming/VariableNameCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static final String ABSTRACT_CLASS_PREFIX = "Abstract";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getNameWithoutContext(String name, String contextName) {
// String suggestedName = "";
// String[] separated = name.split("(?i)" + contextName);
// for (String separatedName : separated) {
// if (!isEmpty(separatedName)) {
// suggestedName = suggestedName + separatedName;
// }
// }
// return isEmpty(suggestedName) ? name :
// suggestedName.substring(0, 1).toLowerCase() + suggestedName.substring(1);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.Map;
import static es.startuphero.checkstyle.util.ClassUtils.ABSTRACT_CLASS_PREFIX;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getNameWithoutContext;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap; | package es.startuphero.checkstyle.checks.naming;
/**
* @author ozlem.ulag
*/
public class VariableNameCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "illegal.variable.name";
/**
* set entity annotation to understand that a class is an entity.
*/
private String typeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static final String ABSTRACT_CLASS_PREFIX = "Abstract";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getNameWithoutContext(String name, String contextName) {
// String suggestedName = "";
// String[] separated = name.split("(?i)" + contextName);
// for (String separatedName : separated) {
// if (!isEmpty(separatedName)) {
// suggestedName = suggestedName + separatedName;
// }
// }
// return isEmpty(suggestedName) ? name :
// suggestedName.substring(0, 1).toLowerCase() + suggestedName.substring(1);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/naming/VariableNameCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.Map;
import static es.startuphero.checkstyle.util.ClassUtils.ABSTRACT_CLASS_PREFIX;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getNameWithoutContext;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
package es.startuphero.checkstyle.checks.naming;
/**
* @author ozlem.ulag
*/
public class VariableNameCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "illegal.variable.name";
/**
* set entity annotation to understand that a class is an entity.
*/
private String typeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) { | if (isEntity(ast, typeAnnotation)) { |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/naming/VariableNameCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static final String ABSTRACT_CLASS_PREFIX = "Abstract";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getNameWithoutContext(String name, String contextName) {
// String suggestedName = "";
// String[] separated = name.split("(?i)" + contextName);
// for (String separatedName : separated) {
// if (!isEmpty(separatedName)) {
// suggestedName = suggestedName + separatedName;
// }
// }
// return isEmpty(suggestedName) ? name :
// suggestedName.substring(0, 1).toLowerCase() + suggestedName.substring(1);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.Map;
import static es.startuphero.checkstyle.util.ClassUtils.ABSTRACT_CLASS_PREFIX;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getNameWithoutContext;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap; | package es.startuphero.checkstyle.checks.naming;
/**
* @author ozlem.ulag
*/
public class VariableNameCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "illegal.variable.name";
/**
* set entity annotation to understand that a class is an entity.
*/
private String typeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, typeAnnotation)) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static final String ABSTRACT_CLASS_PREFIX = "Abstract";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getNameWithoutContext(String name, String contextName) {
// String suggestedName = "";
// String[] separated = name.split("(?i)" + contextName);
// for (String separatedName : separated) {
// if (!isEmpty(separatedName)) {
// suggestedName = suggestedName + separatedName;
// }
// }
// return isEmpty(suggestedName) ? name :
// suggestedName.substring(0, 1).toLowerCase() + suggestedName.substring(1);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/naming/VariableNameCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.Map;
import static es.startuphero.checkstyle.util.ClassUtils.ABSTRACT_CLASS_PREFIX;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getNameWithoutContext;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
package es.startuphero.checkstyle.checks.naming;
/**
* @author ozlem.ulag
*/
public class VariableNameCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "illegal.variable.name";
/**
* set entity annotation to understand that a class is an entity.
*/
private String typeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, typeAnnotation)) { | String className = getClassName(ast); |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/naming/VariableNameCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static final String ABSTRACT_CLASS_PREFIX = "Abstract";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getNameWithoutContext(String name, String contextName) {
// String suggestedName = "";
// String[] separated = name.split("(?i)" + contextName);
// for (String separatedName : separated) {
// if (!isEmpty(separatedName)) {
// suggestedName = suggestedName + separatedName;
// }
// }
// return isEmpty(suggestedName) ? name :
// suggestedName.substring(0, 1).toLowerCase() + suggestedName.substring(1);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.Map;
import static es.startuphero.checkstyle.util.ClassUtils.ABSTRACT_CLASS_PREFIX;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getNameWithoutContext;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap; | package es.startuphero.checkstyle.checks.naming;
/**
* @author ozlem.ulag
*/
public class VariableNameCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "illegal.variable.name";
/**
* set entity annotation to understand that a class is an entity.
*/
private String typeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, typeAnnotation)) {
String className = getClassName(ast); | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static final String ABSTRACT_CLASS_PREFIX = "Abstract";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getNameWithoutContext(String name, String contextName) {
// String suggestedName = "";
// String[] separated = name.split("(?i)" + contextName);
// for (String separatedName : separated) {
// if (!isEmpty(separatedName)) {
// suggestedName = suggestedName + separatedName;
// }
// }
// return isEmpty(suggestedName) ? name :
// suggestedName.substring(0, 1).toLowerCase() + suggestedName.substring(1);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/naming/VariableNameCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.Map;
import static es.startuphero.checkstyle.util.ClassUtils.ABSTRACT_CLASS_PREFIX;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getNameWithoutContext;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
package es.startuphero.checkstyle.checks.naming;
/**
* @author ozlem.ulag
*/
public class VariableNameCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "illegal.variable.name";
/**
* set entity annotation to understand that a class is an entity.
*/
private String typeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, typeAnnotation)) {
String className = getClassName(ast); | if (className.startsWith(ABSTRACT_CLASS_PREFIX)) { |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/naming/VariableNameCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static final String ABSTRACT_CLASS_PREFIX = "Abstract";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getNameWithoutContext(String name, String contextName) {
// String suggestedName = "";
// String[] separated = name.split("(?i)" + contextName);
// for (String separatedName : separated) {
// if (!isEmpty(separatedName)) {
// suggestedName = suggestedName + separatedName;
// }
// }
// return isEmpty(suggestedName) ? name :
// suggestedName.substring(0, 1).toLowerCase() + suggestedName.substring(1);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.Map;
import static es.startuphero.checkstyle.util.ClassUtils.ABSTRACT_CLASS_PREFIX;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getNameWithoutContext;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap; | package es.startuphero.checkstyle.checks.naming;
/**
* @author ozlem.ulag
*/
public class VariableNameCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "illegal.variable.name";
/**
* set entity annotation to understand that a class is an entity.
*/
private String typeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, typeAnnotation)) {
String className = getClassName(ast);
if (className.startsWith(ABSTRACT_CLASS_PREFIX)) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static final String ABSTRACT_CLASS_PREFIX = "Abstract";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getNameWithoutContext(String name, String contextName) {
// String suggestedName = "";
// String[] separated = name.split("(?i)" + contextName);
// for (String separatedName : separated) {
// if (!isEmpty(separatedName)) {
// suggestedName = suggestedName + separatedName;
// }
// }
// return isEmpty(suggestedName) ? name :
// suggestedName.substring(0, 1).toLowerCase() + suggestedName.substring(1);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/naming/VariableNameCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.Map;
import static es.startuphero.checkstyle.util.ClassUtils.ABSTRACT_CLASS_PREFIX;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getNameWithoutContext;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
package es.startuphero.checkstyle.checks.naming;
/**
* @author ozlem.ulag
*/
public class VariableNameCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "illegal.variable.name";
/**
* set entity annotation to understand that a class is an entity.
*/
private String typeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, typeAnnotation)) {
String className = getClassName(ast);
if (className.startsWith(ABSTRACT_CLASS_PREFIX)) { | className = getNameWithoutContext(className, ABSTRACT_CLASS_PREFIX); |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/naming/VariableNameCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static final String ABSTRACT_CLASS_PREFIX = "Abstract";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getNameWithoutContext(String name, String contextName) {
// String suggestedName = "";
// String[] separated = name.split("(?i)" + contextName);
// for (String separatedName : separated) {
// if (!isEmpty(separatedName)) {
// suggestedName = suggestedName + separatedName;
// }
// }
// return isEmpty(suggestedName) ? name :
// suggestedName.substring(0, 1).toLowerCase() + suggestedName.substring(1);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.Map;
import static es.startuphero.checkstyle.util.ClassUtils.ABSTRACT_CLASS_PREFIX;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getNameWithoutContext;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap; | package es.startuphero.checkstyle.checks.naming;
/**
* @author ozlem.ulag
*/
public class VariableNameCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "illegal.variable.name";
/**
* set entity annotation to understand that a class is an entity.
*/
private String typeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, typeAnnotation)) {
String className = getClassName(ast);
if (className.startsWith(ABSTRACT_CLASS_PREFIX)) {
className = getNameWithoutContext(className, ABSTRACT_CLASS_PREFIX);
}
checkVariablesName(ast, className);
}
}
private void checkVariablesName(DetailAST ast, String className) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static final String ABSTRACT_CLASS_PREFIX = "Abstract";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getNameWithoutContext(String name, String contextName) {
// String suggestedName = "";
// String[] separated = name.split("(?i)" + contextName);
// for (String separatedName : separated) {
// if (!isEmpty(separatedName)) {
// suggestedName = suggestedName + separatedName;
// }
// }
// return isEmpty(suggestedName) ? name :
// suggestedName.substring(0, 1).toLowerCase() + suggestedName.substring(1);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/naming/VariableNameCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.Map;
import static es.startuphero.checkstyle.util.ClassUtils.ABSTRACT_CLASS_PREFIX;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getNameWithoutContext;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
package es.startuphero.checkstyle.checks.naming;
/**
* @author ozlem.ulag
*/
public class VariableNameCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "illegal.variable.name";
/**
* set entity annotation to understand that a class is an entity.
*/
private String typeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, typeAnnotation)) {
String className = getClassName(ast);
if (className.startsWith(ABSTRACT_CLASS_PREFIX)) {
className = getNameWithoutContext(className, ABSTRACT_CLASS_PREFIX);
}
checkVariablesName(ast, className);
}
}
private void checkVariablesName(DetailAST ast, String className) { | Map<String, DetailAST> variableNameAstMap = getVariableNameAstMap(ast, false); |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/ForbiddenAnnotationCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Boolean hasAnnotation(DetailAST ast, String fullAnnotation) {
// return CommonUtils.getSimpleAndFullNames(fullAnnotation).stream()
// .anyMatch(annotation -> AnnotationUtil.containsAnnotation(ast, annotation));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import com.puppycrawl.tools.checkstyle.utils.CommonUtil;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.hasAnnotation;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static java.util.Objects.nonNull; |
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.VARIABLE_DEF,
TokenTypes.PARAMETER_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.TYPECAST,
TokenTypes.LITERAL_THROWS,
TokenTypes.IMPLEMENTS_CLAUSE,
TokenTypes.TYPE_ARGUMENT,
TokenTypes.LITERAL_NEW,
TokenTypes.DOT,
TokenTypes.ANNOTATION_FIELD_DEF
};
}
@Override
public int[] getRequiredTokens() {
return CommonUtil.EMPTY_INT_ARRAY;
}
@Override
public void visitToken(DetailAST ast) {
forbiddenAnnotations.stream() | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Boolean hasAnnotation(DetailAST ast, String fullAnnotation) {
// return CommonUtils.getSimpleAndFullNames(fullAnnotation).stream()
// .anyMatch(annotation -> AnnotationUtil.containsAnnotation(ast, annotation));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/ForbiddenAnnotationCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import com.puppycrawl.tools.checkstyle.utils.CommonUtil;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.hasAnnotation;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static java.util.Objects.nonNull;
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.VARIABLE_DEF,
TokenTypes.PARAMETER_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.TYPECAST,
TokenTypes.LITERAL_THROWS,
TokenTypes.IMPLEMENTS_CLAUSE,
TokenTypes.TYPE_ARGUMENT,
TokenTypes.LITERAL_NEW,
TokenTypes.DOT,
TokenTypes.ANNOTATION_FIELD_DEF
};
}
@Override
public int[] getRequiredTokens() {
return CommonUtil.EMPTY_INT_ARRAY;
}
@Override
public void visitToken(DetailAST ast) {
forbiddenAnnotations.stream() | .filter(forbiddenAnnotation -> hasAnnotation(ast, forbiddenAnnotation)) |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/ForbiddenAnnotationCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Boolean hasAnnotation(DetailAST ast, String fullAnnotation) {
// return CommonUtils.getSimpleAndFullNames(fullAnnotation).stream()
// .anyMatch(annotation -> AnnotationUtil.containsAnnotation(ast, annotation));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import com.puppycrawl.tools.checkstyle.utils.CommonUtil;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.hasAnnotation;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static java.util.Objects.nonNull; | @Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.VARIABLE_DEF,
TokenTypes.PARAMETER_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.TYPECAST,
TokenTypes.LITERAL_THROWS,
TokenTypes.IMPLEMENTS_CLAUSE,
TokenTypes.TYPE_ARGUMENT,
TokenTypes.LITERAL_NEW,
TokenTypes.DOT,
TokenTypes.ANNOTATION_FIELD_DEF
};
}
@Override
public int[] getRequiredTokens() {
return CommonUtil.EMPTY_INT_ARRAY;
}
@Override
public void visitToken(DetailAST ast) {
forbiddenAnnotations.stream()
.filter(forbiddenAnnotation -> hasAnnotation(ast, forbiddenAnnotation)) | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Boolean hasAnnotation(DetailAST ast, String fullAnnotation) {
// return CommonUtils.getSimpleAndFullNames(fullAnnotation).stream()
// .anyMatch(annotation -> AnnotationUtil.containsAnnotation(ast, annotation));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/ForbiddenAnnotationCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import com.puppycrawl.tools.checkstyle.utils.CommonUtil;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.hasAnnotation;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static java.util.Objects.nonNull;
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.VARIABLE_DEF,
TokenTypes.PARAMETER_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.TYPECAST,
TokenTypes.LITERAL_THROWS,
TokenTypes.IMPLEMENTS_CLAUSE,
TokenTypes.TYPE_ARGUMENT,
TokenTypes.LITERAL_NEW,
TokenTypes.DOT,
TokenTypes.ANNOTATION_FIELD_DEF
};
}
@Override
public int[] getRequiredTokens() {
return CommonUtil.EMPTY_INT_ARRAY;
}
@Override
public void visitToken(DetailAST ast) {
forbiddenAnnotations.stream()
.filter(forbiddenAnnotation -> hasAnnotation(ast, forbiddenAnnotation)) | .forEach(forbiddenAnnotation -> log(getAnnotation(ast, forbiddenAnnotation).getLineNo(), |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/ForbiddenAnnotationCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Boolean hasAnnotation(DetailAST ast, String fullAnnotation) {
// return CommonUtils.getSimpleAndFullNames(fullAnnotation).stream()
// .anyMatch(annotation -> AnnotationUtil.containsAnnotation(ast, annotation));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import com.puppycrawl.tools.checkstyle.utils.CommonUtil;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.hasAnnotation;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static java.util.Objects.nonNull; | return new int[] {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.VARIABLE_DEF,
TokenTypes.PARAMETER_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.TYPECAST,
TokenTypes.LITERAL_THROWS,
TokenTypes.IMPLEMENTS_CLAUSE,
TokenTypes.TYPE_ARGUMENT,
TokenTypes.LITERAL_NEW,
TokenTypes.DOT,
TokenTypes.ANNOTATION_FIELD_DEF
};
}
@Override
public int[] getRequiredTokens() {
return CommonUtil.EMPTY_INT_ARRAY;
}
@Override
public void visitToken(DetailAST ast) {
forbiddenAnnotations.stream()
.filter(forbiddenAnnotation -> hasAnnotation(ast, forbiddenAnnotation))
.forEach(forbiddenAnnotation -> log(getAnnotation(ast, forbiddenAnnotation).getLineNo(),
MSG_KEY, | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Boolean hasAnnotation(DetailAST ast, String fullAnnotation) {
// return CommonUtils.getSimpleAndFullNames(fullAnnotation).stream()
// .anyMatch(annotation -> AnnotationUtil.containsAnnotation(ast, annotation));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/ForbiddenAnnotationCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import com.puppycrawl.tools.checkstyle.utils.CommonUtil;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.hasAnnotation;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static java.util.Objects.nonNull;
return new int[] {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.VARIABLE_DEF,
TokenTypes.PARAMETER_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.TYPECAST,
TokenTypes.LITERAL_THROWS,
TokenTypes.IMPLEMENTS_CLAUSE,
TokenTypes.TYPE_ARGUMENT,
TokenTypes.LITERAL_NEW,
TokenTypes.DOT,
TokenTypes.ANNOTATION_FIELD_DEF
};
}
@Override
public int[] getRequiredTokens() {
return CommonUtil.EMPTY_INT_ARRAY;
}
@Override
public void visitToken(DetailAST ast) {
forbiddenAnnotations.stream()
.filter(forbiddenAnnotation -> hasAnnotation(ast, forbiddenAnnotation))
.forEach(forbiddenAnnotation -> log(getAnnotation(ast, forbiddenAnnotation).getLineNo(),
MSG_KEY, | getSimpleName(forbiddenAnnotation))); |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/VariableAnnotationKeyValueCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Map<String, DetailAST> getKeyValueAstMap(DetailAST annotationAst) {
// List<DetailAST> keyValuePairAstList =
// CommonUtils.getChildsByType(annotationAst, TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
// return keyValuePairAstList.stream()
// .collect(Collectors.toMap(keyValuePairAst -> keyValuePairAst.getFirstChild().getText(),
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Optional<String> getValueAsString(DetailAST annotationKeyValueAst) {
// Optional<String> result = Optional.empty();
// DetailAST annotationValueNode = getAnnotationValueNode(annotationKeyValueAst);
// DetailAST literalValueAst = annotationValueNode.getFirstChild();
// if (nonNull(literalValueAst)) {
// result = Optional.of(literalValueAst.getText().replaceAll("\"", ""));
// }
// return result;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
| import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.getKeyValueAstMap;
import static es.startuphero.checkstyle.util.AnnotationUtils.getValueAsString;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull; | package es.startuphero.checkstyle.checks.annotation;
/**
* @author ozlem.ulag
*/
public class VariableAnnotationKeyValueCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "annotation.key.value";
/**
* set type annotation to understand that a class is an entity.
*/
private String typeAnnotation;
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
private final Table<String, String, Map<String, String>> variableAnnotationKeyValueTable = HashBasedTable.create();
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Map<String, DetailAST> getKeyValueAstMap(DetailAST annotationAst) {
// List<DetailAST> keyValuePairAstList =
// CommonUtils.getChildsByType(annotationAst, TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
// return keyValuePairAstList.stream()
// .collect(Collectors.toMap(keyValuePairAst -> keyValuePairAst.getFirstChild().getText(),
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Optional<String> getValueAsString(DetailAST annotationKeyValueAst) {
// Optional<String> result = Optional.empty();
// DetailAST annotationValueNode = getAnnotationValueNode(annotationKeyValueAst);
// DetailAST literalValueAst = annotationValueNode.getFirstChild();
// if (nonNull(literalValueAst)) {
// result = Optional.of(literalValueAst.getText().replaceAll("\"", ""));
// }
// return result;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/VariableAnnotationKeyValueCheck.java
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.getKeyValueAstMap;
import static es.startuphero.checkstyle.util.AnnotationUtils.getValueAsString;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
package es.startuphero.checkstyle.checks.annotation;
/**
* @author ozlem.ulag
*/
public class VariableAnnotationKeyValueCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "annotation.key.value";
/**
* set type annotation to understand that a class is an entity.
*/
private String typeAnnotation;
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
private final Table<String, String, Map<String, String>> variableAnnotationKeyValueTable = HashBasedTable.create();
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) { | if (isEntity(ast, typeAnnotation) || isEntity(ast, abstractTypeAnnotation)) { |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/VariableAnnotationKeyValueCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Map<String, DetailAST> getKeyValueAstMap(DetailAST annotationAst) {
// List<DetailAST> keyValuePairAstList =
// CommonUtils.getChildsByType(annotationAst, TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
// return keyValuePairAstList.stream()
// .collect(Collectors.toMap(keyValuePairAst -> keyValuePairAst.getFirstChild().getText(),
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Optional<String> getValueAsString(DetailAST annotationKeyValueAst) {
// Optional<String> result = Optional.empty();
// DetailAST annotationValueNode = getAnnotationValueNode(annotationKeyValueAst);
// DetailAST literalValueAst = annotationValueNode.getFirstChild();
// if (nonNull(literalValueAst)) {
// result = Optional.of(literalValueAst.getText().replaceAll("\"", ""));
// }
// return result;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
| import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.getKeyValueAstMap;
import static es.startuphero.checkstyle.util.AnnotationUtils.getValueAsString;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull; | package es.startuphero.checkstyle.checks.annotation;
/**
* @author ozlem.ulag
*/
public class VariableAnnotationKeyValueCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "annotation.key.value";
/**
* set type annotation to understand that a class is an entity.
*/
private String typeAnnotation;
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
private final Table<String, String, Map<String, String>> variableAnnotationKeyValueTable = HashBasedTable.create();
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, typeAnnotation) || isEntity(ast, abstractTypeAnnotation)) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Map<String, DetailAST> getKeyValueAstMap(DetailAST annotationAst) {
// List<DetailAST> keyValuePairAstList =
// CommonUtils.getChildsByType(annotationAst, TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
// return keyValuePairAstList.stream()
// .collect(Collectors.toMap(keyValuePairAst -> keyValuePairAst.getFirstChild().getText(),
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Optional<String> getValueAsString(DetailAST annotationKeyValueAst) {
// Optional<String> result = Optional.empty();
// DetailAST annotationValueNode = getAnnotationValueNode(annotationKeyValueAst);
// DetailAST literalValueAst = annotationValueNode.getFirstChild();
// if (nonNull(literalValueAst)) {
// result = Optional.of(literalValueAst.getText().replaceAll("\"", ""));
// }
// return result;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/VariableAnnotationKeyValueCheck.java
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.getKeyValueAstMap;
import static es.startuphero.checkstyle.util.AnnotationUtils.getValueAsString;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
package es.startuphero.checkstyle.checks.annotation;
/**
* @author ozlem.ulag
*/
public class VariableAnnotationKeyValueCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "annotation.key.value";
/**
* set type annotation to understand that a class is an entity.
*/
private String typeAnnotation;
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
private final Table<String, String, Map<String, String>> variableAnnotationKeyValueTable = HashBasedTable.create();
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, typeAnnotation) || isEntity(ast, abstractTypeAnnotation)) { | Map<String, DetailAST> variableNameAstMap = getVariableNameAstMap(ast, false); |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/VariableAnnotationKeyValueCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Map<String, DetailAST> getKeyValueAstMap(DetailAST annotationAst) {
// List<DetailAST> keyValuePairAstList =
// CommonUtils.getChildsByType(annotationAst, TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
// return keyValuePairAstList.stream()
// .collect(Collectors.toMap(keyValuePairAst -> keyValuePairAst.getFirstChild().getText(),
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Optional<String> getValueAsString(DetailAST annotationKeyValueAst) {
// Optional<String> result = Optional.empty();
// DetailAST annotationValueNode = getAnnotationValueNode(annotationKeyValueAst);
// DetailAST literalValueAst = annotationValueNode.getFirstChild();
// if (nonNull(literalValueAst)) {
// result = Optional.of(literalValueAst.getText().replaceAll("\"", ""));
// }
// return result;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
| import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.getKeyValueAstMap;
import static es.startuphero.checkstyle.util.AnnotationUtils.getValueAsString;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull; |
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, typeAnnotation) || isEntity(ast, abstractTypeAnnotation)) {
Map<String, DetailAST> variableNameAstMap = getVariableNameAstMap(ast, false);
Set<String> checkedVariables = variableAnnotationKeyValueTable.rowKeySet();
Set<String> checkedAnnotations = variableAnnotationKeyValueTable.columnKeySet();
checkedVariables.stream()
.filter(variableNameAstMap::containsKey)
.forEach(checkedVariable -> {
DetailAST variableAst = variableNameAstMap.get(checkedVariable);
checkedAnnotations.forEach(checkedAnnotation -> checkAnnotation(checkedVariable,
variableAst,
checkedAnnotation));
});
}
}
private void checkAnnotation(String checkedVariable, DetailAST variableAst,
String checkedAnnotation) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Map<String, DetailAST> getKeyValueAstMap(DetailAST annotationAst) {
// List<DetailAST> keyValuePairAstList =
// CommonUtils.getChildsByType(annotationAst, TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
// return keyValuePairAstList.stream()
// .collect(Collectors.toMap(keyValuePairAst -> keyValuePairAst.getFirstChild().getText(),
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Optional<String> getValueAsString(DetailAST annotationKeyValueAst) {
// Optional<String> result = Optional.empty();
// DetailAST annotationValueNode = getAnnotationValueNode(annotationKeyValueAst);
// DetailAST literalValueAst = annotationValueNode.getFirstChild();
// if (nonNull(literalValueAst)) {
// result = Optional.of(literalValueAst.getText().replaceAll("\"", ""));
// }
// return result;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/VariableAnnotationKeyValueCheck.java
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.getKeyValueAstMap;
import static es.startuphero.checkstyle.util.AnnotationUtils.getValueAsString;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, typeAnnotation) || isEntity(ast, abstractTypeAnnotation)) {
Map<String, DetailAST> variableNameAstMap = getVariableNameAstMap(ast, false);
Set<String> checkedVariables = variableAnnotationKeyValueTable.rowKeySet();
Set<String> checkedAnnotations = variableAnnotationKeyValueTable.columnKeySet();
checkedVariables.stream()
.filter(variableNameAstMap::containsKey)
.forEach(checkedVariable -> {
DetailAST variableAst = variableNameAstMap.get(checkedVariable);
checkedAnnotations.forEach(checkedAnnotation -> checkAnnotation(checkedVariable,
variableAst,
checkedAnnotation));
});
}
}
private void checkAnnotation(String checkedVariable, DetailAST variableAst,
String checkedAnnotation) { | DetailAST annotationAst = getAnnotation(variableAst, checkedAnnotation); |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/VariableAnnotationKeyValueCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Map<String, DetailAST> getKeyValueAstMap(DetailAST annotationAst) {
// List<DetailAST> keyValuePairAstList =
// CommonUtils.getChildsByType(annotationAst, TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
// return keyValuePairAstList.stream()
// .collect(Collectors.toMap(keyValuePairAst -> keyValuePairAst.getFirstChild().getText(),
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Optional<String> getValueAsString(DetailAST annotationKeyValueAst) {
// Optional<String> result = Optional.empty();
// DetailAST annotationValueNode = getAnnotationValueNode(annotationKeyValueAst);
// DetailAST literalValueAst = annotationValueNode.getFirstChild();
// if (nonNull(literalValueAst)) {
// result = Optional.of(literalValueAst.getText().replaceAll("\"", ""));
// }
// return result;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
| import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.getKeyValueAstMap;
import static es.startuphero.checkstyle.util.AnnotationUtils.getValueAsString;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull; | public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, typeAnnotation) || isEntity(ast, abstractTypeAnnotation)) {
Map<String, DetailAST> variableNameAstMap = getVariableNameAstMap(ast, false);
Set<String> checkedVariables = variableAnnotationKeyValueTable.rowKeySet();
Set<String> checkedAnnotations = variableAnnotationKeyValueTable.columnKeySet();
checkedVariables.stream()
.filter(variableNameAstMap::containsKey)
.forEach(checkedVariable -> {
DetailAST variableAst = variableNameAstMap.get(checkedVariable);
checkedAnnotations.forEach(checkedAnnotation -> checkAnnotation(checkedVariable,
variableAst,
checkedAnnotation));
});
}
}
private void checkAnnotation(String checkedVariable, DetailAST variableAst,
String checkedAnnotation) {
DetailAST annotationAst = getAnnotation(variableAst, checkedAnnotation);
if (nonNull(annotationAst)) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Map<String, DetailAST> getKeyValueAstMap(DetailAST annotationAst) {
// List<DetailAST> keyValuePairAstList =
// CommonUtils.getChildsByType(annotationAst, TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
// return keyValuePairAstList.stream()
// .collect(Collectors.toMap(keyValuePairAst -> keyValuePairAst.getFirstChild().getText(),
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Optional<String> getValueAsString(DetailAST annotationKeyValueAst) {
// Optional<String> result = Optional.empty();
// DetailAST annotationValueNode = getAnnotationValueNode(annotationKeyValueAst);
// DetailAST literalValueAst = annotationValueNode.getFirstChild();
// if (nonNull(literalValueAst)) {
// result = Optional.of(literalValueAst.getText().replaceAll("\"", ""));
// }
// return result;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/VariableAnnotationKeyValueCheck.java
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.getKeyValueAstMap;
import static es.startuphero.checkstyle.util.AnnotationUtils.getValueAsString;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, typeAnnotation) || isEntity(ast, abstractTypeAnnotation)) {
Map<String, DetailAST> variableNameAstMap = getVariableNameAstMap(ast, false);
Set<String> checkedVariables = variableAnnotationKeyValueTable.rowKeySet();
Set<String> checkedAnnotations = variableAnnotationKeyValueTable.columnKeySet();
checkedVariables.stream()
.filter(variableNameAstMap::containsKey)
.forEach(checkedVariable -> {
DetailAST variableAst = variableNameAstMap.get(checkedVariable);
checkedAnnotations.forEach(checkedAnnotation -> checkAnnotation(checkedVariable,
variableAst,
checkedAnnotation));
});
}
}
private void checkAnnotation(String checkedVariable, DetailAST variableAst,
String checkedAnnotation) {
DetailAST annotationAst = getAnnotation(variableAst, checkedAnnotation);
if (nonNull(annotationAst)) { | Map<String, DetailAST> annotationKeyPairAstMap = getKeyValueAstMap(annotationAst); |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/VariableAnnotationKeyValueCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Map<String, DetailAST> getKeyValueAstMap(DetailAST annotationAst) {
// List<DetailAST> keyValuePairAstList =
// CommonUtils.getChildsByType(annotationAst, TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
// return keyValuePairAstList.stream()
// .collect(Collectors.toMap(keyValuePairAst -> keyValuePairAst.getFirstChild().getText(),
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Optional<String> getValueAsString(DetailAST annotationKeyValueAst) {
// Optional<String> result = Optional.empty();
// DetailAST annotationValueNode = getAnnotationValueNode(annotationKeyValueAst);
// DetailAST literalValueAst = annotationValueNode.getFirstChild();
// if (nonNull(literalValueAst)) {
// result = Optional.of(literalValueAst.getText().replaceAll("\"", ""));
// }
// return result;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
| import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.getKeyValueAstMap;
import static es.startuphero.checkstyle.util.AnnotationUtils.getValueAsString;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull; | .forEach(checkedVariable -> {
DetailAST variableAst = variableNameAstMap.get(checkedVariable);
checkedAnnotations.forEach(checkedAnnotation -> checkAnnotation(checkedVariable,
variableAst,
checkedAnnotation));
});
}
}
private void checkAnnotation(String checkedVariable, DetailAST variableAst,
String checkedAnnotation) {
DetailAST annotationAst = getAnnotation(variableAst, checkedAnnotation);
if (nonNull(annotationAst)) {
Map<String, DetailAST> annotationKeyPairAstMap = getKeyValueAstMap(annotationAst);
Map<String, String> checkedKeyValueMap = variableAnnotationKeyValueTable.get(checkedVariable, checkedAnnotation);
checkedKeyValueMap.keySet().forEach(checkedKey -> checkKeyValuePair(checkedVariable,
checkedAnnotation,
annotationAst,
annotationKeyPairAstMap,
checkedKeyValueMap,
checkedKey));
}
}
private void checkKeyValuePair(String checkedVariable, String checkedAnnotation, DetailAST annotationAst,
Map<String, DetailAST> annotationKeyPairAstMap, Map<String, String> checkedKeyValueMap,
String checkedKey) {
String checkedValue = checkedKeyValueMap.get(checkedKey);
DetailAST annotationKeyValueAst = annotationKeyPairAstMap.get(checkedKey);
if (nonNull(annotationKeyValueAst)) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Map<String, DetailAST> getKeyValueAstMap(DetailAST annotationAst) {
// List<DetailAST> keyValuePairAstList =
// CommonUtils.getChildsByType(annotationAst, TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
// return keyValuePairAstList.stream()
// .collect(Collectors.toMap(keyValuePairAst -> keyValuePairAst.getFirstChild().getText(),
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Optional<String> getValueAsString(DetailAST annotationKeyValueAst) {
// Optional<String> result = Optional.empty();
// DetailAST annotationValueNode = getAnnotationValueNode(annotationKeyValueAst);
// DetailAST literalValueAst = annotationValueNode.getFirstChild();
// if (nonNull(literalValueAst)) {
// result = Optional.of(literalValueAst.getText().replaceAll("\"", ""));
// }
// return result;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/VariableAnnotationKeyValueCheck.java
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.getKeyValueAstMap;
import static es.startuphero.checkstyle.util.AnnotationUtils.getValueAsString;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
.forEach(checkedVariable -> {
DetailAST variableAst = variableNameAstMap.get(checkedVariable);
checkedAnnotations.forEach(checkedAnnotation -> checkAnnotation(checkedVariable,
variableAst,
checkedAnnotation));
});
}
}
private void checkAnnotation(String checkedVariable, DetailAST variableAst,
String checkedAnnotation) {
DetailAST annotationAst = getAnnotation(variableAst, checkedAnnotation);
if (nonNull(annotationAst)) {
Map<String, DetailAST> annotationKeyPairAstMap = getKeyValueAstMap(annotationAst);
Map<String, String> checkedKeyValueMap = variableAnnotationKeyValueTable.get(checkedVariable, checkedAnnotation);
checkedKeyValueMap.keySet().forEach(checkedKey -> checkKeyValuePair(checkedVariable,
checkedAnnotation,
annotationAst,
annotationKeyPairAstMap,
checkedKeyValueMap,
checkedKey));
}
}
private void checkKeyValuePair(String checkedVariable, String checkedAnnotation, DetailAST annotationAst,
Map<String, DetailAST> annotationKeyPairAstMap, Map<String, String> checkedKeyValueMap,
String checkedKey) {
String checkedValue = checkedKeyValueMap.get(checkedKey);
DetailAST annotationKeyValueAst = annotationKeyPairAstMap.get(checkedKey);
if (nonNull(annotationKeyValueAst)) { | Optional<String> annotationValueAsString = getValueAsString(annotationKeyValueAst); |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/VariableAnnotationKeyValueCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Map<String, DetailAST> getKeyValueAstMap(DetailAST annotationAst) {
// List<DetailAST> keyValuePairAstList =
// CommonUtils.getChildsByType(annotationAst, TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
// return keyValuePairAstList.stream()
// .collect(Collectors.toMap(keyValuePairAst -> keyValuePairAst.getFirstChild().getText(),
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Optional<String> getValueAsString(DetailAST annotationKeyValueAst) {
// Optional<String> result = Optional.empty();
// DetailAST annotationValueNode = getAnnotationValueNode(annotationKeyValueAst);
// DetailAST literalValueAst = annotationValueNode.getFirstChild();
// if (nonNull(literalValueAst)) {
// result = Optional.of(literalValueAst.getText().replaceAll("\"", ""));
// }
// return result;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
| import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.getKeyValueAstMap;
import static es.startuphero.checkstyle.util.AnnotationUtils.getValueAsString;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull; | variableAst,
checkedAnnotation));
});
}
}
private void checkAnnotation(String checkedVariable, DetailAST variableAst,
String checkedAnnotation) {
DetailAST annotationAst = getAnnotation(variableAst, checkedAnnotation);
if (nonNull(annotationAst)) {
Map<String, DetailAST> annotationKeyPairAstMap = getKeyValueAstMap(annotationAst);
Map<String, String> checkedKeyValueMap = variableAnnotationKeyValueTable.get(checkedVariable, checkedAnnotation);
checkedKeyValueMap.keySet().forEach(checkedKey -> checkKeyValuePair(checkedVariable,
checkedAnnotation,
annotationAst,
annotationKeyPairAstMap,
checkedKeyValueMap,
checkedKey));
}
}
private void checkKeyValuePair(String checkedVariable, String checkedAnnotation, DetailAST annotationAst,
Map<String, DetailAST> annotationKeyPairAstMap, Map<String, String> checkedKeyValueMap,
String checkedKey) {
String checkedValue = checkedKeyValueMap.get(checkedKey);
DetailAST annotationKeyValueAst = annotationKeyPairAstMap.get(checkedKey);
if (nonNull(annotationKeyValueAst)) {
Optional<String> annotationValueAsString = getValueAsString(annotationKeyValueAst);
if (annotationValueAsString.isPresent() && !annotationValueAsString.get()
.equals(checkedValue)) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static DetailAST getAnnotation(DetailAST ast, String fullAnnotation) {
// DetailAST simpleAnnotationAst =
// AnnotationUtil.getAnnotation(ast, CommonUtils.getSimpleName(fullAnnotation));
// return nonNull(simpleAnnotationAst) ? simpleAnnotationAst
// : AnnotationUtil.getAnnotation(ast, fullAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Map<String, DetailAST> getKeyValueAstMap(DetailAST annotationAst) {
// List<DetailAST> keyValuePairAstList =
// CommonUtils.getChildsByType(annotationAst, TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
// return keyValuePairAstList.stream()
// .collect(Collectors.toMap(keyValuePairAst -> keyValuePairAst.getFirstChild().getText(),
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static Optional<String> getValueAsString(DetailAST annotationKeyValueAst) {
// Optional<String> result = Optional.empty();
// DetailAST annotationValueNode = getAnnotationValueNode(annotationKeyValueAst);
// DetailAST literalValueAst = annotationValueNode.getFirstChild();
// if (nonNull(literalValueAst)) {
// result = Optional.of(literalValueAst.getText().replaceAll("\"", ""));
// }
// return result;
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
// String[] packageNames = fullName.split("\\.");
// return packageNames[packageNames.length - 1];
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/VariableAnnotationKeyValueCheck.java
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getAnnotation;
import static es.startuphero.checkstyle.util.AnnotationUtils.getKeyValueAstMap;
import static es.startuphero.checkstyle.util.AnnotationUtils.getValueAsString;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
variableAst,
checkedAnnotation));
});
}
}
private void checkAnnotation(String checkedVariable, DetailAST variableAst,
String checkedAnnotation) {
DetailAST annotationAst = getAnnotation(variableAst, checkedAnnotation);
if (nonNull(annotationAst)) {
Map<String, DetailAST> annotationKeyPairAstMap = getKeyValueAstMap(annotationAst);
Map<String, String> checkedKeyValueMap = variableAnnotationKeyValueTable.get(checkedVariable, checkedAnnotation);
checkedKeyValueMap.keySet().forEach(checkedKey -> checkKeyValuePair(checkedVariable,
checkedAnnotation,
annotationAst,
annotationKeyPairAstMap,
checkedKeyValueMap,
checkedKey));
}
}
private void checkKeyValuePair(String checkedVariable, String checkedAnnotation, DetailAST annotationAst,
Map<String, DetailAST> annotationKeyPairAstMap, Map<String, String> checkedKeyValueMap,
String checkedKey) {
String checkedValue = checkedKeyValueMap.get(checkedKey);
DetailAST annotationKeyValueAst = annotationKeyPairAstMap.get(checkedKey);
if (nonNull(annotationKeyValueAst)) {
Optional<String> annotationValueAsString = getValueAsString(annotationKeyValueAst);
if (annotationValueAsString.isPresent() && !annotationValueAsString.get()
.equals(checkedValue)) { | log(annotationAst.getLineNo(), MSG_KEY, checkedVariable, getSimpleName(checkedAnnotation), |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/variable/MissingVariableCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isExtendsAnotherClass(DetailAST classAst) {
// return nonNull(classAst.findFirstToken(TokenTypes.EXTENDS_CLAUSE));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static List<String> getVariableNames(DetailAST classAst) {
// return getVariables(classAst).stream()
// .map(VariableUtils::getVariableName)
// .collect(toList());
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.ClassUtils.isExtendsAnotherClass;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNames; | package es.startuphero.checkstyle.checks.variable;
/**
* @author ozlem.ulag
*/
public class MissingVariableCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.variable";
/**
* set type annotation to understand that a class is an entity.
*/
private String typeAnnotation;
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
/**
* set mandatory variables that must exist in each entity.
*/
private Set<String> mandatoryVariables = new HashSet<>();
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isExtendsAnotherClass(DetailAST classAst) {
// return nonNull(classAst.findFirstToken(TokenTypes.EXTENDS_CLAUSE));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static List<String> getVariableNames(DetailAST classAst) {
// return getVariables(classAst).stream()
// .map(VariableUtils::getVariableName)
// .collect(toList());
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/variable/MissingVariableCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.ClassUtils.isExtendsAnotherClass;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNames;
package es.startuphero.checkstyle.checks.variable;
/**
* @author ozlem.ulag
*/
public class MissingVariableCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.variable";
/**
* set type annotation to understand that a class is an entity.
*/
private String typeAnnotation;
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
/**
* set mandatory variables that must exist in each entity.
*/
private Set<String> mandatoryVariables = new HashSet<>();
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) { | if ((isEntity(ast, typeAnnotation) || |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/variable/MissingVariableCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isExtendsAnotherClass(DetailAST classAst) {
// return nonNull(classAst.findFirstToken(TokenTypes.EXTENDS_CLAUSE));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static List<String> getVariableNames(DetailAST classAst) {
// return getVariables(classAst).stream()
// .map(VariableUtils::getVariableName)
// .collect(toList());
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.ClassUtils.isExtendsAnotherClass;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNames; | package es.startuphero.checkstyle.checks.variable;
/**
* @author ozlem.ulag
*/
public class MissingVariableCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.variable";
/**
* set type annotation to understand that a class is an entity.
*/
private String typeAnnotation;
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
/**
* set mandatory variables that must exist in each entity.
*/
private Set<String> mandatoryVariables = new HashSet<>();
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if ((isEntity(ast, typeAnnotation) ||
isEntity(ast, abstractTypeAnnotation)) && | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isExtendsAnotherClass(DetailAST classAst) {
// return nonNull(classAst.findFirstToken(TokenTypes.EXTENDS_CLAUSE));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static List<String> getVariableNames(DetailAST classAst) {
// return getVariables(classAst).stream()
// .map(VariableUtils::getVariableName)
// .collect(toList());
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/variable/MissingVariableCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.ClassUtils.isExtendsAnotherClass;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNames;
package es.startuphero.checkstyle.checks.variable;
/**
* @author ozlem.ulag
*/
public class MissingVariableCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.variable";
/**
* set type annotation to understand that a class is an entity.
*/
private String typeAnnotation;
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
/**
* set mandatory variables that must exist in each entity.
*/
private Set<String> mandatoryVariables = new HashSet<>();
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if ((isEntity(ast, typeAnnotation) ||
isEntity(ast, abstractTypeAnnotation)) && | !isExtendsAnotherClass(ast)) { |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/variable/MissingVariableCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isExtendsAnotherClass(DetailAST classAst) {
// return nonNull(classAst.findFirstToken(TokenTypes.EXTENDS_CLAUSE));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static List<String> getVariableNames(DetailAST classAst) {
// return getVariables(classAst).stream()
// .map(VariableUtils::getVariableName)
// .collect(toList());
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.ClassUtils.isExtendsAnotherClass;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNames; | package es.startuphero.checkstyle.checks.variable;
/**
* @author ozlem.ulag
*/
public class MissingVariableCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.variable";
/**
* set type annotation to understand that a class is an entity.
*/
private String typeAnnotation;
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
/**
* set mandatory variables that must exist in each entity.
*/
private Set<String> mandatoryVariables = new HashSet<>();
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if ((isEntity(ast, typeAnnotation) ||
isEntity(ast, abstractTypeAnnotation)) &&
!isExtendsAnotherClass(ast)) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isExtendsAnotherClass(DetailAST classAst) {
// return nonNull(classAst.findFirstToken(TokenTypes.EXTENDS_CLAUSE));
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static List<String> getVariableNames(DetailAST classAst) {
// return getVariables(classAst).stream()
// .map(VariableUtils::getVariableName)
// .collect(toList());
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/variable/MissingVariableCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
import static es.startuphero.checkstyle.util.ClassUtils.isExtendsAnotherClass;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNames;
package es.startuphero.checkstyle.checks.variable;
/**
* @author ozlem.ulag
*/
public class MissingVariableCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.variable";
/**
* set type annotation to understand that a class is an entity.
*/
private String typeAnnotation;
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
/**
* set mandatory variables that must exist in each entity.
*/
private Set<String> mandatoryVariables = new HashSet<>();
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if ((isEntity(ast, typeAnnotation) ||
isEntity(ast, abstractTypeAnnotation)) &&
!isExtendsAnotherClass(ast)) { | List<String> variableNames = getVariableNames(ast); |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/modifier/MissingAbstractModifierCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isAbstract(DetailAST classAst) {
// return classAst.findFirstToken(TokenTypes.MODIFIERS)
// .branchContains(TokenTypes.ABSTRACT);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import static es.startuphero.checkstyle.util.ClassUtils.isAbstract;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity; | package es.startuphero.checkstyle.checks.modifier;
/**
* @author ozlem.ulag
*/
public class MissingAbstractModifierCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.abstract.modifier";
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isAbstract(DetailAST classAst) {
// return classAst.findFirstToken(TokenTypes.MODIFIERS)
// .branchContains(TokenTypes.ABSTRACT);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/modifier/MissingAbstractModifierCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import static es.startuphero.checkstyle.util.ClassUtils.isAbstract;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
package es.startuphero.checkstyle.checks.modifier;
/**
* @author ozlem.ulag
*/
public class MissingAbstractModifierCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.abstract.modifier";
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) { | if (isEntity(ast, abstractTypeAnnotation) && !isAbstract(ast)) { |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/modifier/MissingAbstractModifierCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isAbstract(DetailAST classAst) {
// return classAst.findFirstToken(TokenTypes.MODIFIERS)
// .branchContains(TokenTypes.ABSTRACT);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import static es.startuphero.checkstyle.util.ClassUtils.isAbstract;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity; | package es.startuphero.checkstyle.checks.modifier;
/**
* @author ozlem.ulag
*/
public class MissingAbstractModifierCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.abstract.modifier";
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isAbstract(DetailAST classAst) {
// return classAst.findFirstToken(TokenTypes.MODIFIERS)
// .branchContains(TokenTypes.ABSTRACT);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/modifier/MissingAbstractModifierCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import static es.startuphero.checkstyle.util.ClassUtils.isAbstract;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
package es.startuphero.checkstyle.checks.modifier;
/**
* @author ozlem.ulag
*/
public class MissingAbstractModifierCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.abstract.modifier";
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) { | if (isEntity(ast, abstractTypeAnnotation) && !isAbstract(ast)) { |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/coding/VariableDeclarationOrderCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Scope getScopeOf(DetailAST variableAst) {
// DetailAST variableModifiersNode = variableAst.findFirstToken(TokenTypes.MODIFIERS);
// return ScopeUtil.getScopeFromMods(variableModifiersNode);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.Scope;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static es.startuphero.checkstyle.util.VariableUtils.getScopeOf;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap; | package es.startuphero.checkstyle.checks.coding;
/**
* @author ozlem.ulag
*/
public class VariableDeclarationOrderCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "illegal.variable.declaration.order";
/**
* set variable name to check declaration order.
*/
private String variableName;
/**
* set declaration order of given variable.
*/
private Integer declarationOrder;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Scope getScopeOf(DetailAST variableAst) {
// DetailAST variableModifiersNode = variableAst.findFirstToken(TokenTypes.MODIFIERS);
// return ScopeUtil.getScopeFromMods(variableModifiersNode);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/coding/VariableDeclarationOrderCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.Scope;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static es.startuphero.checkstyle.util.VariableUtils.getScopeOf;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
package es.startuphero.checkstyle.checks.coding;
/**
* @author ozlem.ulag
*/
public class VariableDeclarationOrderCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "illegal.variable.declaration.order";
/**
* set variable name to check declaration order.
*/
private String variableName;
/**
* set declaration order of given variable.
*/
private Integer declarationOrder;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) { | Map<String, DetailAST> variableNameAstMap = getVariableNameAstMap(ast); |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/coding/VariableDeclarationOrderCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Scope getScopeOf(DetailAST variableAst) {
// DetailAST variableModifiersNode = variableAst.findFirstToken(TokenTypes.MODIFIERS);
// return ScopeUtil.getScopeFromMods(variableModifiersNode);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.Scope;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static es.startuphero.checkstyle.util.VariableUtils.getScopeOf;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap; | package es.startuphero.checkstyle.checks.coding;
/**
* @author ozlem.ulag
*/
public class VariableDeclarationOrderCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "illegal.variable.declaration.order";
/**
* set variable name to check declaration order.
*/
private String variableName;
/**
* set declaration order of given variable.
*/
private Integer declarationOrder;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
Map<String, DetailAST> variableNameAstMap = getVariableNameAstMap(ast);
if (variableNameAstMap.containsKey(variableName)) {
DetailAST variableAst = variableNameAstMap.get(variableName); | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Scope getScopeOf(DetailAST variableAst) {
// DetailAST variableModifiersNode = variableAst.findFirstToken(TokenTypes.MODIFIERS);
// return ScopeUtil.getScopeFromMods(variableModifiersNode);
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/VariableUtils.java
// public static Map<String, DetailAST> getVariableNameAstMap(DetailAST classAst) {
// List<DetailAST> variables = getVariables(classAst);
// return variables.stream().collect(toMap(VariableUtils::getVariableName,
// Function.identity(), (v1, v2) -> null,
// LinkedHashMap::new));
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/coding/VariableDeclarationOrderCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.Scope;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static es.startuphero.checkstyle.util.VariableUtils.getScopeOf;
import static es.startuphero.checkstyle.util.VariableUtils.getVariableNameAstMap;
package es.startuphero.checkstyle.checks.coding;
/**
* @author ozlem.ulag
*/
public class VariableDeclarationOrderCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "illegal.variable.declaration.order";
/**
* set variable name to check declaration order.
*/
private String variableName;
/**
* set declaration order of given variable.
*/
private Integer declarationOrder;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
Map<String, DetailAST> variableNameAstMap = getVariableNameAstMap(ast);
if (variableNameAstMap.containsKey(variableName)) {
DetailAST variableAst = variableNameAstMap.get(variableName); | Scope scopeOfVariable = getScopeOf(variableAst); |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/naming/MissingAbstractNameCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static final String ABSTRACT_CLASS_PREFIX = "Abstract";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import static es.startuphero.checkstyle.util.ClassUtils.ABSTRACT_CLASS_PREFIX;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity; | package es.startuphero.checkstyle.checks.naming;
/**
* @author ozlem.ulag
*/
public class MissingAbstractNameCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.abstract.name";
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static final String ABSTRACT_CLASS_PREFIX = "Abstract";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/naming/MissingAbstractNameCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import static es.startuphero.checkstyle.util.ClassUtils.ABSTRACT_CLASS_PREFIX;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
package es.startuphero.checkstyle.checks.naming;
/**
* @author ozlem.ulag
*/
public class MissingAbstractNameCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.abstract.name";
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) { | if (isEntity(ast, abstractTypeAnnotation)) { |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/naming/MissingAbstractNameCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static final String ABSTRACT_CLASS_PREFIX = "Abstract";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import static es.startuphero.checkstyle.util.ClassUtils.ABSTRACT_CLASS_PREFIX;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity; | package es.startuphero.checkstyle.checks.naming;
/**
* @author ozlem.ulag
*/
public class MissingAbstractNameCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.abstract.name";
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, abstractTypeAnnotation)) { | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static final String ABSTRACT_CLASS_PREFIX = "Abstract";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/naming/MissingAbstractNameCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import static es.startuphero.checkstyle.util.ClassUtils.ABSTRACT_CLASS_PREFIX;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
package es.startuphero.checkstyle.checks.naming;
/**
* @author ozlem.ulag
*/
public class MissingAbstractNameCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.abstract.name";
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, abstractTypeAnnotation)) { | String className = getClassName(ast); |
startupheroes/startupheroes-checkstyle | startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/naming/MissingAbstractNameCheck.java | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static final String ABSTRACT_CLASS_PREFIX = "Abstract";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
| import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import static es.startuphero.checkstyle.util.ClassUtils.ABSTRACT_CLASS_PREFIX;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity; | package es.startuphero.checkstyle.checks.naming;
/**
* @author ozlem.ulag
*/
public class MissingAbstractNameCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.abstract.name";
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, abstractTypeAnnotation)) {
String className = getClassName(ast); | // Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static final String ABSTRACT_CLASS_PREFIX = "Abstract";
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static String getClassName(DetailAST classAst) {
// DetailAST type = classAst.findFirstToken(TokenTypes.LITERAL_CLASS);
// return type.getNextSibling().getText();
// }
//
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/ClassUtils.java
// public static Boolean isEntity(DetailAST classAst, String fullEntityAnnotation) {
// return AnnotationUtils.hasAnnotation(classAst, fullEntityAnnotation);
// }
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/naming/MissingAbstractNameCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import static es.startuphero.checkstyle.util.ClassUtils.ABSTRACT_CLASS_PREFIX;
import static es.startuphero.checkstyle.util.ClassUtils.getClassName;
import static es.startuphero.checkstyle.util.ClassUtils.isEntity;
package es.startuphero.checkstyle.checks.naming;
/**
* @author ozlem.ulag
*/
public class MissingAbstractNameCheck extends AbstractCheck {
/**
* A key is pointing to the warning message text in "messages.properties" file.
*/
private static final String MSG_KEY = "missing.abstract.name";
/**
* set abstract type annotation to understand that a class is abstract.
*/
private String abstractTypeAnnotation;
@Override
public int[] getDefaultTokens() {
return getAcceptableTokens();
}
@Override
public int[] getAcceptableTokens() {
return new int[] {TokenTypes.CLASS_DEF};
}
@Override
public int[] getRequiredTokens() {
return getAcceptableTokens();
}
@Override
public void visitToken(DetailAST ast) {
if (isEntity(ast, abstractTypeAnnotation)) {
String className = getClassName(ast); | if (!className.startsWith(ABSTRACT_CLASS_PREFIX)) { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.