Back to project page easydb.
The source code is released under:
Apache License
If you think the Android project easydb listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.san.api.easydb; //from w w w . jav a 2 s . c o m import java.util.ArrayList; import android.content.Context; /** * * @author Santanu Kumar */ final public class ConnectionManager { protected static ArrayList<Class> ENTITY_LIST=new ArrayList<Class>(); private SQLHelper mDBHelper; private Session session; private static ConnectionManager CONNECTION_MANAGER; private ConnectionManager(Context context,String database) { this.mDBHelper = new SQLHelper(context,database,ENTITY_LIST); } public static ConnectionManager createConnectionManager(Context context,String database) { if(CONNECTION_MANAGER==null) CONNECTION_MANAGER=new ConnectionManager(context,database); return CONNECTION_MANAGER; } /** * * @param className */ public static void registerEntity(Class className) { ENTITY_LIST.add(className); } /** * * @return */ public Session openSession(){ session = new Session(mDBHelper.getWritableDatabase()); return session; } /** * */ public void dispose() { if (mDBHelper != null) { mDBHelper.close(); } CONNECTION_MANAGER=null; } }