Author: tejones
Date: 2010-01-14 12:18:34 -0500 (Thu, 14 Jan 2010)
New Revision: 1746
Modified:
trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java
Log:
TEIID-807: Updating constants
Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2010-01-14
16:38:15 UTC (rev 1745)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2010-01-14
17:18:34 UTC (rev 1746)
@@ -50,47 +50,18 @@
private final Log LOG = LogFactory.getLog(PlatformComponent.class);
/**
- * Property is used to identify an unreachable system
- */
- protected static final String UNREACHABLE_NAME = "UNREACHABLE_PLATFORM";
//$NON-NLS-1$
-
- /**
* @see org.teiid.rhq.plugin.Facet#getComponentType()
* @since 4.3
*/
@Override
String getComponentType() {
- return ConnectionConstants.ComponentType.PLATFORM;
+ return null;
}
@Override
public AvailabilityType getAvailability() {
- if (!connMgr.hasServersDefined()) {
- this.isAvailable = false;
- return AvailabilityType.DOWN;
-
- }
- Connection connection = null;
- try {
-
- LOG.debug("Checking availability of " + this.getComponentIdentifier());
//$NON-NLS-1$
- connection = getConnection();
- if (connection.isAlive()) {
- LOG.info("Availability of " + this.getComponentIdentifier() + " is
up"); //$NON-NLS-1$ //$NON-NLS-2$
- this.isAvailable = true;
- return AvailabilityType.UP;
- }
- } catch (InvalidPluginConfigurationException ipce) {
- // dont log anything, already done when getconnection is called
- } catch (Throwable err) {
- LOG.error("Unknown exception occured when checking availability for resource
" + this.getComponentIdentifier(), err); //$NON-NLS-1$
- } finally {
- connection.close();
- }
- LOG.error("Availability of " + this.getComponentIdentifier() + " is
down"); //$NON-NLS-1$ //$NON-NLS-2$
- this.isAvailable = false;
- return AvailabilityType.DOWN;
+ return AvailabilityType.UP;
}
@@ -112,7 +83,6 @@
public void stop() {
// TODO Auto-generated method stub
super.stop();
- connMgr.shutdown();
}
@Override
Modified:
trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java
===================================================================
---
trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java 2010-01-14
16:38:15 UTC (rev 1745)
+++
trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformDiscoveryComponent.java 2010-01-14
17:18:34 UTC (rev 1746)
@@ -24,14 +24,10 @@
import java.util.HashSet;
import java.util.Set;
-import javax.naming.InitialContext;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.managed.api.ComponentType;
import org.jboss.managed.api.ManagedComponent;
-import org.jboss.profileservice.spi.ProfileService;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
@@ -39,18 +35,13 @@
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
import org.teiid.rhq.plugin.util.PluginConstants;
+import org.teiid.rhq.plugin.util.ProfileServiceUtil;
/**
* This is the parent node for a MetaMatrix system
*/
public class PlatformDiscoveryComponent implements ResourceDiscoveryComponent {
-
- private static final Log LOG = LogFactory
- .getLog(PlatformDiscoveryComponent.class);
-
- public static final String p = "connectorAddress"; //$NON-NLS-1$
-
private final Log log = LogFactory.getLog(this.getClass());
/**
@@ -66,25 +57,14 @@
Set<DiscoveredResourceDetails> discoveredResources = new
HashSet<DiscoveredResourceDetails>();
- InitialContext ic = new InitialContext();
- ProfileService ps = (ProfileService) ic.lookup(PluginConstants.PROFILE_SERVICE);
+ ManagedComponent mc = ProfileServiceUtil.getManagedComponent(
+ new ComponentType(PluginConstants.ComponentType.Runtime.TYPE,
+ PluginConstants.ComponentType.Runtime.SUBTYPE),
+ PluginConstants.ComponentType.Runtime.TEIID_RUNTIME_ENGINE);
- ManagementView vm = ps.getViewManager();
- vm.load();
- ComponentType type = new ComponentType(PluginConstants.CONNECTION_FACTORY_TYPE,
PluginConstants.NO_TX_SUBTYPE);
- ManagedComponent mc = vm.getComponent(PluginConstants.TEIID_RUNTIME_ENGINE,
- type);
-
- /*
- * Currently this uses a hardcoded remote address for access to the
- * MBean server This needs to be switched to check if we e.g. run inside
- * a JBossAS to which we have a connection already that we can reuse.
- */
- Configuration c = new Configuration(); // TODO get from
- // defaultPluginConfig
-
+ Configuration c = new Configuration();
String managerName = mc.getName();
-
+
c.put(new PropertySimple("objectName", managerName));
/**
*
@@ -94,9 +74,9 @@
DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
discoveryContext.getResourceType(), // ResourceType
managerName, // Resource Key
- PluginConstants.TEIID_ENGINE_RESOURCE_NAME, // Resource Name
+ PluginConstants.ComponentType.Runtime.TEIID_ENGINE_RESOURCE_NAME, // Resource Name
null, // Version TODO can we get that from discovery ?
- PluginConstants.TEIID_ENGINE_RESOURCE_DESCRIPTION, // Description
+ PluginConstants.ComponentType.Runtime.TEIID_ENGINE_RESOURCE_DESCRIPTION, //
Description
c, // Plugin Config
null // Process info from a process scan
);
@@ -105,6 +85,6 @@
discoveredResources.add(detail);
log.info("Discovered Teiid instance: " + managerName);
return discoveredResources;
-
+
}
}
\ No newline at end of file
Show replies by date