Author: rareddy
Date: 2009-11-30 13:04:19 -0500 (Mon, 30 Nov 2009)
New Revision: 1607
Added:
branches/JCA/build/kit-jboss-container/deployers/
branches/JCA/build/kit-jboss-container/deployers/teiid-deployer-jboss-beans.xml
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
branches/JCA/runtime/src/main/java/org/teiid/deployers/
branches/JCA/runtime/src/main/java/org/teiid/deployers/DefParser.java
branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestMetaData.java
branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestParser.java
branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBStructure.java
branches/JCA/runtime/src/main/java/org/teiid/services/
Removed:
branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMModel.java
branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingImpl.java
Modified:
branches/JCA/client/src/main/java/org/teiid/adminapi/Model.java
branches/JCA/client/src/main/java/org/teiid/adminapi/VDB.java
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
branches/JCA/common-internal/src/main/java/com/metamatrix/vdb/runtime/VDBKey.java
branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
branches/JCA/pom.xml
branches/JCA/runtime/pom.xml
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
Log:
TEIID-833, TEIID-838: Intial checkin of the VDB deployer work.
Added: branches/JCA/build/kit-jboss-container/deployers/teiid-deployer-jboss-beans.xml
===================================================================
--- branches/JCA/build/kit-jboss-container/deployers/teiid-deployer-jboss-beans.xml
(rev 0)
+++
branches/JCA/build/kit-jboss-container/deployers/teiid-deployer-jboss-beans.xml 2009-11-30
18:04:19 UTC (rev 1607)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="VDBStructure"
class="org.teiid.deployers.VDBStructure" />
+ <bean name="VDBParserDeployer"
class="org.teiid.deployers.VDBParserDeployer" />
+
+ <bean name="VDBDeployer"
class="org.teiid.deployers.VDBDeployer">
+ <install bean="ManagedDeploymentCreator"
method="addAttachmentType">
+ <parameter>
+ <value>org.teiid.adminapi.impl.VDBMetaData</value>
+ </parameter>
+ <parameter>
+ <value>teiid-vdb</value>
+ </parameter>
+ </install>
+ <uninstall bean="ManagedDeploymentCreator"
method="removeAttachmentType">
+ <parameter>
+ <value>org.teiid.adminapi.impl.VDBMetaData</value>
+ </parameter>
+ </uninstall>
+ <property name="managedObjectFactory"><inject
bean="ManagedObjectFactory"/></property>
+ <property name="VDBRepository"><inject
bean="VDBRepository"/></property>
+ </bean>
+
+ <bean name="VDBRepository"
class="org.teiid.deployers.VDBRepository"/>
+</deployment>
\ No newline at end of file
Property changes on:
branches/JCA/build/kit-jboss-container/deployers/teiid-deployer-jboss-beans.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMModel.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMModel.java 2009-11-30
17:12:55 UTC (rev 1606)
+++ branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMModel.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -1,191 +0,0 @@
-/*
- * 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.ArrayList;
-import java.util.List;
-
-import org.teiid.adminapi.Model;
-
-import com.metamatrix.admin.AdminPlugin;
-
-/**
- */
-public class MMModel extends MMAdminObject implements Model {
-
- private static final long serialVersionUID = 3714234763056162230L;
- private List connectorBindingNames = new ArrayList();
- private String modelType = ""; //$NON-NLS-1$
- private String modelURI = ""; //$NON-NLS-1$
- private boolean isMaterialization = false;
- private boolean isPhysical = false;
- private boolean isVisible = false;
- private boolean supportsMultiSourceBindings = false;
-
-
-
- /**
- * Construct a new MMModel
- * @param identifierParts
- */
- public MMModel(String[] identifierParts) {
- super(identifierParts);
- }
-
-
- /**
- * @see java.lang.Object#toString()
- * @return String for display purposes
- */
- public String toString() {
-
- StringBuffer result = new StringBuffer();
- result.append(AdminPlugin.Util.getString("MMModel.MMModel")).append(getIdentifier());
//$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.type")).append(getModelType());
//$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.physical")).append(isPhysical);
//$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.visible")).append(isVisible);
//$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.connector_bindings")).append(getConnectorBindingNames());
//$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.modelURI")).append(getModelURI());
//$NON-NLS-1$
- result.append(AdminPlugin.Util.getString("MMModel.properties")).append(getPropertiesAsString());
//$NON-NLS-1$
- return result.toString();
- }
-
- /**
- * @see org.teiid.adminapi.Model#getConnectorBindingNames()
- * @since 4.3
- */
- public List getConnectorBindingNames() {
- return connectorBindingNames;
- }
-
- /**
- * @see org.teiid.adminapi.Model#isPhysical()
- * @since 4.3
- */
- public boolean isPhysical() {
- return isPhysical;
- }
-
- /**
- * @see org.teiid.adminapi.Model#isVisible()
- * @since 4.3
- */
- public boolean isVisible() {
- return isVisible;
- }
-
- /**
- * @see org.teiid.adminapi.Model#getModelType()
- * @since 4.3
- */
- public String getModelType() {
- return modelType;
- }
-
- /**
- * @see org.teiid.adminapi.Model#getModelURI()
- * @since 4.3
- */
- public String getModelURI() {
- return modelURI;
- }
-
- /**
- * @see org.teiid.adminapi.Model#supportsMultiSourceBindings()
- * @since 4.3
- */
- public boolean supportsMultiSourceBindings() {
- return this.supportsMultiSourceBindings;
- }
-
- /**
- * @param bindings
- */
- public void setConnectorBindingNames(List bindings) {
- connectorBindingNames = bindings;
- }
-
- /**
- * @param supports
- * @since 4.3
- */
- public void setSupportsMultiSourceBindings(boolean supports) {
- this.supportsMultiSourceBindings = supports;
- }
-
-
-
- /**
- * @param isPhysical Whether this model is visible.
- * @since 4.3
- */
- public void setPhysical(boolean isPhysical) {
- this.isPhysical = isPhysical;
- }
-
-
- /**
- * @param isVisible Whether this model is visible.
- * @since 4.3
- */
- public void setVisible(boolean isVisible) {
- this.isVisible = isVisible;
- }
-
-
- /**
- * @param modelType The modelType to set.
- * @since 4.3
- */
- public void setModelType(String modelType) {
- this.modelType = modelType;
- }
-
-
- /**
- * @param modelURI The modelURI to set.
- * @since 4.3
- */
- public void setModelURI(String modelURI) {
- this.modelURI = modelURI;
- }
-
-
- /**
- * @return Returns whether the model is a materialization.
- * @since 4.3
- */
- public boolean isMaterialization() {
- return this.isMaterialization;
- }
-
-
- /**
- * @param isMaterialization whether the model is a materialization..
- * @since 4.3
- */
- public void setMaterialization(boolean isMaterialization) {
- this.isMaterialization = isMaterialization;
- }
-
-}
Deleted: branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java 2009-11-30
17:12:55 UTC (rev 1606)
+++ branches/JCA/client/src/main/java/com/metamatrix/admin/objects/MMVDB.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -1,289 +0,0 @@
-/*
- * 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.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-
-import org.teiid.adminapi.VDB;
-
-import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.core.util.HashCodeUtil;
-
-/**
- * Dataholder object for information about a VDB (Virtual Database)
- */
-public final class MMVDB extends MMAdminObject implements VDB, Comparable {
-
- private static final long serialVersionUID = -3755957080991586389L;
- /**VDB is registered but incomplete*/
- public static final int STATUS_INCOMPLETE = 1;
- /**VDB is deployed but inactive*/
- public static final int STATUS_INACTIVE = 2;
- /**VDB is deployed and active*/
- public static final int STATUS_ACTIVE = 3;
- /**VDB has been deleted*/
- public static final int STATUS_DELETED = 4;
-
- final static String[] VDB_STATUS_NAMES = {"Incomplete", //$NON-NLS-1$
- "Inactive", //$NON-NLS-1$
- "Active", //$NON-NLS-1$
- "Deleted"}; //$NON-NLS-1$
-
-
-
- private Collection models = new ArrayList();
- private short status;
- private Date versionedDate;
- private String versionedBy;
- private long uid;
- private boolean hasMaterializedViews;
- private int cachedHashcode;
- private boolean hasWSDL;
-
-
-
- /**
- * VDBs are identified by name and version.
- * @param identifierParts the VDB name and version parts
- */
- public MMVDB(String[] identifierParts) {
- super(identifierParts);
- this.cachedHashcode = HashCodeUtil.hashCode(13, getIdentifier());
- }
-
- /**
- * @see java.lang.Object#toString()
- * @since 4.3
- */
- public String toString() {
- StringBuffer result = new StringBuffer();
-
result.append(AdminPlugin.Util.getString("MMVDB.MMVDB")).append(getIdentifier());
//$NON-NLS-1$
-
result.append(AdminPlugin.Util.getString("MMVDB.status")).append(getState());
//$NON-NLS-1$
-
result.append(AdminPlugin.Util.getString("MMVDB.versionedDate")).append(versionedDate);
//$NON-NLS-1$
-
result.append(AdminPlugin.Util.getString("MMVDB.versionedBy")).append(versionedBy);
//$NON-NLS-1$
-
result.append(AdminPlugin.Util.getString("MMVDB.properties")).append(getPropertiesAsString());
//$NON-NLS-1$
-
result.append(AdminPlugin.Util.getString("MMVDB.models")).append(models);
//$NON-NLS-1$
- return result.toString();
- }
-
- /**
- * Add an MMModel
- * @param mmModel
- * @since 4.3
- */
- public void addModel(MMModel mmModel) {
- models.add(mmModel);
- }
-
- /**
- * @return date the VDB was versioned
- */
- public Date getVersionedDate() {
- return versionedDate;
- }
-
- /**
- * @return user that versioned the VDB
- */
- public String getVersionedBy() {
- return versionedBy;
- }
-
- /**
- * @return Collection of MMModels
- */
- public Collection getModels() {
- return models;
- }
-
- /**
- * @return the status
- */
- public int getState() {
- return status;
- }
-
- /**
- * @return the status
- */
- public String getStateAsString() {
- return VDB_STATUS_NAMES[this.status - 1];
- }
-
- /**
- * Must be overridden since, unlike other admin objects, the
- * name component of a VDB is the first component of the
- * identifier. VDB version is the second component.
- * @see com.metamatrix.admin.objects.MMAdminObject#getName()
- * @return The Name of the VDB
- * @since 4.3
- */
- public String getName() {
- return identifierParts[0];
- }
-
- /**
- * @return the VDB version
- */
- public String getVDBVersion() {
- return identifierParts[1];
- }
-
-
- /**
- * @param bound The date the VDB was bound.
- * @since 4.3
- */
- public void setVersionedDate(Date bound) {
- this.versionedDate = bound;
- }
-
-
- /**
- * @param boundBy The user that bound the VDB.
- * @since 4.3
- */
- public void setVersionedBy(String boundBy) {
- this.versionedBy = boundBy;
- }
-
-
- /**
- * @param models Collection of MMModels to set.
- * @since 4.3
- */
- public void setModels(Collection models) {
- this.models = models;
- }
-
-
- /**
- * @param status The status to set.
- * @since 4.3
- */
- public void setStatus(short status) {
- this.status = status;
-
- //TODO: are these correct?
- setEnabled(status == STATUS_ACTIVE);
- setRegistered(status == STATUS_ACTIVE || status == STATUS_INACTIVE || status ==
STATUS_INCOMPLETE);
- }
-
-
- /**
- * @return Returns the uid.
- * @since 4.3
- */
- public long getUID() {
- return this.uid;
- }
-
-
- /**
- * @param uid The uid to set.
- * @since 4.3
- */
- public void setUID(long uid) {
- this.uid = uid;
- }
-
- /**
- * @see org.teiid.adminapi.VDB#hasMaterializedViews()
- * @since 4.3
- */
- public boolean hasMaterializedViews() {
- return hasMaterializedViews;
- }
-
-
- /**
- * @param hasMaterializedViews The hasMaterializedViews to set.
- * @since 4.3
- */
- public void setMaterializedViews(boolean hasMaterializedViews) {
- this.hasMaterializedViews = hasMaterializedViews;
- }
-
-
-
-
- /**
- * @return Returns the hasWSDL.
- * @since 5.5.3
- */
- public boolean hasWSDL() {
- return this.hasWSDL;
- }
-
-
- /**
- * @param hasWSDL The hasWSDL to set.
- * @since 5.5.3
- */
- public void setHasWSDL(boolean hasWSDL) {
- this.hasWSDL = hasWSDL;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- * @since 4.3
- */
- public boolean equals(Object obj) {
- if ( ! (obj instanceof MMVDB) ) {
- return false;
- }
-
- MMVDB other = (MMVDB)obj;
- if ( ! identifier.equals(other.identifier) ) {
- return false;
- }
-
- return true;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- * @since 4.3
- */
- public int hashCode() {
- return this.cachedHashcode;
- }
-
- /**
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- * @since 4.3
- */
- public int compareTo(Object obj) {
- if ( ! (obj instanceof MMVDB) ) {
- return -1;
- }
-
- MMVDB other = (MMVDB)obj;
- return identifier.compareTo(other.identifier);
- }
-
-
-
-}
Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/Model.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/Model.java 2009-11-30 17:12:55
UTC (rev 1606)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/Model.java 2009-11-30 18:04:19
UTC (rev 1607)
@@ -25,29 +25,35 @@
import java.util.List;
/**
- * Represents a metadata model in the MetaMatrix system.
+ * Represents a metadata model in the Teiid system.
*
* @since 4.3
*/
public interface Model extends AdminObject {
+ public final static String PRIVATE_VISIBILITY = "Private"; //$NON-NLS-1$
+ public final static String PUBLIC_VISIBILITY = "Public"; //$NON-NLS-1$
+ public final static short PRIVATE = 2;
+ public final static short PUBLIC = 0;
+
+
/**
- * Return the connector binding names for this Virtual Databse.
+ * Return the connector binding names for this Virtual Database.
* @return connector bindings bound to this model.
*/
- List getConnectorBindingNames();
+ List<String> getConnectorBindingNames();
/**
- * Determine if this model is a physical type.
+ * Determine if this model is a Source model.
*
- * @return <code>true</code> iff it contains physical group(s).
+ * @return <code>true</code> if it contains physical group(s).
*/
- boolean isPhysical();
+ boolean isSource();
/**
* Determine whether this model is exposed for querying.
*
- * @return <code>true</code> iff the model is visible
+ * @return <code>true</code> if the model is visible
* for querying.
*/
boolean isVisible();
@@ -69,17 +75,12 @@
/**
* Determine whether this model can support more than one connector binding.
*
- * @return <code>true</code> iff this model supports multi-source
bindings
+ * @return <code>true</code> if this model supports multi-source
bindings
*/
- boolean supportsMultiSourceBindings();
+ boolean isSupportsMultiSourceBindings();
- /**
- * Determine whether this model is a Materialization Model
- *
- * @return isMaterialization whether the model is a Materialization Model.
- * @since 4.3
- */
+ String getPath();
- boolean isMaterialization();
-
+ String getUuid();
+
}
\ No newline at end of file
Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/VDB.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/VDB.java 2009-11-30 17:12:55 UTC
(rev 1606)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/VDB.java 2009-11-30 18:04:19 UTC
(rev 1607)
@@ -22,11 +22,12 @@
package org.teiid.adminapi;
-import java.util.Collection;
-import java.util.Date;
+import java.net.URL;
+import java.util.Collection;
+import java.util.List;
/**
- * Represents a Virtual Database in the MetaMatrix system.
+ * Represents a Virtual Database in the Teiid System.
* <br>A VDB has a name and a version.</br>
*
* <p>The identifier pattern for a VDB is <CODE>"name<{@link
#DELIMITER_CHAR}>version"</CODE>,
@@ -39,8 +40,7 @@
*
* @since 4.3
*/
-public interface VDB extends
- AdminObject {
+public interface VDB extends AdminObject {
/**
* Constant to denote the latest version of a VDB located
@@ -48,75 +48,40 @@
* VDB to the MetaMatrix Server from the server repository.
*/
public static final String SERVER_REPOSITORY_LATEST_VERSION = "LATEST";
//$NON-NLS-1$
-
- /**
- * Incomplete (if import does not have all the connector bindings)
- *
- * @since 4.3
- */
- public static final int INCOMPLETE = 1;
- /**
- * Inactive VDB (can edit connector binding)
- *
- * @since 4.3
- */
- public static final int INACTIVE = 2;
- /**
- * Active VDB
- *
- * @since 4.3
- */
- public static final int ACTIVE = 3;
- /**
- * Mark VDB for Deletion
- *
- * @since 4.3
- */
- public static final int DELETED = 4;
+
+ enum Status{INCOMPLETE, INACTIVE, ACTIVE, DELETED};
- /**
- * @return date the VDB was versioned
- */
- public Date getVersionedDate();
/**
- * @return user that versioned the VDB
- */
- public String getVersionedBy();
-
- /**
* @return Collection of MMModels
*/
- public Collection getModels();
-
+ public Collection<? extends Model> getModels();
+
/**
* @return the status
*/
- public int getState();
+ public Status getStatus();
/**
- * @return the status
- */
- public String getStateAsString();
-
- /**
* @return the VDB version
*/
- public String getVDBVersion();
-
- /**
- * Check to see if this VDB has any Materialized Models
- *
- * @return true or false
- * @since 4.3
- */
- public boolean hasMaterializedViews();
-
- /**
- * Check to see if this VDB contains a WSDL.
- * @return true if it contains a WSDL.
- * @since 5.5.3
- */
- public boolean hasWSDL();
-
+ public int getVersion();
+
+ /**
+ * Get the URL for the VDB
+ * @return
+ */
+ public URL getUrl();
+
+ /**
+ * Get the description of the VDB
+ * @return
+ */
+ public String getDescription();
+
+ /**
+ * Shows any validity errors present in the VDB
+ * @return
+ */
+ public List<String> getValidityErrors();
}
Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
===================================================================
---
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java 2009-11-30
17:12:55 UTC (rev 1606)
+++
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -31,15 +31,15 @@
private static final long serialVersionUID = -6381303538713462682L;
String name;
Properties properties;
-
- public AdminObjectImpl(String name) {
- this.name = name;
- }
-
+
@Override
public String getName() {
return this.name;
}
+
+ public void setName(String name) {
+ this.name = name;
+ }
@Override
public Properties getProperties() {
Deleted:
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingImpl.java
===================================================================
---
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingImpl.java 2009-11-30
17:12:55 UTC (rev 1606)
+++
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingImpl.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -1,52 +0,0 @@
-/*
- * 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 org.teiid.adminapi.impl;
-
-import org.teiid.adminapi.ConnectorBinding;
-
-public class ConnectorBindingImpl extends AdminObjectImpl implements ConnectorBinding {
-
- private static final long serialVersionUID = -4865836616882247016L;
- private transient Object type;
-
- public ConnectorBindingImpl(String name) {
- super(name);
- }
-
- @Override
- public String getRARFileName() {
- return getPropertyValue("rar-name");
- }
-
- @Override
- public String getJNDIName() {
- return getPropertyValue("jndi-name");
- }
-
- public void setComponentType(Object type) {
- this.type = type;
- }
-
- public Object getComponentType() {
- return this.type;
- }
-}
Copied:
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java
(from rev 1569,
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingImpl.java)
===================================================================
---
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java
(rev 0)
+++
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -0,0 +1,65 @@
+/*
+ * 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 org.teiid.adminapi.impl;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.teiid.adminapi.ConnectorBinding;
+
+@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="connector"))
+public class ConnectorBindingMetaData extends AdminObjectImpl implements ConnectorBinding
{
+
+ private static final long serialVersionUID = -4865836616882247016L;
+ private transient Object type;
+
+ @ManagementProperty(description="Connector Binding Name", readOnly=true)
+ @ManagementObjectID(type="binding")
+ public String getName() {
+ return super.getName();
+ }
+
+ @Override
+ @ManagementProperty(description="RAR file name", readOnly=true)
+ public String getRARFileName() {
+ return getPropertyValue("rar-name");
+ }
+
+ @Override
+ @ManagementProperty(description="JNDI name", readOnly=true)
+ public String getJNDIName() {
+ return getPropertyValue("jndi-name");
+ }
+
+ public void setComponentType(Object type) {
+ this.type = type;
+ }
+
+ public Object getComponentType() {
+ return this.type;
+ }
+
+ public String toString() {
+ return name;
+ }
+}
Property changes on:
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ConnectorBindingMetaData.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
(rev 0)
+++
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -0,0 +1,143 @@
+/*
+ * 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 org.teiid.adminapi.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.teiid.adminapi.Model;
+
+import com.metamatrix.core.vdb.ModelType;
+
+@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="model"))
+public class ModelMetaData extends AdminObjectImpl implements Model {
+
+ private static final long serialVersionUID = 3714234763056162230L;
+ private List<String> connectorBindings = new ArrayList<String>();
+ private String modelType = ""; //$NON-NLS-1$
+ private String modelURI = ""; //$NON-NLS-1$
+ private boolean isVisible = false;
+ private boolean supportsMultiSourceBindings = false;
+ private String path;
+ private String uuid;
+
+ @ManagementProperty(description="Model Name", readOnly=true)
+ @ManagementObjectID(type="model")
+ public String getName() {
+ return super.getName();
+ }
+
+
+ @ManagementProperty(description="Connector Bindings for model")
+ public List<String> getConnectorBindingNames(){
+ return this.connectorBindings;
+ }
+
+ @Override
+ @ManagementProperty(description = "Is Model Source model", readOnly=true)
+ public boolean isSource() {
+ if (modelType != null) {
+ return ModelType.parseString(modelType) == ModelType.PHYSICAL;
+ }
+ throw new IllegalStateException("Model state is not correctly set");
+ }
+
+ @Override
+ @ManagementProperty(description = "Is Model Visible", readOnly=true)
+ public boolean isVisible() {
+ return isVisible;
+ }
+
+ @Override
+ @ManagementProperty(description = "Model Type", readOnly=true)
+ public String getModelType() {
+ return modelType;
+ }
+
+ @Override
+ @ManagementProperty(description = "Model URI", readOnly=true)
+ public String getModelURI() {
+ return modelURI;
+ }
+
+ @Override
+ @ManagementProperty(description = "Does Model supports multi-source bindings",
readOnly=true)
+ public boolean isSupportsMultiSourceBindings() {
+ return this.supportsMultiSourceBindings;
+ }
+
+ @Override
+ @ManagementProperty(description = "Model path", readOnly=true)
+ public String getPath() {
+ return this.path;
+ }
+
+ @Override
+ @ManagementProperty(description = "Model UUID", readOnly=true)
+ public String getUuid() {
+ return this.uuid;
+ }
+
+ @Override
+ @ManagementProperty(description = "Properties", readOnly=true)
+ public Properties getProperties() {
+ return new Properties(super.getProperties());
+ }
+
+ public void addConnectorBinding(String binding) {
+ this.connectorBindings.add(binding);
+ }
+
+ public void setSupportsMultiSourceBindings(boolean supports) {
+ this.supportsMultiSourceBindings = supports;
+ }
+
+ public void setVisible(boolean isVisible) {
+ this.isVisible = isVisible;
+ }
+
+ public void setModelType(String modelType) {
+ this.modelType = modelType;
+ }
+
+ public void setModelURI(String modelURI) {
+ this.modelURI = modelURI;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ public String toString() {
+ return name + connectorBindings;
+ }
+}
Property changes on:
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
(rev 0)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -0,0 +1,145 @@
+/*
+ * 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 org.teiid.adminapi.impl;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.teiid.adminapi.VDB;
+
+@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="vdb"))
+public class VDBMetaData extends AdminObjectImpl implements VDB {
+
+ private static final long serialVersionUID = -4723595252013356436L;
+ private HashSet<ModelMetaData> models = new HashSet<ModelMetaData>();
+ private URL fileUrl = null;
+ private int version = 1;
+ private Status status;
+ private String description;
+ private List<String> errors;
+
+ @ManagementProperty(description="Name of the VDB", readOnly=true)
+ @ManagementObjectID(type="vdb")
+ public String getName() {
+ return super.getName();
+ }
+
+ @Override
+ @ManagementProperty(description="VDB Status", readOnly=true)
+ public Status getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(Status s) {
+ this.status = s;
+ }
+
+ @Override
+ @ManagementProperty(description="VDB version", readOnly=true)
+ public int getVersion() {
+ return this.version;
+ }
+
+ public void setVersion(int version) {
+ this.version = version;
+ }
+
+ @Override
+ @ManagementProperty(description = "The VDB file url", readOnly=true)
+ public URL getUrl() {
+ return this.fileUrl;
+ }
+
+ public void setUrl(URL url) {
+ this.fileUrl = url;
+ }
+
+ @ManagementProperty(description="Model list in a VDB", managed=true)
+ public Set<ModelMetaData> getModels(){
+ return models;
+ }
+
+ public void addModel(ModelMetaData m) {
+ this.models.add(m);
+ }
+
+ @Override
+ @ManagementProperty(description = "Description", readOnly=true)
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String desc) {
+ this.description = desc;
+ }
+
+ @Override
+ @ManagementProperty(description = "VDB validity errors", readOnly=true)
+ public List<String> getValidityErrors(){
+ if (this.errors != null) {
+ return this.errors;
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ public void addValidityError(String error) {
+ if (this.errors == null) {
+ errors = new ArrayList<String>();
+ }
+ this.errors.add(error);
+ }
+
+ public String toString() {
+ return this.name + models;
+ }
+
+ @ManagementOperation(description = "Get the model with given name")
+ public ModelMetaData getModel(String modelName) {
+ for(ModelMetaData m: models) {
+ if (m.getName().equalsIgnoreCase(modelName)) {
+ return m;
+ }
+ }
+ return null;
+ }
+
+ public List<ModelMetaData> getMultiSourceModels(){
+ List<ModelMetaData> list = new ArrayList<ModelMetaData>();
+ for(ModelMetaData m: models) {
+ if (m.isSupportsMultiSourceBindings()) {
+ list.add(m);
+ }
+ }
+ return list;
+ }
+
+
+}
Property changes on:
branches/JCA/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
branches/JCA/common-internal/src/main/java/com/metamatrix/vdb/runtime/VDBKey.java
===================================================================
---
branches/JCA/common-internal/src/main/java/com/metamatrix/vdb/runtime/VDBKey.java 2009-11-30
17:12:55 UTC (rev 1606)
+++
branches/JCA/common-internal/src/main/java/com/metamatrix/vdb/runtime/VDBKey.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -36,6 +36,11 @@
}
}
+ public VDBKey(String name, int version) {
+ this.name = name.toUpperCase();
+ this.version = String.valueOf(version);
+ }
+
public String getName() {
return name;
}
Modified:
branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java
===================================================================
---
branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2009-11-30
17:12:55 UTC (rev 1606)
+++
branches/JCA/jboss-integration/src/main/java/org/teiid/adminapi/jboss/Admin.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -57,7 +57,7 @@
import org.teiid.adminapi.ConnectorBinding;
import org.teiid.adminapi.TeiidAdminMBean;
import org.teiid.adminapi.impl.BaseAdmin;
-import org.teiid.adminapi.impl.ConnectorBindingImpl;
+import org.teiid.adminapi.impl.ConnectorBindingMetaData;
@ManagementObject(description="Teiid Admin Interface",
componentType=@ManagementComponent(type="teiid",subtype="admin"),
properties=ManagementProperties.EXPLICIT, isRuntime=true)
@JMX(name="jboss.teiid:service=teiid-admin",
exposedInterface=TeiidAdminMBean.class, registerDirectly=true)
@@ -110,7 +110,8 @@
SimpleValueSupport v = (SimpleValueSupport)mp.getValue();
if (v.getValue().equals("org.teiid.connector.api.Connector")){
- ConnectorBindingImpl cb = new ConnectorBindingImpl(mc.getName());
+ ConnectorBindingMetaData cb = new ConnectorBindingMetaData();
+ cb.setName(mc.getName());
cb.setComponentType(type);
for (String key:mc.getProperties().keySet()) {
ManagedProperty property = mc.getProperty(key);
@@ -196,7 +197,7 @@
@Override
public void deleteConnectorBinding(String deployedName) throws AdminException {
- ConnectorBindingImpl cb = (ConnectorBindingImpl)getConnectorBinding(deployedName);
+ ConnectorBindingMetaData cb =
(ConnectorBindingMetaData)getConnectorBinding(deployedName);
if (cb != null) {
try {
ManagedComponent mc = getView().getComponent(cb.getName(),
(ComponentType)cb.getComponentType());
Modified: branches/JCA/pom.xml
===================================================================
--- branches/JCA/pom.xml 2009-11-30 17:12:55 UTC (rev 1606)
+++ branches/JCA/pom.xml 2009-11-30 18:04:19 UTC (rev 1607)
@@ -438,6 +438,18 @@
<version>2.1.2.GA</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ <version>2.0.7.GA</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <version>2.0.7.GA</version>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-connector</artifactId>
Modified: branches/JCA/runtime/pom.xml
===================================================================
--- branches/JCA/runtime/pom.xml 2009-11-30 17:12:55 UTC (rev 1606)
+++ branches/JCA/runtime/pom.xml 2009-11-30 18:04:19 UTC (rev 1607)
@@ -87,6 +87,17 @@
<groupId>javax.resource</groupId>
<artifactId>connector-api</artifactId>
<scope>provided</scope>
- </dependency>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified:
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
===================================================================
---
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java 2009-11-30
17:12:55 UTC (rev 1606)
+++
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -45,11 +45,9 @@
import com.metamatrix.admin.objects.MMConnectorType;
import com.metamatrix.admin.objects.MMExtensionModule;
import com.metamatrix.admin.objects.MMLogConfiguration;
-import com.metamatrix.admin.objects.MMModel;
import com.metamatrix.admin.objects.MMPropertyDefinition;
import com.metamatrix.admin.objects.MMRequest;
import com.metamatrix.admin.objects.MMSession;
-import com.metamatrix.admin.objects.MMVDB;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.security.SessionServiceException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
@@ -384,51 +382,53 @@
*/
private org.teiid.adminapi.VDB convertVDB(final com.metamatrix.common.vdb.api.VDBDefn
src, final Object parent) {
- MMVDB vdb = new MMVDB(new String[] {src.getName(), src.getVersion()});
- vdb.setCreated(src.getDateCreated());
- vdb.setCreatedBy(src.getCreatedBy());
- vdb.setEnabled(src.isActiveStatus());
- vdb.setLastUpdated(src.getDateCreated());
- vdb.setLastUpdatedBy(src.getCreatedBy());
- vdb.setMaterializedViews(src.getMatertializationModel() != null);
- vdb.setModels((Collection)convertToAdminObjects(src.getModels(), src));
- vdb.setProperties(null);
- vdb.setRegistered(true);
- vdb.setStatus(src.getStatus());
- vdb.setUID(0); // TODO: src.getUUID());
- vdb.setVersionedBy(src.getCreatedBy());
- vdb.setVersionedDate(src.getDateCreated());
- vdb.setHasWSDL(src.hasWSDLDefined());
-
- return vdb;
+// MMVDB vdb = new MMVDB(new String[] {src.getName(), src.getVersion()});
+// vdb.setCreated(src.getDateCreated());
+// vdb.setCreatedBy(src.getCreatedBy());
+// vdb.setEnabled(src.isActiveStatus());
+// vdb.setLastUpdated(src.getDateCreated());
+// vdb.setLastUpdatedBy(src.getCreatedBy());
+// vdb.setMaterializedViews(src.getMatertializationModel() != null);
+// vdb.setModels((Collection)convertToAdminObjects(src.getModels(), src));
+// vdb.setProperties(null);
+// vdb.setRegistered(true);
+// vdb.setStatus(src.getStatus());
+// vdb.setUID(0); // TODO: src.getUUID());
+// vdb.setVersionedBy(src.getCreatedBy());
+// vdb.setVersionedDate(src.getDateCreated());
+// vdb.setHasWSDL(src.hasWSDLDefined());
+//
+// return vdb;
+ return null;
}
private org.teiid.adminapi.Model convertModel(final
com.metamatrix.common.vdb.api.ModelInfo src, final Object parent) {
- final com.metamatrix.common.vdb.api.VDBDefn vdb =
(com.metamatrix.common.vdb.api.VDBDefn)parent;
- MMModel model = new MMModel(new String[] {src.getName()});
- model.setCreated(vdb.getDateCreated());
- model.setCreatedBy(vdb.getCreatedBy());
- model.setEnabled(vdb.isActiveStatus());
- model.setLastUpdated(vdb.getDateCreated());
- model.setLastUpdatedBy(vdb.getCreatedBy());
- model.setModelType(src.getModelTypeName());
- model.setModelURI(src.getModelURI());
- model.setMaterialization(src.isMaterialization());
- model.setPhysical(src.isPhysical());
- model.setRegistered(true);
- model.setSupportsMultiSourceBindings(src.isMultiSourceBindingEnabled());
- model.setVisible(src.isVisible());
- if (src.isPhysical()) {
- List bindings = src.getConnectorBindingNames();
- if (bindings != null && !bindings.isEmpty()) {
- List names = new ArrayList();
- for (int i=0; i<bindings.size();i++) {
-
names.add(convertToAdminObject(vdb.getConnectorBindingByName((String)bindings.get(i)),
parent));
- }
- model.setConnectorBindingNames(names);
- }
- }
- return model;
+// final com.metamatrix.common.vdb.api.VDBDefn vdb =
(com.metamatrix.common.vdb.api.VDBDefn)parent;
+// MMModel model = new MMModel(new String[] {src.getName()});
+// model.setCreated(vdb.getDateCreated());
+// model.setCreatedBy(vdb.getCreatedBy());
+// model.setEnabled(vdb.isActiveStatus());
+// model.setLastUpdated(vdb.getDateCreated());
+// model.setLastUpdatedBy(vdb.getCreatedBy());
+// model.setModelType(src.getModelTypeName());
+// model.setModelURI(src.getModelURI());
+// model.setMaterialization(src.isMaterialization());
+// model.setPhysical(src.isPhysical());
+// model.setRegistered(true);
+// model.setSupportsMultiSourceBindings(src.isMultiSourceBindingEnabled());
+// model.setVisible(src.isVisible());
+// if (src.isPhysical()) {
+// List bindings = src.getConnectorBindingNames();
+// if (bindings != null && !bindings.isEmpty()) {
+// List names = new ArrayList();
+// for (int i=0; i<bindings.size();i++) {
+//
names.add(convertToAdminObject(vdb.getConnectorBindingByName((String)bindings.get(i)),
parent));
+// }
+// model.setConnectorBindingNames(names);
+// }
+// }
+// return model;
+ return null;
}
private org.teiid.adminapi.Request convertRequest(final RequestInfo src) {
Modified:
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
===================================================================
---
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java 2009-11-30
17:12:55 UTC (rev 1606)
+++
branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -521,7 +521,7 @@
@Override
public void deleteVDB(String vdbName, String vdbVersion) throws AdminException {
- super.changeVDBStatus(vdbName, vdbVersion, VDB.DELETED);
+ //super.changeVDBStatus(vdbName, vdbVersion, VDB.DELETED);
}
/**
Added: branches/JCA/runtime/src/main/java/org/teiid/deployers/DefParser.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/deployers/DefParser.java
(rev 0)
+++ branches/JCA/runtime/src/main/java/org/teiid/deployers/DefParser.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -0,0 +1,153 @@
+package org.teiid.deployers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.impl.ConnectorBindingMetaData;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+
+import com.metamatrix.common.xml.XMLReaderWriter;
+import com.metamatrix.common.xml.XMLReaderWriterImpl;
+
+public class DefParser {
+
+ public static VDBMetaData load(InputStream defStream) throws IOException {
+ VDBMetaData vdb = new VDBMetaData();
+ try {
+ XMLReaderWriter reader = new XMLReaderWriterImpl();
+ Document doc = reader.readDocument(defStream);
+ Element root = doc.getRootElement();
+
+ // load VDBInfo section
+ loadVDBInfoSection(vdb, root);
+
+ // add Models section
+ loadModelsSection(vdb, root);
+
+ } catch (JDOMException e) {
+ throw new IOException(e);//$NON-NLS-1$
+ }
+ return vdb;
+ }
+
+ private static void loadVDBInfoSection(VDBMetaData vdb, Element root) throws
IOException {
+
+ Element vdbInfoElement = root.getChild(VDBInfoFragment.ELEMENT);
+ if (vdbInfoElement == null) {
+ throw new IOException("VDBDefnXMLHelper.Invalid_xml_section");
//$NON-NLS-1$
+ }
+
+ Properties vdbProps = getElementProperties(vdbInfoElement);
+ if (vdbProps == null || vdbProps.isEmpty()) {
+ throw new
IOException("VDBDefnXMLHelper.No_properties_defined_to_create_defn");
//$NON-NLS-1$
+ }
+
+ vdb.setName((String)vdbProps.remove(VDBInfoFragment.NAME));
+ String version = (String)vdbProps.remove(VDBInfoFragment.VERSION);
+ vdb.setVersion(version!=null?Integer.parseInt(version):1);//$NON-NLS-1$
+ vdb.setDescription((String)vdbProps.remove(VDBInfoFragment.DESCRIPTION));
+ if (TRUE.equals(vdbProps.remove(VDBInfoFragment.ACTIVE))) {
+ vdb.setStatus(VDB.Status.ACTIVE);
+ }
+ else {
+ vdb.setStatus(VDB.Status.INACTIVE);
+ }
+ vdb.setProperties(vdbProps);
+ }
+
+ private static void loadModelsSection(VDBMetaData vdb, Element root) {
+ Collection<Element> modelsElements = root.getChildren(ModelFragment.ELEMENT);
+ for(Element modelElement:modelsElements) {
+ vdb.addModel(loadModel(modelElement));
+ }
+ }
+
+ private static ModelMetaData loadModel(Element modelElement) {
+ Properties props = getElementProperties(modelElement);
+
+ ModelMetaData model = new ModelMetaData();
+ model.setName(props.getProperty(ModelFragment.NAME));
+ props.remove(ModelFragment.NAME);
+
+ String visibility = props.getProperty(ModelFragment.VISIBILITY,
org.teiid.adminapi.Model.PUBLIC_VISIBILITY);
+ props.remove(ModelFragment.VISIBILITY);
+
model.setVisible(visibility.equalsIgnoreCase(org.teiid.adminapi.Model.PUBLIC_VISIBILITY)?true:false);
+
+
model.setSupportsMultiSourceBindings(Boolean.parseBoolean(props.getProperty(ModelFragment.MULTI_SOURCE_ENABLED)));
+ props.remove(ModelFragment.MULTI_SOURCE_ENABLED);
+
+ model.setProperties(props);
+
+ Element cbElement =
modelElement.getChild(ModelFragment.CONNECTOR_BINDINGS_ELEMENT);
+ if (cbElement != null) {
+ Collection<Element> bindingElements =
cbElement.getChildren(ModelFragment.CONNECTOR);
+ for(Element bindingElement:bindingElements) {
+ String connectorName =
bindingElement.getAttributeValue(ModelFragment.CONNECTOR_ATTRIBUTE_NAME);
+ model.addConnectorBinding(connectorName);
+ }
+ }
+ return model;
+ }
+
+ protected static Properties getElementProperties(Element rootElement) {
+ Properties properties = new Properties();
+ if(rootElement == null) {
+ return properties;
+ }
+ // obtain any defaults that are defined
+ List propertyElements = rootElement.getChildren(PropertyFragment.ELEMENT);
+ if (propertyElements != null) {
+ Iterator iterator = propertyElements.iterator();
+ for (int i = 1; iterator.hasNext(); i++) {
+ Element element = (Element)iterator.next();
+ String name =
element.getAttributeValue(PropertyFragment.ATTRIBUTE_NAME);
+ String value =
element.getAttributeValue(PropertyFragment.ATTRIBUTE_VALUE);
+ if (name != null && name.length() > 0) {
+ properties.setProperty(name, value);
+ }
+ }
+ }
+ return properties;
+ }
+
+ static final String ROOT_ELEMENT = "VDB"; //$NON-NLS-1$
+ private static final String TRUE = "true"; //$NON-NLS-1$
+ private static class VDBInfoFragment {
+ public static final String ELEMENT = "VDBInfo"; //$NON-NLS-1$
+ public static final String NAME = "Name"; //$NON-NLS-1$
+ public static final String VERSION = "Version"; //$NON-NLS-1$
+
+ // Optional - defaults to VDB Name
+ public static final String DESCRIPTION = "Description"; //$NON-NLS-1$
+ public static final String ACTIVE = "Active"; //$NON-NLS-1$
+ }
+
+ private static class PropertyFragment {
+ public static final String ELEMENT = "Property"; //$NON-NLS-1$
+ public static final String ATTRIBUTE_NAME = "Name"; //$NON-NLS-1$
+ public static final String ATTRIBUTE_VALUE = "Value"; //$NON-NLS-1$
+ }
+
+ private static class ModelFragment {
+ public static final String ELEMENT = "Model"; //$NON-NLS-1$
+ public static final String NAME = "Name"; //$NON-NLS-1$
+
+ // Optional - Default - physical=false, virtual=true
+ public static final String VISIBILITY = "Visibility"; //$NON-NLS-1$
+ public static final String MULTI_SOURCE_ENABLED = "MultiSourceEnabled";
//$NON-NLS-1$
+
+ // Optional - no binding set
+ public static final String CONNECTOR_BINDINGS_ELEMENT = "ConnectorBindings";
//$NON-NLS-1$
+ public static final String CONNECTOR = "Connector"; //$NON-NLS-1$
+ public static final String CONNECTOR_ATTRIBUTE_NAME = "Name"; //$NON-NLS-1$
+ }
+}
Property changes on:
branches/JCA/runtime/src/main/java/org/teiid/deployers/DefParser.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestMetaData.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestMetaData.java
(rev 0)
+++
branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestMetaData.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -0,0 +1,36 @@
+/*
+ * 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 org.teiid.deployers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.teiid.adminapi.impl.ModelMetaData;
+
+@ManagementObject
+public class ManifestMetaData {
+ String vdbName;
+ String vdbDescription;
+ List<ModelMetaData> models = new ArrayList<ModelMetaData>();
+ List<String> errors = new ArrayList<String>();
+}
Property changes on:
branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestMetaData.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestParser.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestParser.java
(rev 0)
+++ branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestParser.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -0,0 +1,111 @@
+/*
+ * 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 org.teiid.deployers;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.Namespace;
+import org.teiid.adminapi.impl.ModelMetaData;
+
+import com.metamatrix.common.xml.XMLReaderWriter;
+import com.metamatrix.common.xml.XMLReaderWriterImpl;
+import com.metamatrix.core.util.StringUtil;
+
+
+/**
+ * VDB Manifest file; right now this is defined as EMF resource in the vdb.edit code,
+ * so to break the dependency from EMF we have defined as the simple XML type here. This
+ * will defined as simple xml in future then we can remove this. There is defect logged
on this
+ * in JIRA
+ */
+public class ManifestParser{
+
+ public static ManifestMetaData load(InputStream in) throws IOException {
+
+ ManifestMetaData vdb = new ManifestMetaData();
+
+ try {
+ XMLReaderWriter reader = new XMLReaderWriterImpl();
+ Document doc = reader.readDocument(in);
+ Element root = doc.getRootElement();
+
+ Namespace ns= root.getNamespace(NS);
+ Element vdbElement = root.getChild(VDB_ELEMENT, ns);
+ if (vdbElement != null) {
+ vdb.vdbName = vdbElement.getAttributeValue(NAME);
+ vdb.vdbDescription = vdbElement.getAttributeValue(DESCRIPTION);
+
+ // build the models
+ List<Element> modelElements = vdbElement.getChildren(MODELS);
+ for(Element modelElement:modelElements) {
+
+ String modelName = StringUtil.getFirstToken(modelElement.getAttributeValue(NAME),
".");
+ ModelMetaData model = new ModelMetaData();
+ model.setName(modelName);
+
+ model.setModelType(modelElement.getAttributeValue(MODEL_TYPE));
+ model.setPath(modelElement.getAttributeValue(MODEL_PATH,""));
+ model.setUuid(modelElement.getAttributeValue(UUID));
+ model.setModelURI(modelElement.getAttributeValue(PRIMARY_METAMODEL_URI));
+
+ String visibility = modelElement.getAttributeValue(ACCESSIBILITY);
+ if (visibility != null) {
+ model.setVisible("Public".equals(visibility)?true:false);
+ }
+
+ List<Element> markers = modelElement.getChildren(MARKERS);
+ for(Element marker:markers) {
+ String severity = marker.getAttributeValue(SEVERITY);
+ if (severity.equals(ERROR)) {
+ vdb.errors.add(marker.getAttributeValue(MESSAGE));
+ }
+ }
+ vdb.models.add(model);
+ }
+ }
+ } catch (JDOMException e) {
+ throw new IOException("Failed to read the VDB-Manifest file");
//$NON-NLS-1$
+ }
+ return vdb;
+ }
+
+ private static final String MODELS = "models"; //$NON-NLS-1$
+ private static final String ACCESSIBILITY = "accessibility"; //$NON-NLS-1$
+ private static final String PRIMARY_METAMODEL_URI = "primaryMetamodelUri";
//$NON-NLS-1$
+ private static final String UUID = "uuid"; //$NON-NLS-1$
+ private static final String NS = "vdb"; //$NON-NLS-1$
+ private static final String MESSAGE = "message"; //$NON-NLS-1$
+ private static final String ERROR = "ERROR"; //$NON-NLS-1$
+ private static final String SEVERITY = "severity"; //$NON-NLS-1$
+ private static final String NAME = "name"; //$NON-NLS-1$
+ private static final String MODEL_PATH = "modelLocation";//$NON-NLS-1$
+ private static final String MODEL_TYPE = "modelType";//$NON-NLS-1$
+ private static final String VDB_ELEMENT = "VirtualDatabase";//$NON-NLS-1$
+ private static final String DESCRIPTION = "description";//$NON-NLS-1$
+ private static final String MARKERS = "markers";//$NON-NLS-1$
+}
Property changes on:
branches/JCA/runtime/src/main/java/org/teiid/deployers/ManifestParser.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
(rev 0)
+++ branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -0,0 +1,64 @@
+package org.teiid.deployers;
+
+import java.util.Map;
+import java.util.Set;
+
+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.managed.api.ManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+
+public class VDBDeployer extends AbstractSimpleRealDeployer<VDBMetaData> implements
ManagedObjectCreator {
+ private ManagedObjectFactory mof;
+ private VDBRepository vdbRepository;
+
+ public VDBDeployer() {
+ super(VDBMetaData.class);
+ setInput(VDBMetaData.class);
+ setOutput(VDBMetaData.class);
+ }
+
+ @Override
+ public void deploy(DeploymentUnit unit, VDBMetaData deployment) throws
DeploymentException {
+ this.vdbRepository.addVDB(deployment);
+ System.out.println("VDB = "+deployment + " deployed");
+ }
+
+ @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 (ModelMetaData m : vdb.getModels()) {
+
+ 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;
+ }
+
+ @Override
+ public void undeploy(DeploymentUnit unit, VDBMetaData deployment) {
+ super.undeploy(unit, deployment);
+ this.vdbRepository.removeVDB(deployment.getName(), deployment.getVersion());
+ System.out.println("VDB = "+deployment + " undeployed");
+ }
+
+}
Property changes on:
branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
(rev 0)
+++
branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -0,0 +1,93 @@
+/*
+ * 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 org.teiid.deployers;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.deployers.vfs.spi.deployer.MultipleVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VirtualFile;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+
+/**
+ * This file loads the ".def" file and "manifest" file inside a VDB
file.
+ */
+public class VDBParserDeployer extends MultipleVFSParsingDeployer<VDBMetaData> {
+ protected Logger log = Logger.getLogger(getClass());
+
+ public VDBParserDeployer() {
+ super(VDBMetaData.class, getCustomMappings());
+ }
+
+ private static Map<String, Class<?>> getCustomMappings() {
+ Map<String, Class<?>> mappings = new HashMap<String,
Class<?>>();
+ mappings.put("ConfigurationInfo.def", VDBMetaData.class);
+ mappings.put("MetaMatrix-VdbManifestModel.xmi", ManifestMetaData.class);
+ return mappings;
+ }
+
+ @Override
+ protected <U> U parse(Class<U> expectedType, VirtualFile file, Object root)
throws Exception {
+ if (expectedType.equals(VDBMetaData.class)) {
+ VDBMetaData def = DefParser.load(file.openStream());
+ return expectedType.cast(def);
+ }
+ else if (expectedType.equals(ManifestMetaData.class)) {
+ ManifestMetaData manifest = ManifestParser.load(file.openStream());
+ return expectedType.cast(manifest);
+ }
+ else {
+ throw new IllegalArgumentException("Cannot match arguments: expectedClass="
+ expectedType );
+ }
+ }
+
+ @Override
+ protected VDBMetaData mergeMetaData(VFSDeploymentUnit unit, Map<Class<?>,
List<Object>> metadata) throws Exception {
+ VDBMetaData def = getInstance(metadata, VDBMetaData.class);
+ ManifestMetaData manifest = getInstance(metadata, ManifestMetaData.class);
+
+ if (def == null || manifest == null) {
+ log.error("Invalid VDB file deployment failed ="+unit.getRoot().getName());
+ return null;
+ }
+ log.debug("VDB "+unit.getRoot().getName()+" has been parsed.");
+ return merge(def, manifest);
+ }
+
+ private VDBMetaData merge(VDBMetaData def, ManifestMetaData manifest) {
+ for(ModelMetaData manifestModel: manifest.models) {
+ ModelMetaData model = def.getModel(manifestModel.getName());
+ if (model != null) {
+ model.setModelType(manifestModel.getModelType());
+ model.setModelURI(manifestModel.getModelURI());
+ model.setPath(manifestModel.getPath());
+ model.setUuid(manifestModel.getUuid());
+ model.setVisible(manifestModel.isVisible());
+ }
+ }
+ return def;
+ }
+}
Property changes on:
branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBParserDeployer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
(rev 0)
+++ branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -0,0 +1,87 @@
+/*
+ * 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 org.teiid.deployers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.impl.VDBMetaData;
+
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
+import com.metamatrix.metadata.runtime.api.VirtualDatabaseDoesNotExistException;
+import com.metamatrix.metadata.runtime.api.VirtualDatabaseException;
+import com.metamatrix.vdb.runtime.VDBKey;
+
+/**
+ * Repository for VDBs
+ */
+public class VDBRepository {
+
+ Map<VDBKey, VDBMetaData> repo = new ConcurrentHashMap<VDBKey,
VDBMetaData>();
+
+ public void addVDB(VDBMetaData vdb) throws DeploymentException {
+ if (getVDB(vdb.getName(), vdb.getVersion()) != null) {
+ throw new DeploymentException("VDB with given name and version already
exists!");
+ }
+ this.repo.put(vdbId(vdb), vdb);
+ }
+
+ public VDBMetaData getVDB(String name, int version) {
+ return this.repo.get(vdbId(name, version));
+ }
+
+
+ protected VDBKey vdbId(VDBMetaData vdb) {
+ return new VDBKey(vdb.getName(), vdb.getVersion());
+ }
+
+ protected VDBKey vdbId(String name, int version) {
+ return new VDBKey(name, version);
+ }
+
+ public void removeVDB(String name, int version) {
+ if (getVDB(name, version) != null) {
+ this.repo.remove(vdbId(name, version));
+ }
+ }
+
+ public VDBMetaData getActiveVDB(String vdbName) throws
VirtualDatabaseDoesNotExistException, VirtualDatabaseException {
+ int latestVersion = 0;
+ for (VDBKey key:this.repo.keySet()) {
+ if(key.getName().equalsIgnoreCase(vdbName)) {
+ // Make sure the VDB Name and version number are the only parts of this
vdb key
+ latestVersion = Math.max(latestVersion,
Integer.parseInt(key.getVersion()));
+ }
+ }
+ if(latestVersion == 0) {
+ throw new
VirtualDatabaseDoesNotExistException(DQPEmbeddedPlugin.Util.getString("VDBService.VDB_does_not_exist._2",
vdbName, "latest")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ VDBMetaData vdb = getVDB(vdbName, latestVersion);
+ if (vdb.getStatus() != VDB.Status.ACTIVE) {
+ throw new
VirtualDatabaseException(DQPEmbeddedPlugin.Util.getString("VDBService.VDB_does_not_exist._2",
vdbName, latestVersion)); //$NON-NLS-1$
+ }
+ return vdb;
+ }
+}
Property changes on:
branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBStructure.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBStructure.java
(rev 0)
+++ branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBStructure.java 2009-11-30
18:04:19 UTC (rev 1607)
@@ -0,0 +1,41 @@
+package org.teiid.deployers;
+
+import java.io.IOException;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
+import org.jboss.deployers.vfs.spi.structure.StructureContext;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.context.jar.JarUtils;
+
+
+public class VDBStructure extends AbstractVFSStructureDeployer{
+
+ public VDBStructure(){
+ setRelativeOrder(1000);
+ JarUtils.addJarSuffix(".vdb");
+ }
+
+ @Override
+ public boolean determineStructure(StructureContext structureContext) throws
DeploymentException {
+ VirtualFile file = structureContext.getFile();
+ try {
+ if (isLeaf(file) == false) {
+ if (file.getName().endsWith(".vdb")) {
+ if (file.getChild("ConfigurationInfo.def") == null) {
+ return false;
+ }
+ if (file.getChild("MetaMatrix-VdbManifestModel.xmi") == null) {
+ return false;
+ }
+ createContext(structureContext, new String[] {"/"});
+ return true;
+ }
+ }
+ } catch (IOException e) {
+ throw DeploymentException.rethrowAsDeploymentException("Error determining
structure: " + file.getName(), e);
+ }
+ return false;
+ }
+
+}
Property changes on:
branches/JCA/runtime/src/main/java/org/teiid/deployers/VDBStructure.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain