-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TEIIDDES-1518: Moves the teiid client classes to teiid 8 plugin
* Refactors ExecutionAdmin et al to the teiid 8 plugin * Refactors the teiid server adapters and factories as a consequence of the move * Adds the teiidRuntimeClient extension point for loose coupling of the TeiidServer class to ExecutionAdmin class
- Loading branch information
Paul Richardson
committed
Dec 7, 2012
1 parent
94ca2b3
commit 948f494
Showing
46 changed files
with
1,409 additions
and
438 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
143 changes: 143 additions & 0 deletions
143
plugins/org.teiid.designer.dqp/src/org/teiid/designer/runtime/TeiidServerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* | ||
* See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing. | ||
* | ||
* See the AUTHORS.txt file distributed with this work for a full listing of individual contributors. | ||
*/ | ||
package org.teiid.designer.runtime; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import org.eclipse.wst.server.core.IServer; | ||
import org.teiid.designer.runtime.spi.ITeiidAdminInfo; | ||
import org.teiid.designer.runtime.spi.ITeiidJdbcInfo; | ||
import org.teiid.designer.runtime.spi.ITeiidServer; | ||
import org.teiid.designer.runtime.version.spi.ITeiidServerVersion; | ||
|
||
/** | ||
* @since 8.0 | ||
*/ | ||
public class TeiidServerFactory { | ||
|
||
/** | ||
* Determine whether the {@link ITeiidServer} should be added | ||
* to the {@link TeiidServerManager} after it is created and whether | ||
* it should be connected. | ||
*/ | ||
public enum ServerOptions { | ||
/** | ||
* Add the {@link ITeiidServer} to the {@link TeiidServerManager} | ||
*/ | ||
ADD_TO_REGISTRY, | ||
|
||
/** | ||
* Connect the client to the teiid server | ||
*/ | ||
CONNECT, | ||
|
||
/** | ||
* Do NOT query the {@link TeiidServerManager}'s registry for an existing | ||
* {@link ITeiidServer} | ||
*/ | ||
NO_CHECK_SERVER_REGISTRY, | ||
|
||
|
||
/** | ||
* Do NOT query whether the parent {@link IServer} is connected | ||
*/ | ||
NO_CHECK_CONNECTION | ||
} | ||
|
||
/** | ||
* @param teiidServer | ||
* @param serverManager | ||
* @param options | ||
*/ | ||
private void processOptions(ITeiidServer teiidServer, TeiidServerManager serverManager, ServerOptions[] options) { | ||
List<ServerOptions> optionList = Collections.emptyList(); | ||
if (options != null) | ||
optionList = Arrays.asList(options); | ||
|
||
if (optionList.contains(ServerOptions.CONNECT)) { | ||
// Connect this teiid server | ||
try { | ||
teiidServer.connect(); | ||
} catch (Exception ex) { | ||
DqpPlugin.Util.log(ex); | ||
} | ||
} | ||
|
||
if (optionList.contains(ServerOptions.ADD_TO_REGISTRY)) { | ||
serverManager.addServer(teiidServer); | ||
} | ||
} | ||
|
||
/** | ||
* @param serverVersion | ||
* @param serverManager | ||
* @param parentServer | ||
* @param adminPort | ||
* @param adminUserName | ||
* @param adminPassword | ||
* @param jdbcPort | ||
* @param jdbcUserName | ||
* @param jdbcPassword | ||
* @param options | ||
* | ||
* @return new {@link ITeiidServer} | ||
*/ | ||
public ITeiidServer createTeiidServer(ITeiidServerVersion serverVersion, | ||
TeiidServerManager serverManager, | ||
IServer parentServer, | ||
String adminPort, | ||
String adminUserName, | ||
String adminPassword, | ||
String jdbcPort, | ||
String jdbcUserName, | ||
String jdbcPassword, | ||
ServerOptions... options) { | ||
|
||
ITeiidAdminInfo teiidAdminInfo = new TeiidAdminInfo(adminPort, | ||
adminUserName, | ||
serverManager.getSecureStorageProvider(), | ||
adminPassword, | ||
false); | ||
|
||
ITeiidJdbcInfo teiidJdbcInfo = new TeiidJdbcInfo(jdbcPort, | ||
jdbcUserName, | ||
serverManager.getSecureStorageProvider(), | ||
jdbcPassword, | ||
false); | ||
|
||
ITeiidServer teiidServer = new TeiidServer(serverVersion, teiidAdminInfo, teiidJdbcInfo, serverManager, parentServer); | ||
|
||
processOptions(teiidServer, serverManager, options); | ||
|
||
return teiidServer; | ||
} | ||
|
||
/** | ||
* @param serverVersion | ||
* @param teiidAdminInfo | ||
* @param teiidJdbcInfo | ||
* @param serverManager | ||
* @param parentServer | ||
* @param options | ||
* | ||
* @return | ||
*/ | ||
public ITeiidServer createTeiidServer(ITeiidServerVersion serverVersion, | ||
ITeiidAdminInfo teiidAdminInfo, | ||
ITeiidJdbcInfo teiidJdbcInfo, | ||
TeiidServerManager serverManager, | ||
IServer parentServer, | ||
ServerOptions... options) { | ||
|
||
ITeiidServer teiidServer = new TeiidServer(serverVersion, teiidAdminInfo, teiidJdbcInfo, serverManager, parentServer); | ||
processOptions(teiidServer, serverManager, options); | ||
|
||
return teiidServer; | ||
} | ||
} |
Oops, something went wrong.