本文整理汇总了Java中org.teiid.adminapi.impl.VDBMetaData.setModels方法的典型用法代码示例。如果您正苦于以下问题:Java VDBMetaData.setModels方法的具体用法?Java VDBMetaData.setModels怎么用?Java VDBMetaData.setModels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.teiid.adminapi.impl.VDBMetaData
的用法示例。
在下文中一共展示了VDBMetaData.setModels方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addImports
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* Adds the Import to supplied VDB deployment. The new VDB is returned.
* @param vdb the VDB
* @param importVdbName the name of the VDB to import
* @param importVdbVersion the version of the VDB to import
* @return the new VDB
*/
public VDBMetaData addImports(VDBMetaData vdb, List<String> importVdbNames, List<Integer> importVdbVersions) {
String vdbName = vdb.getName();
int vdbVersion = vdb.getVersion();
// Get current vdb imports
List<VDBImportMetadata> currentVdbImports = getVdbImports(vdb);
List<String> currentVdbImportNames = new ArrayList<String>();
for(VDBImportMetadata importMeta : currentVdbImports) {
currentVdbImportNames.add(importMeta.getName());
}
List<ModelMetaData> currentViewModels = getVdbViewModels(vdb);
Properties currentProperties = getVdbProperties(vdb);
// Clear any prior Model Messages (needed for successful redeploy)
clearModelMessages(currentViewModels);
// Create a new vdb
VDBMetaData newVdb = createVdb(vdbName,vdbVersion,currentProperties);
// Add the existing ViewModels
newVdb.setModels(currentViewModels);
// Add new import to current imports (if not already present)
for(int i=0; i<importVdbNames.size(); i++) {
String importToAdd = importVdbNames.get(i);
if(!currentVdbImportNames.contains(importToAdd)) {
currentVdbImports.add(createVdbImport(importVdbNames.get(i), importVdbVersions.get(i)));
}
}
newVdb.getVDBImports().addAll(currentVdbImports);
return newVdb;
}
示例2: replaceImport
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* Replaces and import in the supplied vdb with a different import. (Used for source renames)
* @param vdb the VDB
* @param originalImportName the name of the existing import
* @param originalImportName the version of the existing import
* @param newImportName the name of the new import which replaces existing
* @param newImportName the version of the new import which replaces existing
* @return the new VDB
*/
public VDBMetaData replaceImport(VDBMetaData vdb, String originalImportName, Integer originalImportVersion, String newImportName, Integer newImportVersion) {
String vdbName = vdb.getName();
int vdbVersion = vdb.getVersion();
// Get current vdb imports
List<VDBImportMetadata> currentVdbImports = getVdbImports(vdb);
List<String> currentVdbImportNames = new ArrayList<String>();
for(VDBImportMetadata importMeta : currentVdbImports) {
currentVdbImportNames.add(importMeta.getName());
}
List<ModelMetaData> currentViewModels = getVdbViewModels(vdb);
Properties currentProperties = getVdbProperties(vdb);
// Clear any prior Model Messages (needed for successful redeploy)
clearModelMessages(currentViewModels);
// Create a new vdb
VDBMetaData newVdb = createVdb(vdbName,vdbVersion,currentProperties);
// Add the existing ViewModels
newVdb.setModels(currentViewModels);
// Go thru the current Vdb Imports. Add them into the new import list. If the originalImportName import is found, replace it.
List<VDBImportMetadata> newVdbImports = new ArrayList<VDBImportMetadata>();
for(VDBImportMetadata currentImport : currentVdbImports) {
if(currentImport.getName().equalsIgnoreCase(originalImportName)) {
newVdbImports.add(createVdbImport(newImportName, newImportVersion));
} else {
newVdbImports.add(currentImport);
}
}
newVdb.getVDBImports().addAll(newVdbImports);
return newVdb;
}
示例3: addViewModel
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* Adds the ViewModel to supplied VDB deployment. The new VDB is returned.
* @param vdb the VDB
* @param viewModelRequest details of the requested viewModel to create
* @return the new VDB
*/
public VDBMetaData addViewModel(VDBMetaData vdb, ViewModelRequestBean viewModelRequest) {
//public VDBMetaData addViewModel(VDBMetaData vdb, String viewModelName, String description, String ddlString, boolean isVisible) {
String vdbName = vdb.getName();
int vdbVersion = vdb.getVersion();
String viewModelName = viewModelRequest.getName();
String description = viewModelRequest.getDescription();
String ddlString = viewModelRequest.getDdl();
boolean isVisible = viewModelRequest.isVisible();
// Get current vdb imports
List<VDBImportMetadata> currentVdbImports = getVdbImports(vdb);
List<ModelMetaData> currentViewModels = getVdbViewModels(vdb);
Properties currentProperties = getVdbProperties(vdb);
// If original VDB has view model with supplied name, remove it
removeViewModel(currentViewModels, viewModelName);
// Clear any prior Model Messages (needed for successful redeploy)
clearModelMessages(currentViewModels);
// Create a new vdb
VDBMetaData newVdb = createVdb(vdbName,vdbVersion,currentProperties);
// Create View Model and add to current view models
ModelMetaData modelMetaData = createViewModel(viewModelName,description,ddlString,isVisible);
currentViewModels.add(modelMetaData);
// Set ViewModels on new VDB
newVdb.setModels(currentViewModels);
// Add new import to current imports
newVdb.getVDBImports().addAll(currentVdbImports);
return newVdb;
}
示例4: removeImports
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* Removes the imports from the supplied VDB - if they exist. The new VDB is returned.
* @param vdb the VDB
* @param removeImportNameList the list of import names to remove
* @return the List of ImportInfo data
*/
public VDBMetaData removeImports(VDBMetaData vdb, List<String> removeImportNameList) {
String vdbName = vdb.getName();
int vdbVersion = vdb.getVersion();
// Get current vdb imports
List<VDBImportMetadata> currentVdbImports = getVdbImports(vdb);
List<ModelMetaData> currentViewModels = getVdbViewModels(vdb);
Properties currentProperties = getVdbProperties(vdb);
// Clear any prior Model Messages (needed for successful redeploy)
clearModelMessages(currentViewModels);
// Create a new vdb
VDBMetaData newVdb = createVdb(vdbName,vdbVersion,currentProperties);
// Add the existing ViewModels
newVdb.setModels(currentViewModels);
// Create import list for new model
List<VDBImportMetadata> newImports = new ArrayList<VDBImportMetadata>();
for(VDBImportMetadata vdbImport: currentVdbImports) {
String currentName = vdbImport.getName();
// Keep the import - unless its in the remove list
if(!removeImportNameList.contains(currentName)) {
newImports.add((VDBImportMetadata)vdbImport);
}
}
newVdb.getVDBImports().addAll(newImports);
return newVdb;
}
示例5: deployVDB
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* Deploy the given set of models as vdb name.1
* @param name
* @param models
* @throws ConnectorManagerException
* @throws VirtualDatabaseException
* @throws TranslatorException
*/
public void deployVDB(String name, ModelMetaData... models)
throws ConnectorManagerException, VirtualDatabaseException, TranslatorException {
VDBMetaData vdb = new VDBMetaData();
vdb.setXmlDeployment(true);
vdb.setName(name);
vdb.setModels(Arrays.asList(models));
//TODO: the api should be hardened to prevent the creation of invalid metadata
//missing source/translator names will cause issues
deployVDB(vdb, null);
}
示例6: cloneVdbRenamingViewModels
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* Clone the supplied VDB, renaming all its views by appending the supplied suffix to the name
* @param vdb the VDB
* @param viewModelSuffix suffix to be applied when changing the view names
* @return the new VDB
*/
public VDBMetaData cloneVdbRenamingViewModels(VDBMetaData vdb, String viewModelSuffix) {
String vdbName = vdb.getName();
int vdbVersion = vdb.getVersion();
// Get current vdb imports
List<VDBImportMetadata> currentVdbImports = getVdbImports(vdb);
List<ModelMetaData> currentViewModels = getVdbViewModels(vdb);
Properties currentProperties = getVdbProperties(vdb);
// Clear any prior Model Messages (needed for successful redeploy)
clearModelMessages(currentViewModels);
// Create a new vdb
VDBMetaData newVdb = createVdb(vdbName,vdbVersion,currentProperties);
// The new View Model list is all current models, plus clones
List<ModelMetaData> newViewModels = new ArrayList<ModelMetaData>();
// Iterate the list of names to clone
for(Model model: currentViewModels) {
ModelMetaData modelMeta = (ModelMetaData)model;
// Clone the view model, renaming it
String theModelName = model.getName();
String newViewModelName = theModelName+viewModelSuffix;
String description = model.getDescription();
boolean isVisible = model.isVisible();
String ddlString = modelMeta.getSchemaText();
ModelMetaData clonedModelMeta = createViewModel(newViewModelName,description,ddlString,isVisible);
// Add to list of new models
newViewModels.add(clonedModelMeta);
}
newVdb.setModels(newViewModels);
// The imports are unchanged
List<VDBImportMetadata> newImports = new ArrayList<VDBImportMetadata>();
for(VDBImportMetadata vdbImport: currentVdbImports) {
newImports.add((VDBImportMetadata)vdbImport);
}
newVdb.getVDBImports().addAll(newImports);
return newVdb;
}
示例7: cloneVdb
import org.teiid.adminapi.impl.VDBMetaData; //导入方法依赖的package包/类
/**
* Clone the supplied VDB, basically to force reload of the source models
* @param vdb the VDB
* @return the new VDB
*/
public VDBMetaData cloneVdb(VDBMetaData vdb) {
String vdbName = vdb.getName();
int vdbVersion = vdb.getVersion();
// Get current vdb imports
List<VDBImportMetadata> currentVdbImports = getVdbImports(vdb);
List<ModelMetaData> currentViewModels = getVdbViewModels(vdb);
Properties currentProperties = getVdbProperties(vdb);
// Clear any prior Model Messages (needed for successful redeploy)
clearModelMessages(currentViewModels);
// Create a new vdb
VDBMetaData newVdb = createVdb(vdbName,vdbVersion,currentProperties);
// The new View Model list is all current models, plus clones
List<ModelMetaData> newViewModels = new ArrayList<ModelMetaData>();
// Iterate the list of names to clone
for(Model model: currentViewModels) {
ModelMetaData modelMeta = (ModelMetaData)model;
// Clone the view model
String theModelName = model.getName();
String newViewModelName = theModelName;
String description = model.getDescription();
boolean isVisible = model.isVisible();
String ddlString = modelMeta.getSchemaText();
ModelMetaData clonedModelMeta = createViewModel(newViewModelName,description,ddlString,isVisible);
// Add to list of new models
newViewModels.add(clonedModelMeta);
}
newVdb.setModels(newViewModels);
// The imports are unchanged
List<VDBImportMetadata> newImports = new ArrayList<VDBImportMetadata>();
for(VDBImportMetadata vdbImport: currentVdbImports) {
newImports.add((VDBImportMetadata)vdbImport);
}
newVdb.getVDBImports().addAll(newImports);
return newVdb;
}