[teiid-commits] teiid SVN: r1957 - in trunk: client/src/main/resources and 1 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Wed Mar 10 13:54:41 EST 2010


Author: rareddy
Date: 2010-03-10 13:54:40 -0500 (Wed, 10 Mar 2010)
New Revision: 1957

Modified:
   trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
   trunk/client/src/main/resources/vdb-deployer.xsd
   trunk/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java
   trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
Log:
TEIID-1013: UDF files will be loaded based on path information provided; if path is not provided it will assume the "modelname.xmi" as the file name inside the VDB

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-10 15:44:27 UTC (rev 1956)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java	2010-03-10 18:54:40 UTC (rev 1957)
@@ -64,9 +64,12 @@
 	});
 	
 	@XmlAttribute(name = "type")
-	protected String modelType = Type.PHYSICAL.name(); //$NON-NLS-1$
+	protected String modelType = Type.PHYSICAL.name();
+	
+	@XmlAttribute(name = "path")
+	protected String path; 
     
-    @XmlAttribute(name = "visible")
+	@XmlAttribute(name = "visible")
     protected Boolean visible = true;
     
     @XmlElement(name = "validation-error")
@@ -87,10 +90,7 @@
 	@Override
 	@ManagementProperty(description = "Is Model Source model", readOnly=true)
     public boolean isSource() {
-		if (modelType != null) {
-			return ModelType.parseString(modelType.toUpperCase()) == ModelType.PHYSICAL;
-		}
-		throw new IllegalStateException("Model state is not correctly set");
+		return ModelType.parseString(modelType.toUpperCase()) == ModelType.PHYSICAL;
 	}
 
 	@Override
@@ -104,7 +104,16 @@
 	public Type getModelType() {
 		return Type.valueOf(modelType);
 	}
+	
+	@ManagementProperty(description = "Path to model file inside the archive", readOnly=true)
+    public String getPath() {
+		return path;
+	}
 
+	public void setPath(String path) {
+		this.path = path;
+	}	
+
 	@Override
 	@ManagementProperty(description = "Does Model supports multi-source bindings", readOnly=true)
     public boolean isSupportsMultiSourceBindings() {

Modified: trunk/client/src/main/resources/vdb-deployer.xsd
===================================================================
--- trunk/client/src/main/resources/vdb-deployer.xsd	2010-03-10 15:44:27 UTC (rev 1956)
+++ trunk/client/src/main/resources/vdb-deployer.xsd	2010-03-10 18:54:40 UTC (rev 1957)
@@ -46,6 +46,7 @@
 							</xs:simpleType>
 						</xs:attribute>
 						<xs:attribute name="visible" type="xs:boolean" default="true"/>
+                        <xs:attribute name="path" type="xs:string"/>
 					</xs:complexType>
 				</xs:element>
 				<xs:element name="role" minOccurs="0" maxOccurs="unbounded">

Modified: trunk/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java	2010-03-10 15:44:27 UTC (rev 1956)
+++ trunk/runtime/src/main/java/org/teiid/deployers/UDFMetaData.java	2010-03-10 18:54:40 UTC (rev 1957)
@@ -40,7 +40,7 @@
 	private HashMap<String, VirtualFile> files = new HashMap<String, VirtualFile>();
 	
 	public void addModelFile(VirtualFile file) {
-		this.files.put(file.getName(), file);
+		this.files.put(file.getPathName(), file);
 	}
 	
 	

Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java	2010-03-10 15:44:27 UTC (rev 1956)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java	2010-03-10 18:54:40 UTC (rev 1957)
@@ -161,7 +161,11 @@
 			// load the UDF
 			for(Model model:vdb.getModels()) {
 				if (model.getModelType().equals(Model.Type.FUNCTION)) {
-					udf.buildFunctionModelFile(model.getName()+VdbConstants.MODEL_EXT);
+					String path = ((ModelMetaData)model).getPath();
+					if (path == null) {
+						path = model.getName()+VdbConstants.MODEL_EXT;
+					}
+					udf.buildFunctionModelFile(path);
 				}
 			}		
 			



More information about the teiid-commits mailing list