public inbox for rhdb@sourceware.org
 help / color / mirror / Atom feed
From: "B.G. M.K." <binary_data@hotmail.com>
To: rhdb@sources.redhat.com
Subject: Patch for adding "ALTER AGGREGATE RENAME" functionality to Java Administrator
Date: Tue, 23 Dec 2003 20:12:00 -0000	[thread overview]
Message-ID: <BAY8-F768EA1J6nXFh70005e6b8@hotmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 402 bytes --]

This patch adds functionality for renaming aggregates in Java Administrator 
2.0, when using a 7.4 or higher backend.

Regards,
Benjamin

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/photos&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca

[-- Attachment #2: RenameAggregate.diff --]
[-- Type: application/octet-stream, Size: 7612 bytes --]

? RenameAggregate.diff
? build
? dist
? docs
? src/com/redhat/rhdb/admin/.nbattrs
? src/com/redhat/rhdb/admin/resources/.nbattrs
? src/com/redhat/rhdb/admin/resources/Resources.java
? src/com/redhat/rhdb/admin/resources/Resources_ja_JP.java
? src/com/redhat/rhdb/admin/resources/Resources_ru_RU.java
Index: ChangeLog
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/ChangeLog,v
retrieving revision 1.2
diff -c -r1.2 ChangeLog
*** ChangeLog	23 Dec 2003 16:50:03 -0000	1.2
--- ChangeLog	23 Dec 2003 20:08:26 -0000
***************
*** 1,3 ****
--- 1,17 ----
+ 2003-12-23  Benjamin Mar Kuck  <binary_data@hotmail.com>
+ 
+ 	* src/com/redhat/rhdb/admin/AggregateUpdate.java (renameAggregate):
+ 	Add new function to rename aggregates.
+ 	* src/com/redhat/rhdb/admin/RenameDialog.java (doOKAction): Add
+ 	handling for renaming aggregates.
+ 	* src/com/redhat/rhdb/admin/resources/AdminResources.java: Add new
+ 	Strings.
+ 	* src/com/redhat/rhdb/admin/resources/Resources.java.in: Add new
+ 	aggregate menu string.
+ 	* src/com/redhat/rhdb/admin/tree/AggregateNode.java (doMenuAction):
+ 	Add handling for renaming of aggregates.
+ 	(getNodeMenu): Add new menu option for renaming aggregates.
+ 
  2003-12-19  Deepak Bhole  <ibetthisidisavailable@yahoo.ca>
  
  	* src/com/redhat/rhdb/admin/AdminBackendClient.java
Index: src/com/redhat/rhdb/admin/AggregateUpdate.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/AggregateUpdate.java,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 AggregateUpdate.java
*** src/com/redhat/rhdb/admin/AggregateUpdate.java	21 Nov 2003 18:30:20 -0000	1.1.1.1
--- src/com/redhat/rhdb/admin/AggregateUpdate.java	23 Dec 2003 20:08:26 -0000
***************
*** 179,184 ****
--- 179,212 ----
  	
  	}
  		
