Re: [Spacewalk-devel] Constructor problem

2009-02-02 Thread Devan Goodwin
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Mon, 2 Feb 2009 13:54:49 +0900
Coe, Colin C. (Unix Engineer) colin@woodside.com.au wrote:

 ctx.getRequiredParam(RequestContext.NAME)

Hey Colin, Looks like this is getting populated with a Long not a
String. (a println would confirm) Are you setting name in the context
somewhere in your diff that wasn't included?

Cheers,

Devan

- -- 
  Devan Goodwin dgood...@redhat.com
  Software Engineer Spacewalk / RHN Satellite
  Halifax, Canada   650.567.9039x79267
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkmG46IACgkQAyHWaPV9my7ThACguBFNITiCuAwCMQ6sWOpeS7X1
vywAoL5rCwB9vIzbX2s43YDRk0N38Bbo
=3c3o
-END PGP SIGNATURE-

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


Re: [Spacewalk-devel] Constructor problem

2009-02-02 Thread Jesus Rodriguez
On Mon, Feb 02, 2009 at 01:54:49PM +0900, Coe, Colin C. (Unix Engineer) wrote:
 
 Hi all
 
 I'm currently working on getting the Spacewalk web GUI to be able to create 
 and manage Cobbler snippets.
 
 Right now I'm getting the following compile time error.
 
 ---
 compile-main:
 [javac] Compiling 5 source files to 
 /home/coec/git/spacewalk/java/build/classes
 [javac] 
 /home/coec/git/spacewalk/java/code/src/com/redhat/rhn/frontend/action/kickstart/cobbler/CobblerSnippetEditAction.java:28:
  cannot find symbol
 [javac] symbol  : constructor CobblerSnippetEditCommand(java.lang.Long)
 [javac] location: class 
 com.redhat.rhn.manager.kickstart.cobbler.CobblerSnippetEditCommand
 [javac] return new CobblerSnippetEditCommand(
 [javac]^
 [javac] Note: 
 /home/coec/git/spacewalk/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerSnippetEditCommand.java
  uses or overrides a deprecated API.
 [javac] Note: Recompile with -Xlint:deprecation for details.
 [javac] Note: 
 /home/coec/git/spacewalk/java/code/src/com/redhat/rhn/frontend/struts/RequestContext.java
  uses unchecked or unsafe operations.
 [javac] Note: Recompile with -Xlint:unchecked for details.
 [javac] 1 error
 ---
 
 In 
 java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerSnippetEditCommand.java
  I have
 ---
 public class CobblerSnippetEditCommand extends BaseCobblerSnippetCommand {
 
 /**
  * Create new Command and Key
  * @param snippetName of key to lookup.
  */
 public CobblerSnippetEditCommand(String snippetName) {
 super();
 }
 ---
 
 In 
 java/code/src/com/redhat/rhn/frontend/action/kickstart/cobbler/CobblerSnippetEditAction.java
  I have
 ---
 public class CobblerSnippetEditAction extends BaseCobblerSnippetEditAction {
 
 protected BaseCobblerSnippetCommand getCommand(RequestContext ctx) {
 return new CobblerSnippetEditCommand(
 ctx.getRequiredParam(RequestContext.NAME));
 }
 
 }
 ---
 
 git diff code/src/com/redhat/rhn/frontend/struts/RequestContext.java
 ---
 diff --git a/java/code/src/com/redhat/rhn/frontend/struts/RequestContext.java 
 b/java/code/src/com/redhat/rhn/frontend/struts/RequestContext.java
 index 1ca3636..7092612 100644
 --- a/java/code/src/com/redhat/rhn/frontend/struts/RequestContext.java
 +++ b/java/code/src/com/redhat/rhn/frontend/struts/RequestContext.java
 @@ -92,6 +92,7 @@ public class RequestContext {
  public static final String KICKSTART_SCRIPT_ID = kssid;
  public static final String CONFIG_FILE_ID = cfid;
  public static final String SERVER_GROUP_ID = sgid;
 +public static final String NAME = name;
  // Request Attributes go here:
  public static final String ACTIVATION_KEY = activationkey;
  public static final String KICKSTART = ksdata;
 ---
 
 
 However the error talks about 'constructor 
 CobblerSnippetEditCommand(java.lang.Long)' but this is supposed to be a 
 string.  Could someone point me in the right direction?

getRequiredParam(String) returns a Long in RequestContext. Since your
CobblerSnippetEditCommand constructor is expecting a String , and
getRequiredParam returns Long, that's why you're getting that error.

Use getParam(String paramName, boolean required) as that method
returns a String.

-- 
jesus m. rodriguez| jes...@redhat.com
sr. software engineer | irc: zeus
rhn satellite  spacewalk | 919.754.4413 (w)
rhce # 805008586930012| 919.623.0080 (c)
+---+
|  Those who cannot learn from history |
|   are doomed to repeat it.   |
|   -- George Santayana |
+---+

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


[Spacewalk-devel] PGPORT: Porting tables; contributions needed

2009-02-02 Thread Gurjeet Singh
Hi All,

I have migrated the following DB objects to work okay with Postgres:

./procs/create_first_org.sql
./tables/web_customer.sql
./tables/rhnUserGroupType.sql
./tables/rhnUserGroup.sql
./tables/rhnOrgQuota.sql
./tables/rhnUserGroup_sequences.sql
./tables/rhnServerGroupType.sql
./tables/rhnUserGroupType_data.sql
./tables/rhnServerGroup.sql
./triggers/rhnOrgQuota.sql

And follwing are the two new files:

./main.sql
./tables/dual.sql

Here I will list out the instructions and lessons learnt so that any of
you who wishes to contribute to this effort can start submitting patches.
Look at the above objects for refernce, anddo not hesitate to ask questions,
here or on IRC.

Create a local branch off of  pgsql branch, this is where all the fun is.
Copy the files you want to work on from
schema/spacewalk/rhnsat/objecttype/fileame.sql to
schema/spacewalk/postgresql/objecttype/fileame.sql and then start working
on it.

We need to migrate objects in the following order of prefernce:
Tables, Triggers, Sequences, Views, Procedures.

We are leaving out the Objects, Packages, and Synonyms for now for various
reasons. If you feel comfortable doing these, you are welcome (synonyms are
not portable, so don;t bother with those).

=== Compacting DDL ===

While migrating these objects, we wish to compact the DDL to the point where
it looks sane and does not look like a bloat. For example,

1) Remove the constraint name from NOT NULL constraints. But keep the
Foreign Key, Primary Key and CHECK constraint names.

2) Try to club together the various declarations for the same column. For
example, there a re a few table DDLs where a column is declared NOT NULL and
(either in CREATE statememt, or using ALTER TABLE), a Primary Key is also
specified on the same. In such a case, get rid of the NOT NULL, and put the
PRIMARY KEY clause right next to the column.

3) If there's a multi-column primary key, specify that in the CREATE TABLE
command itself, instead of ALTER TABLE ADD CONSTRAINT...

