[teiid-commits] teiid SVN: r900 - in trunk/client/src/main/java/com/metamatrix/admin: api/server and 1 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Sat May 9 19:10:49 EDT 2009


Author: vhalbert at 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




More information about the teiid-commits mailing list