[teiid-commits] teiid SVN: r2419 - in trunk: console and 2 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Thu Aug 5 13:41:38 EDT 2010


Author: shawkins
Date: 2010-08-05 13:41:38 -0400 (Thu, 05 Aug 2010)
New Revision: 2419

Modified:
   trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
   trunk/console/pom.xml
   trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
   trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java
   trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java
Log:
TEIID-1187 updating versioning logic to use .version.vdb

Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java	2010-08-05 16:49:58 UTC (rev 2418)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java	2010-08-05 17:41:38 UTC (rev 2419)
@@ -60,6 +60,8 @@
 @XmlRootElement(name = "vdb")
 public class VDBMetaData extends AdminObjectImpl implements VDB {
 
+	private static final String VERSION_DELIM = "."; //$NON-NLS-1$
+
 	private static final long serialVersionUID = -4723595252013356436L;
 	
 	/**
@@ -109,12 +111,17 @@
 	private boolean removed;
 
 	@ManagementProperty(description="Name of the VDB")
-	@ManagementObjectID(type="vdb")
 	@XmlAttribute(name = "name", required = true)
 	public String getName() {
 		return super.getName();
 	}
 	
+	@ManagementProperty(description="Full Name of the VDB")
+	@ManagementObjectID(type="vdb")
+	public String getFullName() {
+		return getName() + VERSION_DELIM + getVersion();
+	}
+	
 	// This needed by JAXB marshaling
 	public void setName(String name) {
 		super.setName(name);
@@ -170,8 +177,12 @@
 	
 	public void setUrl(URL url) {
 		this.setUrl(url.toExternalForm());
-		String fileName = FileUtils.getBaseFileNameWithoutExtension(url.getPath());
-		String prefix = getName() + "_"; //$NON-NLS-1$
+		String path = url.getPath();
+		if (path.endsWith("/")) { //$NON-NLS-1$
+			path = path.substring(0, path.length() - 1);
+		}
+		String fileName = FileUtils.getBaseFileNameWithoutExtension(path);
+		String prefix = getName() + VERSION_DELIM;
 		if (StringUtil.startsWithIgnoreCase(fileName, prefix)) {
 			try {
 				int fileVersion = Integer.parseInt(fileName.substring(prefix.length()));
@@ -270,7 +281,7 @@
     } 	
     
 	public String toString() {
-		return getName()+"."+getVersion()+ models.getMap().values(); //$NON-NLS-1$
+		return getName()+VERSION_DELIM+getVersion()+ models.getMap().values(); //$NON-NLS-1$
 	}
 
 	public ModelMetaData getModel(String modelName) {

Modified: trunk/console/pom.xml
===================================================================
--- trunk/console/pom.xml	2010-08-05 16:49:58 UTC (rev 2418)
+++ trunk/console/pom.xml	2010-08-05 17:41:38 UTC (rev 2419)
@@ -104,6 +104,7 @@
 		<dependency>
 			<groupId>org.jboss.teiid</groupId>
 			<artifactId>teiid-client</artifactId>
+			<scope>provided</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.jboss.teiid</groupId>

Modified: trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java	2010-08-05 16:49:58 UTC (rev 2418)
+++ trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java	2010-08-05 17:41:38 UTC (rev 2419)
@@ -47,6 +47,7 @@
 import org.teiid.adminapi.Request;
 import org.teiid.adminapi.Session;
 import org.teiid.adminapi.Transaction;
+import org.teiid.adminapi.VDB.Status;
 import org.teiid.adminapi.impl.RequestMetadata;
 import org.teiid.adminapi.impl.RequestMetadataMapper;
 import org.teiid.rhq.plugin.objects.ExecutedResult;
@@ -137,7 +138,7 @@
 				.equals(PluginConstants.ComponentType.VDB.Metrics.STATUS)) {
 			// TODO remove version parameter after AdminAPI is changed
 			resultObject = getVDBStatus(connection, (String) valueMap
-					.get(VDB.NAME), 1);
+					.get(VDB.NAME));
 		} else if (metric
 				.equals(PluginConstants.ComponentType.VDB.Metrics.QUERY_COUNT)) {
 			resultObject = new Double(getQueryCount(connection).doubleValue());
@@ -375,7 +376,7 @@
 	}
 
 	public static String getVDBStatus(ProfileServiceConnection connection,
-			String vdbName, int version) {
+			String vdbName) {
 
 		ManagedComponent mcVdb = null;
 		try {
@@ -392,6 +393,10 @@
 			final String msg = "Exception in getVDBStatus(): " + e.getMessage(); //$NON-NLS-1$
 			LOG.error(msg, e);
 		}
+		
+		if (mcVdb == null) {
+			return Status.INACTIVE.toString();
+		}
 
 		return ProfileServiceUtil.getSimpleValue(mcVdb, "status", String.class); //$NON-NLS-1$
 	}

Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java	2010-08-05 16:49:58 UTC (rev 2418)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java	2010-08-05 17:41:38 UTC (rev 2419)
@@ -93,7 +93,7 @@
 	@Override
 	public void start(ResourceContext context) {
 		this.setComponentName(context.getPluginConfiguration().getSimpleValue(
-				"name", null));
+				"fullName", null));
 		this.resourceConfiguration = context.getPluginConfiguration();
 		this.componentType = PluginConstants.ComponentType.VDB.NAME;
 		super.start(context);
@@ -136,7 +136,7 @@
 		// TODO Remove vdb version after no longer viable in Teiid
 		String version = this.resourceConfiguration.getSimpleValue(
 				"version", null);
-		String status = DQPManagementView.getVDBStatus(getConnection(), this.name, Integer.parseInt(version));
+		String status = DQPManagementView.getVDBStatus(getConnection(), this.name);
 		if (status.equals("ACTIVE")) {
 			return AvailabilityType.UP;
 		}
@@ -149,8 +149,7 @@
 			Map<String, Object> valueMap) {
 		// Parameter logic for VDB Metrics
 		String key = VDB.NAME;
-		valueMap.put(key, this.resourceConfiguration.getSimpleValue("name",
-				null));
+		valueMap.put(key, this.name);
 	}
 
 	@Override

Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java	2010-08-05 16:49:58 UTC (rev 2418)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java	2010-08-05 17:41:38 UTC (rev 2419)
@@ -64,6 +64,8 @@
 			String vdbKey = mcVdb.getDeployment().getName();
 			String vdbName = ProfileServiceUtil.getSimpleValue(mcVdb, "name",
 					String.class);
+			String fullName = ProfileServiceUtil.getSimpleValue(mcVdb, "fullName",
+					String.class);
 			Integer vdbVersion = ProfileServiceUtil.getSimpleValue(mcVdb,
 					"version", Integer.class);
 			String vdbDescription = ProfileServiceUtil.getSimpleValue(mcVdb,
@@ -93,6 +95,7 @@
 			Configuration configuration = detail.getPluginConfiguration();
 
 			configuration.put(new PropertySimple("name", vdbName));
+			configuration.put(new PropertySimple("fullName", fullName));
 			configuration.put(new PropertySimple("version", vdbVersion));
 			configuration
 					.put(new PropertySimple("description", vdbDescription));



More information about the teiid-commits mailing list