use of org.teiid.jboss.TeiidServiceNames.InvalidServiceNameException in project teiid by teiid.
the class EngineStatistics method updateServices.
static void updateServices(OperationContext context, RuntimeVDB vdb, String dsName, ReplaceResult rr) {
if (rr.isNew) {
VDBDeployer.addDataSourceListener(context.getServiceTarget(), new VDBKey(vdb.getVdb().getName(), vdb.getVdb().getVersion()), dsName);
}
if (rr.removedDs != null) {
final ServiceRegistry registry = context.getServiceRegistry(true);
ServiceName serviceName;
try {
serviceName = TeiidServiceNames.dsListenerServiceName(vdb.getVdb().getName(), vdb.getVdb().getVersion(), rr.removedDs);
} catch (InvalidServiceNameException e) {
// the old isn't valid
return;
}
final ServiceController<?> controller = registry.getService(serviceName);
if (controller != null) {
context.removeService(serviceName);
}
}
}
use of org.teiid.jboss.TeiidServiceNames.InvalidServiceNameException in project teiid by teiid.
the class VDBDeployer method undeploy.
@Override
public void undeploy(final DeploymentUnit deploymentUnit) {
if (!TeiidAttachments.isVDBDeployment(deploymentUnit)) {
return;
}
final VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
if (!this.shutdownListener.isShutdownInProgress()) {
final VDBMetaData vdb = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
ServiceController<?> sc = deploymentUnit.getServiceRegistry().getService(TeiidServiceNames.OBJECT_SERIALIZER);
if (sc != null) {
ObjectSerializer serilalizer = ObjectSerializer.class.cast(sc.getValue());
serilalizer.removeAttachments(vdb);
// $NON-NLS-1$ //$NON-NLS-2$
LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB " + vdb.getName() + " metadata removed");
}
}
this.vdbRepository.removeVDB(deployment.getName(), deployment.getVersion());
ServiceController<?> switchSvc = deploymentUnit.getServiceRegistry().getService(TeiidServiceNames.vdbSwitchServiceName(deployment.getName(), deployment.getVersion()));
if (switchSvc != null) {
switchSvc.setMode(ServiceController.Mode.REMOVE);
}
for (ModelMetaData model : deployment.getModelMetaDatas().values()) {
for (SourceMappingMetadata smm : model.getSources().values()) {
String dsName = smm.getConnectionJndiName();
if (dsName == null) {
continue;
}
ServiceController<?> dsService;
try {
dsService = deploymentUnit.getServiceRegistry().getService(TeiidServiceNames.dsListenerServiceName(deployment.getName(), deployment.getVersion(), dsName));
} catch (InvalidServiceNameException e) {
continue;
}
if (dsService != null) {
dsService.setMode(ServiceController.Mode.REMOVE);
}
}
}
final ServiceController<?> controller = deploymentUnit.getServiceRegistry().getService(TeiidServiceNames.vdbServiceName(deployment.getName(), deployment.getVersion()));
if (controller != null) {
controller.setMode(ServiceController.Mode.REMOVE);
}
}
Aggregations