Skip to content

Commit

Permalink
Updates to teiid client for support of Teiid 8.9
Browse files Browse the repository at this point in the history
* Lots of changes are requires serious testing for all latter versions of
  teiid server.

* Change of saxon version dependency to 9.1.5-6j implies API changes in
  saxon dependent package. Thus, errors in Eclipse until TP has been
  upgraded to include 1.2 version of locus which should contain the new
  saxon library.

* Temporary fixes to accomodate change of libraries
 * Extras target file added to include the new provisional saxon 9.5.1
   plugin
 * pom.xml
 * target-platform/pom.xml
  * In order to accommodate the saxon plugin not yet being in the IS
    repository, it is necessary to include a provisional repo and attach it
    to the target platform. However, in order for maven to 'see' it, the
    target once again must become local so has to be build prior to the
    rest of the application.
  * For convenience the TP has thus been committed once again
  • Loading branch information
Paul Richardson committed Nov 3, 2014
1 parent 9a19b21 commit d298e0b
Show file tree
Hide file tree
Showing 79 changed files with 2,755 additions and 910 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ enum VersionID {

TEIID_8_7(EIGHT + DOT + SEVEN + DOT + ZERO),

TEIID_8_8(EIGHT + DOT + EIGHT + DOT + ZERO);
TEIID_8_8(EIGHT + DOT + EIGHT + DOT + ZERO),

TEIID_8_9(EIGHT + DOT + NINE + DOT + ZERO);

private final String id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,16 @@ public static enum Version {
* Teiid 8.8
*/
TEIID_8_8(VersionID.TEIID_8_8),


/**
* Teiid 8.9
*/
TEIID_8_9(VersionID.TEIID_8_9),

/**
* Default Teiid for this Designer
*/
TEIID_DEFAULT(VersionID.TEIID_8_8);
TEIID_DEFAULT(VersionID.TEIID_8_9);

private final ITeiidServerVersion version;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Bundle-Version: 9.0.1.qualifier
Bundle-Vendor: %pluginProvider
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Localization: plugin
Require-Bundle: org.jboss.tools.locus.sf.saxon;bundle-version="[9.2.1,10.0.0)",
Require-Bundle: org.jboss.tools.locus.sf.saxon;bundle-version="[9.5.1,10.0.0)",
org.teiid.designer.spi;bundle-version="[9.0.0,10.0.0)",
org.eclipse.core.runtime;bundle-version="[3.10.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.9.1,4.0.0)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ enum MetadataStatus {LOADING, LOADED, FAILED, RETRYING};

/**
* Determine whether this model is exposed for querying.
*
*
* <br>Note: for imported models, this may be overriden. See {@link VDB#isVisible(String)}
*
* @return <code>true</code> if the model is visible
* for querying.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,12 @@ public enum ConnectionType {NONE, BY_VERSION, ANY}
*/
@Since(Version.TEIID_8_0)
public List<? extends Entry> getEntries();

/**
* Whether the model is visible
* @param modelName
* @return
*/
@Since(Version.TEIID_8_9)
boolean isVisible(String modelName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.teiid.adminapi.DataPolicy;
Expand Down Expand Up @@ -128,6 +130,9 @@ public String getKey(DataPolicyMetadata entry) {
@Since(Version.TEIID_8_0)
private Set<String> importedModels = Collections.emptySet();

@Since(Version.TEIID_8_9)
private Map<String, Boolean> visibilityOverrides = new HashMap<String, Boolean>(2);

private LinkedHashMap<String, ModelMetaData> convertModels(ListOverMap<ModelMetaData> overMap) {
LinkedHashMap<String, ModelMetaData> newMap = new LinkedHashMap<String, ModelMetaData>();
for (Entry<String, ModelMetaData> entry : overMap.getMap().entrySet()) {
Expand Down Expand Up @@ -368,10 +373,20 @@ public String toString() {
return getName()+VERSION_DELIM+getVersion()+ models.values();
}

public boolean isVisible(String modelName) {
ModelMetaData model = getModel(modelName);
return model == null || model.isVisible();
}
@Override
public boolean isVisible(String modelName) {
ModelMetaData model = getModel(modelName);
if (model == null) {
return true;
}
if (!visibilityOverrides.isEmpty()) {
Boolean result = visibilityOverrides.get(modelName);
if (result != null) {
return result;
}
}
return model.isVisible();
}

public ModelMetaData getModel(String modelName) {
return this.models.get(modelName);
Expand Down Expand Up @@ -462,9 +477,20 @@ public VDBMetaData clone() {
clone.attachments = new CopyOnWriteLinkedHashMap<Class<?>, Object>();
clone.attachments.putAll(attachments);
clone.dataPolicies = new LinkedHashMap<String, DataPolicyMetadata>(dataPolicies);
clone.visibilityOverrides = new HashMap<String, Boolean>(visibilityOverrides);
return clone;
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}

@Since(Version.TEIID_8_9)
public void setVisibilityOverride(String name, boolean visible) {
this.visibilityOverrides.put(name, visible);
}

@Since(Version.TEIID_8_9)
public Map<String, Boolean> getVisibilityOverrides() {
return visibilityOverrides;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,25 @@

import java.io.IOException;
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.atomic.AtomicLong;
import org.teiid.core.util.StringUtil;
import org.teiid.designer.annotation.Since;
import org.teiid.designer.runtime.version.spi.TeiidServerVersion.Version;


/**
* AbstractMetadataRecord
*/
public abstract class AbstractMetadataRecord implements Serializable {


@Since(Version.TEIID_8_9)
private static final Collection<AbstractMetadataRecord> EMPTY_INCOMING = Collections.emptyList();

public interface Modifiable {
long getLastModified();
}
Expand All @@ -59,6 +65,9 @@ public interface DataModifiable {
private volatile Map<String, String> properties;
private String annotation;

@Since(Version.TEIID_8_9)
private transient Collection<AbstractMetadataRecord> incomingObjects;

public static final String RELATIONAL_URI = "{http://www.teiid.org/ext/relational/2012}"; //$NON-NLS-1$

public String getUUID() {
Expand All @@ -81,6 +90,19 @@ public void setNameInSource(String nameInSource) {
}

/**
* Get the name in source or the name if
* the name in source is not set.
* @return
*/
@Since(Version.TEIID_8_9)
public String getSourceName() {
if (this.nameInSource != null && this.nameInSource.length() > 0) {
return this.nameInSource;
}
return getName();
}

/**
* WARNING - The name returned by this method may be ambiguous and
* is not SQL safe - it may need quoted/escaped
*/
Expand Down Expand Up @@ -239,5 +261,22 @@ private void readObject(java.io.ObjectInputStream in) throws IOException, ClassN
public int hashCode() {
return getUUID().hashCode();
}


@Since(Version.TEIID_8_9)
public Collection<AbstractMetadataRecord> getIncomingObjects() {
if (incomingObjects == null) {
return EMPTY_INCOMING;
}
return incomingObjects;
}

@Since(Version.TEIID_8_9)
public void setIncomingObjects(Collection<AbstractMetadataRecord> incomingObjects) {
this.incomingObjects = incomingObjects;
}

@Since(Version.TEIID_8_9)
public boolean isUUIDSet() {
return this.uuid != null && this.uuid.length() > 0 && !Character.isDigit(this.uuid.charAt(0));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ public BaseColumn(ITeiidServerVersion teiidVersion) {
this.teiidVersion = teiidVersion;
}

/**
* @return the teiidVersion
*/
public ITeiidServerVersion getTeiidVersion() {
return this.teiidVersion;
}

public String getDefaultValue() {
return defaultValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.teiid.designer.annotation.Since;
import org.teiid.designer.runtime.version.spi.ITeiidServerVersion;
import org.teiid.designer.runtime.version.spi.TeiidServerVersion.Version;
import org.teiid.query.function.metadata.FunctionCategoryConstants;
import org.teiid.query.function.metadata.FunctionMetadataValidator;


/**
* <p>This class represents information about a particular function signature.
* Function signatures are unique with respect to their name, # of arguments,
Expand All @@ -55,6 +57,10 @@
* @see FunctionParameter
*/
public class FunctionMethod extends AbstractMetadataRecord {

@Since(Version.TEIID_8_9)
public static final String SYSTEM_NAME = AbstractMetadataRecord.RELATIONAL_URI + "system-name"; //$NON-NLS-1$

private static final long serialVersionUID = -8039086494296455152L;

private static final String NOT_ALLOWED = "NOT_ALLOWED"; //$NON-NLS-1$
Expand Down Expand Up @@ -274,15 +280,15 @@ public void setInputParameters(List<FunctionParameter> params) {
}

/**
* Get ouput parameter.
* Get ouput/return parameter.
* @return Output parameter or return argument
*/
public FunctionParameter getOutputParameter() {
return this.outputParameter;
}

/**
* Set ouput parameter.
* Set ouput/return parameter.
* @param param Output Parameter
*/
public void setOutputParameter(FunctionParameter param) {
Expand Down Expand Up @@ -510,13 +516,13 @@ public static void convertExtensionMetadata(Procedure procedureRecord, FunctionM
}
}

public static FunctionMethod createFunctionMethod(String name, String description, String category,
public static FunctionMethod createFunctionMethod(ITeiidServerVersion version, String name, String description, String category,
String returnType, String... paramTypes) {
FunctionParameter[] params = new FunctionParameter[paramTypes.length];
for (int i = 0; i < paramTypes.length; i++) {
params[i] = new FunctionParameter("param" + (i+1), paramTypes[i]); //$NON-NLS-1$
params[i] = new FunctionParameter(version, "param" + (i+1), paramTypes[i]); //$NON-NLS-1$
}
FunctionMethod method = new FunctionMethod(name, description, category, params, new FunctionParameter("result", returnType)); //$NON-NLS-1$
FunctionMethod method = new FunctionMethod(name, description, category, params, new FunctionParameter(version, "result", returnType)); //$NON-NLS-1$
method.setNameInSource(name);
return method;
}
Expand Down

0 comments on commit d298e0b

Please sign in to comment.