Author: vhalbert(a)redhat.com
Date: 2010-07-14 12:18:49 -0400 (Wed, 14 Jul 2010)
New Revision: 2341
Modified:
trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminProvider.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
Log:
TEIID-1142 & TEIID-1055 These changes Teiid to work in a secured server (EAP 5.1)
and provide access to the profile service
Modified: trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-07-14
01:59:05 UTC (rev 2340)
+++ trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-07-14
16:18:49 UTC (rev 2341)
@@ -1,21 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <interceptor xmlns="urn:jboss:aop-beans:1.0" name="JndiAspect"
class="org.jboss.aop.microcontainer.aspects.jndi.JndiIntroduction">
- <property name="env">
- <map class="java.util.Properties"
keyClass="java.lang.String" valueClass="java.lang.String">
-
<entry><key>java.naming.factory.initial</key><value>org.jnp.interfaces.NamingContextFactory</value></entry>
- </map>
- </property>
- </interceptor>
-
- <introduction xmlns="urn:jboss:aop-beans:1.0"
class="(a)org.jboss.aop.microcontainer.aspects.jndi.JndiBinding">
-
<interfaces>org.jboss.kernel.spi.dependency.KernelControllerContextAware</interfaces>
- </introduction>
-
- <bind xmlns="urn:jboss:aop-beans:1.0" pointcut="execution(*
$instanceof{org.jboss.kernel.spi.dependency.KernelControllerContextAware}->$implements{org.jboss.kernel.spi.dependency.KernelControllerContextAware}(..))">
- <interceptor-ref name="JndiAspect"/>
- </bind>
<!-- Teiid Services -->
<bean name="SessionService"
class="org.teiid.services.SessionServiceImpl">
@@ -63,7 +47,8 @@
</bean>
<bean name="RuntimeEngineDeployer"
class="org.teiid.jboss.deployers.RuntimeEngineDeployer">
-
<annotation>@org.jboss.aop.microcontainer.aspects.jndi.JndiBinding(name="teiid/engine-deployer")</annotation>
+ <property name="jndiName">teiid/engine-deployer</property>
+ <property name="profileService"><inject
bean="ProfileService"/></property>
<property name="jdbcSocketConfiguration"><inject
bean="JdbcSocketConfiguration"/></property>
<property name="adminSocketConfiguration"><inject
bean="AdminSocketConfiguration"/></property>
<property name="workManager"><inject
bean="WorkManager"/></property>
Modified:
trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminProvider.java
===================================================================
---
trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminProvider.java 2010-07-14
01:59:05 UTC (rev 2340)
+++
trunk/jboss-integration/src/main/java/org/teiid/adminapi/jboss/AdminProvider.java 2010-07-14
16:18:49 UTC (rev 2341)
@@ -45,6 +45,11 @@
import org.teiid.adminapi.AdminComponentException;
public class AdminProvider {
+
+ public static Admin getLocal(final ProfileService profileService) {
+ ProfileConnection pc = new ProfileConnection(profileService);
+ return new Admin(pc.getManagementView(), pc.getDeploymentManager());
+ }
public static Admin getLocal() throws AdminComponentException {
ProfileConnection pc = new ProfileConnection();
@@ -89,9 +94,9 @@
private String password;
- public ProfileConnection() throws AdminComponentException {
- this.profileService = connect(null, null, null);
- }
+ public ProfileConnection(final ProfileService profileService) {
+ this.profileService = profileService;
+ }
public ProfileConnection(String providerURL, String user, String password) throws
AdminComponentException {
this.userName = user;
@@ -113,7 +118,7 @@
// local connection
if (providerURL == null) {
InitialContext ic = new InitialContext();
- return (ProfileService)ic.lookup(PROFILE_SERVICE_JNDI_NAME);
+ return (ProfileService)ic.lookup(PROFILE_SERVICE_JNDI_NAME);
}
Properties env = new Properties();
Modified:
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
---
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-07-14
01:59:05 UTC (rev 2340)
+++
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-07-14
16:18:49 UTC (rev 2341)
@@ -30,6 +30,8 @@
import java.util.Date;
import java.util.List;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import javax.resource.spi.XATerminator;
import javax.resource.spi.work.WorkManager;
import javax.transaction.TransactionManager;
@@ -42,6 +44,8 @@
import org.jboss.managed.api.annotation.ManagementProperties;
import org.jboss.managed.api.annotation.ManagementProperty;
import org.jboss.managed.api.annotation.ViewUse;
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.util.naming.Util;
import org.teiid.adminapi.Admin;
import org.teiid.adminapi.AdminComponentException;
import org.teiid.adminapi.AdminException;
@@ -96,6 +100,9 @@
private transient ClientServiceRegistryImpl csr = new ClientServiceRegistryImpl();
private transient VDBRepository vdbRepository;
+ private transient ProfileService profileService;
+ private transient String jndiName;
+
public RuntimeEngineDeployer() {
// TODO: this does not belong here
LogManager.setLogListener(new Log4jListener());
@@ -136,9 +143,27 @@
LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("socket_not_enabled", "admin
connections")); //$NON-NLS-1$ //$NON-NLS-2$
}
LogManager.logInfo(LogConstants.CTX_RUNTIME,
IntegrationPlugin.Util.getString("engine_started", new
Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
+ if (jndiName != null) {
+ final InitialContext ic ;
+ try {
+ ic = new InitialContext() ;
+ Util.bind(ic, jndiName, this) ;
+ } catch (final NamingException ne) {
+ // Add jndi_failed to bundle
+ LogManager.logError(LogConstants.CTX_RUNTIME, ne,
IntegrationPlugin.Util.getString("jndi_failed", new
Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
+ }
+ }
}
public void stop() {
+ if (jndiName != null) {
+ final InitialContext ic ;
+ try {
+ ic = new InitialContext() ;
+ Util.unbind(ic, jndiName) ;
+ } catch (final NamingException ne) {
+ }
+ }
try {
this.dqpCore.stop();
@@ -164,11 +189,15 @@
this.dqpCore.start(this);
this.logon = new LogonImpl(this.sessionService, "teiid-cluster");
//$NON-NLS-1$
- try {
- this.admin = AdminProvider.getLocal();
- } catch (AdminComponentException e) {
- throw new TeiidRuntimeException(e.getCause());
- }
+ if (profileService != null) {
+ this.admin = AdminProvider.getLocal(profileService);
+ } else {
+ try {
+ this.admin = AdminProvider.getLocal();
+ } catch (AdminComponentException e) {
+ throw new TeiidRuntimeException(e.getCause());
+ }
+ }
}
/**
@@ -234,6 +263,14 @@
this.vdbRepository = repo;
}
+ public void setProfileService(final ProfileService profileService) {
+ this.profileService = profileService ;
+ }
+
+ public void setJndiName(final String jndiName) {
+ this.jndiName = jndiName ;
+ }
+
@Override
@ManagementOperation(description="Requests for perticular session",
impact=Impact.ReadOnly,params={@ManagementParameter(name="sessionId",description="The
session Identifier")})
public List<RequestMetadata> getRequestsForSession(String sessionId) {
Show replies by date