Package org.apache.derby.iapi.sql.dictionary

Examples of org.apache.derby.iapi.sql.dictionary.FileInfoDescriptor


  private void drop() throws StandardException
  {
    //
    //Like create table we say we are writing before we read the dd
    dd.startWriting(lcc);
    FileInfoDescriptor fid = getInfo();
    if (fid == null)
      throw StandardException.newException(SQLState.LANG_FILE_DOES_NOT_EXIST, sqlName,schemaName);

    String dbcp_s = PropertyUtil.getServiceProperty(lcc.getTransactionExecute(),Property.DATABASE_CLASSPATH);
    if (dbcp_s != null)
    {
      String[][]dbcp= IdUtil.parseDbClassPath(dbcp_s);
      boolean found = false;
      //
      //Look for the jar we are dropping on our database classpath.
      //We don't concern ourselves with 3 part names since they may
      //refer to a jar file in another database and may not occur in
      //a database classpath that is stored in the propert congomerate.
      for (int ix=0;ix<dbcp.length;ix++)
        if (dbcp.length == 2 &&
          dbcp[ix][0].equals(schemaName) && dbcp[ix][1].equals(sqlName))
          found = true;
      if (found)
        throw StandardException.newException(SQLState.LANG_CANT_DROP_JAR_ON_DB_CLASS_PATH_DURING_EXECUTION,
                  IdUtil.mkQualifiedName(schemaName,sqlName),
                  dbcp_s);
    }

    try {
   
      notifyLoader(false);
      dd.invalidateAllSPSPlans();
      DependencyManager dm = dd.getDependencyManager();
      dm.invalidateFor(fid, DependencyManager.DROP_JAR, lcc);

            UUID id = fid.getUUID();
      dd.dropFileInfoDescriptor(fid);
            fr.remove(
                JarUtil.mkExternalName(
                    id, schemaName, sqlName, fr.getSeparatorChar()),
        fid.getGenerationId());
    } finally {
      notifyLoader(true);
    }
  }