+    	/**
+ 	 * Renames an aggregate
+ 	 *
+ 	 * @param client The backend client.
+ 	 * @param node the invoking aggregate node.
+ 	 * @param name the new name of the aggregate.
+ 	 * @throws ObjectUpdateException if the aggregate cannot be renamed.
+ 	 */
+ 
+ 	public static void renameAggregate(AdminBackendClient client, AggregateNode node, String name) throws ObjectUpdateException {
+ 
+ 		String updateString = "ALTER AGGREGATE ";
+ 		
+ 		updateString += AdminMiscFunctions.getDoubleQuotedIdentifier(node.getParentSchemaName()) + ".";
+ 		updateString += node.getQuotedSignature();		
+ 		
+ 		updateString += " RENAME TO " + name;
+ 		
+ 		// perform the update. Any errors are passed to the parent
+ 
+ 		try {
+ 			client.performUpdate(node.getParentClusterName(), node.getParentDatabaseName(), updateString);
+ 		} catch (Exception e) {
+ 			throw new ObjectUpdateException(e.getMessage());
+ 		}	
+ 	
+ 	}
+ 
  	/**
  	 * Comments on an aggregate
  	 *
Index: src/com/redhat/rhdb/admin/RenameDialog.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/RenameDialog.java,v
retrieving revision 1.2
diff -c -r1.2 RenameDialog.java
*** src/com/redhat/rhdb/admin/RenameDialog.java	23 Dec 2003 16:50:03 -0000	1.2
--- src/com/redhat/rhdb/admin/RenameDialog.java	23 Dec 2003 20:08:27 -0000
***************
*** 232,237 ****
--- 232,239 ----
  			GroupUpdate.renameGroup(backendClient, (GroupNode) invocationNode, quotedName);
  		else if (invocationNode instanceof UserNode)
  			UserUpdate.renameUser(backendClient, (UserNode) invocationNode, quotedName);
+ 		else if (invocationNode instanceof AggregateNode)
+ 			AggregateUpdate.renameAggregate(backendClient, (AggregateNode) invocationNode, quotedName);
  
  		// Reached here => all went well
  		
Index: src/com/redhat/rhdb/admin/resources/AdminResources.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/resources/AdminResources.java,v
retrieving revision 1.2
diff -c -r1.2 AdminResources.java
*** src/com/redhat/rhdb/admin/resources/AdminResources.java	23 Dec 2003 16:50:03 -0000	1.2
--- src/com/redhat/rhdb/admin/resources/AdminResources.java	23 Dec 2003 20:08:28 -0000
***************
*** 284,289 ****
--- 284,290 ----
  	public static final String MENU_REMOVE_CLUSTER		= "remove.cluster";
  	public static final String MENU_REINDEX_INDEX = "menu.reindex.index";
  	public static final String MENU_REINDEX_TABLE = "menu.reindex.table";
+ 	public static final String MENU_RENAME_AGGREGATE = "menu.rename.aggregate";
  	public static final String MENU_RENAME_DATABASE = "menu.rename.database";
  	public static final String MENU_RENAME_COLUMN = "menu.rename.column";
  	public static final String MENU_RENAME_GROUP = "menu.rename.group";
Index: src/com/redhat/rhdb/admin/resources/Resources.java.in
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/resources/Resources.java.in,v
retrieving revision 1.2
diff -c -r1.2 Resources.java.in
*** src/com/redhat/rhdb/admin/resources/Resources.java.in	23 Dec 2003 16:50:03 -0000	1.2
--- src/com/redhat/rhdb/admin/resources/Resources.java.in	23 Dec 2003 20:08:28 -0000
***************
*** 284,289 ****
--- 284,290 ----
  		{ AdminResources.MENU_REINDEX_INDEX, "REINDEX INDEX" },
  		{ AdminResources.MENU_REINDEX_TABLE, "REINDEX TABLE..."},
  		{ AdminResources.MENU_REMOVE_CLUSTER,		"REMOVE CLUSTER" },
+ 		{ AdminResources.MENU_RENAME_AGGREGATE, "RENAME AGGREGATE..." },
  		{ AdminResources.MENU_RENAME_DATABASE, "RENAME DATABASE..." },
  		{ AdminResources.MENU_RENAME_GROUP, "RENAME GROUP..." },
  		{ AdminResources.MENU_RENAME_INDEX, "RENAME INDEX" },
Index: src/com/redhat/rhdb/admin/tree/AggregateNode.java
===================================================================
RCS file: /cvs/rhdb/src/rhdb/guitools/rhdb-admin/src/com/redhat/rhdb/admin/tree/AggregateNode.java,v
retrieving revision 1.2
diff -c -r1.2 AggregateNode.java
*** src/com/redhat/rhdb/admin/tree/AggregateNode.java	23 Dec 2003 16:50:04 -0000	1.2
--- src/com/redhat/rhdb/admin/tree/AggregateNode.java	23 Dec 2003 20:08:28 -0000
***************
*** 138,143 ****
--- 138,146 ----
                  		this.sendRefreshRequest(new TreePath(path));
  				
  			}
+ 		} else if (selectedMenuCaption == AdminResources.getString(AdminResources.MENU_RENAME_AGGREGATE)) {
+ 			RenameDialog rd = new RenameDialog(dockWindow, this, client, this.getNodeType());
+ 			rd.show();
  		} else if (selectedMenuCaption == AdminResources.getString(AdminResources.MENU_COMMENT)) {
  			String[][] metaData;
  			// get the comment
***************
*** 165,170 ****
--- 168,194 ----
  
  		menu.add(new JMenuItem(AdminResources.getString(AdminResources.MENU_DROP_RESTRICT)));
  		menu.add(new JMenuItem(AdminResources.getString(AdminResources.MENU_DROP_CASCADE)));
+ 
+ 		// Menu items that vary according to backend
+ 		
+ 		JMenuItem jmiRename = new JMenuItem();
+ 		jmiRename.setText(AdminResources.getString(AdminResources.MENU_RENAME_AGGREGATE));
+ 		jmiRename.setEnabled(false);
+ 		
+ 		try {
+ 			
+ 			// For a consistent look, if item is not available on this version, 
+ 			// we will disable it, but still show it
+ 
+ 			if (client.getBackendVersion(this.getParentClusterName()) > 7.3) {
+ 				 jmiRename.setEnabled(true);
+ 			}
+ 
+ 		} catch (Exception e) {
+ 			// Nothing.. element will remain disabled
+ 		}
+                 menu.add(jmiRename);
+ 		
  		menu.add(new JMenuItem(AdminResources.getString(AdminResources.MENU_COMMENT)));
  
  		return menu;

                 reply	other threads:[~2003-12-23 20:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BAY8-F768EA1J6nXFh70005e6b8@hotmail.com \
    --to=binary_data@hotmail.com \
    --cc=rhdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).