Package de.iritgo.aktera.persist

Examples of de.iritgo.aktera.persist.PersistenceException


    Configuration mySchema = (Configuration) schemas.get(firstPart);

    if (mySchema == null)
    {
      throw new PersistenceException("No such schema '" + firstPart + "' defined for PersistentFactory '"
              + getName() + "'");
    }

    Configuration[] eachTable = mySchema.getChildren();

    if (eachTable.length == 0)
    {
      throw new PersistenceException("No persistent obejcts defined in schema '" + firstPart + "' for factory '"
              + getName() + "'");
    }

    for (int i = 0; i < eachTable.length; i++)
    {
      Configuration oneTable = eachTable[i];

      if (oneTable.getName().equals("persistent"))
      {
        if (oneTable.getAttribute("name").equals(secondPart))
        {
          try
          {
            pd = (PersistentMetaData) getService(PersistentMetaData.ROLE);

            pd.setFactory(this);
            pd.setSchemaName(firstPart);
            pd.setDataSource(dataSource);
            pd.setDatabaseType(databaseType);

            if (pd instanceof Serviceable)
            {
              ((Serviceable) pd).service(getServiceManager());
            }

            pd.configurePersistent(oneTable);
            metas.put(persistentName, pd);

            return pd;
          }
          catch (Exception e)
          {
            throw new PersistenceException(PersistentMetaData.ROLE
                    + "Error creating metadata for persistent " + persistentName, e);
          }
        }
      }
    }

    throw new PersistenceException("No meta-data definition for persistent '" + secondPart + "' in factory '"
            + getName() + "' in schema '" + firstPart + "'");
  }
View Full Code Here


  public final PersistentFactory getFactory(String newName) throws PersistenceException
  {
    if (newName == null)
    {
      throw new PersistenceException("No factory name specified");
    }

    try
    {
      return (PersistentFactory) getService(PersistentFactory.ROLE, newName, getKeelContext());
    }
    catch (ServiceException e)
    {
      throw new PersistenceException(e);
    }
  }
View Full Code Here

    {
      dataSource = (DataSourceComponent) getService(DataSourceComponent.ROLE, dataSourceName);
    }
    catch (ServiceException e)
    {
      throw new PersistenceException(e);
    }

    try
    {
      databaseType = (DatabaseType) getService(DatabaseType.ROLE, dbTypeName);
    }
    catch (ServiceException e)
    {
      throw new PersistenceException(e);
    }

    // Get a reference to a database type
    databaseType.setDataSource(dataSource);
    initialized = true;
View Full Code Here

      //Separate the field and lookup portions
      StringTokenizer tok = new StringTokenizer(attrib, ":");

      if (tok.countTokens() != 2)
      {
        throw new PersistenceException("Format error (need field:lookup) in indirect default-data value: "
                + attrib);
      }

      String fieldStr = tok.nextToken();
      String lookupStr = tok.nextToken();

      //Extract the schema, table, field names
      tok = new StringTokenizer(fieldStr, ".");

      if (tok.countTokens() != 3)
      {
        throw new PersistenceException(
                "Format error (need $schema.table.field) in indirect default-data value: " + attrib);
      }

      String schema = tok.nextToken();
      String table = tok.nextToken();
      String field = tok.nextToken();

      //Extract the value from the table
      Persistent p = create(schema + "." + table);

      tok = new StringTokenizer(lookupStr, "|");

      String f = null;
      String v = null;
      StringTokenizer t = null;

      for (int i = 0; i < tok.countTokens(); i++)
      {
        t = new StringTokenizer(tok.nextToken(), "=");
        f = t.nextToken();
        v = t.nextToken();
        p.setField(f, v);
      }

      if (p.find())
      {
        retValue = p.getFieldString(field);
      }
      else
      {
        throw new PersistenceException("Could not lookup indirect default-data value: " + retValue);
      }
    }

    return retValue;
  }
View Full Code Here

    {
      return PropertyUtils.getProperty(data, columnName);
    }
    catch (Exception x)
    {
      throw new PersistenceException("[BeanRowData] Error while fetching column '" + columnName + "': " + x);
    }
  }
View Full Code Here

    {
      return StringTools.trim(PropertyUtils.getProperty(data, columnName));
    }
    catch (Exception x)
    {
      throw new PersistenceException("[BeanRowData] Error while fetching column '" + columnName + "': " + x);
    }
  }
View Full Code Here

    {
      return NumberTools.toInt(PropertyUtils.getProperty(data, columnName), 0);
    }
    catch (Exception x)
    {
      throw new PersistenceException("[BeanRowData] Error while fetching column '" + columnName + "': " + x);
    }
  }
View Full Code Here

    {
      return NumberTools.toLong(PropertyUtils.getProperty(data, columnName), 0);
    }
    catch (Exception x)
    {
      throw new PersistenceException("[BeanRowData] Error while fetching column '" + columnName + "': " + x);
    }
  }
View Full Code Here

    {
      return NumberTools.toFloat(PropertyUtils.getProperty(data, columnName), 0);
    }
    catch (Exception x)
    {
      throw new PersistenceException("[BeanRowData] Error while fetching column '" + columnName + "': " + x);
    }
  }
View Full Code Here

    {
      return (Time) PropertyUtils.getProperty(data, columnName);
    }
    catch (Exception x)
    {
      throw new PersistenceException("[BeanRowData] Error while fetching column '" + columnName + "': " + x);
    }
  }
View Full Code Here

TOP

Related Classes of de.iritgo.aktera.persist.PersistenceException

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.