View Full Code Here


    //Like create table we say we are writing before we read the dd
    dd.startWriting(lcc);

    //
    //Temporarily drop the FileInfoDescriptor from the data dictionary.
    FileInfoDescriptor fid = getInfo();
    if (fid == null)
      throw StandardException.newException(SQLState.LANG_FILE_DOES_NOT_EXIST, sqlName,schemaName);

    try {
      // disable loads from this jar
      notifyLoader(false);
      dd.invalidateAllSPSPlans();
      dd.dropFileInfoDescriptor(fid);
            final String jarExternalName =
                JarUtil.mkExternalName(
                    fid.getUUID(), schemaName, sqlName, fr.getSeparatorChar());

      //
      //Replace the file.
      long generationId = setJar(jarExternalName, is, false,
          fid.getGenerationId());
           
      //
      //Re-add the descriptor to the data dictionary.
      FileInfoDescriptor fid2 =
        ddg.newFileInfoDescriptor(fid.getUUID(),fid.getSchemaDescriptor(),
                sqlName,generationId);
      dd.addDescriptor(fid2, fid.getSchemaDescriptor(),
               DataDictionary.SYSFILES_CATALOG_NUM, false, lcc.getTransactionExecute());
      return generationId;
View Full Code Here

    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(2);
    keyRow.setColumn(1, nameOrderable);
    keyRow.setColumn(2, schemaIDOrderable);
    FileInfoDescriptor r = (FileInfoDescriptor)
          getDescriptorViaIndex(
            SYSFILESRowFactory.SYSFILES_INDEX1_ID,
            keyRow,
            (ScanQualifier [][]) null,
            ti,
View Full Code Here

    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(2);
    keyRow.setColumn(1, nameOrderable);
    keyRow.setColumn(2, schemaIDOrderable);
    FileInfoDescriptor r = (FileInfoDescriptor)
          getDescriptorViaIndex(
            SYSFILESRowFactory.SYSFILES_INDEX1_ID,
            keyRow,
            (ScanQualifier [][]) null,
            ti,
View Full Code Here

  public long add(InputStream is) throws StandardException
  {
    //
    //Like create table we say we are writing before we read the dd
    dd.startWriting(lcc);
    FileInfoDescriptor fid = getInfo();
    if (fid != null)
      throw
        StandardException.newException(SQLState.LANG_OBJECT_ALREADY_EXISTS_IN_OBJECT,
                         fid.getDescriptorType(), sqlName, fid.getSchemaDescriptor().getDescriptorType(), schemaName);

    try {
      notifyLoader(false);
      dd.invalidateAllSPSPlans();
      long generationId = fr.add(JarDDL.mkExternalName(schemaName, sqlName, fr.getSeparatorChar()),is);
View Full Code Here

  public void drop(boolean purgeOnCommit) throws StandardException
  {
    //
    //Like create table we say we are writing before we read the dd
    dd.startWriting(lcc);
    FileInfoDescriptor fid = getInfo();
    if (fid == null)
      throw StandardException.newException(SQLState.LANG_FILE_DOES_NOT_EXIST, sqlName,schemaName);

    if (SanityManager.DEBUG)
    {
      if (id != null && !fid.getUUID().equals(id))
      {
        SanityManager.THROWASSERT("Drop id mismatch want="+id+
            " have "+fid.getUUID());
      }
    }

    String dbcp_s = PropertyUtil.getServiceProperty(lcc.getTransactionExecute(),Property.DATABASE_CLASSPATH);
    if (dbcp_s != null)
    {
      String[][]dbcp= IdUtil.parseDbClassPath(dbcp_s,
                                                            lcc.getIdentifierCasing() != lcc.ANTI_ANSI_CASING );
      boolean found = false;
      //
      //Look for the jar we are dropping on our database classpath.
      //We don't concern ourselves with 3 part names since they may
      //refer to a jar file in another database and may not occur in
      //a database classpath that is stored in the propert congomerate.
      for (int ix=0;ix<dbcp.length;ix++)
        if (dbcp.length == 2 &&
          dbcp[ix][0].equals(schemaName) && dbcp[ix][1].equals(sqlName))
          found = true;
      if (found)
        throw StandardException.newException(SQLState.LANG_CANT_DROP_JAR_ON_DB_CLASS_PATH_DURING_EXECUTION,
                  IdUtil.mkQualifiedName(schemaName,sqlName),
                  dbcp_s);
    }

    try {
   
      notifyLoader(false);
      dd.invalidateAllSPSPlans();
      DependencyManager dm = dd.getDependencyManager();
      dm.invalidateFor(fid, DependencyManager.DROP_JAR, lcc);

      dd.dropFileInfoDescriptor(fid);

      fr.remove(JarDDL.mkExternalName(schemaName, sqlName, fr.getSeparatorChar()),
        fid.getGenerationId(), true /*purgeOnCommit*/);
    } finally {
      notifyLoader(true);
    }
  }
View Full Code Here

    //Like create table we say we are writing before we read the dd
    dd.startWriting(lcc);

    //
    //Temporarily drop the FileInfoDescriptor from the data dictionary.
    FileInfoDescriptor fid = getInfo();
    if (fid == null)
      throw StandardException.newException(SQLState.LANG_FILE_DOES_NOT_EXIST, sqlName,schemaName);

    if (SanityManager.DEBUG)
    {
      if (id != null && !fid.getUUID().equals(id))
      {
        SanityManager.THROWASSERT("Replace id mismatch want="+
          id+" have "+fid.getUUID());
      }
    }

    try {
      // disable loads from this jar
      notifyLoader(false);
      dd.invalidateAllSPSPlans();
      dd.dropFileInfoDescriptor(fid);

      //
      //Replace the file.
      long generationId =
        fr.replace(JarDDL.mkExternalName(schemaName, sqlName, fr.getSeparatorChar()),
          fid.getGenerationId(), is, purgeOnCommit);

      //
      //Re-add the descriptor to the data dictionary.
      FileInfoDescriptor fid2 =
        ddg.newFileInfoDescriptor(fid.getUUID(),fid.getSchemaDescriptor(),
                sqlName,generationId);
      dd.addDescriptor(fid2, fid.getSchemaDescriptor(),
               DataDictionary.SYSFILES_CATALOG_NUM, false, lcc.getTransactionExecute());
      return generationId;
View Full Code Here

  public static Object getAsObject(String schemaName, String sqlName)
     throws StandardException
  {
    JarUtil jUtil = new JarUtil(null,schemaName,sqlName);

    FileInfoDescriptor fid = jUtil.getInfo();
    if (fid == null)
      throw StandardException.newException(SQLState.LANG_FILE_DOES_NOT_EXIST, sqlName,schemaName);

    long generationId = fid.getGenerationId();

    StorageFile f = jUtil.getAsFile(generationId);
    if (f != null)
      return f;
View Full Code Here

    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(2);
    keyRow.setColumn(1, nameOrderable);
    keyRow.setColumn(2, schemaIDOrderable);
    FileInfoDescriptor r = (FileInfoDescriptor)
          getDescriptorViaIndex(
            SYSFILESRowFactory.SYSFILES_INDEX1_ID,
            keyRow,
            (ScanQualifier [][]) null,
            ti,
View Full Code Here

   
    ExecRow              row;

    if (td != null
    {
      FileInfoDescriptor descriptor = (FileInfoDescriptor)td;
      id_S = descriptor.getUUID().toString();
      schemaId_S = descriptor.getSchemaDescriptor().getUUID().toString();
      SQLname = descriptor.getName();
      generationId = descriptor.getGenerationId();
    }
 
    /* Build the row to insert  */
    row = getExecutionFactory().getValueRow(SYSFILES_COLUMN_COUNT);

View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.dictionary.FileInfoDescriptor

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.