Package com.db4o.cs.config

Examples of com.db4o.cs.config.ClientConfiguration


   * Saves a Model into the database
   * @param Model to save
   */
  public <T> boolean save(T aModel){
    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    theDB.store(aModel);
    System.out.println("Stored " + aModel);
    logger.log(Level.FINE, "Saving model [" + aModel + "]");
    theDB.commit();
View Full Code Here


   * Saves a Model associated with the given project into the database
   * @param Model to save
   */
  public <T> boolean save(T aModel, Project aProject){
    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    ((Model) aModel).setProject(aProject); //Sets the model's project to the given project
    theDB.store(aModel);
    System.out.println("Stored " + aModel);
    logger.log(Level.FINE, "Saving model [" + aModel + "]");
View Full Code Here

     *  anObjectQueried - You can get this by giving an object of the desired type and calling .getClass()
     *  aFieldName - this should be the suffix of the getter. So for getID you would make this field be "ID"
     */

    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    logger.log(Level.FINE, "Attempting Database Retrieve...");

    Method[] allMethods = anObjectQueried.getMethods();
    Method methodToBeSaved = null;
View Full Code Here

     *  anObjectQueried - You can get this by giving an object of the desired type and calling .getClass()
     *  aFieldName - this should be the suffix of the getter. So for getID you would make this field be "ID"
     */

    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    logger.log(Level.FINE, "Attempting Database Retrieve...");
    Method[] allMethods = anObjectQueried.getMethods();
    Method methodToBeSaved = null;
    for(Method m: allMethods){//Cycles through all of the methods in the class anObjectQueried
View Full Code Here

   * @param aSample an object of the class we want to retrieve All of
   * @return a List of all of the objects of the given class
   */
  public <T> List<T> retrieveAll(T aSample){
    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    List<T> result = theDB.queryByExample(aSample.getClass());
    System.out.println("retrievedAll: "+result);
    theDB.commit();

View Full Code Here

   * @param aProject Project to search in for the objects
   * @return a List of all of the objects of the given class
   */
  public <T> List<Model> retrieveAll(T aSample, Project aProject){
    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    ArrayList<Model> result = new ArrayList<Model>();
    List<Model> allResults = theDB.queryByExample(aSample.getClass());
    for(Model theModel : allResults) {
      if(theModel.getProject() != null &&
View Full Code Here

   * @param The object to be deleted
   * @return The object being deleted
   */
  public <T> T delete(T aTNG){
    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    logger.log(Level.FINE, "Database Delete Attempt...");
    //ObjectContainer client = server.openClient();
    ObjectSet<T> result = theDB.queryByExample(aTNG);
    T found = (T) result.next();
View Full Code Here

   * @param aSample an object of the class we want to retrieve All of
   * @return a List of all of the objects deleted
   */
  public <T> List<T> deleteAll(T aSample){
    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    List<T> toBeDeleted = retrieveAll(aSample);
    for(T aTNG: toBeDeleted){
      System.out.println("Deleting: "+aTNG);
      theDB.delete(aTNG);
View Full Code Here

   * @param aProject Project to search in for the objects
   * @return a List of all of the objects of the given class in the given project
   */
  public <T> List<Model> deleteAll(T aSample, Project aProject){
    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    List<Model> toBeDeleted = retrieveAll(aSample, aProject);
    for(Model aTNG: toBeDeleted){
      System.out.println("Deleting: "+aTNG);
      theDB.delete(aTNG);
View Full Code Here

   * @throws WPISuiteException
   */
  @SuppressWarnings("rawtypes") //Ignore the warning about the use of type Class
  public List<Model> notRetrieve(final Class anObjectQueried, String aFieldName, final Object theGivenValue) throws WPISuiteException{
    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    Method[] allMethods = anObjectQueried.getMethods();
    Method methodToBeSaved = null;
    for(Method m: allMethods){//Cycles through all of the methods in the class anObjectQueried
      if(m.getName().equalsIgnoreCase("get"+aFieldName)){
View Full Code Here

TOP

Related Classes of com.db4o.cs.config.ClientConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.