本文整理汇总了Java中org.teiid.adminapi.VDB类的典型用法代码示例。如果您正苦于以下问题:Java VDB类的具体用法?Java VDB怎么用?Java VDB使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VDB类属于org.teiid.adminapi包,在下文中一共展示了VDB类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDataServiceVdbNames
import org.teiid.adminapi.VDB; //导入依赖的package包/类
public List<String> getDataServiceVdbNames( ) throws AdminApiClientException {
if(this.admin==null) return Collections.emptyList();
// Get list of VDB Names
Collection<? extends VDB> vdbs = null;
try {
vdbs = this.admin.getVDBs();
} catch (AdminException e) {
throw new AdminApiClientException(e.getMessage());
}
if(vdbs!=null) {
// Get VDB names
List<String> vdbNames = new ArrayList<String>();
for(VDB vdb : vdbs) {
String serviceViewName = vdb.getPropertyValue(Constants.VDB_PROP_KEY_DATASERVICE_VIEWNAME);
if(!StringUtils.isEmpty(serviceViewName)) {
String vdbName = ((VDBMetaData)vdb).getName();
vdbNames.add(vdbName);
}
}
return vdbNames;
} else {
return Collections.emptyList();
}
}
示例2: getVdbStatus
import org.teiid.adminapi.VDB; //导入依赖的package包/类
/**
* Get the VDB Status that will be displayed in the UI. This may be different from the VDBMetaData object status to simplify
* @param vdb the VDBMetaData
* @return the vdb status
*/
public String getVdbStatus(VDBMetaData vdb) {
VDB.Status status = vdb.getStatus();
String vdbStatus = Constants.STATUS_UNKNOWN;
// Change FAILED, REMOVED, LOADING status to INACTIVE
if(status!=null) {
vdbStatus = status.toString();
if( status==VDB.Status.FAILED || status==VDB.Status.REMOVED || status==VDB.Status.LOADING ) {
vdbStatus=Constants.STATUS_INACTIVE;
}
}
// If no models, change status to INACTIVE
List<Model> models = vdb.getModels();
if(models.isEmpty()) vdbStatus = Constants.STATUS_INACTIVE;
return vdbStatus;
}
示例3: getVdbsWithImport
import org.teiid.adminapi.VDB; //导入依赖的package包/类
private Collection<VDBMetaData> getVdbsWithImport(String importVdbName) {
Collection<VDBMetaData> vdbsWithImport = new ArrayList<VDBMetaData>();
// Get VDB name and version for the specified deploymentName
Collection<? extends VDB> allVdbs = null;
try {
allVdbs = clientAccessor.getClient().getVdbs();
for(VDB vdbMeta : allVdbs) {
if(vdbMeta instanceof VDBMetaData) {
VDBMetaData theVDB = (VDBMetaData)vdbMeta;
if(vdbHelper.hasImport(theVDB,importVdbName)) {
vdbsWithImport.add(theVDB);
}
}
}
} catch (AdminApiClientException e) {
}
return vdbsWithImport;
}
示例4: testEvents
import org.teiid.adminapi.VDB; //导入依赖的package包/类
@Test
public void testEvents() throws Exception {
FakeServer server = null;
try {
server = new FakeServer(true);
EventListener events = Mockito.mock(EventListener.class);
server.getEventDistributor().register(events);
server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/PartsSupplier.vdb");
Mockito.verify(events).vdbDeployed(VDB, 1);
Mockito.verify(events).vdbLoaded((VDB)Mockito.any());
server.undeployVDB(VDB);
Mockito.verify(events).vdbDeployed(VDB, 1);
Mockito.verify(events).vdbLoaded((VDB)Mockito.any());
Mockito.verify(events).vdbUndeployed(VDB, 1);
} finally {
if (server != null) {
server.stop();
}
}
}
示例5: waitForVDBLoad
import org.teiid.adminapi.VDB; //导入依赖的package包/类
static boolean waitForVDBLoad(Admin admin, String vdbName, int vdbVersion,
int timeoutInSecs) throws AdminException {
long waitUntil = System.currentTimeMillis() + timeoutInSecs*1000;
if (timeoutInSecs < 0) {
waitUntil = Long.MAX_VALUE;
}
boolean first = true;
do {
if (!first) {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
break;
}
} else {
first = false;
}
VDB vdb = admin.getVDB(vdbName, vdbVersion);
if (vdb != null && vdb.getStatus() != Status.LOADING) {
return true;
}
} while (System.currentTimeMillis() < waitUntil);
return false;
}
示例6: getVdbNames
import org.teiid.adminapi.VDB; //导入依赖的package包/类
public Collection<String> getVdbNames(boolean includeDynamic, boolean includeArchive, boolean includePreview) throws AdminApiClientException {
if(this.admin==null) return Collections.emptyList();
// Get list of VDB Names
Collection<? extends VDB> vdbs = null;
try {
vdbs = this.admin.getVDBs();
} catch (AdminException e) {
throw new AdminApiClientException(e.getMessage());
}
if(vdbs!=null) {
// Get VDB names
Collection<String> vdbNames = new ArrayList<String>();
for(VDB vdb : vdbs) {
VDBMetaData vdbMeta = (VDBMetaData)vdb;
String vdbName = vdbMeta.getName();
boolean isDynamic = vdbMeta.isXmlDeployment();
boolean isPreview = vdbMeta.isPreview();
// Dynamic VDB
if(isDynamic) {
if(includeDynamic) vdbNames.add(vdbName);
// Archive VDB
} else if(includeArchive) {
if(!isPreview) {
vdbNames.add(vdbName);
} else if(includePreview) {
vdbNames.add(vdbName);
}
}
}
return vdbNames;
} else {
return Collections.emptyList();
}
}
示例7: getVdbs
import org.teiid.adminapi.VDB; //导入依赖的package包/类
public Collection<? extends VDB> getVdbs() throws AdminApiClientException {
// Get list of VDB Names
Collection<? extends VDB> vdbs = null;
try {
vdbs = this.admin.getVDBs();
} catch (AdminException e) {
throw new AdminApiClientException(e.getMessage());
}
return vdbs;
}
示例8: getVDB
import org.teiid.adminapi.VDB; //导入依赖的package包/类
public VDBMetaData getVDB(String vdbName, int vdbVersion) throws AdminApiClientException {
// Get list of VDBS - get the named VDB
Collection<? extends VDB> vdbs = getVdbs();
VDBMetaData vdb = null;
for(VDB aVdb : vdbs) {
VDBMetaData vdbMeta = (VDBMetaData)aVdb;
if(vdbMeta.getName()!=null && vdbMeta.getName().equalsIgnoreCase(vdbName) && vdbMeta.getVersion()==vdbVersion) {
vdb = vdbMeta;
break;
}
}
return vdb;
}
示例9: cleanUp
import org.teiid.adminapi.VDB; //导入依赖的package包/类
static void cleanUp(Admin admin) throws AdminException {
//TODO: cleanup when as supports it
/*for (String name : admin.getDataSourceNames()) {
admin.deleteDataSource(name);
}*/
for (VDB vdb : admin.getVDBs()) {
String deploymentName = vdb.getPropertyValue("deployment-name");
if (deploymentName != null) {
admin.undeploy(deploymentName);
}
}
}
示例10: getAuthenticationType
import org.teiid.adminapi.VDB; //导入依赖的package包/类
@Override
public AuthenticationType getAuthenticationType(String vdbName, String version, String userName) throws LogonException {
if (vdbName != null) {
VDB vdb;
try {
vdb = getActiveVDB(vdbName, version);
} catch (SessionServiceException e) {
throw new LogonException(e);
}
String gssPattern = vdb.getPropertyValue(GSS_PATTERN_PROPERTY);
//TODO: cache the patterns
if (gssPattern != null && Pattern.matches(gssPattern, userName)) {
return AuthenticationType.GSS;
}
String passwordPattern = vdb.getPropertyValue(PASSWORD_PATTERN_PROPERTY);
if (passwordPattern != null && Pattern.matches(passwordPattern, userName)) {
return AuthenticationType.USERPASSWORD;
}
String typeProperty = vdb.getPropertyValue(AUTHENTICATION_TYPE_PROPERTY);
if (typeProperty != null) {
return AuthenticationType.valueOf(typeProperty);
}
}
return this.defaultAuthenticationType;
}
示例11: getSecurityDomain
import org.teiid.adminapi.VDB; //导入依赖的package包/类
public String getSecurityDomain(String userName, String vdbName, String version, VDB vdb) throws LoginException {
String securityDomain = getDomainName(userName);
if (vdbName != null) {
try {
if (vdb == null) {
vdb = getActiveVDB(vdbName, version);
}
String typeProperty = vdb.getPropertyValue(SECURITY_DOMAIN_PROPERTY);
if (typeProperty != null) {
if (securityDomain != null && !typeProperty.equals(securityDomain)) {
//conflicting
throw new LoginException(RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40116));
}
return typeProperty;
}
} catch (SessionServiceException e) {
// ignore and return default, this only occur if the name and version are wrong
}
}
if (securityDomain != null) {
if (this.securityDomainNames != null && this.securityDomainNames.contains(securityDomain)) {
return securityDomain;
}
throw new LoginException(RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40116));
}
if (this.securityDomainNames != null && !this.securityDomainNames.isEmpty()) {
return this.securityDomainNames.get(0);
}
//no default
return null;
}
示例12: setConnectionProperties
import org.teiid.adminapi.VDB; //导入依赖的package包/类
public static void setConnectionProperties(ConnectionImpl conn)
throws SQLException {
SessionMetadata sm = ((LocalServerConnection)conn.getServerConnection()).getWorkContext().getSession();
VDB vdb = sm.getVdb();
Properties p = vdb.getProperties();
setConnectionProperties(conn, p);
}
示例13: checkVDB
import org.teiid.adminapi.VDB; //导入依赖的package包/类
static VDBMetaData checkVDB(OperationContext context, String vdbName,
int vdbVersion) throws OperationFailedException {
ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(TeiidServiceNames.VDB_REPO);
VDBRepository repo = VDBRepository.class.cast(sc.getValue());
VDBMetaData vdb = repo.getLiveVDB(vdbName, vdbVersion);
if (vdb == null) {
throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50102, vdb, vdbVersion)));
}
Status status = vdb.getStatus();
if (status != VDB.Status.ACTIVE) {
throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50096, vdbName, vdbVersion, status)));
}
return vdb;
}
示例14: executeOperation
import org.teiid.adminapi.VDB; //导入依赖的package包/类
@Override
protected void executeOperation(OperationContext context, VDBRepository repo, ModelNode operation) throws OperationFailedException {
if (!operation.hasDefined(OperationsConstants.VDB_NAME.getName())) {
throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.VDB_NAME.getName()+MISSING)));
}
if (!operation.hasDefined(OperationsConstants.VDB_VERSION.getName())) {
throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.VDB_VERSION.getName()+MISSING)));
}
if (!operation.hasDefined(OperationsConstants.MODEL_NAME.getName())) {
throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.getString(OperationsConstants.MODEL_NAME.getName()+MISSING)));
}
ModelNode result = context.getResult();
String vdbName = operation.get(OperationsConstants.VDB_NAME.getName()).asString();
int vdbVersion = operation.get(OperationsConstants.VDB_VERSION.getName()).asInt();
String modelName = operation.get(OperationsConstants.MODEL_NAME.getName()).asString();
VDBMetaData vdb = repo.getLiveVDB(vdbName, vdbVersion);
if (vdb == null || (vdb.getStatus() != VDB.Status.ACTIVE)) {
throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50096, vdbName, vdbVersion)));
}
EnumSet<SchemaObjectType> schemaTypes = null;
if (vdb.getModel(modelName) == null){
throw new OperationFailedException(new ModelNode().set(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50097, vdbName, vdbVersion, modelName)));
}
if (operation.hasDefined(OperationsConstants.ENTITY_TYPE.getName())) {
String[] types = operation.get(OperationsConstants.ENTITY_TYPE.getName()).asString().toUpperCase().split(","); //$NON-NLS-1$
if (types.length > 0) {
ArrayList<SchemaObjectType> sot = new ArrayList<Admin.SchemaObjectType>();
for (int i = 1; i < types.length; i++) {
sot.add(SchemaObjectType.valueOf(types[i]));
}
schemaTypes = EnumSet.of(SchemaObjectType.valueOf(types[0]), sot.toArray(new SchemaObjectType[sot.size()]));
}
else {
schemaTypes = EnumSet.of(SchemaObjectType.valueOf(types[0]));
}
}
String regEx = null;
if (operation.hasDefined(OperationsConstants.ENTITY_PATTERN.getName())) {
regEx = operation.get(OperationsConstants.ENTITY_PATTERN.getName()).asString();
}
MetadataStore metadataStore = vdb.getAttachment(TransformationMetadata.class).getMetadataStore();
Schema schema = metadataStore.getSchema(modelName);
String ddl = DDLStringVisitor.getDDLString(schema, schemaTypes, regEx);
result.set(ddl);
}
示例15: vdbLoaded
import org.teiid.adminapi.VDB; //导入依赖的package包/类
/**
* VDB and all its metadata has been loaded and in ACTIVE state.
* @param vdb
*/
void vdbLoaded(VDB vdb);