Author: rareddy
Date: 2010-03-09 12:03:57 -0500 (Tue, 09 Mar 2010)
New Revision: 1947
Added:
trunk/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java
Modified:
trunk/build/kit-jboss-container/deployers/teiid.deployer/teiid-deployer-jboss-beans.xml
trunk/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
Log:
TEIID-833: Source mappings are now exposed through the profile service as Managed
objects.
Modified:
trunk/build/kit-jboss-container/deployers/teiid.deployer/teiid-deployer-jboss-beans.xml
===================================================================
---
trunk/build/kit-jboss-container/deployers/teiid.deployer/teiid-deployer-jboss-beans.xml 2010-03-09
16:59:43 UTC (rev 1946)
+++
trunk/build/kit-jboss-container/deployers/teiid.deployer/teiid-deployer-jboss-beans.xml 2010-03-09
17:03:57 UTC (rev 1947)
@@ -35,7 +35,6 @@
<value>org.teiid.adminapi.impl.VDBMetaData</value>
</parameter>
</uninstall>
- <property name="managedObjectFactory"><inject
bean="ManagedObjectFactory"/></property>
<property name="VDBRepository"><inject
bean="VDBRepository"/></property>
<property name="contextCache"><inject
bean="ContextCache"/></property>
<property name="objectSerializer"><inject
bean="ObjectSerializer"/></property>
Modified: trunk/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java 2010-03-09 16:59:43 UTC
(rev 1946)
+++ trunk/client/src/main/java/org/teiid/adminapi/TeiidAdmin.java 2010-03-09 17:03:57 UTC
(rev 1947)
@@ -31,8 +31,7 @@
@Override
public void assignBindingToModel(String vdbName, int vdbVersion, String modelName,
String connectorBindingName)
throws AdminException {
- // rameshTODO Auto-generated method stub
-
+ throw new AdminProcessingException("feature coming soon..");
}
@@ -45,16 +44,16 @@
@Override
public void restart() throws AdminException {
- // rameshTODO Auto-generated method stub
+ throw new AdminProcessingException("feature coming soon..");
}
@Override
public void shutdown(int millisToWait) throws AdminException {
- // rameshTODO Auto-generated method stub
+ throw new AdminProcessingException("feature coming soon..");
}
@Override
public void setRuntimeProperty(String propertyName, String propertyValue) throws
AdminException {
- // rameshTODO Auto-generated method stub
+ throw new AdminProcessingException("feature coming soon..");
}
}
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-03-09
16:59:43 UTC (rev 1946)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-03-09
17:03:57 UTC (rev 1947)
@@ -56,9 +56,9 @@
private static final long serialVersionUID = 3714234763056162230L;
@XmlElement(name = "source")
- protected ListOverMap<SourceMapping> sources = new ListOverMap(new
KeyBuilder<SourceMapping>() {
+ protected ListOverMap<SourceMappingMetadata> sources = new ListOverMap(new
KeyBuilder<SourceMappingMetadata>() {
@Override
- public String getKey(SourceMapping entry) {
+ public String getKey(SourceMappingMetadata entry) {
return entry.getName();
}
});
@@ -140,9 +140,9 @@
this.visible = value;
}
- @ManagementProperty(description = "Source Mappings (defined by user)")
- public List<SourceMapping> getSourceMappings(){
- return new ArrayList<SourceMapping>(this.sources.getMap().values());
+ @ManagementProperty(description = "Source Mappings (defined by user)",
managed=true)
+ public List<SourceMappingMetadata> getSourceMappings(){
+ return new ArrayList<SourceMappingMetadata>(this.sources.getMap().values());
}
@Override
@@ -151,7 +151,7 @@
}
public String getSourceJndiName(String sourceName) {
- SourceMapping s = this.sources.getMap().get(sourceName);
+ SourceMappingMetadata s = this.sources.getMap().get(sourceName);
if (s == null) {
return null;
}
@@ -159,10 +159,10 @@
}
public void addSourceMapping(String name, String jndiName) {
- this.sources.getMap().put(name, new SourceMapping(name, jndiName));
+ this.sources.getMap().put(name, new SourceMappingMetadata(name, jndiName));
}
- @ManagementProperty(description = "Model Validity Errors", readOnly=true)
+ @ManagementProperty(description = "Model Validity Errors", readOnly=true,
managed=true)
public List<ValidationError> getErrors(){
return this.errors;
}
@@ -198,6 +198,7 @@
}
@ManagementProperty (description="Error Message", readOnly = true)
+ @ManagementObjectID(type="error")
public String getValue() {
return value;
}
@@ -214,52 +215,5 @@
public void setSeverity(String severity) {
this.severity = severity;
}
- }
-
- @XmlAccessorType(XmlAccessType.NONE)
- @XmlType(name = "")
- @ManagementObject(properties=ManagementProperties.EXPLICIT)
- public static class SourceMapping implements Serializable {
- private static final long serialVersionUID = -4417878417697685794L;
-
- @XmlAttribute(name = "name", required = true)
- private String name;
-
- @XmlAttribute(name = "jndi-name")
- private String jndiName;
-
-
- public SourceMapping() {}
-
- public SourceMapping(String name, String jndiName) {
- this.name = name;
- this.jndiName = jndiName;
- }
-
- @ManagementProperty (description="Source Name", readOnly = true)
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @ManagementProperty (description="JNDI Name of the resource to assosiate with
Source name")
- public String getJndiName() {
- // this default could be controlled if needed.
- if (this.jndiName == null) {
- return "java:"+name;
- }
- return jndiName;
- }
-
- public void setJndiName(String jndiName) {
- this.jndiName = jndiName;
- }
-
- public String toString() {
- return getName()+":"+getJndiName();
- }
}
}
Added: trunk/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java
(rev 0)
+++
trunk/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java 2010-03-09
17:03:57 UTC (rev 1947)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (C) 2008 Red Hat, Inc.
+ * Copyright (C) 2000-2007 MetaMatrix, Inc.
+ * Licensed to Red Hat, Inc. under one or more contributor
+ * license agreements. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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 org.teiid.adminapi.impl;
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+(a)XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "")
+(a)ManagementObject(properties=ManagementProperties.EXPLICIT)
+public class SourceMappingMetadata implements Serializable {
+ private static final long serialVersionUID = -4417878417697685794L;
+
+ @XmlAttribute(name = "name", required = true)
+ private String name;
+
+ @XmlAttribute(name = "jndi-name")
+ private String jndiName;
+
+
+ public SourceMappingMetadata() {}
+
+ public SourceMappingMetadata(String name, String jndiName) {
+ this.name = name;
+ this.jndiName = jndiName;
+ }
+
+ @ManagementProperty (description="Source Name", readOnly = true)
+ @ManagementObjectID(type="sourceMapping")
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @ManagementProperty (description="JNDI Name of the resource to assosiate with
Source name")
+ public String getJndiName() {
+ // this default could be controlled if needed.
+ if (this.jndiName == null) {
+ return "java:"+name;
+ }
+ return jndiName;
+ }
+
+ public void setJndiName(String jndiName) {
+ this.jndiName = jndiName;
+ }
+
+ public String toString() {
+ return getName()+":"+getJndiName();
+ }
+}
\ No newline at end of file
Property changes on:
trunk/client/src/main/java/org/teiid/adminapi/impl/SourceMappingMetadata.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-03-09
16:59:43 UTC (rev 1946)
+++ trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2010-03-09
17:03:57 UTC (rev 1947)
@@ -79,8 +79,6 @@
import org.teiid.adminapi.impl.SessionMetadata;
import org.teiid.adminapi.impl.TransactionMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.adminapi.impl.ModelMetaData.SourceMapping;
-import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
import org.teiid.jboss.deployers.RuntimeEngineDeployer;
public class Admin extends TeiidAdmin {
@@ -470,17 +468,26 @@
model.setModelType(ManagedUtil.getSimpleValue(mc, "modelType",
String.class));
model.setProperties(ManagedUtil.getPropertiesValue(mc, "properties"));
- List<SourceMapping> mappings =
(List<SourceMapping>)MetaValueFactory.getInstance().unwrap(mc.getProperty("sourceMappings").getValue());
- for (SourceMapping s:mappings) {
- model.addSourceMapping(s.getName(), s.getJndiName());
- }
- List<ValidationError> errors =
(List<ValidationError>)MetaValueFactory.getInstance().unwrap(mc.getProperty("errors").getValue());
- if (errors != null) {
- for (ValidationError error:errors) {
- model.addError(error.getSeverity(), error.getValue());
- }
- }
+ ManagedProperty sourceMappings = mc.getProperty("sourceMappings");
+ if (sourceMappings != null){
+ List<ManagedObject> mappings =
(List<ManagedObject>)MetaValueFactory.getInstance().unwrap(sourceMappings.getValue());
+ for (ManagedObject mo:mappings) {
+ String name = ManagedUtil.getSimpleValue(mo, "name",
String.class);
+ String jndiName = ManagedUtil.getSimpleValue(mo, "jndiName",
String.class);
+ model.addSourceMapping(name, jndiName);
+ }
+ }
+
+ ManagedProperty validationErrors = mc.getProperty("errors");
+ if (validationErrors != null) {
+ List<ManagedObject> errors =
(List<ManagedObject>)MetaValueFactory.getInstance().unwrap(validationErrors.getValue());
+ if (errors != null) {
+ for (ManagedObject mo:errors) {
+ model.addError(ManagedUtil.getSimpleValue(mo, "severity",
String.class), ManagedUtil.getSimpleValue(mo, "value", String.class));
+ }
+ }
+ }
return model;
}
@@ -902,6 +909,7 @@
// } catch (Exception e) {
// throw new AdminComponentException(e.getMessage(), e);
// }
+ throw new AdminProcessingException("feature coming soon..");
}
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-03-09 16:59:43
UTC (rev 1946)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2010-03-09 17:03:57
UTC (rev 1947)
@@ -27,19 +27,15 @@
import java.util.Collection;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.spi.deployer.managed.ManagedObjectCreator;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
import org.jboss.virtual.VirtualFile;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.VDB;
@@ -59,9 +55,8 @@
import com.metamatrix.query.function.metadata.FunctionMethod;
import com.metamatrix.query.metadata.QueryMetadataInterface;
-public class VDBDeployer extends AbstractSimpleRealDeployer<VDBMetaData> implements
ManagedObjectCreator {
+public class VDBDeployer extends AbstractSimpleRealDeployer<VDBMetaData> {
protected Logger log = Logger.getLogger(getClass());
- private ManagedObjectFactory mof;
private VDBRepository vdbRepository;
private ConnectorManagerRepository connectorManagerRepository;
private DQPContextCache contextCache;
@@ -191,32 +186,6 @@
return metadata;
}
-
-
- @Override
- public void build(DeploymentUnit unit, Set<String> attachmentNames, Map<String,
ManagedObject> managedObjects)
- throws DeploymentException {
-
- ManagedObject vdbMO = managedObjects.get(VDBMetaData.class.getName());
- if (vdbMO != null) {
- VDBMetaData vdb = (VDBMetaData) vdbMO.getAttachment();
- for (Model m : vdb.getModels()) {
- if (m.getName().equals(CoreConstants.SYSTEM_MODEL)) {
- continue;
- }
- ManagedObject mo = this.mof.initManagedObject(m, ModelMetaData.class,
m.getName(),m.getName());
- if (mo == null) {
- throw new DeploymentException("could not create managed object");
- }
- managedObjects.put(mo.getName(), mo);
- }
- }
- }
-
- public void setManagedObjectFactory(ManagedObjectFactory mof) {
- this.mof = mof;
- }
-
public void setVDBRepository(VDBRepository repo) {
this.vdbRepository = repo;
}