modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertPriority.java | 2 modules/core/domain/src/main/java/org/rhq/core/domain/auth/Principal.java | 4 modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java | 5 modules/core/domain/src/main/java/org/rhq/core/domain/util/Recordizable.java | 28 - modules/enterprise/gui/coregui/src/main/java/org/rhq/core/rebind/RecordBuilderGenerator.java | 164 ---------- modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml | 6 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerBean.java | 7 7 files changed, 8 insertions(+), 208 deletions(-)
New commits: commit 9264d30249387f2419e5f6090670c938a3333764 Author: Joseph Marques joseph@redhat.com Date: Wed Nov 24 16:45:56 2010 -0500
remove exclamation points prefixing alert priority in emails
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertPriority.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertPriority.java index ec9f880..f6424c0 100644 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertPriority.java +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertPriority.java @@ -26,7 +26,7 @@ package org.rhq.core.domain.alert; * @author Joseph Marques */ public enum AlertPriority { - LOW("! - Low"), MEDIUM("!! - Medium"), HIGH("!!! - High"); + LOW("Low"), MEDIUM("Medium"), HIGH("High");
private String displayName;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerBean.java index 7fb3fa6..a3909a1 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerBean.java @@ -106,7 +106,7 @@ public class EmailManagerBean implements EmailManagerLocal { mimeMessage.setSubject(messageSubject); mimeMessage.setContent(messageBody, "text/plain"); } catch (MessagingException e) { - e.printStackTrace(); // TODO: Customise this generated block + e.printStackTrace(); // TODO: Customise this generated block return toAddresses; }
@@ -120,7 +120,8 @@ public class EmailManagerBean implements EmailManagerLocal { InternetAddress recipient = new InternetAddress(toAddress); Transport.send(mimeMessage, new InternetAddress[] { recipient }); } catch (Exception e) { - LOG.error("Failed to send email [" + messageSubject + "] to recipient [" + toAddress + "]: " + e.getMessage()); + LOG.error("Failed to send email [" + messageSubject + "] to recipient [" + toAddress + "]: " + + e.getMessage()); badAdresses.add(toAddress);
// Remember the first error - in case its due to a session initialization problem, @@ -155,7 +156,7 @@ public class EmailManagerBean implements EmailManagerLocal { template = template.replaceAll(TEMPLATE_TOKEN_ALERT_NAME, cleanse(alertName, "?Unknown Alert?"));
//if the priority enum for alerts changes in the future, we'll be safe - template = template.replaceAll(TEMPLATE_TOKEN_PRIORITY, cleanse(priority, "!! - Medium")); + template = template.replaceAll(TEMPLATE_TOKEN_PRIORITY, cleanse(priority, "Medium"));
// better to be paranoid and on the safe side than risk it just to save one line of code template = template.replaceAll(TEMPLATE_TOKEN_TIMESTAMP, cleanse(timestamp, new Date().toString()));
commit 2cd7285a7b6de25399310fcaa5699105c1cd6cd0 Author: Joseph Marques joseph@redhat.com Date: Wed Nov 24 13:45:54 2010 -0500
will be favoring composite and/or flyweight objects in the future
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Principal.java b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Principal.java index e49db95..fa3a923 100644 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Principal.java +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Principal.java @@ -22,8 +22,6 @@ */ package org.rhq.core.domain.auth;
-import org.rhq.core.domain.util.Recordizable; - import java.io.Serializable;
import javax.persistence.Column; @@ -45,7 +43,7 @@ import javax.persistence.Table; @NamedQuery(name = Principal.QUERY_FIND_ALL_USERS, query = "SELECT m FROM Principal AS m") }) @SequenceGenerator(name = "RHQ_PRINCIPAL_ID_SEQ", sequenceName = "RHQ_PRINCIPAL_ID_SEQ", allocationSize = 10) @Table(name = "RHQ_PRINCIPAL") -public class Principal implements Serializable, Recordizable { +public class Principal implements Serializable { public static final String QUERY_FIND_BY_USERNAME = "Principal.findByUsername"; public static final String QUERY_FIND_ALL_USERS = "Principal.findAllUsers";
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java index 25bab8b..6358954 100644 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java @@ -51,13 +51,12 @@ import org.jetbrains.annotations.NotNull; import org.rhq.core.domain.authz.Role; import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.resource.group.ResourceGroup; -import org.rhq.core.domain.util.Recordizable;
/** * @author Greg Hinkle */ @Entity -@NamedQueries({ +@NamedQueries( { @NamedQuery(name = Subject.QUERY_FIND_BY_IDS, query = "" // + "SELECT s " // + " FROM Subject s " // @@ -201,7 +200,7 @@ import org.rhq.core.domain.util.Recordizable; @SequenceGenerator(name = "RHQ_SUBJECT_ID_SEQ", sequenceName = "RHQ_SUBJECT_ID_SEQ") @Table(name = "RHQ_SUBJECT") /*@Cache(usage= CacheConcurrencyStrategy.TRANSACTIONAL)*/ -public class Subject implements Serializable, Recordizable { +public class Subject implements Serializable { public static final String QUERY_FIND_ALL = "Subject.findAll"; public static final String QUERY_FIND_BY_IDS = "Subject.findByIds"; public static final String QUERY_FIND_BY_NAME = "Subject.findByName"; diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/util/Recordizable.java b/modules/core/domain/src/main/java/org/rhq/core/domain/util/Recordizable.java deleted file mode 100644 index 262d131..0000000 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/util/Recordizable.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2010 Red Hat, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package org.rhq.core.domain.util; - -/** - * A marker interface for generating Record builders - * - * @author Greg Hinkle - */ -public interface Recordizable { - -} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/rebind/RecordBuilderGenerator.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/rebind/RecordBuilderGenerator.java deleted file mode 100644 index 940b7de..0000000 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/core/rebind/RecordBuilderGenerator.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2010 Red Hat, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package org.rhq.core.rebind; - -import java.io.PrintWriter; - -import javax.persistence.Entity; - -import com.google.gwt.core.ext.Generator; -import com.google.gwt.core.ext.GeneratorContext; -import com.google.gwt.core.ext.TreeLogger; -import com.google.gwt.core.ext.UnableToCompleteException; -import com.google.gwt.core.ext.typeinfo.JClassType; -import com.google.gwt.core.ext.typeinfo.JField; -import com.google.gwt.core.ext.typeinfo.NotFoundException; -import com.google.gwt.core.ext.typeinfo.TypeOracle; -import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; -import com.google.gwt.user.rebind.SourceWriter; - -/** - * This is the start to a rebinder for our domain entities to allow for the - * easy generation of Smart's Record objects. - * - * TODO: Get this working. - * TODO: This should ideally be moved to a separate Maven module (e.g. rhq-gwt-tools.jar), - * since it's not part of coregui.war, but rather, a tool used to help compile it. - * - * @author Greg Hinkle - */ -public class RecordBuilderGenerator extends Generator { - - protected TreeLogger logger; - private String packageName; - private String qualifiedStubClassName; - private JClassType requestedClass; - private String simpleStubClassName; - private SourceWriter sourceWriter; - private TypeOracle typeOracle; - - /** - * Create a new type that satisfies the rebind request. - */ - @Override - public String generate(TreeLogger logger, GeneratorContext context, String typeName) - throws UnableToCompleteException { - - System.out.println("classType " + typeName); - - if (!init(logger, context, typeName)) { - return null; - } - - writeSource(); - sourceWriter.commit(logger); - - return qualifiedStubClassName; - } - - protected JClassType getRequestedClass() { - return requestedClass; - } - - protected SourceWriter getSourceWriter() { - return sourceWriter; - } - - protected TypeOracle getTypeOracle() { - return typeOracle; - } - - protected void writeSource() throws UnableToCompleteException { - - JField[] fields = requestedClass.getFields(); - - writeBuildRecordMethod(fields, sourceWriter); - } - - /** - * Gets the name of the native stub class. - */ - private String getSimpleStubClassName(JClassType baseClass) { - return "__" + baseClass.getSimpleSourceName() + "_RecordBuilder"; - } - - private SourceWriter getSourceWriter(TreeLogger logger, GeneratorContext ctx, String packageName, String className, - String superclassName) { - - PrintWriter printWriter = ctx.tryCreate(logger, packageName, className); - if (printWriter == null) { - return null; - } - - ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(packageName, className); - - composerFactory.setSuperclass(superclassName); - - return composerFactory.createSourceWriter(ctx, printWriter); - } - - private boolean init(TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException { - this.logger = logger; - typeOracle = context.getTypeOracle(); - assert typeOracle != null; - - try { - requestedClass = typeOracle.getType(typeName); - } catch (NotFoundException e) { - logger.log(TreeLogger.ERROR, "Could not find type '" + typeName - + "'; please see the log, as this usually indicates a previous error ", e); - throw new UnableToCompleteException(); - } - - if (requestedClass.getAnnotation(Entity.class) == null) { - System.out.println("Not an entity: " + typeName); - return false; - } - - System.out.println("$$$$$$$$Making a record builder for: " + typeName); - - // Get the stub class name, and see if its source file exists. - // - simpleStubClassName = getSimpleStubClassName(requestedClass); - packageName = requestedClass.getPackage().getName(); - qualifiedStubClassName = packageName + "." + simpleStubClassName; - - sourceWriter = getSourceWriter(logger, context, packageName, simpleStubClassName, requestedClass - .getQualifiedSourceName()); - - return sourceWriter != null; - } - - private void writeBuildRecordMethod(JField[] fields, SourceWriter sw) { - sw.println(); - sw.println("protected final com.smartgwt.client.data.Record buildRecord(" - + requestedClass.getQualifiedSourceName() + " entity) throws Throwable {"); - sw.indent(); - - sw.println("com.smartgwt.client.data.Record record = new com.smartgwt.client.data.Record();"); - - for (JField field : fields) { - sw.println("record.setAttribute("" + field.getName() + "", " + field.getName() + ");"); - } - sw.println("return record;"); - sw.outdent(); - sw.println("}"); - } - -} diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml index 9579f03..3ef0391 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml @@ -49,12 +49,6 @@ --> <set-property name="log_DivLogger" value="DISABLED" />
- <!-- - <generate-with class="org.rhq.core.rebind.RecordBuilderGenerator"> - <when-type-assignable class="org.rhq.core.domain.util.Recordizable"/> - </generate-with> - --> - <replace-with class="org.rhq.enterprise.gui.coregui.client.components.upload.DynamicCallbackFormImpl"> <when-type-is class="org.rhq.enterprise.gui.coregui.client.components.upload.DynamicCallbackFormImpl"/> </replace-with>