当前位置: 首页>>代码示例>>Java>>正文


Java ObjectContainer.close方法代码示例

本文整理汇总了Java中com.db4o.ObjectContainer.close方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectContainer.close方法的具体用法?Java ObjectContainer.close怎么用?Java ObjectContainer.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.db4o.ObjectContainer的用法示例。


在下文中一共展示了ObjectContainer.close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteStudent

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
/**
 * Delete student.
 *
 * @param studentID
 *            the student id
 * @param hostName
 *            the host name
 */
public static void deleteStudent(String studentID, String hostName)
{
	ObjectContainer db = Db4oClientServer.openClient(generateConfig(), hostName, Database.DB_PORT, Database.DB_USER, Database.DB_PASS);
	try
	{
		List<StudentDatabaseFormat> dbReps = db.query(StudentDatabaseFormat.class);
		if (dbReps != null)
		{
			for (StudentDatabaseFormat dbRep : dbReps)
			{
				if (dbRep.getStudentID().equals(studentID))
				{
					db.delete(dbRep);
					break;
				}
			}
		}
	}
	finally
	{
		db.close();
	}
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:32,代码来源:DatabaseActivity.java

示例2: getStudentColour

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
/**
 * Gets the student colour.
 *
 * @param studentID
 *            the student id
 * @param hostName
 *            the host name
 * @return the student colour
 */
public static String getStudentColour(String studentID, String hostName)
{
	ObjectContainer db = Db4oClientServer.openClient(generateConfig(), hostName, Database.DB_PORT, Database.DB_USER, Database.DB_PASS);
	try
	{
		List<StudentDatabaseFormat> dbReps = db.query(StudentDatabaseFormat.class);
		if (dbReps.size() > 0)
		{
			for (StudentDatabaseFormat dbRep : dbReps)
			{
				if (dbRep.getStudentID().equals(studentID))
				{
					return dbRep.getColour();
				}
			}
		}
	}
	finally
	{
		db.close();
	}
	return "white";
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:33,代码来源:DatabaseActivity.java

示例3: getStudentGallery

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
/**
 * Gets the student gallery.
 *
 * @param studentID
 *            the student id
 * @param hostName
 *            the host name
 * @return the student gallery
 */
public static ArrayList<GalleryItemDatabaseFormat> getStudentGallery(String studentID, String hostName)
{
	ObjectContainer db = Db4oClientServer.openClient(generateConfig(), hostName, Database.DB_PORT, Database.DB_USER, Database.DB_PASS);
	try
	{
		List<StudentDatabaseFormat> dbReps = db.query(StudentDatabaseFormat.class);
		if (dbReps.size() > 0)
		{
			for (StudentDatabaseFormat dbRep : dbReps)
			{
				if (dbRep.getStudentID().equals(studentID))
				{
					return dbRep.getGalleryItems();
				}
			}
		}
	}
	finally
	{
		db.close();
	}
	return new ArrayList<GalleryItemDatabaseFormat>();
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:33,代码来源:DatabaseActivity.java

示例4: getStudentRepresentationFromDatabase

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
/**
 * Gets the student representation from database.
 *
 * @param studentID
 *            the student id
 * @param hostName
 *            the host name
 * @param stage
 *            the stage
 * @return the student representation from database
 */
public static StudentRepresentation getStudentRepresentationFromDatabase(final String studentID, String hostName, IStage stage)
{
	ObjectContainer db = Db4oClientServer.openClient(generateConfig(), hostName, Database.DB_PORT, Database.DB_USER, Database.DB_PASS);
	try
	{

		List<StudentDatabaseFormat> dbReps = db.query(StudentDatabaseFormat.class);
		if (dbReps.size() > 0)
		{
			for (StudentDatabaseFormat dbRep : dbReps)
			{
				if (dbRep.getStudentID().equals(studentID))
				{
					StudentRepresentation studentRep = dbToStudentRep(dbRep, stage);
					return studentRep;
				}
			}
		}
	}
	finally
	{
		db.close();
	}
	return null;
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:37,代码来源:DatabaseActivity.java

示例5: getStudentsFromDatabase

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
/**
 * Gets the students from database.
 *
 * @param hostName
 *            the host name
 * @return the students from database
 */
public static ArrayList<Student> getStudentsFromDatabase(String hostName)
{
	ArrayList<Student> toReturn = new ArrayList<Student>();
	ObjectContainer db = Db4oClientServer.openClient(generateConfig(), hostName, Database.DB_PORT, Database.DB_USER, Database.DB_PASS);
	try
	{
		List<StudentDatabaseFormat> dbReps = db.query(StudentDatabaseFormat.class);

		if (dbReps.size() > 0)
		{
			for (StudentDatabaseFormat dbRep : dbReps)
			{
				Student student = dbToStudent(dbRep);
				toReturn.add(student);
			}
		}
	}
	finally
	{
		db.close();
	}
	return toReturn;
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:31,代码来源:DatabaseActivity.java

示例6: moveStudent

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
/**
 * Move student.
 *
 * @param studentID
 *            the student id
 * @param newClass
 *            the new class
 * @param hostName
 *            the host name
 */
public static void moveStudent(String studentID, String newClass, String hostName)
{
	ObjectContainer db = Db4oClientServer.openClient(generateConfig(), hostName, Database.DB_PORT, Database.DB_USER, Database.DB_PASS);
	try
	{
		List<StudentDatabaseFormat> dbReps = db.query(StudentDatabaseFormat.class);
		if (dbReps.size() > 0)
		{
			for (StudentDatabaseFormat dbRep : dbReps)
			{
				if (dbRep.getStudentID().equals(studentID))
				{
					dbRep.setClassname(newClass);
					db.delete(dbRep);
					db.store(dbRep);
					break;
				}
			}
		}
	}
	finally
	{
		db.close();
	}
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:36,代码来源:DatabaseActivity.java

示例7: removeStudentsOfClass

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
/**
 * Removes the students of class.
 *
 * @param className
 *            the class name
 * @param hostName
 *            the host name
 */
public static void removeStudentsOfClass(String className, String hostName)
{
	ObjectContainer db = Db4oClientServer.openClient(generateConfig(), hostName, Database.DB_PORT, Database.DB_USER, Database.DB_PASS);
	try
	{
		List<StudentDatabaseFormat> dbReps = db.query(StudentDatabaseFormat.class);
		if (dbReps != null)
		{
			for (StudentDatabaseFormat dbRep : dbReps)
			{
				if (dbRep.getClassName().equalsIgnoreCase(className))
				{
					db.delete(dbRep);
				}
			}
		}
	}
	finally
	{
		db.close();
	}
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:31,代码来源:DatabaseActivity.java

示例8: retrieveSystem

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
public CentralAuthority retrieveSystem()
    {
        ObjectContainer conn = createConnection();
        ObjectSet<CentralAuthority> systems = conn.query(CentralAuthority.class); // Change to the object you want to save
        CentralAuthority system;
        if (systems.size() == 0){
            
            //system = CentralAuthority.getInstance();
            system = ConfigureCentralAuthority.initialize();
// If there's no System in the record, create a new one
            
        }
        else{
            //system = systems.get(0);
            system = systems.get(systems.size() - 1);
        }
        conn.close();
        return system;
    }
 
开发者ID:abhishek-nandgaonkar,项目名称:HealTech,代码行数:20,代码来源:DB4OUtil.java

示例9: clearSystem

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
public synchronized void clearSystem()
{
    ObjectContainer conn = createConnection();
    ObjectSet<CentralAuthority> systems = conn.query(CentralAuthority.class); // Change to the object you want to save
    CentralAuthority system;
    if (systems.size() == 0){
        system = ConfigureCentralAuthority.initialize();  // If there's no System in the record, create a new one
        
    }
    else{
        system = systems.get(0);
    }
    conn.delete(system);
    conn.close();
    
}
 
开发者ID:abhishek-nandgaonkar,项目名称:HealTech,代码行数:17,代码来源:DB4OUtil.java

示例10: save

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
public void save(T obj) {
	if (obj == null) {
		return;
	}

	synchronized (DB4OUtils.class) {

		ObjectContainer oc = Db4oEmbedded.openFile(DB4OUtils
				.getDataBasePath());
		try {

			oc.store(obj);
			oc.commit();
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {

			oc.close();
		}
	}
}
 
开发者ID:yukozh,项目名称:CodeComb.Mobile.Android,代码行数:23,代码来源:BaseProvider.java

示例11: getKeys

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
@Override
public Collection<Integer> getKeys() throws StorageOperationException {
	ObjectContainer db = Db4oEmbedded.openFile(getConfiguration(), source);

	final Collection<Integer> result = new ArrayList<Integer>();

	try {
		db.query(new Predicate<V>() {
			@Override
			public boolean match(V v) {
				result.add(v.hashCode());
				return false;
			}
		});

	} finally {
		db.close();
	}

	return result;
}
 
开发者ID:kboom,项目名称:setphrase,代码行数:22,代码来源:DB4oObjectStorage.java

示例12: getAll

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
@Override
public List<V> getAll(final K... keys) throws StorageOperationException {
	ObjectContainer db = Db4oEmbedded.openFile(getConfiguration(), source);

	List<V> result = null;
	try {
		result = db.query(new Predicate<V>() {
			@Override
			public boolean match(V v) {
				for (K key : keys) {
					if (key.match(v))
						return true;
				}
				return false;
			}
		});

	} finally {
		db.close();
	}
	if (result == null)
		return createList();
	else
		return result;
}
 
开发者ID:kboom,项目名称:setphrase,代码行数:26,代码来源:DB4oObjectStorage.java

示例13: put

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
@Override
public void put(final K key, V value) throws StorageOperationException {
	ObjectContainer db = Db4oEmbedded.openFile(getConfiguration(), source);
	ObjectSet<V> set = db.query(new Predicate<V>() {
		@Override
		public boolean match(V v) {
			if (key.match(v))
				return true;
			else
				return false;
		}
	});
	db.delete(set);
	db.store(value);
	db.close();
}
 
开发者ID:kboom,项目名称:setphrase,代码行数:17,代码来源:DB4oObjectStorage.java

示例14: printObjects

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
public void printObjects(Class c)
{
    ObjectContainer client = this.server.openClient();
    Query query = client.query();
    query.constrain(DescrizioneProdotto.class);
    ObjectSet list = query.execute();
    Iterator iter = list.iterator();
    int i = 1;
    while(iter.hasNext())
    {
        DescrizioneProdotto desc = (DescrizioneProdotto) iter.next();
        List<IScontoProdottoStrategy> sconti = desc.getTuttiSconti();
        for(IScontoProdottoStrategy sconto:sconti)
        {
            System.out.println("Sconto: "+sconto.getClass()+" valid: "+sconto.isValid(DateTime.now()));
        }
        i++;
    }
    client.close();
}
 
开发者ID:GameShopAdvance,项目名称:GameShop-Advance,代码行数:21,代码来源:DbManagerSingleton.java

示例15: modifyStudent

import com.db4o.ObjectContainer; //导入方法依赖的package包/类
/**
 * Modify student.
 *
 * @param student
 *            the student
 * @param hostName
 *            the host name
 */
public static void modifyStudent(Student student, String hostName)
{
	ObjectContainer db = Db4oClientServer.openClient(generateConfig(), hostName, Database.DB_PORT, Database.DB_USER, Database.DB_PASS);
	try
	{
		List<StudentDatabaseFormat> dbReps = db.query(StudentDatabaseFormat.class);
		if (dbReps != null)
		{
			for (StudentDatabaseFormat dbRep : dbReps)
			{
				if (dbRep.getStudentID().equals(student.getStudentID()))
				{
					ArrayList<GalleryItemDatabaseFormat> galleryItems = dbRep.getGalleryItems();
					db.delete(dbRep);
					StudentDatabaseFormat dbRepNew = studentTodb(student);
					for (GalleryItemDatabaseFormat galleryItem : galleryItems)
					{
						dbRepNew.addGalleryItem(galleryItem);
					}
					db.store(dbRepNew);
					break;
				}
			}
		}
	}
	finally
	{
		db.close();
	}
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:39,代码来源:DatabaseActivity.java


注:本文中的com.db4o.ObjectContainer.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。