4) If you see a VARCHAR(1) or a CHAR(1) column datatype, and if you think
the application might be using it as a boolean (Y/N), then just put a TODO
item on top of that column saying TODO: Should this be a boolean?.

5) Convert all NUMBER datatypes to NUMERIC. Soon we will be identifying the
columns whose precision can be reduced to use just INT/BIGINT, because
Postgres' NUMERIC datatype does not perform all that well.

6) Convert all DATE datatype columns to TIMESTAMP.

7) Replace SYSDATE usage (in DEFAULTs etc. ) with CURRENT_TIMESTAMP.

8) Remember to keep the TABLESPACE clauses when you move a UNIQUE
INDEX/PRIMARY KEY from outside to inside the CREATE TABLE.

9) Sometimes there are TRIGGERS created in the same file as the table's. We
need to strip out those and create a file by the same name in triggers/
directory and create the trigger there.

10) Convert Oracle's sequence_name.nextval as nextval( 'sequence_name' ).
Same applies for curval and setval too.

11) Keep an eye open for possible caompatbility issues, you'll learn a lot.
If you find any, please make a note here, or document them in
PostgresWorklog (https://fedorahosted.org/spacewalk/wiki/PostgresWorklog)
and mark them OPEN if needed.

When done with porting an object, add that file to the main.sql and recreate
the scema as mentioned in README. You might be required to re-order a few
line isn main.sql to resolve dependency conflicts.

When you start porting, please let the list know hwere, so that we can
coordinate our efforts.

Any help provided is much appreciated.

Best regards,
--
gurjeet[.sin...@enterprisedb.com
EnterpriseDB  http://www.enterprisedb.com

singh.gurj...@{ gmail | hotmail | indiatimes | yahoo }.com
___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Re: [Spacewalk-devel] PGPORT: Another porting request.

2009-02-02 Thread Jan Pazdziora
On Mon, Feb 02, 2009 at 09:30:17PM -0400, Devan Goodwin wrote:
 
 Hey guys, blocked on another spot in the installer and wanted to queue
 these items up for porting:
 
 Out of backend/satellite_tools/satCerts.py:
 
 _query_latest_version = rhnSQL.Statement(
 SELECT nvl(version, 0) version, version orig_version, cert,
TO_CHAR(issued, '-MM-DD HH24:MI:SS') issued,
TO_CHAR(expires, '-MM-DD HH24:MI:SS') expires
   FROM rhnSatelliteCert
  WHERE label = :label
  ORDER BY version DESC NULLS LAST
 )
 
 So rhnSatelliteCert needs some mappings, I think the TO_CHAR looks
 usable in PostgreSQL, is it just the nvl that needs to change here?

It looks like nvl is in Orafce.

-- 
Jan Pazdziora | adelton at #satellite*, #brno
Satellite Engineering, Red Hat

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel