[rhq] Branch 'content' - modules/core
by Pradeep Kilambi
modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit a466a081be06673a9cb047e2dd745cdab400684a
Author: Pradeep Kilambi <pkilambi(a)redhat.com>
Date: Tue Nov 24 17:09:17 2009 -0500
bumping url field size to 256
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
index ad47c4a..8932862 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
@@ -476,7 +476,7 @@
<table name="RHQ_ADVISORY_BUGLIST">
<column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/>
- <column name="BUG_ID" size="64" type="VARCHAR2" required="true"/>
+ <column name="BUG_ID" size="256" type="VARCHAR2" required="true"/>
<column name="LAST_MODIFIED" type="LONG" required="true"/>
<column name="CTIME" type="LONG" required="true"/>
14 years, 5 months
[rhq] Branch 'content' - modules/core modules/enterprise
by Mike McCune
modules/core/dbutils/pom.xml | 2
modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml | 12
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 33 +
modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSource.java | 33 -
modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceSyncResults.java | 8
modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceSyncStatus.java | 27 -
modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSyncStatus.java | 27 +
modules/core/domain/src/main/java/org/rhq/core/domain/content/Repo.java | 57 +++
modules/core/domain/src/main/java/org/rhq/core/domain/content/RepoSyncResults.java | 168 ++++++++++
modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceSyncResultsTest.java | 6
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java | 6
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java | 35 --
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/ContentProviderManager.java | 84 +----
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java | 5
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentSourceManagerBeanTest.java | 4
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/RepoManagerBeanTest.java | 38 --
16 files changed, 367 insertions(+), 178 deletions(-)
New commits:
commit 08a2b166ec8994e6419728d58c8e1bab9c28530b
Author: Mike McCune <mmccune(a)gibson.pdx.redhat.com>
Date: Tue Nov 24 10:46:47 2009 -0800
1102 - adding RepoSyncResults
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index f352799..b375393 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -22,7 +22,7 @@
<properties>
<scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.71</db.schema.version>
+ <db.schema.version>2.72</db.schema.version>
</properties>
<dependencies>
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
index 8e6e627..ad47c4a 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
@@ -208,9 +208,19 @@
<column name="START_TIME" type="LONG" required="true"/>
<column name="END_TIME" type="LONG" required="false"/>
<column name="RESULTS" type="LONGVARCHAR" required="false"/>
-
<column name="CONTENT_SRC_ID" type="INTEGER" required="true" references="RHQ_CONTENT_SOURCE"/>
</table>
+
+ <table name="RHQ_REPO_SYNC">
+ <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/>
+ <column name="STATUS" type="VARCHAR2" size="16" required="true"/>
+ <column name="START_TIME" type="LONG" required="true"/>
+ <column name="END_TIME" type="LONG" required="false"/>
+ <column name="RESULTS" type="LONGVARCHAR" required="false"/>
+ <column name="PERCENT_COMPLETE" type="LONGVARCHAR" required="false"/>
+ <column name="REPO_ID" type="INTEGER" required="true" references="RHQ_REPO"/>
+ </table>
+
<table name="RHQ_PACKAGE_INST_STEP">
<column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index eaeef31..a863d45 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -2637,9 +2637,36 @@
REFERENCES RHQ_REPO ( ID )
</statement>
</schema-directSQL>
-
</schemaSpec>
-
- </dbupgrade>
+
+ <!-- Adding repo_sync support -->
+ <schemaSpec version="2.72">
+ <schema-createSequence name="RHQ_REPO_SYNC_ID_SEQ" initial="10001" />
+ <schema-directSQL>
+ <statement>
+ CREATE TABLE RHQ_REPO_SYNC ( ID INTEGER PRIMARY KEY )
+ </statement>
+ </schema-directSQL>
+ <schema-alterColumn table="RHQ_REPO_SYNC" column="ID" nullable="false" />
+ <schema-addColumn table="RHQ_REPO_SYNC" column="STATUS" precision="16" columnType="VARCHAR2" />
+ <schema-alterColumn table="RHQ_REPO_SYNC" column="STATUS" nullable="false" />
+ <schema-addColumn table="RHQ_REPO_SYNC" column="START_TIME" columnType="INTEGER" />
+ <schema-alterColumn table="RHQ_REPO_SYNC" column="START_TIME" nullable="false" />
+ <schema-addColumn table="RHQ_REPO_SYNC" column="END_TIME" columnType="INTEGER" />
+ <schema-addColumn table="RHQ_REPO_SYNC" column="RESULTS" columnType="LONGVARCHAR" />
+ <schema-addColumn table="RHQ_REPO_SYNC" column="PERCENT_COMPLETE" columnType="LONG" />
+ <schema-addColumn table="RHQ_REPO_SYNC" column="REPO_ID" columnType="INTEGER" />
+ <schema-alterColumn table="RHQ_REPO_SYNC" column="REPO_ID" nullable="false" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_REPO_SYNC foreign key relation to RHQ_REPO for scheduled jobs">
+ ALTER TABLE RHQ_REPO_SYNC
+ ADD CONSTRAINT RHQ_REPO_SYNC_REPO_ID_FKEY
+ FOREIGN KEY (REPO_ID)
+ REFERENCES RHQ_REPO (ID)
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
+
+ </dbupgrade>
</target>
</project>
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSource.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSource.java
index 80cedf7..511da1a 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSource.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSource.java
@@ -24,9 +24,6 @@ package org.rhq.core.domain.content;
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -141,7 +138,7 @@ public class ContentSource implements Serializable {
@OneToMany(mappedBy = "contentSource", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
private Set<RepoContentSource> repoContentSources;
- // Constructor
+ // Constructor asdf
public ContentSource() {
// for JPA use
@@ -294,35 +291,9 @@ public class ContentSource implements Serializable {
}
/**
- * The list of sync results; ordered with the latest results first in the list guaranteed.
- * guaranteed.
+ * The list of sync results - order not ensured
*/
public List<ContentSourceSyncResults> getSyncResults() {
-
- Comparator dc = new Comparator() {
- public int compare(Object arg0, Object arg1) {
- long currTime = System.currentTimeMillis();
- ContentSourceSyncResults c1 = (ContentSourceSyncResults) arg0;
- ContentSourceSyncResults c2 = (ContentSourceSyncResults) arg1;
- Date d1 = null;
- Date d2 = null;
-
- if (c1.getEndTime() == null) {
- d1 = new Date(currTime);
- } else {
- d1 = new Date(c1.getEndTime());
- }
- if (c2.getEndTime() == null) {
- d2 = new Date(currTime);
- } else {
- d2 = new Date(c2.getEndTime());
- }
- return d1.compareTo(d2);
- }
- };
-
- Collections.sort(syncResults, dc);
-
return syncResults;
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceSyncResults.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceSyncResults.java
index 25ce4f5..87fb2d3 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceSyncResults.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceSyncResults.java
@@ -72,7 +72,7 @@ public class ContentSourceSyncResults implements Serializable {
@Column(name = "STATUS", nullable = false)
@Enumerated(EnumType.STRING)
- private ContentSourceSyncStatus status;
+ private ContentSyncStatus status;
@Column(name = "START_TIME", nullable = false)
private long startTime;
@@ -85,7 +85,7 @@ public class ContentSourceSyncResults implements Serializable {
protected ContentSourceSyncResults() {
this.startTime = System.currentTimeMillis();
- this.status = ContentSourceSyncStatus.INPROGRESS;
+ this.status = ContentSyncStatus.INPROGRESS;
}
public ContentSourceSyncResults(ContentSource contentSource) {
@@ -115,11 +115,11 @@ public class ContentSourceSyncResults implements Serializable {
/**
* The status that typically indicates if the sync request succeeded, failed or is currently in progress.
*/
- public ContentSourceSyncStatus getStatus() {
+ public ContentSyncStatus getStatus() {
return status;
}
- public void setStatus(ContentSourceSyncStatus status) {
+ public void setStatus(ContentSyncStatus status) {
this.status = status;
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceSyncStatus.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceSyncStatus.java
deleted file mode 100644
index e304a41..0000000
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSourceSyncStatus.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 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, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * 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 and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.core.domain.content;
-
-public enum ContentSourceSyncStatus {
- INPROGRESS, SUCCESS, FAILURE, NONE
-}
\ No newline at end of file
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSyncStatus.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSyncStatus.java
new file mode 100644
index 0000000..799640d
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/ContentSyncStatus.java
@@ -0,0 +1,27 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.content;
+
+public enum ContentSyncStatus {
+ INPROGRESS, SUCCESS, FAILURE, NONE
+}
\ No newline at end of file
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/Repo.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/Repo.java
index 2d1d0aa..efcaa0c 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/Repo.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/Repo.java
@@ -23,7 +23,12 @@
package org.rhq.core.domain.content;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import javax.persistence.CascadeType;
@@ -36,6 +41,7 @@ import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
+import javax.persistence.OrderBy;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.SequenceGenerator;
@@ -93,8 +99,7 @@ import org.rhq.core.domain.resource.Resource;
+ " WHERE rcs.repo.id = r.id " //
+ " AND rcs.contentSource.id = :contentSourceId) = 1 " //
+ "AND (SELECT COUNT(rcs) FROM RepoContentSource rcs" //
- + " WHERE rcs.repo.id = r.id) = 1 ")
- })
+ + " WHERE rcs.repo.id = r.id) = 1 ") })
@SequenceGenerator(name = "SEQ", sequenceName = "RHQ_REPO_ID_SEQ")
@Table(name = "RHQ_REPO")
public class Repo implements Serializable, Taggable {
@@ -157,6 +162,11 @@ public class Repo implements Serializable, Taggable {
@OneToMany(mappedBy = "repo", fetch = FetchType.LAZY)
private Set<RepoTag> repoTags;
+ @OneToMany(mappedBy = "repo", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
+ @OrderBy("startTime DESC")
+ // latest appears first, oldest last
+ private List<RepoSyncResults> syncResults;
+
@Transient
private String syncStatus;
@@ -337,6 +347,7 @@ public class Repo implements Serializable, Taggable {
*/
@Transient
public String getSyncStatus() {
+
return this.syncStatus;
}
@@ -791,4 +802,46 @@ public class Repo implements Serializable, Taggable {
public void setSyncStatus(String syncStatusIn) {
this.syncStatus = syncStatusIn;
}
+
+ public void addSyncResult(RepoSyncResults syncResult) {
+ if (this.syncResults == null) {
+ this.syncResults = new ArrayList<RepoSyncResults>();
+ }
+
+ this.syncResults.add(syncResult);
+ syncResult.setRepo(this);
+ }
+
+ /**
+ * The list of sync results - order ENSURED by date sort on start and end times
+ */
+ public List<RepoSyncResults> getSyncResults() {
+
+ Comparator dc = new Comparator() {
+ public int compare(Object arg0, Object arg1) {
+ long currTime = System.currentTimeMillis();
+ ContentSourceSyncResults c1 = (ContentSourceSyncResults) arg0;
+ ContentSourceSyncResults c2 = (ContentSourceSyncResults) arg1;
+ Date d1 = null;
+ Date d2 = null;
+
+ if (c1.getEndTime() == null) {
+ d1 = new Date(currTime);
+ } else {
+ d1 = new Date(c1.getEndTime());
+ }
+ if (c2.getEndTime() == null) {
+ d2 = new Date(currTime);
+ } else {
+ d2 = new Date(c2.getEndTime());
+ }
+ return d1.compareTo(d2);
+ }
+ };
+
+ Collections.sort(syncResults, dc);
+
+ return syncResults;
+ }
+
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/RepoSyncResults.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/RepoSyncResults.java
new file mode 100644
index 0000000..a6c0050
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/RepoSyncResults.java
@@ -0,0 +1,168 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.content;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+
+/**
+ * Represents the results of a repo sync request. When a {@link Repo} synchronizes with its remote
+ * backend, the results of that are stored in this object.
+ *
+ */
+@Entity
+@NamedQueries( {
+ @NamedQuery(name = RepoSyncResults.QUERY_GET_INPROGRESS_BY_REPO_ID, query = "SELECT rssr "
+ + " FROM RepoSyncResults rssr " + " WHERE rssr.repo.id = :repoId " + " AND status = 'INPROGRESS' "
+ + " ORDER BY rssr.startTime DESC "),
+ @NamedQuery(name = RepoSyncResults.QUERY_GET_ALL_BY_REPO_ID, query = "SELECT rssr "
+ + " FROM RepoSyncResults rssr " + " WHERE rssr.repo.id = :repoId ") })
+@SequenceGenerator(name = "SEQ", sequenceName = "RHQ_REPO_SYNC_ID_SEQ")
+@Table(name = "RHQ_REPO_SYNC")
+public class RepoSyncResults implements Serializable {
+ public static final String QUERY_GET_INPROGRESS_BY_REPO_ID = "RepoSyncResults.getInProgressByRepoId";
+ public static final String QUERY_GET_ALL_BY_REPO_ID = "RepoSyncResults.getAllByRepoId";
+
+ private static final long serialVersionUID = 1L;
+
+ @Column(name = "ID", nullable = false)
+ @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ")
+ @Id
+ private int id;
+
+ @JoinColumn(name = "REPO_ID", referencedColumnName = "ID", nullable = false)
+ @ManyToOne(fetch = FetchType.LAZY)
+ private Repo repo;
+
+ @Column(name = "STATUS", nullable = false)
+ @Enumerated(EnumType.STRING)
+ private ContentSyncStatus status;
+
+ @Column(name = "START_TIME", nullable = false)
+ private long startTime;
+
+ @Column(name = "END_TIME", nullable = true)
+ private Long endTime;
+
+ @Column(name = "RESULTS", nullable = true)
+ private String results;
+
+ protected RepoSyncResults() {
+ this.startTime = System.currentTimeMillis();
+ this.status = ContentSyncStatus.INPROGRESS;
+ }
+
+ public RepoSyncResults(Repo repoIn) {
+ this();
+ this.repo = repoIn;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ /**
+ * The Repo that performed the sync.
+ */
+ public Repo getRepo() {
+ return repo;
+ }
+
+ public void setRepo(Repo repoIn) {
+ this.repo = repoIn;
+ }
+
+ /**
+ * The status that typically indicates if the sync request succeeded, failed or is currently in progress.
+ */
+ public ContentSyncStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(ContentSyncStatus status) {
+ this.status = status;
+ }
+
+ /**
+ * Indicates when the sync began.
+ */
+ public long getStartTime() {
+ return startTime;
+ }
+
+ public void setStartTime(long startTime) {
+ this.startTime = startTime;
+ }
+
+ /**
+ * Indicates when the sync stopped.
+ */
+ public Long getEndTime() {
+ return endTime;
+ }
+
+ public void setEndTime(Long endTime) {
+ this.endTime = endTime;
+ }
+
+ /**
+ * Tells you the results of the sync.
+ */
+ public String getResults() {
+ return results;
+ }
+
+ public void setResults(String results) {
+ this.results = results;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder str = new StringBuilder(this.getClass().getSimpleName() + ": ");
+ str.append("start-time=[" + new Date(startTime));
+ str.append("], end-time=[" + ((endTime != null) ? new Date(endTime) : "---"));
+ str.append("], status=[" + status);
+ str.append("], repo=[" + repo);
+ str.append("]");
+ return str.toString();
+ }
+}
\ No newline at end of file
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceSyncResultsTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceSyncResultsTest.java
index 156bfa2..eed6b3f 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceSyncResultsTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/content/test/ContentSourceSyncResultsTest.java
@@ -31,7 +31,7 @@ import org.testng.annotations.Test;
import org.rhq.core.domain.content.Architecture;
import org.rhq.core.domain.content.ContentSource;
import org.rhq.core.domain.content.ContentSourceSyncResults;
-import org.rhq.core.domain.content.ContentSourceSyncStatus;
+import org.rhq.core.domain.content.ContentSyncStatus;
import org.rhq.core.domain.content.ContentSourceType;
import org.rhq.core.domain.content.Package;
import org.rhq.core.domain.content.PackageType;
@@ -83,13 +83,13 @@ public class ContentSourceSyncResultsTest extends AbstractEJB3Test {
assert syncResults.size() == 1;
results = syncResults.get(0);
assert results.getContentSource().equals(cs);
- assert results.getStatus() == ContentSourceSyncStatus.INPROGRESS;
+ assert results.getStatus() == ContentSyncStatus.INPROGRESS;
assert results.getResults() == null;
assert results.getEndTime() == null;
assert results.getStartTime() <= System.currentTimeMillis();
results.setEndTime(System.currentTimeMillis());
- results.setStatus(ContentSourceSyncStatus.FAILURE);
+ results.setStatus(ContentSyncStatus.FAILURE);
results.setResults("dummy failure");
results = em.merge(results);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
index 1365208..40bc541 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
@@ -59,7 +59,7 @@ import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.content.Architecture;
import org.rhq.core.domain.content.ContentSource;
import org.rhq.core.domain.content.ContentSourceSyncResults;
-import org.rhq.core.domain.content.ContentSourceSyncStatus;
+import org.rhq.core.domain.content.ContentSyncStatus;
import org.rhq.core.domain.content.ContentSourceType;
import org.rhq.core.domain.content.Distribution;
import org.rhq.core.domain.content.DistributionFile;
@@ -893,7 +893,7 @@ public class ContentSourceManagerBean implements ContentSourceManagerLocal {
// happened that left them in a bad state which will most likely never change unless we do it here.
// If a content source sync takes longer than 24 hours, then we've made a bad assumption here and
// this code needs to change - though I doubt any content source will take 24 hours to sync.
- if (results.getStatus() == ContentSourceSyncStatus.INPROGRESS) {
+ if (results.getStatus() == ContentSyncStatus.INPROGRESS) {
if ((System.currentTimeMillis() - inprogressList.get(0).getStartTime()) < (1000 * 60 * 60 * 24)) {
alreadyInProgress = true;
inprogressList.remove(0); // we need to leave this one as-is, so get rid of it from list
@@ -902,7 +902,7 @@ public class ContentSourceManagerBean implements ContentSourceManagerLocal {
// take this time to mark all old inprogress results as failed
for (ContentSourceSyncResults inprogress : inprogressList) {
- inprogress.setStatus(ContentSourceSyncStatus.FAILURE);
+ inprogress.setStatus(ContentSyncStatus.FAILURE);
inprogress.setEndTime(System.currentTimeMillis());
inprogress.setResults("This synchronization seems to have stalled or ended abnormally.");
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java
index 4f9ec58..b34c324 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java
@@ -40,8 +40,7 @@ import org.jboss.annotation.IgnoreDependency;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.content.ContentSource;
-import org.rhq.core.domain.content.ContentSourceSyncResults;
-import org.rhq.core.domain.content.ContentSourceSyncStatus;
+import org.rhq.core.domain.content.ContentSyncStatus;
import org.rhq.core.domain.content.Distribution;
import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.content.PackageVersionContentSource;
@@ -54,6 +53,7 @@ import org.rhq.core.domain.content.RepoPackageVersion;
import org.rhq.core.domain.content.RepoRelationship;
import org.rhq.core.domain.content.RepoRelationshipType;
import org.rhq.core.domain.content.RepoRepoRelationship;
+import org.rhq.core.domain.content.RepoSyncResults;
import org.rhq.core.domain.content.ResourceRepo;
import org.rhq.core.domain.content.composite.RepoComposite;
import org.rhq.core.domain.criteria.PackageVersionCriteria;
@@ -892,27 +892,22 @@ public class RepoManagerBean implements RepoManagerLocal, RepoManagerRemote {
public String calculateSyncStatus(Subject subject, int repoId) {
Repo found = this.getRepo(subject, repoId);
- Set<ContentSourceSyncStatus> stati = new HashSet<ContentSourceSyncStatus>();
- Set<ContentSource> contentSources = found.getContentSources();
- Iterator<ContentSource> i = contentSources.iterator();
- while (i.hasNext()) {
- ContentSource cs = i.next();
- List<ContentSourceSyncResults> syncResults = cs.getSyncResults();
- // Add the most recent sync results status
- if (syncResults != null && (!syncResults.isEmpty()) && syncResults.get(0) != null) {
- stati.add(syncResults.get(0).getStatus());
- } else {
- stati.add(ContentSourceSyncStatus.NONE);
- }
+ Set<ContentSyncStatus> stati = new HashSet<ContentSyncStatus>();
+ List<RepoSyncResults> syncResults = found.getSyncResults();
+ // Add the most recent sync results status
+ if (syncResults != null && (!syncResults.isEmpty()) && syncResults.get(0) != null) {
+ stati.add(syncResults.get(0).getStatus());
+ } else {
+ stati.add(ContentSyncStatus.NONE);
}
- if (stati.contains(ContentSourceSyncStatus.FAILURE)) {
- return ContentSourceSyncStatus.FAILURE.toString();
+ if (stati.contains(ContentSyncStatus.FAILURE)) {
+ return ContentSyncStatus.FAILURE.toString();
}
- if (stati.contains(ContentSourceSyncStatus.INPROGRESS)) {
- return ContentSourceSyncStatus.INPROGRESS.toString();
+ if (stati.contains(ContentSyncStatus.INPROGRESS)) {
+ return ContentSyncStatus.INPROGRESS.toString();
}
- if (stati.contains(ContentSourceSyncStatus.SUCCESS)) {
- return ContentSourceSyncStatus.SUCCESS.toString();
+ if (stati.contains(ContentSyncStatus.SUCCESS)) {
+ return ContentSyncStatus.SUCCESS.toString();
}
return null;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/ContentProviderManager.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/ContentProviderManager.java
index 6bb8b41..1e195fb 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/ContentProviderManager.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/ContentProviderManager.java
@@ -38,8 +38,8 @@ import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.content.ContentSource;
import org.rhq.core.domain.content.ContentSourceSyncResults;
-import org.rhq.core.domain.content.ContentSourceSyncStatus;
import org.rhq.core.domain.content.ContentSourceType;
+import org.rhq.core.domain.content.ContentSyncStatus;
import org.rhq.core.domain.content.Repo;
import org.rhq.core.domain.util.PageControl;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
@@ -93,7 +93,6 @@ public class ContentProviderManager {
return inputStream;
}
-
/**
* Asks that the adapter responsible for the given content source return a stream to the
* DistributionFile bits for the DistributionFile at the given location.
@@ -103,8 +102,7 @@ public class ContentProviderManager {
* @return the stream to the DistributionFile bits
* @throws Exception if the adapter failed to load the bits
*/
- public InputStream loadDistributionFileBits(int contentSourceId, String location)
- throws Exception {
+ public InputStream loadDistributionFileBits(int contentSourceId, String location) throws Exception {
ContentProvider adapter = getIsolatedContentProvider(contentSourceId);
DistributionSource distSource = (DistributionSource) adapter;
@@ -112,8 +110,7 @@ public class ContentProviderManager {
if (inputStream == null) {
throw new Exception("Adapter for content source [" + contentSourceId
- + "] failed to give us a stream to the distribution file at location [" + location +
- "]");
+ + "] failed to give us a stream to the distribution file at location [" + location + "]");
}
return inputStream;
@@ -145,11 +142,9 @@ public class ContentProviderManager {
StringBuilder progress = new StringBuilder();
try {
- ContentSource contentSource = contentSourceManager
- .getContentSource(overlord, contentSourceId);
+ ContentSource contentSource = contentSourceManager.getContentSource(overlord, contentSourceId);
if (contentSource == null) {
- throw new Exception(
- "Cannot sync a non-existing content source [" + contentSourceId + "]");
+ throw new Exception("Cannot sync a non-existing content source [" + contentSourceId + "]");
}
// This should not take very long so it should be OK to block other callers.
@@ -159,8 +154,7 @@ public class ContentProviderManager {
// We can come back and revisit if we need more fine-grained locking.
synchronized (synchronizeContentSourceLock) {
progress.append(new Date()).append(": ");
- progress.append("Start synchronization of content provider [")
- .append(contentSource.getName()).append(
+ progress.append("Start synchronization of content provider [").append(contentSource.getName()).append(
"]");
progress.append('\n');
progress.append(new Date()).append(": ");
@@ -182,16 +176,14 @@ public class ContentProviderManager {
return false;
}
- RepoSourceSynchronizer repoSourceSynchronizer =
- new RepoSourceSynchronizer(contentSource, provider);
+ RepoSourceSynchronizer repoSourceSynchronizer = new RepoSourceSynchronizer(contentSource, provider);
repoSourceSynchronizer.synchronizeCandidateRepos(progress);
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
if (results != null) {
// try to reload the results in case it was updated by the SLSB before the
// exception happened
- ContentSourceSyncResults reloadedResults = contentSourceManager
- .getContentSourceSyncResults(results.getId());
+ ContentSourceSyncResults reloadedResults = contentSourceManager.getContentSourceSyncResults(results
+ .getId());
if (reloadedResults != null) {
results = reloadedResults;
if (results.getResults() != null) {
@@ -205,7 +197,7 @@ public class ContentProviderManager {
progress.append("SYNCHRONIZATION ERROR - STACK TRACE FOLLOWS:\n");
progress.append(baos.toString());
results.setResults(progress.toString());
- results.setStatus(ContentSourceSyncStatus.FAILURE);
+ results.setStatus(ContentSyncStatus.FAILURE);
// finally clause will merge this
}
@@ -254,13 +246,12 @@ public class ContentProviderManager {
for (ContentSource source : repo.getContentSources()) {
ContentProvider provider = getIsolatedContentProvider(source.getId());
- PackageSourceSynchronizer packageSourceSynchronizer =
- new PackageSourceSynchronizer(repo, source, provider);
+ PackageSourceSynchronizer packageSourceSynchronizer = new PackageSourceSynchronizer(repo, source, provider);
packageSourceSynchronizer.synchronizePackageMetadata();
packageSourceSynchronizer.synchronizePackageBits();
- DistributionSourceSynchronizer distributionSourceSynchronizer =
- new DistributionSourceSynchronizer(repo, source, provider);
+ DistributionSourceSynchronizer distributionSourceSynchronizer = new DistributionSourceSynchronizer(repo,
+ source, provider);
distributionSourceSynchronizer.synchronizeDistributionMetadata();
distributionSourceSynchronizer.synchronizeDistributionBits();
}
@@ -281,8 +272,7 @@ public class ContentProviderManager {
try {
adapter.testConnection();
- }
- catch (Throwable t) {
+ } catch (Throwable t) {
return false;
}
@@ -326,11 +316,8 @@ public class ContentProviderManager {
ContentProvider adapter = getIsolatedContentSourceAdapter(contentSource);
adapter.initialize(contentSource.getConfiguration());
- }
- catch (Exception e) {
- log.warn(
- "Failed to initialize adapter for content source [" + contentSource.getName() + "]",
- e);
+ } catch (Exception e) {
+ log.warn("Failed to initialize adapter for content source [" + contentSource.getName() + "]", e);
throw new InitializationException(e);
}
}
@@ -358,10 +345,8 @@ public class ContentProviderManager {
ContentProvider adapter = getIsolatedContentSourceAdapter(contentSource);
adapter.shutdown();
- }
- catch (Throwable t) {
- log.warn(
- "Failed to shutdown adapter for content source [" + contentSource.getName() + "]", t);
+ } catch (Throwable t) {
+ log.warn("Failed to shutdown adapter for content source [" + contentSource.getName() + "]", t);
} finally {
this.adapters.remove(contentSource);
}
@@ -398,8 +383,7 @@ public class ContentProviderManager {
}
}
- throw new RuntimeException(
- "Content source ID [" + contentProviderId + "] doesn't exist; can't get adapter");
+ throw new RuntimeException("Content source ID [" + contentProviderId + "] doesn't exist; can't get adapter");
}
/**
@@ -414,14 +398,12 @@ public class ContentProviderManager {
protected void initialize(ContentServerPluginManager pluginManager) {
this.pluginManager = pluginManager;
- ContentSourceMetadataManagerLocal metadataManager = LookupUtil
- .getContentSourceMetadataManager();
+ ContentSourceMetadataManagerLocal metadataManager = LookupUtil.getContentSourceMetadataManager();
ContentSourceManagerLocal contentSourceManager = LookupUtil.getContentSourceManager();
// Our plugin manager should have parsed all descriptors and have our types for us.
// Let's register the types to make sure they are merged with the old existing types.
- ContentSourcePluginMetadataManager pluginMetadataManager = this.pluginManager
- .getMetadataManager();
+ ContentSourcePluginMetadataManager pluginMetadataManager = this.pluginManager.getMetadataManager();
Set<ContentSourceType> allTypes = pluginMetadataManager.getAllContentSourceTypes();
metadataManager.registerTypes(allTypes);
@@ -437,8 +419,7 @@ public class ContentProviderManager {
for (ContentSource contentSource : contentSources) {
try {
startAdapter(contentSource);
- }
- catch (Exception e) {
+ } catch (Exception e) {
log.warn("Failed to start adapator for content source [" + contentSource + "]");
}
}
@@ -484,8 +465,7 @@ public class ContentProviderManager {
* @return the adapter that is communicating with the content source, isolated to its classloader
* @throws RuntimeException if there is no content source adapter available
*/
- protected ContentProvider getIsolatedContentSourceAdapter(ContentSource contentSource)
- throws RuntimeException {
+ protected ContentProvider getIsolatedContentSourceAdapter(ContentSource contentSource) throws RuntimeException {
ContentProvider adapter;
synchronized (this.adapters) {
@@ -496,11 +476,9 @@ public class ContentProviderManager {
throw new RuntimeException("There is no adapter for content source [" + adapter + "]");
}
- ServerPluginEnvironment env = this.pluginManager
- .getPluginEnvironment(contentSource.getContentSourceType());
+ ServerPluginEnvironment env = this.pluginManager.getPluginEnvironment(contentSource.getContentSourceType());
if (env == null) {
- throw new RuntimeException(
- "There is no plugin env. for content source [" + contentSource + "]");
+ throw new RuntimeException("There is no plugin env. for content source [" + contentSource + "]");
}
ClassLoader classLoader = env.getPluginClassLoader();
@@ -538,8 +516,7 @@ public class ContentProviderManager {
try {
ContentSourceType type = contentSource.getContentSourceType();
apiClassName = type.getContentSourceApiClass();
- pluginName = this.pluginManager.getMetadataManager()
- .getPluginNameFromContentSourceType(type);
+ pluginName = this.pluginManager.getMetadataManager().getPluginNameFromContentSourceType(type);
ServerPluginEnvironment pluginEnv = this.pluginManager.getPluginEnvironment(pluginName);
ClassLoader pluginClassloader = pluginEnv.getPluginClassLoader();
@@ -559,11 +536,8 @@ public class ContentProviderManager {
} finally {
Thread.currentThread().setContextClassLoader(startingClassLoader);
}
- }
- catch (Throwable t) {
- log.warn(
- "Failed to create the API class [" + apiClassName + "] for plugin [" + pluginName +
- "]", t);
+ } catch (Throwable t) {
+ log.warn("Failed to create the API class [" + apiClassName + "] for plugin [" + pluginName + "]", t);
}
if (adapter != null) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
index 7e864bf..c2cc916 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
@@ -52,6 +52,11 @@ public class ContentProviderSyncJob implements StatefulJob {
private static final Log log = LogFactory.getLog(ContentProviderSyncJob.class);
private static final String SEPARATOR = "--";
+ public int getPercentComplete() {
+ int retval = (int) (Math.random() * 100);
+ return retval;
+ }
+
public void execute(JobExecutionContext context) throws JobExecutionException {
try {
JobDetail jobDetail = context.getJobDetail();
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentSourceManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentSourceManagerBeanTest.java
index 47cb78f..0208014 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentSourceManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentSourceManagerBeanTest.java
@@ -40,7 +40,7 @@ import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.content.Architecture;
import org.rhq.core.domain.content.ContentSource;
import org.rhq.core.domain.content.ContentSourceSyncResults;
-import org.rhq.core.domain.content.ContentSourceSyncStatus;
+import org.rhq.core.domain.content.ContentSyncStatus;
import org.rhq.core.domain.content.ContentSourceType;
import org.rhq.core.domain.content.DownloadMode;
import org.rhq.core.domain.content.InstalledPackage;
@@ -208,7 +208,7 @@ public class ContentSourceManagerBeanTest extends AbstractEJB3Test {
// try to create another but this one is a FAILURE, this is allowed
another = new ContentSourceSyncResults(contentSource);
- another.setStatus(ContentSourceSyncStatus.FAILURE);
+ another.setStatus(ContentSyncStatus.FAILURE);
another.setEndTime(System.currentTimeMillis());
another = contentSourceManager.persistContentSourceSyncResults(another);
assert another != null : "Allowed to have two results persisted if only one is INPROGRESS";
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/RepoManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/RepoManagerBeanTest.java
index 13981eb..f545530 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/RepoManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/RepoManagerBeanTest.java
@@ -35,14 +35,14 @@ import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.content.ContentSource;
-import org.rhq.core.domain.content.ContentSourceSyncResults;
-import org.rhq.core.domain.content.ContentSourceSyncStatus;
import org.rhq.core.domain.content.ContentSourceType;
+import org.rhq.core.domain.content.ContentSyncStatus;
import org.rhq.core.domain.content.Repo;
import org.rhq.core.domain.content.RepoGroup;
import org.rhq.core.domain.content.RepoGroupType;
import org.rhq.core.domain.content.RepoRelationshipType;
import org.rhq.core.domain.content.RepoRepoRelationship;
+import org.rhq.core.domain.content.RepoSyncResults;
import org.rhq.core.domain.criteria.RepoCriteria;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
@@ -50,10 +50,9 @@ import org.rhq.enterprise.server.content.ContentSourceManagerLocal;
import org.rhq.enterprise.server.content.RepoException;
import org.rhq.enterprise.server.content.RepoManagerLocal;
import org.rhq.enterprise.server.content.metadata.ContentSourceMetadataManagerLocal;
+import org.rhq.enterprise.server.plugin.pc.content.TestContentServerPluginService;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
import org.rhq.enterprise.server.util.LookupUtil;
-import org.rhq.enterprise.server.plugin.pc.ServerPluginServiceManagement;
-import org.rhq.enterprise.server.plugin.pc.content.TestContentServerPluginService;
public class RepoManagerBeanTest extends AbstractEJB3Test {
@@ -134,47 +133,34 @@ public class RepoManagerBeanTest extends AbstractEJB3Test {
@Test(enabled = ENABLED)
public void testSyncStatus() throws Exception {
Repo repo = new Repo("testSyncStatus");
- repoManager.createRepo(overlord, repo).getId();
+ repo = repoManager.createRepo(overlord, repo);
Calendar cal = Calendar.getInstance();
- ContentSourceType cst = new ContentSourceType("testSyncStatus");
- ContentSource cs = new ContentSource("testSyncStatus", cst);
- EntityManager em = getEntityManager();
- em.persist(cst);
- em.persist(cs);
-
for (int i = 0; i < 10; i++) {
cal.roll(Calendar.DATE, false);
- ContentSourceSyncResults results = new ContentSourceSyncResults(cs);
+ RepoSyncResults results = new RepoSyncResults(repo);
if (i % 2 == 0 && i != 0) {
System.out.println("Setting failed: i: [" + i + "]");
- results.setStatus(ContentSourceSyncStatus.FAILURE);
+ results.setStatus(ContentSyncStatus.FAILURE);
} else {
- results.setStatus(ContentSourceSyncStatus.SUCCESS);
+ results.setStatus(ContentSyncStatus.SUCCESS);
}
results.setEndTime(cal.getTimeInMillis());
System.out.println("EndTime: " + new Date(results.getEndTime().longValue()));
- em.persist(results);
- cs.addSyncResult(results);
+ repo.addSyncResult(results);
}
// Add one with no end time. This is to test NPE during sorting
- ContentSourceSyncResults results = new ContentSourceSyncResults(cs);
+ RepoSyncResults results = new RepoSyncResults(repo);
results.setStartTime(cal.getTimeInMillis());
- em.persist(results);
- cs.addSyncResult(results);
-
- repo.addContentSource(cs);
-
- em.flush();
- em.close();
+ repo.addSyncResult(results);
// Check sync status
- cs.getSyncResults();
+ repo.getSyncResults();
String status = repoManager.calculateSyncStatus(overlord, repo.getId());
- assert status.equals(ContentSourceSyncStatus.SUCCESS.toString());
+ assert status.equals(ContentSyncStatus.SUCCESS.toString());
}
@Test(enabled = ENABLED)
14 years, 5 months
[rhq] Branch 'content' - modules/core
by Pradeep Kilambi
modules/core/dbutils/src/main/scripts/dbsetup/content-data.xml | 7 -
modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml | 47 ----------
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 4
3 files changed, 7 insertions(+), 51 deletions(-)
New commits:
commit ce152230a633f5ec049ac5868923528a7c28f6e3
Author: Pradeep Kilambi <pkilambi(a)redhat.com>
Date: Tue Nov 24 16:38:32 2009 -0500
clean up of db changes for 2.71 spec
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/content-data.xml b/modules/core/dbutils/src/main/scripts/dbsetup/content-data.xml
index ddb04c4..65be5b1 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/content-data.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/content-data.xml
@@ -62,13 +62,6 @@
<data id="103" name="Security Advisory" description="Security Advisory(RHSA) Advisory"/>
</table>
- <table name="RHQ_ADVISORY_FILE_TYPE">
- <data id="101" label="RPM" />
- <data id="102" label="SRPM"/>
- <data id="103" label="IMG"/>
- <data id="104" label="OVAL"/>
- </table>
-
<table name="RHQ_ADVISORY_SEVERITY">
<data id="101" rank="0" label="errata.sev.label.critical" />
<data id="102" rank="1" label="errata.sev.label.important"/>
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
index d5f6566..8e6e627 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
@@ -389,8 +389,8 @@
<column name="DESCRIPTION" size="500" type="VARCHAR2" required="false"/>
</table>
-
- <table name="RHQ_ADVISORY_SEVERITY">
+
+ <table name="RHQ_ADVISORY_SEVERITY" >
<column name="ID" default="sequence-only" initial="101" primarykey="true" required="true" type="INTEGER"/>
<column name="RANK" type="INTEGER" required="true"/>
<column name="LABEL" size="40" type="VARCHAR2" required="true"/>
@@ -406,7 +406,7 @@
<column name="SYNOPSIS" size="4000" type="VARCHAR2" required="true"/>
<column name="TOPIC" size="4000" type="VARCHAR2" required="false"/>
<column name="SOLUTION" size="4000" type="VARCHAR2" required="true"/>
- <column name="SEVERITY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY_SEVERITY"/>
+ <column name="SEVERITY_ID" type="INTEGER" required="false" references="RHQ_ADVISORY_SEVERITY"/>
<column name="ISSUE_DATE" type="LONG" required="true"/>
<column name="UPDATE_DATE" type="LONG" required="true"/>
<column name="CTIME" type="LONG" required="true"/>
@@ -430,31 +430,6 @@
</table>
- <table name="RHQ_ADVISORY_FILE_TYPE">
- <column name="ID" default="sequence-only" initial="101" primarykey="true" required="true" type="INTEGER"/>
- <column name="LABEL" size="40" type="VARCHAR2" required="true"/>
-
- <index name="RHQ_ADVISORY_FILE_TYPE_UQ" unique="true">
- <field ref="LABEL"/>
- </index>
-
- </table>
-
- <table name="RHQ_ADVISORY_FILE">
- <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/>
- <column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_DISTRIBUTION"/>
- <column name="FILE_TYPE_ID" type="INTEGER" required="true" references="RHQ_ADVISORY_FILE_TYPE"/>
- <column name="RELATIVE_FILENAME" size="256" type="VARCHAR2" required="true"/>
- <column name="MD5SUM" size="64" type="VARCHAR2" required="true"/>
- <column name="LAST_MODIFIED" type="LONG" required="true"/>
- <column name="CTIME" type="LONG" required="true"/>
-
- <index name="RHQ_ADVISORY_ID_FILE_UQ" unique="true">
- <field ref="ADVISORY_ID"/>
- <field ref="RELATIVE_FILENAME"/>
- </index>
- </table>
-
<table name="RHQ_ADVISORY_PACKAGE_MAP">
<column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/>
<column name="PACKAGE_ID" type="INTEGER" required="true" references="RHQ_PACKAGE"/>
@@ -469,20 +444,6 @@
</constraint>
</table>
- <table name="RHQ_ADVISORY_FILE_PKG_MAP">
- <column name="ADVISORY_FILE_ID" type="INTEGER" required="true" references="RHQ_ADVISORY_FILE"/>
- <column name="PACKAGE_ID" type="INTEGER" required="true" references="RHQ_PACKAGE"/>
- <column name="LAST_MODIFIED" type="LONG" required="true"/>
- <column name="CTIME" type="LONG" required="true"/>
-
- <constraint name="RHQ_ADV_FILE_PKG_MAP_KEY" unique="true">
- <primaryKey>
- <field ref="ADVISORY_FILE_ID"/>
- <field ref="PACKAGE_ID"/>
- </primaryKey>
- </constraint>
- </table>
-
<table name="RHQ_CVE">
<column name="ID" default="sequence-only" initial="101" primarykey="true" required="true" type="INTEGER"/>
<column name="NAME" size="64" type="VARCHAR2" required="true"/>
@@ -505,7 +466,7 @@
<table name="RHQ_ADVISORY_BUGLIST">
<column name="ADVISORY_ID" type="INTEGER" required="true" references="RHQ_ADVISORY"/>
- <column name="BUG_ID" type="INTEGER" required="true"/>
+ <column name="BUG_ID" size="64" type="VARCHAR2" required="true"/>
<column name="LAST_MODIFIED" type="LONG" required="true"/>
<column name="CTIME" type="LONG" required="true"/>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 5a580ae..eaeef31 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -2637,7 +2637,9 @@
REFERENCES RHQ_REPO ( ID )
</statement>
</schema-directSQL>
- </schemaSpec>
+
+ </schemaSpec>
+
</dbupgrade>
</target>
</project>
14 years, 5 months
[rhq] Branch 'content' - modules/enterprise
by jdob
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/ListReposUIBean.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
New commits:
commit f6354530faec8f5eb46cbf8d3d53efb9848705af
Author: Jason Dobies <jason.dobies(a)redhat.com>
Date: Tue Nov 24 16:24:13 2009 -0500
Should be the last signature update to build.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/ListReposUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/ListReposUIBean.java
index e3ac9d1..e4041c5 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/ListReposUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/ListReposUIBean.java
@@ -63,7 +63,13 @@ public class ListReposUIBean extends PagedDataTableUIBean {
Integer[] repoIds = getIntegerArray(selected);
if (repoIds.length > 0) {
- int syncCount = repoManager.synchronizeRepos(subject, repoIds);
+ int syncCount = 0;
+ try {
+ syncCount = repoManager.synchronizeRepos(subject, repoIds);
+ }
+ catch (Exception e) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Failed to delete repositories.", e);
+ }
if (syncCount > 0) {
FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Synchronizing [" + syncCount
+ "] content providers.");
14 years, 5 months
[rhq] Branch 'content' - modules/enterprise
by jdob
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoDetailsUIBean.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
New commits:
commit 455b0bb036304e919565dda5c89723a039a18cd7
Author: Jason Dobies <jason.dobies(a)redhat.com>
Date: Tue Nov 24 15:59:46 2009 -0500
Missed another one in the signature change.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoDetailsUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoDetailsUIBean.java
index f850d0f..33f674e 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoDetailsUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoDetailsUIBean.java
@@ -49,7 +49,14 @@ public class RepoDetailsUIBean {
public String sync() {
Subject subject = EnterpriseFacesContextUtility.getSubject();
Integer[] repoIds = { FacesContextUtility.getRequiredRequestParameter("id", Integer.class) };
- int syncCount = LookupUtil.getRepoManagerLocal().synchronizeRepos(subject, repoIds);
+ int syncCount = 0;
+ try {
+ syncCount = LookupUtil.getRepoManagerLocal().synchronizeRepos(subject, repoIds);
+ }
+ catch (Exception e) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Error: " + e.getMessage());
+ return "edit";
+ }
if (syncCount > 0) {
FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "The repository is syncing.");
} else {
14 years, 5 months
[rhq] Branch 'content' - modules/enterprise
by jdob
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
New commits:
commit 9327d5503ba16ede31bbf3321199226081003965
Author: Jason Dobies <jason.dobies(a)redhat.com>
Date: Tue Nov 24 15:04:55 2009 -0500
Oops, forgot to update this with the new signature.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
index 8587e51..068dde4 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/webservices/WebservicesManagerBean.java
@@ -286,8 +286,7 @@ public class WebservicesManagerBean implements WebservicesRemote {
return repoManager.findPackageVersionsInRepoByCriteria(subject, criteria);
}
- @Override
- public int synchronizeRepos(Subject subject, Integer[] repoIds) {
+ public int synchronizeRepos(Subject subject, Integer[] repoIds) throws Exception {
return repoManager.synchronizeRepos(subject, repoIds);
}
14 years, 5 months
[rhq] Branch 'linux-config' - modules/enterprise
by Jay Shaughnessy
modules/enterprise/server/xml-schemas/src/main/resources/rhq-serverplugin-perspective.xsd | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
New commits:
commit 60ba50a452f0db9c6af51d2e2a86a608813da3e0
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Nov 24 15:02:17 2009 -0500
Fix problem due to a failed git merge
diff --git a/modules/enterprise/server/xml-schemas/src/main/resources/rhq-serverplugin-perspective.xsd b/modules/enterprise/server/xml-schemas/src/main/resources/rhq-serverplugin-perspective.xsd
index 4c48957..5093db1 100644
--- a/modules/enterprise/server/xml-schemas/src/main/resources/rhq-serverplugin-perspective.xsd
+++ b/modules/enterprise/server/xml-schemas/src/main/resources/rhq-serverplugin-perspective.xsd
@@ -120,9 +120,8 @@
</xs:documentation>
</xs:annotation>
</xs:element>
-
<xs:element
- ref="perspective:resourceActivator"
+ ref="perspective:inventoryActivator"
minOccurs="0"
maxOccurs="unbounded">
<xs:annotation>
14 years, 5 months
[rhq] Branch 'pc' - modules/enterprise
by jharris
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginComponent.java | 73 ++++++++++
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginUIBean.java | 66 ++++-----
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml | 1
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/admin-beans.xml | 7
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/admin-navigation.xml | 11 +
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-edit.xhtml | 24 +++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-view.xhtml | 27 +++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details.xhtml | 19 --
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list.xhtml | 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java | 22 ---
10 files changed, 187 insertions(+), 67 deletions(-)
New commits:
commit 93cd6e74d101d7dc645ac38168b4d0157752bf8d
Author: Justin Harris <jharris(a)redhat.com>
Date: Tue Nov 24 14:57:46 2009 -0500
Moving in some seam functionality to allow for page scoped beans in form submission.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginComponent.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginComponent.java
new file mode 100644
index 0000000..0bb87bd
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginComponent.java
@@ -0,0 +1,73 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 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.enterprise.gui.admin.plugin;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Factory;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.web.RequestParameter;
+import org.rhq.core.domain.plugin.Plugin;
+import org.rhq.core.domain.plugin.PluginDeploymentType;
+import org.rhq.enterprise.server.plugin.ServerPluginsLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * Component responsible for looking up a {@link Plugin}, obtaining
+ * the <code>name</code> and <code>type</code> from request parameters.
+ *
+ * @author jharris
+ */
+@Name("installedPlugin")
+public class InstalledPluginComponent {
+
+ @RequestParameter("plugin")
+ private String name;
+ @RequestParameter("pluginType")
+ private PluginDeploymentType type;
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public PluginDeploymentType getType() {
+ return this.type;
+ }
+
+ public void setType(PluginDeploymentType type) {
+ this.type = type;
+ }
+
+ @Factory(value="plugin", autoCreate=true, scope=ScopeType.PAGE)
+ public Plugin lookupPlugin() {
+ if (this.type == PluginDeploymentType.AGENT) {
+ return LookupUtil.getResourceMetadataManager().getPlugin(this.name);
+ } else if (this.type == PluginDeploymentType.SERVER) {
+ ServerPluginsLocal serverPluginsBean = LookupUtil.getServerPlugins();
+ Plugin plugin = serverPluginsBean.getServerPlugin(this.name);
+ return serverPluginsBean.getServerPluginRelationships(plugin);
+ }
+
+ return null;
+ }
+}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginUIBean.java
index b6db223..3fe6988 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/admin/plugin/InstalledPluginUIBean.java
@@ -21,8 +21,13 @@ package org.rhq.enterprise.gui.admin.plugin;
import javax.faces.application.FacesMessage;
import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
import org.rhq.core.clientapi.agent.metadata.ConfigurationMetadataParser;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
@@ -40,21 +45,24 @@ import org.rhq.enterprise.server.xmlschema.generated.serverplugin.ServerPluginDe
* @author Greg Hinkle
* @author John Mazzitelli
*/
+(a)Scope(ScopeType.PAGE)
+@Name("InstalledPluginUIBean")
public class InstalledPluginUIBean {
- private final Log log = LogFactory.getLog(InstalledPluginUIBean.class);
+ private static final String OUTCOME_SUCCESS = "success";
public static final String MANAGED_BEAN_NAME = InstalledPluginUIBean.class.getSimpleName();
-
+ private final Log log = LogFactory.getLog(InstalledPluginUIBean.class);
+ @In
private Plugin plugin;
private ConfigurationDefinition pluginConfigurationDefinition;
private ConfigurationDefinition scheduledJobsDefinition;
- public InstalledPluginUIBean() {
- lookupPlugin();
+ public Plugin getPlugin() {
+ return plugin;
}
- public Plugin getPlugin() {
- return this.plugin;
+ public void setPlugin(Plugin plugin) {
+ this.plugin = plugin;
}
public ConfigurationDefinition getPluginConfigurationDefinition() {
@@ -65,40 +73,39 @@ public class InstalledPluginUIBean {
return this.scheduledJobsDefinition;
}
- public void updatePlugin() {
+ public boolean isEditable() {
+ return this.pluginConfigurationDefinition != null || this.scheduledJobsDefinition != null;
+ }
+
+ public String updatePlugin() {
ServerPluginsLocal serverPlugins = LookupUtil.getServerPlugins();
try {
serverPlugins.updateServerPluginExceptContent(EnterpriseFacesContextUtility.getSubject(), plugin);
-
FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO,
- "Configuration settings saved.");
+ "Configuration settings saved.");
+
+ return OUTCOME_SUCCESS;
} catch (Exception e) {
log.error("Error updating the plugin configurations.", e);
FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR,
- "There was an error changing the configuration settings.", e);
- }
+ "There was an error changing the configuration settings.", e);
- lookupPlugin();
+ return null;
+ }
}
- private void lookupPlugin() {
+ @Create
+ public void lookupConfigDefinitions() {
hasPermission();
- String pluginName = FacesContextUtility.getRequiredRequestParameter("plugin", String.class);
- String pluginType = FacesContextUtility.getRequiredRequestParameter("pluginType", String.class);
- PluginDeploymentType deploymentType = PluginDeploymentType.valueOf(pluginType);
- if (deploymentType == PluginDeploymentType.AGENT) {
- this.plugin = LookupUtil.getResourceMetadataManager().getPlugin(pluginName);
- } else {
- ServerPluginsLocal serverPluginsBean = LookupUtil.getServerPlugins();
- this.plugin = serverPluginsBean.getServerPlugin(pluginName);
- this.plugin = serverPluginsBean.getServerPluginRelationships(this.plugin);
+ String pluginName = this.plugin.getName();
+
+ if (this.plugin.getDeployment() == PluginDeploymentType.SERVER) {
try {
+ ServerPluginsLocal serverPluginsBean = LookupUtil.getServerPlugins();
ServerPluginDescriptorType descriptor = serverPluginsBean.getServerPluginDescriptor(pluginName);
- this.pluginConfigurationDefinition = ConfigurationMetadataParser.parse("pc:" + pluginName, descriptor
- .getPluginConfiguration());
- this.scheduledJobsDefinition = ConfigurationMetadataParser.parse("jobs:" + pluginName, descriptor
- .getScheduledJobs());
+ this.pluginConfigurationDefinition = ConfigurationMetadataParser.parse("pc:" + pluginName, descriptor.getPluginConfiguration());
+ this.scheduledJobsDefinition = ConfigurationMetadataParser.parse("jobs:" + pluginName, descriptor.getScheduledJobs());
} catch (Exception e) {
String err = "Cannot determine what the plugin configuration or scheduled jobs configuration looks like";
log.error(err + " - Cause: " + e);
@@ -114,8 +121,7 @@ public class InstalledPluginUIBean {
private void hasPermission() {
Subject subject = EnterpriseFacesContextUtility.getSubject();
if (!LookupUtil.getAuthorizationManager().hasGlobalPermission(subject, Permission.MANAGE_SETTINGS)) {
- throw new PermissionException("User [" + subject.getName()
- + "] does not have the proper permissions to view or manage plugins");
+ throw new PermissionException("User [" + subject.getName() + "] does not have the proper permissions to view or manage plugins");
}
}
-}
\ No newline at end of file
+}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
index bacb535..64bd31e 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
@@ -11,6 +11,7 @@
<component name="org.jboss.seam.core.init">
<property name="debug">false</property> <!-- enable only when needed -->
<property name="transactionManagementEnabled">false</property>
+ <property name="jndi-pattern">rhq/#{ejbName}/local</property>
</component>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/admin-beans.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/admin-beans.xml
index 11dadd0..a80402b 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/admin-beans.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/admin-beans.xml
@@ -20,13 +20,6 @@
<managed-bean-class>org.rhq.enterprise.gui.admin.plugin.InstalledPluginsUIBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
- <managed-bean>
- <description>Visibility for the installed agent and server plugins</description>
- <display-name>Installed Plugin</display-name>
- <managed-bean-name>InstalledPluginUIBean</managed-bean-name>
- <managed-bean-class>org.rhq.enterprise.gui.admin.plugin.InstalledPluginUIBean</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- </managed-bean>
<managed-bean>
<description>Access to downloads information</description>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/admin-navigation.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/admin-navigation.xml
index 93932df..7f19f4d 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/admin-navigation.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/admin-navigation.xml
@@ -28,6 +28,17 @@
</navigation-case>
</navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/rhq/admin/plugin/plugin-details-edit.xhtml</from-view-id>
+
+ <navigation-case>
+ <from-outcome>success</from-outcome>
+ <to-view-id>/rhq/admin/plugin/plugin-details-view.xhtml?plugin=#{plugin.name}&pluginType=#{plugin.deployment}</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ </navigation-rule>
<navigation-rule>
<navigation-case>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-edit.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-edit.xhtml
new file mode 100644
index 0000000..d88afe7
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-edit.xhtml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<ui:composition template="/rhq/admin/plugin/plugin-details.xhtml">
+ <ui:param name="editMode" value="true"/>
+
+ <ui:define name="post-config">
+ <rich:panel rendered="#{InstalledPluginUIBean.editable}">
+ <h:commandButton value="SAVE" type="submit" action="#{InstalledPluginUIBean.updatePlugin}"
+ alt="Click to Save Changes" styleClass="buttonmed" />
+ <h:commandButton value="RESET" type="reset" immediate="true"
+ title="Click to Reset Fields" styleClass="buttonmed"/>
+ </rich:panel>
+ </ui:define>
+</ui:composition>
+
+</html>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-view.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-view.xhtml
new file mode 100644
index 0000000..389923a
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details-view.xhtml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<ui:composition template="/rhq/admin/plugin/plugin-details.xhtml">
+ <ui:param name="editMode" value="false"/>
+
+ <ui:define name="pre-config">
+ <h:panelGrid columns="1" styleClass="buttons-table" columnClasses="button-cell"
+ rendered="#{InstalledPluginUIBean.editable}">
+ <h:outputLink value="/rhq/admin/plugin/plugin-details-edit.xhtml"
+ styleClass="buttonmed">
+ <f:param name="plugin" value="#{installedPlugin.name}"/>
+ <f:param name="pluginType" value="#{installedPlugin.type}"/>
+ <h:outputText value="EDIT"/>
+ </h:outputLink>
+ </h:panelGrid>
+ </ui:define>
+ </ui:composition>
+
+</html>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details.xhtml
index fa46dc8..cc11203 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-details.xhtml
@@ -35,8 +35,6 @@
layout="table"
width="100%"/>
-
-
<h:form id="pluginsForm">
<rich:panel>
@@ -66,7 +64,6 @@
</h:panelGrid>
-
<rich:panel>
<f:facet name="header">
<h:outputText value="Plugin Help"/>
@@ -76,6 +73,7 @@
</rich:panel>
+ <ui:insert name="pre-config" />
<rich:panel rendered="#{InstalledPluginUIBean.plugin.pluginConfiguration != null}">
<f:facet name="header">
@@ -83,7 +81,8 @@
</f:facet>
<onc:config
configurationDefinition="#{InstalledPluginUIBean.pluginConfigurationDefinition}"
- configuration="#{InstalledPluginUIBean.plugin.pluginConfiguration}" />
+ configuration="#{InstalledPluginUIBean.plugin.pluginConfiguration}"
+ readOnly="#{not editMode}" />
</rich:panel>
<rich:panel rendered="#{InstalledPluginUIBean.plugin.scheduledJobsConfiguration != null}">
@@ -92,17 +91,11 @@
</f:facet>
<onc:config
configurationDefinition="#{InstalledPluginUIBean.scheduledJobsDefinition}"
- configuration="#{InstalledPluginUIBean.plugin.scheduledJobsConfiguration}" />
+ configuration="#{InstalledPluginUIBean.plugin.scheduledJobsConfiguration}"
+ readOnly="#{not editMode}" />
</rich:panel>
- <input type="hidden" name="plugin" value="#{param.plugin}"/>
- <input type="hidden" name="pluginType" value="#{param.pluginType}"/>
-
- <rich:panel rendered="#{InstalledPluginUIBean.plugin.pluginConfiguration != null ||
- InstalledPluginUIBean.plugin.scheduledJobsConfiguration != null}">
- <h:commandButton value="OK" type="submit" action="#{InstalledPluginUIBean.updatePlugin}"
- alt="Click to Save Plugin" styleClass="buttonmed" />
- </rich:panel>
+ <ui:insert name="post-config" />
</rich:panel>
</h:form>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list.xhtml
index 72f941e..5654368 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list.xhtml
@@ -75,7 +75,7 @@
<h:outputText styleClass="headerText" value="Name"/>
</f:facet>
- <h:outputLink value="/rhq/admin/plugin/plugin-details.xhtml">
+ <h:outputLink value="/rhq/admin/plugin/plugin-details-view.xhtml">
<f:param name="plugin" value="#{agentPlugin.name}"/>
<f:param name="pluginType" value="AGENT"/>
<h:outputText value="#{agentPlugin.displayName}"/>
@@ -160,7 +160,7 @@
<h:outputText styleClass="headerText" value="Name"/>
</f:facet>
- <h:outputLink value="/rhq/admin/plugin/plugin-details.xhtml">
+ <h:outputLink value="/rhq/admin/plugin/plugin-details-view.xhtml">
<f:param name="plugin" value="#{serverPlugin.name}"/>
<f:param name="pluginType" value="SERVER"/>
<h:outputText value="#{serverPlugin.displayName}"/>
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java
index ce603da..1415bb5 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/ServerPluginsBean.java
@@ -16,7 +16,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
package org.rhq.enterprise.server.plugin;
import java.io.BufferedInputStream;
@@ -67,14 +66,12 @@ import org.rhq.enterprise.server.xmlschema.generated.serverplugin.ServerPluginDe
@Stateless
@javax.annotation.Resource(name = "RHQ_DS", mappedName = RHQConstants.DATASOURCE_JNDI_NAME)
public class ServerPluginsBean implements ServerPluginsLocal {
- private final Log log = LogFactory.getLog(ServerPluginsBean.class);
+ private final Log log = LogFactory.getLog(ServerPluginsBean.class);
@PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
private EntityManager entityManager;
-
@javax.annotation.Resource(name = "RHQ_DS")
private DataSource dataSource;
-
@EJB
private ServerPluginsLocal serverPluginsBean; //self
@@ -242,8 +239,7 @@ public class ServerPluginsBean implements ServerPluginsLocal {
File currentFile = new File(pluginDir, doomedPlugin.getPath());
currentFile.delete();
} catch (Exception e) {
- log.error("Failed to delete the undeployed plugin [" + doomedPlugin.getPath() + "]. Cause: "
- + ThrowableUtil.getAllMessages(e));
+ log.error("Failed to delete the undeployed plugin [" + doomedPlugin.getPath() + "]. Cause: " + ThrowableUtil.getAllMessages(e));
}
}
}
@@ -279,7 +275,7 @@ public class ServerPluginsBean implements ServerPluginsLocal {
@RequiredPermission(Permission.MANAGE_SETTINGS)
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void setServerPluginStatus(Subject subject, List<Integer> pluginIds, PluginStatusType status)
- throws Exception {
+ throws Exception {
if (pluginIds == null || pluginIds.size() == 0) {
return; // nothing to do
}
@@ -295,8 +291,7 @@ public class ServerPluginsBean implements ServerPluginsLocal {
public Plugin registerServerPlugin(Subject subject, Plugin plugin, File pluginFile) throws Exception {
if (plugin.getDeployment() != PluginDeploymentType.SERVER) {
- throw new IllegalArgumentException("Plugin [" + plugin.getName()
- + "] must be a server plugin to be registered");
+ throw new IllegalArgumentException("Plugin [" + plugin.getName() + "] must be a server plugin to be registered");
}
Plugin existingPlugin = null;
@@ -309,8 +304,7 @@ public class ServerPluginsBean implements ServerPluginsLocal {
if (existingPlugin != null) {
if (existingPlugin.getStatus() == PluginStatusType.DELETED) {
- throw new IllegalArgumentException("Cannot register plugin [" + plugin.getName()
- + "], it has been marked as deleted");
+ throw new IllegalArgumentException("Cannot register plugin [" + plugin.getName() + "], it has been marked as deleted");
}
Plugin obsolete = ServerPluginDescriptorUtil.determineObsoletePlugin(plugin, existingPlugin);
if (obsolete == existingPlugin) { // yes use == for reference equality
@@ -328,8 +322,7 @@ public class ServerPluginsBean implements ServerPluginsLocal {
if (plugin.getId() == 0) {
PluginStatusType status = getServerPluginStatus(plugin.getName());
if (PluginStatusType.DELETED == status) {
- throw new IllegalArgumentException("Cannot register plugin [" + plugin.getName()
- + "], it has been previously marked as deleted.");
+ throw new IllegalArgumentException("Cannot register plugin [" + plugin.getName() + "], it has been previously marked as deleted.");
}
entityManager.persist(plugin);
} else {
@@ -371,8 +364,7 @@ public class ServerPluginsBean implements ServerPluginsLocal {
// to entityManager.merge that plugin POJO, it would null out that blob column.
if (plugin.getDeployment() != PluginDeploymentType.SERVER) {
- throw new IllegalArgumentException("Plugin [" + plugin.getName()
- + "] must be a server plugin to be updated");
+ throw new IllegalArgumentException("Plugin [" + plugin.getName() + "] must be a server plugin to be updated");
}
if (plugin.getId() == 0) {
14 years, 5 months
[rhq] Branch 'content' - modules/enterprise
by jdob
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerLocal.java | 13 ++--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/sync/PackageSourceSynchronizer.java | 27 ++++++----
2 files changed, 24 insertions(+), 16 deletions(-)
New commits:
commit bacfd8264d21eff7b2d7b48be320204677ecc72c
Author: Jason Dobies <jason.dobies(a)redhat.com>
Date: Tue Nov 24 13:30:49 2009 -0500
Minor code cleanup.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerLocal.java
index df7c91e..c3eeb94 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerLocal.java
@@ -173,11 +173,11 @@ public interface ContentSourceManagerLocal {
/**
* Create the specified content source.
- *
+ *
* @param subject The user making the request.
- *
+ *
* @param contentSource A content source to be created.
- *
+ *
* @return The created content source.
*/
ContentSource createContentSource(Subject subject, ContentSource contentSource) throws ContentSourceException;
@@ -264,7 +264,7 @@ public interface ContentSourceManagerLocal {
* @param resourceId
* @param packageDetailsKey
*
- * @return teh length of the package version
+ * @return the length of the package version
*/
long getPackageBitsLength(int resourceId, PackageDetailsKey packageDetailsKey);
@@ -284,7 +284,7 @@ public interface ContentSourceManagerLocal {
PageList<PackageVersionContentSource> getPackageVersionsFromContentSources(Subject subject, int[] contentSourceIds,
PageControl pc);
-
+
/**
* Returns all the package versions that are served by the content source identified by the given ID but whose
@@ -301,6 +301,7 @@ public interface ContentSourceManagerLocal {
int contentSourceId, PageControl pc);
+
/**
* This will download all the distribution bits associated with a specific content source.
*
@@ -439,7 +440,7 @@ public interface ContentSourceManagerLocal {
ContentSourceSyncResults _mergeContentSourceSyncReportADD(ContentSource contentSource,
DistributionSyncReport report, ContentSourceSyncResults syncResults, StringBuilder progress);
-
+
/**
* Requests all {@link PackageVersion#getMetadata() metadata} for all package versions that the given resource
* component is subscribed to (see {@link Repo#getResources()}. The returned object has the metadata bytes that
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/sync/PackageSourceSynchronizer.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/sync/PackageSourceSynchronizer.java
index b3e30e0..3d84178 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/sync/PackageSourceSynchronizer.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/sync/PackageSourceSynchronizer.java
@@ -131,6 +131,7 @@ public class PackageSourceSynchronizer {
public void synchronizePackageBits() throws Exception {
+ // Determine if the sync even needs to take place
if (!(provider instanceof PackageSource)) {
return;
}
@@ -147,21 +148,27 @@ public class PackageSourceSynchronizer {
return;
}
- long start = System.currentTimeMillis();
- List<PackageVersionContentSource> packageVersionContentSources;
+ long start;
- // make sure we only get back those that have not yet been loaded
- // TODO: consider paging here - do we have to load them all in at once or can we do them in chunks?
+ // Determine which packages need bit synccing
+ /* If there become performance issues here, consider paging. So we have to load them all
+ in at once or can we do them in chunks?
+ */
+ start = System.currentTimeMillis();
PageControl pc = PageControl.getUnlimitedInstance();
Subject overlord = subjectManager.getOverlord();
- packageVersionContentSources = contentSourceManager
- .getUnloadedPackageVersionsFromContentSource(overlord,
- source.getId(), pc);
- // For each unloaded package version, let's download them now.
- // This can potentially take a very long time.
- // We abort the entire download if we fail getting just one package.
+ // TODO: jdob - Need to change this call to only load packages for this repo
+ List<PackageVersionContentSource> packageVersionContentSources = contentSourceManager
+ .getUnloadedPackageVersionsFromContentSource(overlord, source.getId(), pc);
+ log.info("Synchronize Package Bits: [" + source.getName() + "], repo [" + repo.getName() +
+ "]: loaded package list for sync (" + (System.currentTimeMillis() - start) + ")ms");
+
+ // Download the bits for each unloaded package version. Abort the entire download if we
+ // fail getting just one package.
+
+ // Note: This can potentially take a very long time.
for (PackageVersionContentSource item : packageVersionContentSources) {
PackageVersionContentSourcePK pk = item.getPackageVersionContentSourcePK();
14 years, 5 months
[rhq] Branch 'content' - modules/enterprise
by jdob
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/sync/PackageSourceSynchronizer.java | 13 ++++++++++
1 file changed, 13 insertions(+)
New commits:
commit 3ad8807bca347cdf6c0a5728bbcb7f1e48fbf987
Author: Jason Dobies <jason.dobies(a)redhat.com>
Date: Tue Nov 24 12:34:02 2009 -0500
635 - Added lazy load and download mode "never" checks.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/sync/PackageSourceSynchronizer.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/sync/PackageSourceSynchronizer.java
index abfbf19..b3e30e0 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/sync/PackageSourceSynchronizer.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/content/sync/PackageSourceSynchronizer.java
@@ -38,6 +38,7 @@ import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.content.PackageVersionContentSource;
import org.rhq.core.domain.content.PackageVersionContentSourcePK;
import org.rhq.core.domain.content.Repo;
+import org.rhq.core.domain.content.DownloadMode;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageControl;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
@@ -134,6 +135,18 @@ public class PackageSourceSynchronizer {
return;
}
+ if (source.getDownloadMode() == DownloadMode.NEVER) {
+ log.info("Download mode of NEVER for source [" + source.getName() + "], skipping " +
+ "package bits sync for repo [" + repo.getName() + "]");
+ return;
+ }
+
+ if (source.isLazyLoad()) {
+ log.info("Lazy load enabled for source [" + source.getName() + "], skipping " +
+ "package bits sync for repo [" + repo.getName() + "]");
+ return;
+ }
+
long start = System.currentTimeMillis();
List<PackageVersionContentSource> packageVersionContentSources;
14 years, 5 months