Package com.arjuna.ats.arjuna.objectstore.jdbc

Examples of com.arjuna.ats.arjuna.objectstore.jdbc.JDBCAccess


  }

  protected void parseObjectName(ObjectName objName) throws Exception
  {
    String jdbcAccessClassName, tableName;
    JDBCAccess jdbcAccess;

    if (objName == null)
    {
      if (tsLogger.arjLoggerI18N.isFatalEnabled())
      {
View Full Code Here


      throws Exception
  {
    if (jdbcAccessClassName == null || jdbcAccessClassName.length() == 0)
      throw new ObjectStoreException();

    final JDBCAccess jdbcAccess;
    synchronized (_theAccesses)
    {
      final Object jdbcAccessObject = _theAccesses
          .get(jdbcAccessClassName);
      if (jdbcAccessObject != null)
      {
        jdbcAccess = (JDBCAccess) jdbcAccessObject;
      }
      else
      {
        try
        {
          final Class jdbcAccessClass = Thread.currentThread()
              .getContextClassLoader().loadClass(
                  jdbcAccessClassName);
          jdbcAccess = (JDBCAccess) jdbcAccessClass.newInstance();
        }
        catch (final Exception ex)
        {
          if (tsLogger.arjLoggerI18N.isFatalEnabled())
          {
            tsLogger.arjLoggerI18N
                .fatal(
                    "com.arjuna.ats.internal.arjuna.objectstore.JDBCStore_2",
                    new Object[]
                    { ex, jdbcAccessClassName });
          }
          throw ex;
        }
        _theAccesses.put(jdbcAccessClassName, jdbcAccess);
      }
    }
    setJDBCAccess(jdbcAccess);

    final String impleTableName;
    if ((tableName != null) && (tableName.length() > 0))
    {
      impleTableName = tableName;
    }
    else
    {
      final String jdbcAccessTableName = jdbcAccess.tableName();
      if ((jdbcAccessTableName != null)
          && (jdbcAccessTableName.length() > 0))
      {
        impleTableName = jdbcAccessTableName;
      }
      else
      {
        impleTableName = getDefaultTableName();
      }
    }

    setTableName(impleTableName);

    final String impleKey = jdbcAccessClassName + ":" + impleTableName;

    synchronized (_theImples)
    {
      final Object currentImple = _theImples.get(impleKey);
      if (currentImple != null)
      {
        _theImple = (JDBCImple) currentImple;
      }
      else
      {
        try
        {
          /*
           * This had better not be an Arjuna jdbc connection!
           */
          final Connection connection;

          try
          {
            connection = jdbcAccess.getConnection();
          }
          catch (final SQLException sqle)
          {
            if (tsLogger.arjLoggerI18N.isFatalEnabled())
            {
View Full Code Here

    try
    {
      if (arjPropertyManager.propertyManager.getProperty(Environment.OBJECTSTORE_TYPE) != null &&
          arjPropertyManager.propertyManager.getProperty(Environment.OBJECTSTORE_TYPE).startsWith("JDBCStore"))
      {
        JDBCAccess mJDBC = (JDBCAccess) Class.forName(System.getProperty("JDBC2_USER_DB_ACCESS")).newInstance();
        Connection mConnection = mJDBC.getConnection();
        Statement s = mConnection.createStatement();
        s.executeUpdate("DROP TABLE " + mJDBC.tableName());
      }
      else
      {
        String objectStoreDirName = arjPropertyManager.propertyManager.getProperty(Environment.OBJECTSTORE_DIR, com.arjuna.ats.arjuna.common.Configuration.objectStoreRoot());
View Full Code Here

      }

      if (arjPropertyManager.propertyManager.getProperty(Environment.OBJECTSTORE_TYPE) != null &&
          arjPropertyManager.propertyManager.getProperty(Environment.OBJECTSTORE_TYPE).startsWith("JDBCStore"))
      {
        JDBCAccess mJDBC = (JDBCAccess) Class.forName(arjPropertyManager.propertyManager.getProperty(Environment.JDBC_USER_DB_ACCESS)).newInstance();
        String tableName = mJDBC.tableName();
        if (tableName == "")
          /* from arjuna.internal.JDBCStore */
        {
          tableName = "ArjunaTSTable";
        }
        System.err.println("Dropping object store table: " + tableName);
        Connection mConnection = mJDBC.getConnection();
        Statement s = mConnection.createStatement();
        try
        {
          s.executeUpdate("DROP TABLE " + tableName);
        }
View Full Code Here

                        throws Exception
        {
                if (jdbcAccessClassName == null || jdbcAccessClassName.length() == 0)
                        throw new ObjectStoreException();

                final JDBCAccess jdbcAccess;
                synchronized (_theAccesses)
                {
                        final Object jdbcAccessObject = _theAccesses
                                        .get(jdbcAccessClassName);
                        if (jdbcAccessObject != null)
                        {
                                jdbcAccess = (JDBCAccess) jdbcAccessObject;
                        }
                        else
                        {
                                try
                                {
                                        final Class jdbcAccessClass = Thread.currentThread()
                                                        .getContextClassLoader().loadClass(
                                                                        jdbcAccessClassName);
                                        jdbcAccess = (JDBCAccess) jdbcAccessClass.newInstance();
                                }
                                catch (final Exception ex)
                                {
                                        if (tsLogger.arjLoggerI18N.isFatalEnabled())
                                        {
                                                tsLogger.arjLoggerI18N
                                                                .fatal(
                                                                                "com.arjuna.ats.internal.arjuna.objectstore.JDBCStore_2",
                                                                                new Object[]
                                                                                { ex, jdbcAccessClassName });
                                        }
                                        throw ex;
                                }
                                _theAccesses.put(jdbcAccessClassName, jdbcAccess);
                        }
                }
                setJDBCAccess(jdbcAccess);

                final String impleTableName;
                if ((tableName != null) && (tableName.length() > 0))
                {
                        impleTableName = tableName;
                }
                else
                {
                        final String jdbcAccessTableName = jdbcAccess.tableName();
                        if ((jdbcAccessTableName != null)
                                        && (jdbcAccessTableName.length() > 0))
                        {
                                impleTableName = jdbcAccessTableName;
                        }
                        else
                        {
                                impleTableName = getDefaultTableName();
                        }
                }

                setTableName(impleTableName);

                final String impleKey = jdbcAccessClassName + ":" + impleTableName;

                synchronized (_theImples)
                {
                        final Object currentImple = _theImples.get(impleKey);
                        if (currentImple != null)
                        {
                                _theImple = (JDBCImple) currentImple;
                        }
                        else
                        {
                                try
                                {
                                        /*
                                         * This had better not be an Arjuna jdbc connection!
                                         */
                                        final Connection connection;

                                        try
                                        {
                                                connection = jdbcAccess.getConnection();
                                        }
                                        catch (final SQLException sqle)
                                        {
                                                if (tsLogger.arjLoggerI18N.isFatalEnabled())
                                                {
View Full Code Here

/*     */   protected void setupStore(String jdbcAccessClassName, String tableName)
/*     */     throws Exception
/*     */   {
/* 647 */     if ((jdbcAccessClassName == null) || (jdbcAccessClassName.length() == 0))
/* 648 */       throw new ObjectStoreException();
/*     */     JDBCAccess jdbcAccess;
/* 651 */     synchronized (_theAccesses)
/*     */     {
/* 653 */       Object jdbcAccessObject = _theAccesses.get(jdbcAccessClassName);
/*     */       JDBCAccess jdbcAccess;
/* 655 */       if (jdbcAccessObject != null)
/*     */       {
/* 657 */         jdbcAccess = (JDBCAccess)jdbcAccessObject;
/*     */       }
/*     */       else
/*     */       {
/*     */         try
/*     */         {
/* 663 */           Class jdbcAccessClass = Thread.currentThread().getContextClassLoader().loadClass(jdbcAccessClassName);
/*     */
/* 666 */           jdbcAccess = (JDBCAccess)jdbcAccessClass.newInstance();
/*     */         }
/*     */         catch (Exception ex)
/*     */         {
/* 670 */           if (tsLogger.arjLoggerI18N.isFatalEnabled())
/*     */           {
/* 672 */             tsLogger.arjLoggerI18N.fatal("com.arjuna.ats.internal.arjuna.objectstore.JDBCStore_2", new Object[] { ex, jdbcAccessClassName });
/*     */           }
/*     */
/* 678 */           throw ex;
/*     */         }
/* 680 */         _theAccesses.put(jdbcAccessClassName, jdbcAccess);
/*     */       }
/*     */     }
/* 683 */     setJDBCAccess(jdbcAccess);
/*     */     String impleTableName;
/*     */     String impleTableName;
/* 686 */     if ((tableName != null) && (tableName.length() > 0))
/*     */     {
/* 688 */       impleTableName = tableName;
/*     */     }
/*     */     else
/*     */     {
/* 692 */       String jdbcAccessTableName = jdbcAccess.tableName();
/*     */       String impleTableName;
/* 693 */       if ((jdbcAccessTableName != null) && (jdbcAccessTableName.length() > 0))
/*     */       {
/* 696 */         impleTableName = jdbcAccessTableName;
/*     */       }
/*     */       else
/*     */       {
/* 700 */         impleTableName = getDefaultTableName();
/*     */       }
/*     */     }
/*     */
/* 704 */     setTableName(impleTableName);
/*     */
/* 706 */     String impleKey = jdbcAccessClassName + ":" + impleTableName;
/*     */
/* 708 */     synchronized (_theImples)
/*     */     {
/* 710 */       Object currentImple = _theImples.get(impleKey);
/* 711 */       if (currentImple != null)
/*     */       {
/* 713 */         this._theImple = ((JDBCImple)currentImple);
/*     */       }
/*     */       else
/*     */       {
/*     */         try
/*     */         {
/*     */           Connection connection;
/*     */           try
/*     */           {
/* 726 */             connection = jdbcAccess.getConnection();
/*     */           }
/*     */           catch (SQLException sqle)
/*     */           {
/* 730 */             if (tsLogger.arjLoggerI18N.isFatalEnabled())
/*     */             {
View Full Code Here

    }
   
    protected void parseObjectName (ObjectName objName) throws Exception
    {
  String jdbcAccessClassName, tableName;
  JDBCAccess jdbcAccess;
 
  if (objName == null)
  {
      if (tsLogger.arjLoggerI18N.isFatalEnabled())
      {
View Full Code Here

    protected void setupStore(String jdbcAccessClassName, String tableName) throws Exception
    {
  if (jdbcAccessClassName == null || jdbcAccessClassName.length() == 0)
      throw new ObjectStoreException() ;

  final JDBCAccess jdbcAccess ;
  synchronized(_theAccesses)
  {
      final Object jdbcAccessObject = _theAccesses.get(jdbcAccessClassName) ;
      if (jdbcAccessObject != null)
      {
                jdbcAccess = (JDBCAccess)jdbcAccessObject ;
            }
      else
      {
                try
                {
                    final Class jdbcAccessClass = Thread.currentThread().getContextClassLoader().loadClass(jdbcAccessClassName) ;
                    jdbcAccess = (JDBCAccess)jdbcAccessClass.newInstance() ;
                }
                catch (final Exception ex)
                {
                    if (tsLogger.arjLoggerI18N.isFatalEnabled())
                    {
                        tsLogger.arjLoggerI18N.fatal("com.arjuna.ats.internal.arjuna.objectstore.JDBCStore_2",
                                    new Object[]{ex, jdbcAccessClassName});
                    }
                    throw ex ;
                }
                _theAccesses.put(jdbcAccessClassName, jdbcAccess) ;
      }
  }  
        setJDBCAccess(jdbcAccess) ;
       
        final String impleTableName ;
        if ((tableName != null) && (tableName.length() > 0))
        {
            impleTableName = tableName ;
        }
        else
        {
            final String jdbcAccessTableName = jdbcAccess.tableName() ;
            if ((jdbcAccessTableName != null) && (jdbcAccessTableName.length() > 0))
            {
                impleTableName = jdbcAccessTableName ;
            }
            else
            {
                impleTableName = getDefaultTableName() ;
            }
        }
       
        setTableName(impleTableName) ;
       
        final String impleKey = jdbcAccessClassName + ":" + impleTableName ;
       
        synchronized(_theImples)
        {
            final Object currentImple = _theImples.get(impleKey) ;
            if (currentImple != null)
            {
                _theImple = (JDBCImple)currentImple ;
            }
            else
            {
                try
                {
                    /*
                     * This had better not be an Arjuna jdbc connection!
                     */
                    final Connection connection ;
                   
                    try
                    {
                        connection = jdbcAccess.getConnection() ;
                    }
                    catch(final SQLException sqle)
                    {
                        if (tsLogger.arjLoggerI18N.isFatalEnabled())
                        {
View Full Code Here

TOP

Related Classes of com.arjuna.ats.arjuna.objectstore.jdbc.JDBCAccess

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.