teiid SVN: r902 - in trunk/server/src: test/java/com/metamatrix/admin/server and 1 other directory.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-05-10 00:51:35 -0400 (Sun, 10 May 2009)
New Revision: 902
Modified:
trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java
trunk/server/src/test/java/com/metamatrix/admin/server/TestServerConfigAdminImpl.java
Log:
Teiid 570 (new service method) - new methods to support configuring and monitoring services via adminAPI
Modified: trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java 2009-05-09 23:22:50 UTC (rev 901)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java 2009-05-10 04:51:35 UTC (rev 902)
@@ -2100,7 +2100,7 @@
service.setCreatedBy(svc.getCreatedBy());
service.setLastUpdated(svc.getLastChangedDate());
service.setLastUpdatedBy(svc.getLastChangedBy());
- results.add(svc);
+ results.add(service);
}
}
} catch(ConfigurationException e) {
Modified: trunk/server/src/test/java/com/metamatrix/admin/server/TestServerConfigAdminImpl.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/admin/server/TestServerConfigAdminImpl.java 2009-05-09 23:22:50 UTC (rev 901)
+++ trunk/server/src/test/java/com/metamatrix/admin/server/TestServerConfigAdminImpl.java 2009-05-10 04:51:35 UTC (rev 902)
@@ -34,6 +34,7 @@
import com.metamatrix.admin.api.objects.AdminOptions;
import com.metamatrix.admin.api.objects.ConnectorBinding;
import com.metamatrix.admin.api.objects.Host;
+import com.metamatrix.admin.api.objects.Service;
import com.metamatrix.core.util.ObjectConverterUtil;
import com.metamatrix.core.util.UnitTestUtil;
import com.metamatrix.metadata.runtime.api.Model;
@@ -362,9 +363,11 @@
}
public void testGetServices() throws Exception {
- Collection<ConnectorBinding> bindings = admin.getServicesToConfigure("*");
+ Collection<Service> bindings = admin.getServicesToConfigure("*");
assertEquals(7, bindings.size());
+ Service svc = (Service) bindings.iterator().next();
+
bindings = admin.getServicesToConfigure("QueryService");
assertEquals(1, bindings.size());
15 years, 7 months
teiid SVN: r901 - in trunk/server/src: main/java/com/metamatrix/platform/config/service and 2 other directories.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-05-09 19:22:50 -0400 (Sat, 09 May 2009)
New Revision: 901
Modified:
trunk/server/src/main/java/com/metamatrix/admin/server/AbstractAdminImpl.java
trunk/server/src/main/java/com/metamatrix/admin/server/ServerAdminImpl.java
trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java
trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java
trunk/server/src/main/java/com/metamatrix/platform/config/service/ConfigurationServiceImpl.java
trunk/server/src/test/java/com/metamatrix/admin/server/FakeConfiguration.java
trunk/server/src/test/java/com/metamatrix/admin/server/TestServerConfigAdminImpl.java
trunk/server/src/test/java/com/metamatrix/admin/server/TestServerMonitoringAdminImpl.java
trunk/server/src/test/resources/config/config.xml
Log:
Teiid 570 (new service method) - new methods to support configuring and monitoring services via adminAPI
Teiid 571 (new connector bindinng method) - new methods to support configuring bindings (existing method is used for monitoring and exposes them in the context of a host / process) via adminAPI
Modified: trunk/server/src/main/java/com/metamatrix/admin/server/AbstractAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/AbstractAdminImpl.java 2009-05-09 23:10:49 UTC (rev 900)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/AbstractAdminImpl.java 2009-05-09 23:22:50 UTC (rev 901)
@@ -360,16 +360,16 @@
return results;
}
- protected String getConnectorBindingNameFromUUID(String uuid) throws ConfigurationException {
- Configuration config;
- config = getConfigurationServiceProxy().getCurrentConfiguration();
- ConnectorBinding cb = config.getConnectorBindingByRoutingID(uuid);
- if (cb != null) {
- return cb.getName();
- }
-
- return null;
- }
+// protected String getConnectorBindingNameFromUUID(String uuid) throws ConfigurationException {
+// Configuration config;
+// config = getConfigurationServiceProxy().getCurrentConfiguration();
+// ConnectorBinding cb = config.getConnectorBindingByRoutingID(uuid);
+// if (cb != null) {
+// return cb.getName();
+// }
+//
+// return null;
+// }
protected List getConnectorBindingNamesFromUUIDs(List uuids, ConfigurationModelContainer configModel) {
List results = new ArrayList(uuids.size());
@@ -386,11 +386,11 @@
}
- protected List getConnectorBindingNamesFromUUIDs(List uuids) throws ConfigurationException, ServiceException {
- ConfigurationModelContainer cmc = getConfigurationModel();
-
- return getConnectorBindingNamesFromUUIDs(uuids, cmc);
- }
+// protected List getConnectorBindingNamesFromUUIDs(List uuids) throws ConfigurationException, ServiceException {
+// ConfigurationModelContainer cmc = getConfigurationModel();
+//
+// return getConnectorBindingNamesFromUUIDs(uuids, cmc);
+// }
protected Map getConnectorBindingNamesMapFromUUIDs(Collection uuids) throws ConfigurationException {
Configuration config;
Modified: trunk/server/src/main/java/com/metamatrix/admin/server/ServerAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/ServerAdminImpl.java 2009-05-09 23:10:49 UTC (rev 900)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/ServerAdminImpl.java 2009-05-09 23:22:50 UTC (rev 901)
@@ -989,5 +989,27 @@
public void terminateTransaction(Xid transactionId) throws AdminException {
getRuntimeAdmin().terminateTransaction(transactionId);
}
+
+ @Override
+ public Collection getConnectorBindingsToConfigure(String resourceIdentfier)
+ throws AdminException {
+ // TODO Auto-generated method stub
+ return getConfigurationAdmin().getConnectorBindingsToConfigure(resourceIdentfier);
+ }
+
+ @Override
+ public Collection getServicesToConfigure(String resourceIdentfier)
+ throws AdminException {
+ // TODO Auto-generated method stub
+ return getConfigurationAdmin().getServicesToConfigure(resourceIdentfier);
+ }
+
+ @Override
+ public Collection getServices(String identifier) throws AdminException {
+ // TODO Auto-generated method stub
+ return getMonitoringAdmin().getServices(identifier);
+ }
+
+
}
\ No newline at end of file
Modified: trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java 2009-05-09 23:10:49 UTC (rev 900)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java 2009-05-09 23:22:50 UTC (rev 901)
@@ -59,6 +59,7 @@
import com.metamatrix.admin.objects.MMConnectorBinding;
import com.metamatrix.admin.objects.MMLogConfiguration;
import com.metamatrix.admin.objects.MMScriptsContainer;
+import com.metamatrix.admin.objects.MMService;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.api.exception.security.AuthorizationException;
@@ -2014,7 +2015,105 @@
throw new AdminComponentException(e);
}
}
+
+
+ @Override
+ public Collection getConnectorBindingsToConfigure(String resourceIdentfier)
+ throws AdminException {
+ if (resourceIdentfier == null) {
+ throwProcessingException("AdminImpl.requiredparameter", new Object[] {}); //$NON-NLS-1$
+ }
+
+ HashSet results = new HashSet();
+ try {
+ ConfigurationModelContainer config = getConfigurationServiceProxy().getConfigurationModel(Configuration.NEXT_STARTUP);
+ Collection<ConnectorBinding> components = config.getConfiguration().getConnectorBindings();
+
+ for (Iterator<ConnectorBinding> iter = components.iterator(); iter.hasNext();) {
+ ConnectorBinding cb = iter.next();
+
+ String bindingName = cb.getName();
+
+ String[] identifierParts = new String[] {
+ bindingName
+ };
+
+ if (identifierMatches(resourceIdentfier, identifierParts)) {
+ MMConnectorBinding binding = new MMConnectorBinding(identifierParts);
+ binding.setConnectorTypeName(cb.getComponentTypeID().getFullName());
+ binding.setRoutingUUID(cb.getRoutingUUID());
+ binding.setEnabled(cb.isEnabled());
+ binding.setDeployed(false);
+ binding.setRegistered(false);
+ binding.setState(MMConnectorBinding.STATE_NOT_REGISTERED);
+ binding.setProperties(cb.getProperties());
+
+ binding.setCreated(cb.getCreatedDate());
+ binding.setCreatedBy(cb.getCreatedBy());
+ binding.setLastUpdated(cb.getLastChangedDate());
+ binding.setLastUpdatedBy(cb.getLastChangedBy());
+ results.add(binding);
+ }
+ }
+ } catch(ConfigurationException e) {
+ throw new AdminComponentException(e);
+ } catch (ServiceException e) {
+ throw new AdminComponentException(e);
+ }
+
+ return results;
+ }
+
+ @Override
+ public Collection getServicesToConfigure(String resourceIdentfier)
+ throws AdminException {
+ if (resourceIdentfier == null) {
+ throwProcessingException("AdminImpl.requiredparameter", new Object[] {}); //$NON-NLS-1$
+ }
+
+ HashSet results = new HashSet();
+ try {
+ ConfigurationModelContainer config = getConfigurationServiceProxy().getConfigurationModel(Configuration.NEXT_STARTUP);
+
+ Collection<ServiceComponentDefn> components = config.getConfiguration().getServiceComponentDefns();
+
+ for (Iterator<ServiceComponentDefn> iter = components.iterator(); iter.hasNext();) {
+ ServiceComponentDefn svc = iter.next();
+
+ String svcName = svc.getName();
+
+ String[] identifierParts = new String[] {
+ svcName
+ };
+
+ if (identifierMatches(resourceIdentfier, identifierParts)) {
+ MMService service = new MMService(identifierParts);
+ service.setComponentTypeName(svc.getComponentTypeID().getFullName());
+ service.setEnabled(svc.isEnabled());
+ service.setDeployed(false);
+ service.setRegistered(false);
+ service.setState(MMConnectorBinding.STATE_NOT_REGISTERED);
+ service.setProperties(svc.getProperties());
+
+ service.setCreated(svc.getCreatedDate());
+ service.setCreatedBy(svc.getCreatedBy());
+ service.setLastUpdated(svc.getLastChangedDate());
+ service.setLastUpdatedBy(svc.getLastChangedBy());
+ results.add(svc);
+ }
+ }
+ } catch(ConfigurationException e) {
+ throw new AdminComponentException(e);
+ } catch (ServiceException e) {
+ throw new AdminComponentException(e);
+ }
+
+ return results;
+
+ }
+
+
protected ServiceComponentDefn getServiceByName(String serviceName) throws ConfigurationException,
InvalidSessionException,
AuthorizationException,
Modified: trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java 2009-05-09 23:10:49 UTC (rev 900)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/ServerMonitoringAdminImpl.java 2009-05-09 23:22:50 UTC (rev 901)
@@ -47,6 +47,7 @@
import com.metamatrix.admin.api.objects.AdminObject;
import com.metamatrix.admin.api.objects.Model;
import com.metamatrix.admin.api.objects.Resource;
+import com.metamatrix.admin.api.objects.Service;
import com.metamatrix.admin.api.objects.Session;
import com.metamatrix.admin.api.objects.SystemObject;
import com.metamatrix.admin.api.objects.Transaction;
@@ -62,6 +63,7 @@
import com.metamatrix.admin.objects.MMQueueWorkerPool;
import com.metamatrix.admin.objects.MMRequest;
import com.metamatrix.admin.objects.MMResource;
+import com.metamatrix.admin.objects.MMService;
import com.metamatrix.admin.objects.MMSession;
import com.metamatrix.admin.objects.MMSystem;
import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -164,11 +166,12 @@
MMConnectorBinding binding = new MMConnectorBinding(identifierParts);
binding.setConnectorTypeName(configBinding.getComponentTypeID().getFullName());
binding.setRoutingUUID(configBinding.getRoutingUUID());
- binding.setEnabled(configBinding.isEnabled());
+ binding.setEnabled(component.isEnabled()); // use the deployed component setting for being enabled.
binding.setDeployed(true);
binding.setRegistered(false);
binding.setState(MMConnectorBinding.STATE_NOT_REGISTERED);
binding.setProperties(configBinding.getProperties());
+ binding.setDescription(component.getDescription());
binding.setCreated(configBinding.getCreatedDate());
binding.setCreatedBy(configBinding.getCreatedBy());
@@ -196,8 +199,6 @@
if (runtimeMap.containsKey(deployedComponent.getFullName())) {
//reuse MMConnectorBinding from config
binding = (MMConnectorBinding) runtimeMap.get(deployedComponent.getFullName());
- binding.setConnectorTypeName(deployedComponent.getComponentTypeID().getFullName());
- binding.setDescription(deployedComponent.getDescription());
binding.setState(serviceBinding.getCurrentState());
binding.setStateChangedTime(serviceBinding.getStateChangeTime());
binding.setRegistered(true);
@@ -707,7 +708,124 @@
}
return results;
}
+
+ /**
+ * Get monitoring information about services.
+ * @see com.metamatrix.admin.api.server.ServerMonitoringAdmin#getServicess(java.lang.String)
+ * @param identifier Fully-qualified identifier of a host, process, or service
+ * to get information for. For example, "hostname", or "hostname.processname", or "
+ * "hostname.processname.servicename".
+ * <p>If identifier is "*", this method returns information about all services in the system.
+ * @return a <code>Collection</code> of <code>com.metamatrix.admin.api.Service</code>
+ * @since 4.3
+ */
+ public Collection getServices(String identifier) throws AdminException {
+
+ if (identifier == null) {
+ throwProcessingException("AdminImpl.requiredparameter", new Object[] {}); //$NON-NLS-1$
+ }
+
+ HashSet results = new HashSet();
+ try {
+ //get config data from ConfigurationService
+ Configuration config = getConfigurationServiceProxy().getCurrentConfiguration();
+ Collection components = config.getDeployedComponents();
+
+ //convert config data to MMService objects, put in a hashmap by identifier
+ Map runtimeMap = new HashMap();
+ for (Iterator iter = components.iterator(); iter.hasNext();) {
+ BasicDeployedComponent component = (BasicDeployedComponent)iter.next();
+ if (component.isDeployedConnector()) {
+ continue;
+ }
+ String serviceName = component.getName();
+ String[] identifierParts = new String[] {
+ component.getHostID().getName(), component.getVMComponentDefnID().getName(), serviceName
+ };
+
+ ServiceComponentDefn service = config.getServiceComponentDefn(serviceName);
+ if (service != null && identifierMatches(identifier, identifierParts)) {
+
+ MMService mmservice = new MMService(identifierParts);
+ mmservice.setComponentTypeName(service.getComponentTypeID().getFullName());
+ mmservice.setEnabled(component.isEnabled());
+ mmservice.setDeployed(true);
+ mmservice.setRegistered(false);
+ mmservice.setState(Service.STATE_NOT_REGISTERED);
+ mmservice.setProperties(service.getProperties());
+ mmservice.setDescription(component.getDescription());
+
+ mmservice.setCreated(service.getCreatedDate());
+ mmservice.setCreatedBy(service.getCreatedBy());
+ mmservice.setLastUpdated(service.getLastChangedDate());
+ mmservice.setLastUpdatedBy(service.getLastChangedBy());
+
+ runtimeMap.put(component.getFullName(), mmservice);
+ results.add(mmservice);
+ }
+
+ }
+
+ // get runtime data from RuntimeStateAdminAPIHelper
+ Collection serviceBindings = this.registry.getServiceBindings(null, null);
+
+ //convert runtime data into MMConnectorBinding objects
+ for (Iterator iter = serviceBindings.iterator(); iter.hasNext();) {
+ ServiceRegistryBinding serviceBinding = (ServiceRegistryBinding) iter.next();
+ DeployedComponent deployedComponent = serviceBinding.getDeployedComponent();
+
+ if (deployedComponent!= null && ! deployedComponent.isDeployedConnector()) {
+ String name = serviceBinding.getDeployedName();
+
+ MMService mmservice;
+ if (runtimeMap.containsKey(deployedComponent.getFullName())) {
+ //reuse MMService from config
+ mmservice = (MMService) runtimeMap.get(deployedComponent.getFullName());
+ mmservice.setState(serviceBinding.getCurrentState());
+ mmservice.setStateChangedTime(serviceBinding.getStateChangeTime());
+ mmservice.setRegistered(true);
+ mmservice.setServiceID(serviceBinding.getServiceID().getID());
+
+ } else {
+
+ String[] identifierParts = new String[] {
+ deployedComponent.getHostID().getName(),
+ deployedComponent.getVMComponentDefnID().getName(),
+ deployedComponent.getName()
+ };
+
+ if (identifierMatches(identifier, identifierParts)) {
+
+ //not in config - create new MMConnectorBinding
+ mmservice = new MMService(identifierParts);
+ mmservice.setDeployed(false);
+ mmservice.setState(MMConnectorBinding.STATE_NOT_DEPLOYED);
+
+
+ mmservice.setComponentTypeName(deployedComponent.getComponentTypeID().getFullName());
+ mmservice.setDescription(deployedComponent.getDescription());
+ mmservice.setState(serviceBinding.getCurrentState());
+ mmservice.setStateChangedTime(serviceBinding.getStateChangeTime());
+ mmservice.setRegistered(true);
+ mmservice.setServiceID(serviceBinding.getServiceID().getID());
+
+ results.add(mmservice);
+
+ }
+
+ }
+ }
+ }
+ } catch (ServiceException e) {
+ throw new AdminComponentException(e);
+ } catch (ConfigurationException e) {
+ throw new AdminComponentException(e);
+ }
+ return results;
+ }
+
+
/**
* Get monitoring information about worker queues for DQPs or connector bindings.
* @see com.metamatrix.admin.api.server.ServerMonitoringAdmin#getQueueWorkerPools(java.lang.String)
Modified: trunk/server/src/main/java/com/metamatrix/platform/config/service/ConfigurationServiceImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/config/service/ConfigurationServiceImpl.java 2009-05-09 23:10:49 UTC (rev 900)
+++ trunk/server/src/main/java/com/metamatrix/platform/config/service/ConfigurationServiceImpl.java 2009-05-09 23:22:50 UTC (rev 901)
@@ -816,6 +816,9 @@
}
}
+ /**
+ * the name is nullable, if not specified, then the name in the inputStream (connector type file) will be used
+ */
public ComponentType importConnectorType(InputStream inputStream, String name, String principalName) throws ConfigurationException {
ComponentType newType = null;
ConfigurationObjectEditor editor = createEditor();
Modified: trunk/server/src/test/java/com/metamatrix/admin/server/FakeConfiguration.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/admin/server/FakeConfiguration.java 2009-05-09 23:10:49 UTC (rev 900)
+++ trunk/server/src/test/java/com/metamatrix/admin/server/FakeConfiguration.java 2009-05-09 23:22:50 UTC (rev 901)
@@ -53,6 +53,7 @@
import com.metamatrix.common.config.model.BasicConfigurationObjectEditor;
import com.metamatrix.common.config.model.BasicConnectorBinding;
import com.metamatrix.common.config.model.BasicDeployedComponent;
+import com.metamatrix.common.config.model.BasicServiceComponentDefn;
import com.metamatrix.common.config.model.BasicVMComponentDefn;
import com.metamatrix.common.config.model.ConfigurationVisitor;
import com.metamatrix.common.log.LogConfiguration;
@@ -67,7 +68,10 @@
/**List<DeployedComponent**/
- public List deployedComponents;
+ public List deployedComponents;
+ public List services;
+ public Map serviceMap;
+ public List connectorbindings;
protected Map hosts ;
@@ -124,7 +128,10 @@
*/
public void initDeployedComponents() {
deployedComponents = new ArrayList();
- hosts = new HashMap();
+ hosts = new HashMap();
+ serviceMap = new HashMap();
+ this.connectorbindings = new ArrayList();
+ this.services = new ArrayList();
//Connector Bindings
ConfigurationObjectEditor editor = new BasicConfigurationObjectEditor(false);
@@ -140,7 +147,10 @@
DeployedComponentID deployedComponentID1 = new DeployedComponentID("connectorBinding1", Configuration.NEXT_STARTUP_ID, (HostID) h.getID(), //$NON-NLS-1$
processID1);
ConnectorBindingID connectorBindingID1 = new ConnectorBindingID(Configuration.NEXT_STARTUP_ID, "connectorBinding1"); //$NON-NLS-1$
- BasicDeployedComponent deployedComponent1 = new BasicDeployedComponent(deployedComponentID1, Configuration.NEXT_STARTUP_ID,
+ BasicConnectorBinding cb = new BasicConnectorBinding(Configuration.NEXT_STARTUP_ID, connectorBindingID1, ConnectorBindingType.CONNECTOR_TYPE_ID);
+
+ this.connectorbindings.add(cb);
+ BasicDeployedComponent deployedComponent1 = new BasicDeployedComponent(deployedComponentID1, Configuration.NEXT_STARTUP_ID,
(HostID) h.getID(), processID1,
connectorBindingID1,
ConnectorBindingType.CONNECTOR_TYPE_ID);
@@ -159,6 +169,11 @@
DeployedComponentID deployedComponentID2 = new DeployedComponentID("connectorBinding2", Configuration.NEXT_STARTUP_ID, (HostID) h2.getID(), //$NON-NLS-1$
processID2);
ConnectorBindingID connectorBindingID2 = new ConnectorBindingID(Configuration.NEXT_STARTUP_ID, "connectorBinding2"); //$NON-NLS-1$
+ BasicConnectorBinding cb2 = new BasicConnectorBinding(Configuration.NEXT_STARTUP_ID, connectorBindingID2, ConnectorBindingType.CONNECTOR_TYPE_ID);
+
+ this.connectorbindings.add(cb2);
+
+
BasicDeployedComponent deployedComponent2 = new BasicDeployedComponent(deployedComponentID2, Configuration.NEXT_STARTUP_ID,
(HostID) h2.getID(), processID2,
connectorBindingID2,
@@ -179,6 +194,11 @@
DeployedComponentID deployedComponentID3 = new DeployedComponentID("connectorBinding3", Configuration.NEXT_STARTUP_ID, (HostID) h3.getID(), //$NON-NLS-1$
processID3);
ConnectorBindingID connectorBindingID3 = new ConnectorBindingID(Configuration.NEXT_STARTUP_ID, "connectorBinding3"); //$NON-NLS-1$
+ BasicConnectorBinding cb3 = new BasicConnectorBinding(Configuration.NEXT_STARTUP_ID, connectorBindingID3, ConnectorBindingType.CONNECTOR_TYPE_ID);
+
+ this.connectorbindings.add(cb3);
+
+
BasicDeployedComponent deployedComponent3 = new BasicDeployedComponent(deployedComponentID3, Configuration.NEXT_STARTUP_ID,
(HostID) h3.getID(), processID3,
connectorBindingID3,
@@ -192,6 +212,12 @@
DeployedComponentID deployedComponentID1A = new DeployedComponentID("dqp1", Configuration.NEXT_STARTUP_ID, (HostID) h.getID(), //$NON-NLS-1$
processID1);
ServiceComponentDefnID defnID1A = new ServiceComponentDefnID(Configuration.NEXT_STARTUP_ID, "dqp1"); //$NON-NLS-1$
+ BasicServiceComponentDefn sdfn = new BasicServiceComponentDefn(Configuration.NEXT_STARTUP_ID, defnID1A, new ComponentTypeID("QueryService"));
+
+ this.services.add(sdfn);
+ serviceMap.put(defnID1A.getFullName(), sdfn);
+
+
BasicDeployedComponent deployedComponent1A = new BasicDeployedComponent(deployedComponentID1A, Configuration.NEXT_STARTUP_ID,
(HostID) h.getID(), processID1,
defnID1A,
@@ -203,6 +229,12 @@
DeployedComponentID deployedComponentID2A = new DeployedComponentID("dqp2", Configuration.NEXT_STARTUP_ID, (HostID) h2.getID(), //$NON-NLS-1$
processID2);
ServiceComponentDefnID defnID2A = new ServiceComponentDefnID(Configuration.NEXT_STARTUP_ID, "dqp2"); //$NON-NLS-1$
+ BasicServiceComponentDefn sdfn2 = new BasicServiceComponentDefn(Configuration.NEXT_STARTUP_ID, defnID2A, new ComponentTypeID("QueryService"));
+
+ this.services.add(sdfn2);
+ serviceMap.put(defnID2A.getFullName(), sdfn2);
+
+
BasicDeployedComponent deployedComponent2A = new BasicDeployedComponent(deployedComponentID2A, Configuration.NEXT_STARTUP_ID,
(HostID) h2.getID(), processID2,
defnID2A,
@@ -214,6 +246,11 @@
DeployedComponentID deployedComponentID3A = new DeployedComponentID("dqp3", Configuration.NEXT_STARTUP_ID, (HostID) h3.getID(), //$NON-NLS-1$
processID3);
ServiceComponentDefnID defnID3A = new ServiceComponentDefnID(Configuration.NEXT_STARTUP_ID, "dqp3"); //$NON-NLS-1$
+ BasicServiceComponentDefn sdfn3 = new BasicServiceComponentDefn(Configuration.NEXT_STARTUP_ID, defnID3A, new ComponentTypeID("QueryService"));
+
+ this.services.add(sdfn3);
+ serviceMap.put(defnID3A.getFullName(), sdfn3);
+
BasicDeployedComponent deployedComponent3A = new BasicDeployedComponent(deployedComponentID3A, Configuration.NEXT_STARTUP_ID,
(HostID) h3.getID(), processID3,
defnID3A,
@@ -324,7 +361,10 @@
}
public Collection getConnectorBindings() {
- return null;
+ List results = new ArrayList();
+
+ results.addAll(this.connectorbindings);
+ return results;
}
/**
@@ -398,15 +438,19 @@
}
public ServiceComponentDefn getServiceComponentDefn(ComponentDefnID defnID) {
- return null;
+ return (ServiceComponentDefn) serviceMap.get(defnID.getFullName());
}
public ServiceComponentDefn getServiceComponentDefn(String name) {
- return null;
+ return (ServiceComponentDefn) serviceMap.get(name);
}
public Collection getServiceComponentDefns() {
- return null;
+ List results = new ArrayList();
+
+ results.addAll(this.services);
+ return results;
+
}
public VMComponentDefn getVMComponentDefn(ComponentDefnID componentID) {
Modified: trunk/server/src/test/java/com/metamatrix/admin/server/TestServerConfigAdminImpl.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/admin/server/TestServerConfigAdminImpl.java 2009-05-09 23:10:49 UTC (rev 900)
+++ trunk/server/src/test/java/com/metamatrix/admin/server/TestServerConfigAdminImpl.java 2009-05-09 23:22:50 UTC (rev 901)
@@ -345,7 +345,35 @@
if(admin.getConfigurationModel().getConfiguration().getAuthenticationProvider(name) == null) {
fail("AuthenticationProvider ["+name+"] was not found to be added"); //$NON-NLS-1$ //$NON-NLS-2$
}
- }
+ }
+
+ public void testGetConnectorBindings() throws Exception {
+ Collection<ConnectorBinding> bindings = admin.getConnectorBindingsToConfigure("*");
+ assertEquals(2, bindings.size());
+
+ bindings = admin.getConnectorBindingsToConfigure("My Connector");
+ assertEquals(1, bindings.size());
+
+ bindings = admin.getConnectorBindingsToConfigure("My*");
+ assertEquals(1, bindings.size());
+
+
+
+ }
+
+ public void testGetServices() throws Exception {
+ Collection<ConnectorBinding> bindings = admin.getServicesToConfigure("*");
+ assertEquals(7, bindings.size());
+
+ bindings = admin.getServicesToConfigure("QueryService");
+ assertEquals(1, bindings.size());
+
+ bindings = admin.getServicesToConfigure("Query*");
+ assertEquals(1, bindings.size());
+
+
+
+ }
}
Modified: trunk/server/src/test/java/com/metamatrix/admin/server/TestServerMonitoringAdminImpl.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/admin/server/TestServerMonitoringAdminImpl.java 2009-05-09 23:10:49 UTC (rev 900)
+++ trunk/server/src/test/java/com/metamatrix/admin/server/TestServerMonitoringAdminImpl.java 2009-05-09 23:22:50 UTC (rev 901)
@@ -44,8 +44,10 @@
import com.metamatrix.admin.objects.MMQueueWorkerPool;
import com.metamatrix.admin.objects.MMRequest;
import com.metamatrix.admin.objects.MMResource;
+import com.metamatrix.admin.objects.MMService;
import com.metamatrix.admin.objects.MMSession;
import com.metamatrix.admin.objects.MMSystem;
+import com.metamatrix.common.config.api.ServiceComponentDefn;
import com.metamatrix.common.config.api.SharedResource;
import com.metamatrix.platform.registry.ClusteredRegistryState;
import com.metamatrix.platform.registry.FakeRegistryUtil;
@@ -146,9 +148,52 @@
results = admin.getConnectorBindings(HOST_2_2_2_2_WILDCARD);
assertEquals(1, results.size());
+
+ }
+
+ /**
+ * Tests <code>ServerMonitoringImpl.getServices()</code>.
+ *
+ * Fake data is set up in FakeConfiguration.getDeployedComponents(), FakeConfiguration.getServices(),
+ * FakeRuntimeStateAdminAPIHelper.getService(),
+ * Expects service1 to be deployed, but not running.
+ * Expects service2 to be deployed and running.
+ * Expects service3 to be running, but not deployed.
+ * @since 6.1
+ */
+ public void testGetServices() throws AdminException {
+
+ try {
+ ServiceRegistryBinding binding = admin.registry.getServiceBinding("3.3.3.3","3", new ServiceID(3, "3.3.3.3", "3")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ binding.updateState(ConnectorBinding.STATE_CLOSED);
+ } catch (ResourceNotBoundException e1) {
+ }
+
+ Collection<MMService> results = admin.getServices(AdminObject.WILDCARD);
+ assertEquals(3, results.size());
+ for (Iterator iter = results.iterator(); iter.hasNext(); ) {
+
+ MMService svc = (MMService) iter.next();
+
+ if (HOST_2_2_2_2_PROCESS2_DQP2.equals(svc.getIdentifier())){
+
+ assertEquals(true, svc.isRegistered());
+ } else if (_3_3_3_3_PROCESS3_DQP3.equals(svc.getIdentifier())) {
+
+ assertEquals(true, svc.isRegistered());
+ }
+ }
+
+ results = admin.getServices(HOST_2_2_2_2_PROCESS2_DQP2);
+ assertEquals(1, results.size());
+
+ results = admin.getServices(_3_3_3_3_PROCESS3_DQP3);
+ assertEquals(1, results.size());
+
}
+
Modified: trunk/server/src/test/resources/config/config.xml
===================================================================
--- trunk/server/src/test/resources/config/config.xml 2009-05-09 23:10:49 UTC (rev 900)
+++ trunk/server/src/test/resources/config/config.xml 2009-05-09 23:22:50 UTC (rev 901)
@@ -81,7 +81,9 @@
<DeployedService Name="ConfigurationService" ComponentType="ConfigurationService" LastChangedBy="ConfigurationStartup" CreatedBy="ConfigurationStartup" />
<DeployedService Name="QueryService" ComponentType="QueryService" LastChangedBy="ConfigurationStartup" CreatedBy="ConfigurationStartup" />
<DeployedService Name="RuntimeMetadataService" ComponentType="RuntimeMetadataService" LastChangedBy="ConfigurationStartup" CreatedBy="ConfigurationStartup" />
- </Process>
+ <DeployedService Name="My Connector" ComponentType="JDBC Connector" LastChangedBy="ConfigurationStartup" CreatedBy="ConfigurationStartup" />
+ <DeployedService Name="Test Connector" ComponentType="JDBC Connector" LastChangedBy="ConfigurationStartup" CreatedBy="ConfigurationStartup" />
+ </Process>
</Host>
</Configuration>
<Services>
@@ -164,6 +166,16 @@
<Property Name="IsXA">true</Property>
</Properties>
</Connector>
+ <Connector Name="My Connector" ComponentType="JDBC Connector" LastChangedBy="ImportConfiguration" LastChangedDate="2005-03-09T06:28:34.422-06:00" CreatedBy="ImportConfiguration" CreationDate="2005-03-09T06:28:34.422-06:00" QueuedService="false">
+ <Properties>
+ <Property Name="Password">abc</Property>
+ <Property Name="User">theuser</Property>
+ <Property Name="URL">jdbc:mmx://server:port</Property>
+ <Property Name="Driver">driver.class</Property>
+ <Property Name="IsXA">true</Property>
+ </Properties>
+ </Connector>
+
</ConnectorBindings>
<AuthenticationProviders>
<Provider Name="testFileDomainProvider" ComponentType="File Membership Domain Provider" LastChangedBy="metamatrixadmin" LastChangedDate="2007-05-24T12:52:48.088-06:00" CreatedBy="metamatrixadmin" CreationDate="2007-05-24T12:52:48.088-06:00">
15 years, 7 months
teiid SVN: r900 - in trunk/client/src/main/java/com/metamatrix/admin: api/server and 1 other directories.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-05-09 19:10:49 -0400 (Sat, 09 May 2009)
New Revision: 900
Added:
trunk/client/src/main/java/com/metamatrix/admin/api/objects/Service.java
trunk/client/src/main/java/com/metamatrix/admin/objects/MMService.java
Modified:
trunk/client/src/main/java/com/metamatrix/admin/api/server/ServerConfigAdmin.java
trunk/client/src/main/java/com/metamatrix/admin/api/server/ServerMonitoringAdmin.java
Log:
Teiid 570 (new service method) - new methods to support configuring and monitoring services via adminAPI
Teiid 571 (new connector bindinng method) - new methods to support configuring bindings (existing method is used for monitoring and exposes them in the context of a host / process) via adminAPI
Added: trunk/client/src/main/java/com/metamatrix/admin/api/objects/Service.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/api/objects/Service.java (rev 0)
+++ trunk/client/src/main/java/com/metamatrix/admin/api/objects/Service.java 2009-05-09 23:10:49 UTC (rev 900)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.admin.api.objects;
+
+import java.util.Date;
+
+/**
+ * Represents a service in the MetaMatrix system.
+ *
+ * <p>The unique identifier pattern is [host]<{@link #DELIMITER}>[process]<{@link #DELIMITER}>[Service Name]
+ * when running against a MetaMatrix server. The [Service Name] can itself have spaces in the name.
+ * In the case of the MM Query, a Service does not apply as MM Query is not running within a MM Server VM.</p>
+ *
+ * @since 4.3
+ */
+public interface Service extends
+ AdminObject {
+ /**Registered by not initialized*/
+ public static final int STATE_NOT_INITIALIZED = 0;
+ /**Open and running*/
+ public static final int STATE_OPEN = 1;
+ /**Registered but closed*/
+ public static final int STATE_CLOSED = 2;
+ /**Failed after running successfully*/
+ public static final int STATE_FAILED = 3;
+ /**Failed during initialization*/
+ public static final int STATE_INIT_FAILED = 4;
+ /**Not registered*/
+ public static final int STATE_NOT_REGISTERED = 5;
+ /**Running, but the underlying data source is unavailable*/
+ public static final int STATE_DATA_SOURCE_UNAVAILABLE = 6;
+ /**Running, not deployed*/
+ public static final int STATE_NOT_DEPLOYED = 7;
+
+ /**
+ * Retrieve the current connector state. This will be one of the constants:
+ * {@link DQP#STATE_OPEN DQP.STATE_OPEN}.
+ * {@link DQP#STATE_NOT_INITIALIZED DQP.STATE_NOT_INITIALIZED}.
+ * {@link DQP#STATE_CLOSED DQP.STATE_CLOSED}.
+ * {@link DQP#STATE_FAILED DQP.STATE_FAILED}.
+ * {@link DQP#STATE_INIT_FAILED DQP.STATE_INIT_FAILED}.
+ * {@link DQP#STATE_NOT_REGISTERED DQP.STATE_NOT_REGISTERED}.
+ * {@link DQP#STATE_DATA_SOURCE_UNAVAILABLE DQP.STATE_DATA_SOURCE_UNAVAILABLE}.
+ * {@link DQP#STATE_NOT_DEPLOYED DQP.STATE_NOT_DEPLOYED}.
+ * @return current connector state.
+ */
+ int getState();
+
+ /**
+ * Retrieve the current connector state as a printable <code>String</code>.
+ * @return current connector state in String form.
+ */
+ String getStateAsString();
+
+ /**
+ * Returns time of last state change.
+ *
+ * @return time of last state change.
+ * @since 4.3
+ */
+ Date getStateChangedTime();
+
+ /**
+ * Returns the description
+ *
+ * @return description
+ */
+ String getDescription();
+
+ /**
+ * Get the component type identifier for this service {@link ComponentType}.
+ * @return the Component Type identifier which can be used to
+ * find the ComponentType.
+ * @since 6.1
+ */
+ String getComponentTypeName();
+
+}
Property changes on: trunk/client/src/main/java/com/metamatrix/admin/api/objects/Service.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/client/src/main/java/com/metamatrix/admin/api/server/ServerConfigAdmin.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/api/server/ServerConfigAdmin.java 2009-05-09 04:59:46 UTC (rev 899)
+++ trunk/client/src/main/java/com/metamatrix/admin/api/server/ServerConfigAdmin.java 2009-05-09 23:10:49 UTC (rev 900)
@@ -22,6 +22,7 @@
package com.metamatrix.admin.api.server;
+import java.util.Collection;
import java.util.Properties;
import com.metamatrix.admin.RolesAllowed;
@@ -270,6 +271,46 @@
* @throws AdminException
* @since 6.0.0
*/
- byte[] getClusterKey() throws AdminException;
+ byte[] getClusterKey() throws AdminException;
+
+
+ /**
+ * Get the Services that correspond to the specified identifier pattern.
+ * These services represent the unique instance to be configured and instantiated
+ * when the server starts up. To monitor the current state of a running service,
+ * call {@link ServerMonitoringAdmin#getServices(String)}
+ *
+ * @param resourceIdentifier the unique identifier for for a {@link com.metamatrix.admin.api.objects.Service Service}
+ * in the system or "{@link com.metamatrix.admin.api.objects.AdminObject#WILDCARD WILDCARD}"
+ * if all Services are desired.
+ *
+ * NOTE: The {@link Service Service} is used for both monitoring and configuration. For a Service returned as part of configuration,
+ * the State will not be applicable. To find the state of a current running instance, call {@link ServerMonitoringAdmin#getServices(String)}
+ *
+ * @return Collection of {@link com.metamatrix.admin.api.objects.Service Service}
+ * @throws AdminException if there's a system error.
+ * @since 6.1
+ */
+ Collection getServicesToConfigure(String resourceIdentfier) throws AdminException;
+
+ /**
+ * Get the ConnectorBindings that correspond to the specified identifir pattern.
+ * These connectorbindings represent the unique instance to be configured and instantiated
+ * when the server starts up. To monitor the current state of a running connectorbinding,
+ * call {@link ServerMonitoringAdmin#getConnectorBindings(String)}
+ *
+ * @param resourceIdentifier the unique identifier for for a {@link com.metamatrix.admin.api.objects.ConnectorBinding ConnectorBinding}
+ * in the system or "{@link com.metamatrix.admin.api.objects.AdminObject#WILDCARD WILDCARD}"
+ * if all Services are desired.
+ *
+ * NOTE: The {@link ConnectorBinding ConnectorBinding} is used for both monitoring and configuration. For a Service returned as part of configuration,
+ * the State will not be applicable. To find the state of a current running instance, call {@link ServerMonitoringAdmin#getConnectorBinding(String)}
+ *
+ * @return Collection of {@link com.metamatrix.admin.api.objects.ConnectorBinding ConnectorBinding}
+ * @throws AdminException if there's a system error.
+ * @since 6.1
+ */
+ Collection getConnectorBindingsToConfigure(String resourceIdentfier) throws AdminException;
+
}
Modified: trunk/client/src/main/java/com/metamatrix/admin/api/server/ServerMonitoringAdmin.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/api/server/ServerMonitoringAdmin.java 2009-05-09 04:59:46 UTC (rev 899)
+++ trunk/client/src/main/java/com/metamatrix/admin/api/server/ServerMonitoringAdmin.java 2009-05-09 23:10:49 UTC (rev 900)
@@ -63,7 +63,23 @@
*/
@RolesAllowed(value=AdminRoles.RoleName.ANONYMOUS)
Collection getProcesses(String processIdentifier) throws AdminException;
+
+
+ /**
+ * Get the Services that correspond to the specified identifer pattern.
+ * These services represent what is defined for a given {@link Host} | {@link Process};
+ *
+ * @param resourceIdentifier the unique identifier for for a {@link com.metamatrix.admin.api.objects.Service Service}
+ * in the system or "{@link com.metamatrix.admin.api.objects.AdminObject#WILDCARD WILDCARD}"
+ * if all Services are desired.
+ * @return Collection of {@link com.metamatrix.admin.api.objects.Service Service}
+ * @throws AdminException if there's a system error.
+ * @since 6.1
+ */
+ Collection getServices(String identifier) throws AdminException ;
+
+
/**
* Get the Resources that correspond to the specified identifer pattern.
*
Added: trunk/client/src/main/java/com/metamatrix/admin/objects/MMService.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/admin/objects/MMService.java (rev 0)
+++ trunk/client/src/main/java/com/metamatrix/admin/objects/MMService.java 2009-05-09 23:10:49 UTC (rev 900)
@@ -0,0 +1,209 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.admin.objects;
+
+import java.util.Date;
+
+import com.metamatrix.admin.AdminPlugin;
+import com.metamatrix.admin.api.objects.ConnectorBinding;
+import com.metamatrix.admin.api.objects.Service;
+
+
+/**
+ * A Service
+ *
+ */
+public class MMService extends MMAdminObject implements Service {
+
+ private String description = ""; //$NON-NLS-1$
+ private String componentTypeName = ""; //$NON-NLS-1$
+ private int currentState;
+ private Date stateChangedTime;
+ private long serviceID = -1;
+
+
+ /**
+ * Constructor.
+ * @param identifierParts
+ * @since 6.1
+ */
+ public MMService(String[] identifierParts) {
+ super(identifierParts);
+ }
+
+
+
+
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ StringBuffer result = new StringBuffer();
+ result.append(AdminPlugin.Util.getString("MMService.MMService")).append(getIdentifier()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMService.Description")).append(description); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMService.Created")).append(getCreatedDate()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMService.Created_By")).append(getCreatedBy()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMService.Updated")).append(getLastChangedDate()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMService.Updated_By")).append(getLastChangedBy()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMService.State")).append(getState()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMService.State_Changed")).append(getStateChangedTime()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMService.IsRegistered")).append(isRegistered()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMService.IsDeployed")).append(isDeployed()); //$NON-NLS-1$
+ result.append(AdminPlugin.Util.getString("MMService.Properties")).append(getPropertiesAsString()); //$NON-NLS-1$
+ return result.toString();
+ }
+
+
+
+ /**
+ * Returns the description
+ * @return description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Set the description
+ * @param description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+
+ /**
+ * @return the current state of this connector binding.
+ */
+ public int getState() {
+ return this.currentState;
+ }
+
+ /**
+ * @return Returns the currentState as String.
+ * @since 6.1
+ */
+ public String getStateAsString() {
+ switch (currentState) {
+ case STATE_OPEN:
+ return AdminPlugin.Util.getString("MMService.open"); //$NON-NLS-1$
+ case STATE_CLOSED:
+ return AdminPlugin.Util.getString("MMService.closed"); //$NON-NLS-1$
+ case STATE_FAILED:
+ return AdminPlugin.Util.getString("MMService.failed"); //$NON-NLS-1$
+ case STATE_INIT_FAILED:
+ return AdminPlugin.Util.getString("MMService.initializationFailed"); //$NON-NLS-1$
+ case STATE_NOT_INITIALIZED:
+ return AdminPlugin.Util.getString("MMService.notInitialized"); //$NON-NLS-1$
+ case STATE_NOT_REGISTERED:
+ return AdminPlugin.Util.getString("MMService.notRegistered"); //$NON-NLS-1$
+ case STATE_DATA_SOURCE_UNAVAILABLE:
+ return AdminPlugin.Util.getString("MMService.dataSourceUnavailable"); //$NON-NLS-1$
+ default:
+ return AdminPlugin.Util.getString("MMService.unknown"); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Set the state
+ * @param state
+ * @since 6.1
+ */
+ public void setState(int state) {
+ this.currentState = state;
+
+ //check on what states mean "registered"
+ setRegistered(currentState==STATE_OPEN || currentState==STATE_FAILED || currentState==STATE_DATA_SOURCE_UNAVAILABLE);
+ }
+
+
+ /**
+ * @return Returns time of last state change.
+ * @since 6.1
+ */
+ public Date getStateChangedTime() {
+ return stateChangedTime;
+ }
+
+ /**
+ * Set the state changed time
+ * @param stateChangedTime
+ * @since 6.1
+ */
+ public void setStateChangedTime(Date stateChangedTime) {
+ this.stateChangedTime = stateChangedTime;
+ }
+
+
+ /**
+ * @return Returns the serviceID.
+ * @since 6.1
+ */
+ public long getServiceID() {
+ return this.serviceID;
+ }
+
+ /**
+ * @param serviceID The serviceID to set.
+ * @since 6.1
+ */
+ public void setServiceID(long serviceID) {
+ this.serviceID = serviceID;
+ }
+
+
+ /**
+ * @return Returns the processID.
+ * @since 6.1
+ */
+ public String getProcessName() {
+ return identifierParts[1];
+ }
+
+
+ /**
+ * @return Returns the hostName.
+ * @since 6.1
+ */
+ public String getHostName() {
+ return identifierParts[0];
+ }
+
+
+ /**
+ * @param connectorTypeName the identifier for a connector type
+ * @since 6.1
+ */
+ public void setComponentTypeName(String componentTypeName) {
+ this.componentTypeName = componentTypeName;
+ }
+
+ /**
+ * @see com.metamatrix.admin.api.objects.Service#getComponentTypeName()
+ * @since 6.1
+ */
+ public String getComponentTypeName() {
+ return this.componentTypeName;
+ }
+}
\ No newline at end of file
Property changes on: trunk/client/src/main/java/com/metamatrix/admin/objects/MMService.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 7 months
teiid SVN: r899 - trunk/server/src/main/java/com/metamatrix/platform/config/spi/xml.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-05-09 00:59:46 -0400 (Sat, 09 May 2009)
New Revision: 899
Modified:
trunk/server/src/main/java/com/metamatrix/platform/config/spi/xml/XMLConfigurationMgr.java
Log:
Teiid 442 - simplifying configuration mechanics. Needed to add a check in the finally block in cases when the connection was not made and therefore the close shouldn't be called
Modified: trunk/server/src/main/java/com/metamatrix/platform/config/spi/xml/XMLConfigurationMgr.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/config/spi/xml/XMLConfigurationMgr.java 2009-05-08 23:40:10 UTC (rev 898)
+++ trunk/server/src/main/java/com/metamatrix/platform/config/spi/xml/XMLConfigurationMgr.java 2009-05-09 04:59:46 UTC (rev 899)
@@ -169,12 +169,14 @@
} catch (ConfigObjectsNotResolvableException e) {
throw new ConfigurationException(e, ConfigMessages.CONFIG_0120,ConfigPlugin.Util.getString(ConfigMessages.CONFIG_0120, cmc.getConfigurationID()));
} finally {
- try {
- if (!success && pc != null) {
- pc.rollback();
+ if (pc != null) {
+ try {
+ if (!success && pc != null) {
+ pc.rollback();
+ }
+ } finally {
+ pc.close();
}
- } finally {
- pc.close();
}
}
15 years, 7 months
teiid SVN: r898 - trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-05-08 19:40:10 -0400 (Fri, 08 May 2009)
New Revision: 898
Modified:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
Log:
TEIID-558
Modified: trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
===================================================================
--- trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-05-08 20:25:59 UTC (rev 897)
+++ trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-05-08 23:40:10 UTC (rev 898)
@@ -902,6 +902,10 @@
if(udfFile != null && exists(udfFile)) {
List<URL> urls = getCommonExtensionClasspath();
try {
+
+ // un-register the old UDF model, if there is one.
+ unloadUDF();
+
if (urls == null || urls.isEmpty()) {
this.udfSource = new UDFSource(udfFile);
}
15 years, 7 months
teiid SVN: r897 - trunk/adminshell/src/main/resources/scripts.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-05-08 16:25:59 -0400 (Fri, 08 May 2009)
New Revision: 897
Modified:
trunk/adminshell/src/main/resources/scripts/adminapi.bsh
Log:
Teiid-569 - method fails, the script was doing a boolean check on the byte[], which it needed to do an "is not null" check
Modified: trunk/adminshell/src/main/resources/scripts/adminapi.bsh
===================================================================
--- trunk/adminshell/src/main/resources/scripts/adminapi.bsh 2009-05-08 19:21:34 UTC (rev 896)
+++ trunk/adminshell/src/main/resources/scripts/adminapi.bsh 2009-05-08 20:25:59 UTC (rev 897)
@@ -280,7 +280,7 @@
debug("Exporting Connector Binding " + bindingName + " to file " + fileName);
checkAdmin();
contents = currentContext().internalAdmin.exportConnectorBinding(bindingName);
- if (contents) {
+ if (contents != null) {
ObjectConverterUtil.write(contents, fileName);
}
else {
15 years, 7 months
teiid SVN: r896 - trunk/server/src/main/java/com/metamatrix/admin/server.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-05-08 15:21:34 -0400 (Fri, 08 May 2009)
New Revision: 896
Modified:
trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java
Log:
Teiid-569 - changed the exporting of one or more binding to only expect the binding name or the use of the wildcard (*). This will export any defined binding(s) that is seen in the ConnectorBindings panel or seen (export the config) in the ConnectorBindings segment.
Modified: trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java 2009-05-08 15:59:59 UTC (rev 895)
+++ trunk/server/src/main/java/com/metamatrix/admin/server/ServerConfigAdminImpl.java 2009-05-08 19:21:34 UTC (rev 896)
@@ -1087,8 +1087,8 @@
char[] results = null;
- List selectedBindings = new ArrayList();
- List selectedTypes = new ArrayList();
+ List<ConnectorBinding> selectedBindings = new ArrayList<ConnectorBinding>();
+ List<ComponentType> selectedTypes = new ArrayList<ComponentType>();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = new BufferedOutputStream(baos);
@@ -1096,24 +1096,22 @@
XMLConfigurationImportExportUtility util = new XMLConfigurationImportExportUtility();
try {
// get config data from ConfigurationService
- Configuration config = getConfigurationServiceProxy().getCurrentConfiguration();
- ConfigurationModelContainer container = getConfigurationServiceProxy().getConfigurationModel(Configuration.NEXT_STARTUP);
+ ConfigurationModelContainer config = getConfigurationServiceProxy().getConfigurationModel(Configuration.NEXT_STARTUP);
- Collection components = config.getDeployedComponents();
+ Collection<ConnectorBinding> components = config.getConfiguration().getConnectorBindings();
- for (Iterator iter = components.iterator(); iter.hasNext();) {
- BasicDeployedComponent component = (BasicDeployedComponent)iter.next();
+ for (Iterator<ConnectorBinding> iter = components.iterator(); iter.hasNext();) {
+ ConnectorBinding binding = iter.next();
- String bindingName = component.getName();
+ String bindingName = binding.getName();
String[] identifierParts = new String[] {
- component.getHostID().getName(), component.getVMComponentDefnID().getName(), bindingName
+ bindingName
};
- ConnectorBinding binding = config.getConnectorBinding(bindingName);
- if (binding != null && identifierMatches(connectorBindingIdentifier, identifierParts)) {
+ if (identifierMatches(connectorBindingIdentifier, identifierParts)) {
selectedBindings.add(binding);
- ComponentType ct = container.getComponentType(binding.getComponentTypeID().getFullName());
+ ComponentType ct = config.getComponentType(binding.getComponentTypeID().getFullName());
selectedTypes.add(ct);
}
}
15 years, 7 months
teiid SVN: r895 - trunk/server/src/main/java/com/metamatrix/platform/config/service.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-05-08 11:59:59 -0400 (Fri, 08 May 2009)
New Revision: 895
Modified:
trunk/server/src/main/java/com/metamatrix/platform/config/service/ConfigurationServiceImpl.java
Log:
Teiid 442 - simplifying configuration mechanics, these changes continue that process of seperating to either use the read-only configuration or the transaction config. Additionally, the addVMComponent method was updated so that it used a method on the object editor that did not pass the configuration as an argument, (instead passed the ConfigurationID) because the read-only version was being updated using that method. The other method just created the VM without adding it to the current configuration.
Modified: trunk/server/src/main/java/com/metamatrix/platform/config/service/ConfigurationServiceImpl.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/config/service/ConfigurationServiceImpl.java 2009-05-08 14:59:38 UTC (rev 894)
+++ trunk/server/src/main/java/com/metamatrix/platform/config/service/ConfigurationServiceImpl.java 2009-05-08 15:59:59 UTC (rev 895)
@@ -165,7 +165,7 @@
* @throws ConfigurationException if an error occurred within or during communication with the Configuration Service.
*/
public Configuration getCurrentConfiguration() throws ConfigurationException {
- return this.getDesignatedConfiguration();
+ return getReadOnlyConfigurationModel().getConfiguration();
}
/**
@@ -175,17 +175,11 @@
* @throws ConfigurationException if an error occurred within or during communication with the Configuration Service.
*/
public Configuration getNextStartupConfiguration() throws ConfigurationException{
- return this.getDesignatedConfiguration();
+ return getReadOnlyConfigurationModel().getConfiguration();
}
- private Configuration getDesignatedConfiguration() throws ConfigurationException {
- XMLConfigurationConnector transaction = getConnection(null);
- return transaction.getConfigurationModel().getConfiguration();
- }
-
public ConfigurationModelContainer getConfigurationModel(String configName) throws ConfigurationException {
- XMLConfigurationConnector transaction = getConnection(null);
- return transaction.getConfigurationModel();
+ return getReadOnlyConfigurationModel();
}
/**
@@ -255,8 +249,8 @@
}
public Collection getAllComponentTypes(boolean includeDeprecated) throws ConfigurationException {
- XMLConfigurationConnector transaction = getConnection(null);
- Map types = transaction.getConfigurationModel().getComponentTypes();
+// XMLConfigurationConnector transaction = getConnection(null);
+ Map types = getReadOnlyConfigurationModel().getComponentTypes();
Collection result = new LinkedList(types.values());
if (result.size() > 0) {
@@ -637,7 +631,7 @@
Properties defaultProps = config.getDefaultPropertyValues(VMComponentDefn.VM_COMPONENT_TYPE_ID);
// create defn first
- processDefn = editor.createVMComponentDefn(config.getConfiguration(),
+ processDefn = editor.createVMComponentDefn((ConfigurationID) config.getConfiguration().getID(),
(HostID)host.getID(),
VMComponentDefn.VM_COMPONENT_TYPE_ID,
processName);
15 years, 7 months
teiid SVN: r894 - trunk/client-jdbc/src/main/java/com/metamatrix/jdbc.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-05-08 10:59:38 -0400 (Fri, 08 May 2009)
New Revision: 894
Modified:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
Log:
TEIID-567 not throwing an exception on a transaction isolation level set
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java 2009-05-08 13:50:19 UTC (rev 893)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java 2009-05-08 14:59:38 UTC (rev 894)
@@ -1015,7 +1015,7 @@
}
public void setTransactionIsolation(int level) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
+
}
public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
15 years, 7 months
teiid SVN: r893 - trunk/soap/src/test/java/com/metamatrix/soap/service.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-05-08 09:50:19 -0400 (Fri, 08 May 2009)
New Revision: 893
Modified:
trunk/soap/src/test/java/com/metamatrix/soap/service/TestBasicConnectionPoolFactory.java
Log:
TEIID-497 migrated the fix for case 5042 as an initial solution. The user can now override the driver class using either a teiidpool.properties file in the classpath or with a system property.
Modified: trunk/soap/src/test/java/com/metamatrix/soap/service/TestBasicConnectionPoolFactory.java
===================================================================
--- trunk/soap/src/test/java/com/metamatrix/soap/service/TestBasicConnectionPoolFactory.java 2009-05-08 03:23:10 UTC (rev 892)
+++ trunk/soap/src/test/java/com/metamatrix/soap/service/TestBasicConnectionPoolFactory.java 2009-05-08 13:50:19 UTC (rev 893)
@@ -22,6 +22,8 @@
package com.metamatrix.soap.service;
+import java.util.Properties;
+
import junit.framework.TestCase;
@@ -30,7 +32,6 @@
*/
public class TestBasicConnectionPoolFactory extends TestCase {
- private static final BasicConnectionPoolFactory factory = new BasicConnectionPoolFactory();
private static final String TEST_PROPERTY_VALUE = "test"; //$NON-NLS-1$
@@ -39,11 +40,11 @@
*/
public void testGetPropertyWSystemPropertySet() {
System.setProperty(ConnectionPoolFactory.INITIAL_POOL_SIZE_PROPERTY_KEY, TEST_PROPERTY_VALUE);
- assertEquals(TEST_PROPERTY_VALUE, factory.getProperty(ConnectionPoolFactory.INITIAL_POOL_SIZE_PROPERTY_KEY));
+ assertEquals(TEST_PROPERTY_VALUE, BasicConnectionPoolFactory.createMergedProperties(new Properties()).getProperty(ConnectionPoolFactory.INITIAL_POOL_SIZE_PROPERTY_KEY));
}
public void testGetPropertyRetreiveDefault() {
- assertEquals(String.valueOf(BasicConnectionPoolFactory.MAX_ACTIVE_CONNECTIONS_DEFAULT), factory.getProperty(ConnectionPoolFactory.MAX_ACTIVE_CONNECTIONS_PROPERTY_KEY));
+ assertEquals(String.valueOf(BasicConnectionPoolFactory.MAX_ACTIVE_CONNECTIONS_DEFAULT), BasicConnectionPoolFactory.createMergedProperties(new Properties()).getProperty(ConnectionPoolFactory.MAX_ACTIVE_CONNECTIONS_PROPERTY_KEY));
}
}
15 years, 7 months