Author: shawkins
Date: 2009-05-19 22:53:44 -0400 (Tue, 19 May 2009)
New Revision: 985
Added:
trunk/engine/src/main/java/com/metamatrix/common/application/AbstractClassLoaderManager.java
trunk/engine/src/main/java/com/metamatrix/common/application/ClassLoaderManager.java
Modified:
trunk/build/assembly/embedded/build-configuration.xml
trunk/build/assembly/embedded/embedded-dist.xml
trunk/build/kit-embedded/examples/portfolio/run.bat
trunk/build/kit-embedded/examples/portfolio/run.sh
trunk/build/pom.xml
trunk/common-core/src/main/java/com/metamatrix/common/classloader/URLFilteringClassLoader.java
trunk/connector-api/src/main/java/org/teiid/connector/internal/ConnectorPropertyNames.java
trunk/connector-api/src/main/resources/connector-base.xml
trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml
trunk/connectors/connector-ldap/src/main/resources/connector-ldap.xml
trunk/connectors/connector-loopback/src/main/resources/connector-loopback.xml
trunk/connectors/connector-salesforce/src/main/resources/connector-salesforce.xml
trunk/connectors/connector-text/src/main/resources/connector-text.xml
trunk/connectors/connector-xml/src/main/resources/connector-xml.xml
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleReader.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedConfigurationService.java
trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
trunk/server/src/main/java/com/metamatrix/common/extensionmodule/protocol/URLFactory.java
trunk/server/src/main/java/com/metamatrix/platform/service/api/ServiceInterface.java
trunk/server/src/main/java/com/metamatrix/platform/service/controller/AbstractService.java
trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java
trunk/server/src/main/java/com/metamatrix/server/connector/service/ConnectorService.java
trunk/server/src/main/java/com/metamatrix/server/query/service/QueryService.java
trunk/server/src/test/java/com/metamatrix/admin/server/FakeCacheAdmin.java
trunk/server/src/test/java/com/metamatrix/admin/server/FakeConfigurationService.java
trunk/server/src/test/java/com/metamatrix/admin/server/FakeQueryService.java
trunk/server/src/test/java/com/metamatrix/admin/server/FakeServerSessionService.java
trunk/server/src/test/java/com/metamatrix/platform/service/controller/FakeService.java
Log:
TEIID-600 TEIID-615 further refining connector dependency handling, also adding filtering
to add version info to the example scripts
Modified: trunk/build/assembly/embedded/build-configuration.xml
===================================================================
--- trunk/build/assembly/embedded/build-configuration.xml 2009-05-20 02:07:14 UTC (rev
984)
+++ trunk/build/assembly/embedded/build-configuration.xml 2009-05-20 02:53:44 UTC (rev
985)
@@ -18,17 +18,10 @@
</unzip>
<move todir="${kit.dir}/extensions">
<fileset dir="${extensions.dir}/unzipped">
- <exclude name="**/connector-*.jar"/>
- <exclude name="**/*.xml"/>
+ <include name="**/*.jar"/>
</fileset>
</move>
-
- <move todir="${kit.dir}/lib">
- <fileset dir="${extensions.dir}/unzipped">
- <include name="**/connector-*.jar"/>
- </fileset>
- </move>
-
+
<!-- add all the cdk files, and then add the combined fragment to the config.xml
-->
<concat destfile="${extensions.dir}/unzipped/all-cdks.xml">
<fileset dir="${extensions.dir}/unzipped"
includes="connector-*.xml"/>
Modified: trunk/build/assembly/embedded/embedded-dist.xml
===================================================================
--- trunk/build/assembly/embedded/embedded-dist.xml 2009-05-20 02:07:14 UTC (rev 984)
+++ trunk/build/assembly/embedded/embedded-dist.xml 2009-05-20 02:53:44 UTC (rev 985)
@@ -11,18 +11,10 @@
<baseDirectory>teiid-embedded-${version}</baseDirectory>
<fileSets>
-
+
<fileSet>
<directory>target/distribution</directory>
<includes>
- <include>teiid-${version}-embedded.jar</include>
- </includes>
- <outputDirectory>lib</outputDirectory>
- </fileSet>
-
- <fileSet>
- <directory>target/distribution</directory>
- <includes>
<include>teiid-${version}-client.jar</include>
</includes>
<outputDirectory>/</outputDirectory>
@@ -48,10 +40,19 @@
<directory>build/target/kit-embedded</directory>
<outputDirectory>/</outputDirectory>
<excludes>
- <exclude>**/*.foo</exclude>
+ <exclude>**/run.*</exclude>
</excludes>
- </fileSet>
+ </fileSet>
+
+ <fileSet>
+ <directory>build/target/kit-embedded</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>**/run.*</include>
+ </includes>
+ <filtered>true</filtered>
+ </fileSet>
+
</fileSets>
-
</assembly>
\ No newline at end of file
Modified: trunk/build/kit-embedded/examples/portfolio/run.bat
===================================================================
--- trunk/build/kit-embedded/examples/portfolio/run.bat 2009-05-20 02:07:14 UTC (rev 984)
+++ trunk/build/kit-embedded/examples/portfolio/run.bat 2009-05-20 02:53:44 UTC (rev 985)
@@ -2,7 +2,7 @@
set CLIENT_PATH=java/*;PortfolioModel/
rem Second one for the JARs in Teiid embedded
-set TEIID_PATH=../../teiid-6.0.0-client.jar;../../deploy;../../lib/*;../../extensions/*
+set
TEIID_PATH=../../teiid-${pom.version}-client.jar;../../deploy;../../lib/*;../../extensions/*
java -cp %CLIENT_PATH%;%TEIID_PATH% JDBCClient "select * from CustomerAccount"
Modified: trunk/build/kit-embedded/examples/portfolio/run.sh
===================================================================
--- trunk/build/kit-embedded/examples/portfolio/run.sh 2009-05-20 02:07:14 UTC (rev 984)
+++ trunk/build/kit-embedded/examples/portfolio/run.sh 2009-05-20 02:53:44 UTC (rev 985)
@@ -4,6 +4,6 @@
CLIENT_PATH=java/*:PortfolioModel/
#Second one for the JARs in Teiid embedded
-TEIID_PATH=../../teiid-6.0.0-client.jar:../../deploy:../../lib/*:../../extensions/*
+TEIID_PATH=../../teiid-${pom.version}-client.jar:../../deploy:../../lib/*:../../extensions/*
java -cp ${CLIENT_PATH}:${TEIID_PATH} JDBCClient "select * from
CustomerAccount"
Modified: trunk/build/pom.xml
===================================================================
--- trunk/build/pom.xml 2009-05-20 02:07:14 UTC (rev 984)
+++ trunk/build/pom.xml 2009-05-20 02:53:44 UTC (rev 985)
@@ -10,10 +10,6 @@
<packaging>pom</packaging>
<name>Build</name>
<description>Teiid Build</description>
- <properties>
- <org.jboss.teiid.version>6.1.0-SNAPSHOT</org.jboss.teiid.version>
- </properties>
-
<build>
<plugins>
<plugin>
@@ -32,7 +28,7 @@
<artifactItem>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-connector-api</artifactId>
-
<version>${org.jboss.teiid.version}</version>
+ <version>${pom.version}</version>
<classifier>bundle</classifier>
<type>zip</type>
<overWrite>true</overWrite>
@@ -40,7 +36,7 @@
<artifactItem>
<groupId>org.jboss.teiid.connectors</groupId>
<artifactId>connector-xml</artifactId>
-
<version>${org.jboss.teiid.version}</version>
+ <version>${pom.version}</version>
<classifier>bundle</classifier>
<type>zip</type>
<overWrite>true</overWrite>
@@ -48,7 +44,7 @@
<artifactItem>
<groupId>org.jboss.teiid.connectors</groupId>
<artifactId>connector-xml-common</artifactId>
-
<version>${org.jboss.teiid.version}</version>
+ <version>${pom.version}</version>
<classifier>bundle</classifier>
<type>zip</type>
<overWrite>true</overWrite>
@@ -56,7 +52,7 @@
<artifactItem>
<groupId>org.jboss.teiid.connectors</groupId>
<artifactId>connector-jdbc</artifactId>
-
<version>${org.jboss.teiid.version}</version>
+ <version>${pom.version}</version>
<classifier>bundle</classifier>
<type>zip</type>
<overWrite>true</overWrite>
@@ -64,7 +60,7 @@
<artifactItem>
<groupId>org.jboss.teiid.connectors</groupId>
<artifactId>connector-text</artifactId>
-
<version>${org.jboss.teiid.version}</version>
+ <version>${pom.version}</version>
<classifier>bundle</classifier>
<type>zip</type>
<overWrite>true</overWrite>
@@ -72,7 +68,7 @@
<artifactItem>
<groupId>org.jboss.teiid.connectors</groupId>
<artifactId>connector-ldap</artifactId>
-
<version>${org.jboss.teiid.version}</version>
+ <version>${pom.version}</version>
<classifier>bundle</classifier>
<type>zip</type>
<overWrite>true</overWrite>
@@ -80,7 +76,7 @@
<artifactItem>
<groupId>org.jboss.teiid.connectors</groupId>
<artifactId>connector-loopback</artifactId>
-
<version>${org.jboss.teiid.version}</version>
+ <version>${pom.version}</version>
<classifier>bundle</classifier>
<type>zip</type>
<overWrite>true</overWrite>
@@ -88,7 +84,7 @@
<artifactItem>
<groupId>org.jboss.teiid.connectors</groupId>
<artifactId>connector-salesforce</artifactId>
-
<version>${org.jboss.teiid.version}</version>
+ <version>${pom.version}</version>
<classifier>bundle</classifier>
<type>zip</type>
<overWrite>true</overWrite>
Modified:
trunk/common-core/src/main/java/com/metamatrix/common/classloader/URLFilteringClassLoader.java
===================================================================
---
trunk/common-core/src/main/java/com/metamatrix/common/classloader/URLFilteringClassLoader.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/common-core/src/main/java/com/metamatrix/common/classloader/URLFilteringClassLoader.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -91,5 +91,10 @@
}
return temp.toArray(new URL[temp.size()]);
}
+
+ @Override
+ public void addURL(URL url) {
+ super.addURL(url);
+ }
}
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/internal/ConnectorPropertyNames.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/internal/ConnectorPropertyNames.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/connector-api/src/main/java/org/teiid/connector/internal/ConnectorPropertyNames.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -108,5 +108,7 @@
* is about to be executed by a non-XA compatible connector, but there is a global
transaction.
*/
public static final String IS_IMMUTABLE = "Immutable"; //$NON-NLS-1$
+
+ public static final String USE_POST_DELEGATION = "UsePostDelegation";
//$NON-NLS-1$
}
Modified: trunk/connector-api/src/main/resources/connector-base.xml
===================================================================
--- trunk/connector-api/src/main/resources/connector-base.xml 2009-05-20 02:07:14 UTC (rev
984)
+++ trunk/connector-api/src/main/resources/connector-base.xml 2009-05-20 02:53:44 UTC (rev
985)
@@ -2,6 +2,7 @@
<PropertyDefinition Name="SourceConnectionTestInterval"
DisplayName="Data Source Test Connect Interval (seconds)"
ShortDescription="How often (in seconds) to create test connections to the underlying
datasource to see if it is available." DefaultValue="600"
Multiplicity="1" PropertyType="Integer" IsExpert="true"
/>
<PropertyDefinition Name="ConnectorClassPath"
DisplayName="Class Path" ShortDescription=""
Multiplicity="0..1" IsPreferred="true" />
<PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system)" Multiplicity="0..1"
IsExpert="true" IsHidden="true" />
+ <PropertyDefinition Name="UsePostDelegation"
DisplayName="Use Separate Classloader" ShortDescription="Set to true to
indicate that the connector classpath and connector type classpath entries should be
loaded by a connector specific post-delegation class loader."
PropertyType="Boolean" Multiplicity="1" IsExpert="true"
DefaultValue="false"/>
<PropertyDefinition Name="ExceptionOnMaxRows"
DisplayName="Exception on Exceeding Max Rows" ShortDescription="Indicates
if an Exception should be thrown if the specified value for Maximum Result Rows is
exceeded; else no exception and no more than the maximum will be returned"
DefaultValue="true" Multiplicity="1" PropertyType="Boolean"
IsExpert="true" />
<PropertyDefinition Name="metamatrix.service.essentialservice"
DisplayName="Essential Service" ShortDescription="Indicates if the service
is essential to operation of the Integration Server" DefaultValue="false"
Multiplicity="1" PropertyType="Boolean" IsExpert="true"
IsHidden="true" />
<PropertyDefinition Name="ServiceMonitoringEnabled"
DisplayName="Data Source Monitoring Enabled" ShortDescription="Whether to
monitor the underlying data source to see if it is available."
DefaultValue="true" Multiplicity="1" PropertyType="Boolean"
IsExpert="true" />
Modified: trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml
===================================================================
--- trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml 2009-05-20
02:07:14 UTC (rev 984)
+++ trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml 2009-05-20
02:53:44 UTC (rev 985)
@@ -1,6 +1,6 @@
<ComponentType Name="JDBC Connector" ComponentTypeCode="2"
Deployable="true" Deprecated="false" Monitorable="false"
SuperComponentType="Connector" ParentComponentType="Connectors"
LastChangedBy="ConfigurationStartup"
LastChangedDate="2008-10-31T10:26:19.952-06:00"
CreatedBy="ConfigurationStartup"
CreationDate="2008-10-31T10:26:19.952-06:00">
- <PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system, do not modify)" DefaultValue="${classpath}"
Multiplicity="0..1" IsExpert="true" IsModifiable="false"
IsHidden="true" />
- <PropertyDefinition Name="UseBindVariables"
DisplayName="Use prepared statements and bind variables"
ShortDescription="" DefaultValue="false"
PropertyType="Boolean" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system, do not modify)"
DefaultValue="extensionjar:connector_patch.jar;extensionjar:${project.artifactId}-${project.version}.jar;${classpath}"
Multiplicity="0..1" IsExpert="true" IsModifiable="false"
IsHidden="true" />
+ <PropertyDefinition Name="UseBindVariables" DisplayName="Use
prepared statements and bind variables" ShortDescription=""
DefaultValue="false" PropertyType="Boolean" IsExpert="true"
/>
<PropertyDefinition Name="ExtensionCapabilityClass"
DisplayName="Extension Capability Class" ShortDescription=""
IsExpert="true" />
<PropertyDefinition Name="ConnectorClass"
DisplayName="Connector Class" ShortDescription=""
DefaultValue="org.teiid.connector.jdbc.JDBCConnector" Multiplicity="1"
IsExpert="true" />
<PropertyDefinition Name="DatabaseTimeZone"
DisplayName="Database time zone" ShortDescription="Time zone of the
database, if different than Integration Server" IsExpert="true" />
Modified: trunk/connectors/connector-ldap/src/main/resources/connector-ldap.xml
===================================================================
--- trunk/connectors/connector-ldap/src/main/resources/connector-ldap.xml 2009-05-20
02:07:14 UTC (rev 984)
+++ trunk/connectors/connector-ldap/src/main/resources/connector-ldap.xml 2009-05-20
02:53:44 UTC (rev 985)
@@ -1,7 +1,7 @@
<ComponentType Name="LDAP Connector" ComponentTypeCode="2"
Deployable="true" Deprecated="false" Monitorable="false"
SuperComponentType="Connector" ParentComponentType="Connectors"
LastChangedBy="ConfigurationStartup"
LastChangedDate="2008-10-31T10:26:19.946-06:00"
CreatedBy="ConfigurationStartup"
CreationDate="2008-10-31T10:26:19.946-06:00">
<PropertyDefinition Name="ConnectorClassPath"
DisplayName="Class Path" ShortDescription=""
Multiplicity="0..1" IsPreferred="true"/>
- <PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system, do not modify)" DefaultValue="${classpath}"
Multiplicity="0..1" IsExpert="true" IsModifiable="false"
IsHidden="true" />
- <PropertyDefinition Name="SearchDefaultBaseDN"
DisplayName="Default Search Base DN" ShortDescription="Default Base DN for
LDAP Searches" IsExpert="true" />
+ <PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system, do not modify)"
DefaultValue="extensionjar:connector_patch.jar;extensionjar:${project.artifactId}-${project.version}.jar;${classpath}"
Multiplicity="0..1" IsExpert="true" IsModifiable="false"
IsHidden="true" />
+ <PropertyDefinition Name="SearchDefaultBaseDN" DisplayName="Default
Search Base DN" ShortDescription="Default Base DN for LDAP Searches"
IsExpert="true" />
<PropertyDefinition Name="LdapAdminUserDN"
DisplayName="Ldap Admin User DN" ShortDescription="User DN for the LDAP
admin account."
DefaultValue="cn=<>,ou=<>,dc=<>"
Multiplicity="1" IsPreferred="true" />
<PropertyDefinition Name="Standard" DisplayName="Standard
Type" ShortDescription="Standard Built-in Connector Type"
DefaultValue="true" PropertyType="Boolean" IsExpert="true"
IsModifiable="false" />
<PropertyDefinition Name="ConnectorClass"
DisplayName="Connector Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.ldap.LDAPConnector"
Multiplicity="1" IsExpert="true" />
Modified: trunk/connectors/connector-loopback/src/main/resources/connector-loopback.xml
===================================================================
---
trunk/connectors/connector-loopback/src/main/resources/connector-loopback.xml 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/connectors/connector-loopback/src/main/resources/connector-loopback.xml 2009-05-20
02:53:44 UTC (rev 985)
@@ -1,5 +1,5 @@
<ComponentType Name="Loopback Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
LastChangedDate="2008-10-31T10:26:19.945-06:00"
CreatedBy="ConfigurationStartup"
CreationDate="2008-10-31T10:26:19.945-06:00">
- <PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system, do not modify)" DefaultValue="${classpath}"
Multiplicity="0..1" IsExpert="true" IsModifiable="false"
IsHidden="true" />
+ <PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system, do not modify)"
DefaultValue="extensionjar:connector_patch.jar;extensionjar:${project.artifactId}-${project.version}.jar;${classpath}"
Multiplicity="0..1" IsExpert="true" IsModifiable="false"
IsHidden="true" />
<PropertyDefinition Name="CapabilitiesClass"
DisplayName="Capabilities Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.loopback.LoopbackCapabilities"
Multiplicity="1" IsExpert="true" />
<PropertyDefinition Name="WaitTime" DisplayName="Max Random
Wait Time" ShortDescription="" DefaultValue="0"
Multiplicity="1" IsExpert="true" />
<PropertyDefinition Name="ConnectorClass"
DisplayName="Connector Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.loopback.LoopbackConnector"
Multiplicity="1" IsExpert="true" />
Modified:
trunk/connectors/connector-salesforce/src/main/resources/connector-salesforce.xml
===================================================================
---
trunk/connectors/connector-salesforce/src/main/resources/connector-salesforce.xml 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/connectors/connector-salesforce/src/main/resources/connector-salesforce.xml 2009-05-20
02:53:44 UTC (rev 985)
@@ -1,6 +1,7 @@
<ComponentType Name="Salesforce Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="Connector"
ParentComponentType="Connectors"
LastChangedDate="2008-10-31T10:26:19.916-06:00"
CreationDate="2008-10-31T10:26:19.916-06:00">
<PropertyDefinition Name="ConnectorClassPath"
DisplayName="Class Path" ShortDescription=""
Multiplicity="0..1" IsPreferred="true"/>
<PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system, do not modify)" DefaultValue="${classpath}"
Multiplicity="0..1" IsExpert="true" IsModifiable="false"
IsHidden="true" />
+ <PropertyDefinition Name="UsePostDelegation"
DisplayName="Use Separate Classloader" ShortDescription="Set to true to
indicate that the connector classpath and connector type classpath entries should be
loaded by a connector specific post-delegation class loader."
PropertyType="Boolean" Multiplicity="1" IsExpert="true"
DefaultValue="true"/>
<PropertyDefinition Name="username" DisplayName="User
Name" ShortDescription="Name value for Salesforce authentication"
DefaultValue="" Multiplicity="1" IsPreferred="true" />
<PropertyDefinition Name="ConnectorStateClass"
DisplayName="Connector State Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.salesforce.ConnectorState"
Multiplicity="1" IsExpert="true" />
<PropertyDefinition Name="ConnectorClass"
DisplayName="Connector Class" ShortDescription=""
DefaultValue="com.metamatrix.connector.salesforce.Connector"
Multiplicity="1" IsExpert="true" />
Modified: trunk/connectors/connector-text/src/main/resources/connector-text.xml
===================================================================
--- trunk/connectors/connector-text/src/main/resources/connector-text.xml 2009-05-20
02:07:14 UTC (rev 984)
+++ trunk/connectors/connector-text/src/main/resources/connector-text.xml 2009-05-20
02:53:44 UTC (rev 985)
@@ -1,6 +1,6 @@
<ComponentType Name="Text File Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="Connector"
ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup"
LastChangedDate="2008-10-31T10:26:19.945-06:00"
CreatedBy="ConfigurationStartup"
CreationDate="2008-10-31T10:26:19.945-06:00">
<PropertyDefinition Name="ConnectorClassPath"
DisplayName="Class Path" ShortDescription=""
Multiplicity="0..1" IsPreferred="true"/>
- <PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system, do not modify)" DefaultValue="${classpath}"
Multiplicity="0..1" IsExpert="true" IsModifiable="false"
IsHidden="true"/>
+ <PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system, do not modify)"
DefaultValue="extensionjar:connector_patch.jar;extensionjar:${project.artifactId}-${project.version}.jar;${classpath}"
Multiplicity="0..1" IsExpert="true" IsModifiable="false"
IsHidden="true" />
<PropertyDefinition Name="PartialStartupAllowed"
DisplayName="Partial Startup Allowed" ShortDescription=""
DefaultValue="true" Multiplicity="1" PropertyType="Boolean"
IsExpert="true" IsPreferred="true" />
<PropertyDefinition Name="Standard" DisplayName="Standard
Type" ShortDescription="Standard Built-in Connector Type"
DefaultValue="true" PropertyType="Boolean" IsExpert="true"
IsModifiable="false" />
<PropertyDefinition Name="DescriptorFile" DisplayName="Text
File Descriptor" ShortDescription="" Multiplicity="1"
IsPreferred="true" />
Modified: trunk/connectors/connector-xml/src/main/resources/connector-xml.xml
===================================================================
--- trunk/connectors/connector-xml/src/main/resources/connector-xml.xml 2009-05-20
02:07:14 UTC (rev 984)
+++ trunk/connectors/connector-xml/src/main/resources/connector-xml.xml 2009-05-20
02:53:44 UTC (rev 985)
@@ -1,6 +1,7 @@
<ComponentType Name="XML Connector" ComponentTypeCode="2"
Deployable="true" Deprecated="false" Monitorable="false"
SuperComponentType="Connector" ParentComponentType="Connectors"
LastChangedDate="2008-10-31T10:26:19.917-06:00"
CreationDate="2008-10-31T10:26:19.917-06:00">
<PropertyDefinition Name="ConnectorClassPath"
DisplayName="Class Path" ShortDescription=""
Multiplicity="0..1" IsPreferred="true"/>
<PropertyDefinition Name="ConnectorTypeClassPath"
DisplayName="Connector Type Class Path" ShortDescription="Connector Type
classpath (defined by system, do not modify)" DefaultValue="${classpath}"
Multiplicity="0..1" IsExpert="true" IsModifiable="false"
IsHidden="true"/>
+ <PropertyDefinition Name="UsePostDelegation"
DisplayName="Use Separate Classloader" ShortDescription="Set to true to
indicate that the connector classpath and connector type classpath entries should be
loaded by a connector specific post-delegation class loader."
PropertyType="Boolean" Multiplicity="1" IsExpert="true"
DefaultValue="true"/>
</ComponentType>
<ComponentType Name="XML File Connector"
ComponentTypeCode="2" Deployable="true" Deprecated="false"
Monitorable="false" SuperComponentType="XML Connector"
ParentComponentType="Connectors"
LastChangedDate="2008-10-31T10:26:19.917-06:00"
CreationDate="2008-10-31T10:26:19.917-06:00">
Modified:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleReader.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleReader.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleReader.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -29,11 +29,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.config.api.ExtensionModule;
@@ -126,32 +122,7 @@
return extModuleList;
}
- /**
- * Convert the extension path into URLS
- * @param extClassPath -
- * ClassPath String for the extension
- * classpath
Example:extensionjar:jdbcconn.jar;extensionjar:MJjdbc.jar;file://E/mydir/my.jar
- * @param context - dqp.extensions directory path used for finding the context URL
- * @return URL[] array of URLs
- * @throws MalformedURLException
- * @since 4.3
- */
- public static Set<URL> resolveExtensionClasspath(String extClassPath, URL[]
contexts)
- throws IOException {
-
- Set<URL> urls = new LinkedHashSet<URL>();
- StringTokenizer st = new StringTokenizer(extClassPath, ";");
//$NON-NLS-1$
- while (st.hasMoreTokens()) {
- String extModule = st.nextToken();
- URL entry = resolveExtensionModule(extModule, contexts);
- if (entry != null) {
- urls.add(entry);
- }
- }
- return urls;
- }
-
- public static URL resolveExtensionModule(String extModule, URL[] contexts) throws
IOException {
+ public static URL resolveExtensionModule(String extModule, URL[] contexts) throws
MalformedURLException {
int idx = extModule.indexOf(MM_JAR_PROTOCOL);
if (idx != -1) {
for (URL context : contexts) {
Modified:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -38,9 +38,8 @@
import java.util.Set;
import java.util.StringTokenizer;
-import org.teiid.connector.internal.ConnectorPropertyNames;
-
import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.common.application.AbstractClassLoaderManager;
import com.metamatrix.common.application.ApplicationEnvironment;
import com.metamatrix.common.application.exception.ApplicationInitializationException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
@@ -91,7 +90,7 @@
* - Onlu used get, save, delete of any configuration on public api
* @since 4.3
*/
-public class EmbeddedConfigurationService extends EmbeddedBaseDQPService implements
ConfigurationService{
+public class EmbeddedConfigurationService extends EmbeddedBaseDQPService implements
ConfigurationService {
private static final String VDB_LIST_SEPARATOR = ";"; //$NON-NLS-1$
private static final String VDB = ".vdb"; //$NON-NLS-1$
@@ -111,6 +110,19 @@
private UDFSource udfSource;
private HashSet<ServerConnection> clientConnections = new
HashSet<ServerConnection>();
+ private AbstractClassLoaderManager classLoaderManager = new
AbstractClassLoaderManager(Thread.currentThread().getContextClassLoader(), true) {
+
+ @Override
+ public String getCommonExtensionClassPath() {
+ return userPreferences.getProperty(DQPEmbeddedProperties.COMMON_EXTENSION_CLASPATH,
""); //$NON-NLS-1$
+ }
+
+ @Override
+ public URL parseURL(String url) throws MalformedURLException {
+ return ExtensionModuleReader.resolveExtensionModule(url, getExtensionPath());
+ }
+ };
+
boolean valid(String str) {
if (str != null) {
str = str.trim();
@@ -218,35 +230,21 @@
return null;
}
}
-
- /**
- * @see
com.metamatrix.dqp.service.ConfigurationService#getCommonExtensionClasspath()
- */
- public Set<URL> getCommonExtensionClasspath() {
- String classpath=
userPreferences.getProperty(DQPEmbeddedProperties.COMMON_EXTENSION_CLASPATH);
-
- // add the "ConnectorClasspath" to the common extension path
- Collection<ConnectorBinding> bindings =
this.loadedConnectorBindings.values();
- for (ConnectorBinding b:bindings) {
- if (classpath == null) {
- classpath = b.getProperty(ConnectorPropertyNames.CONNECTOR_CLASSPATH);
- }
- else {
- classpath += ";"; //$NON-NLS-1$
- classpath += b.getProperty(ConnectorPropertyNames.CONNECTOR_CLASSPATH);
- }
- }
-
- if (valid(classpath)) {
- try {
- return ExtensionModuleReader.resolveExtensionClasspath(classpath,
getExtensionPath());
- } catch (IOException e) {
- DQPEmbeddedPlugin.logError(e,
"EmbeddedConfigurationService.udf_classspath_failure", new Object[] {});
//$NON-NLS-1$
- }
- }
- return null;
+
+ @Override
+ public ClassLoader getCommonClassLoader(String urls) {
+ return this.classLoaderManager.getCommonClassLoader(urls);
}
+ @Override
+ public ClassLoader getPostDelegationClassLoader(String urls) {
+ return this.classLoaderManager.getPostDelegationClassLoader(urls);
+ }
+
+ public AbstractClassLoaderManager getClassLoaderManager() {
+ return classLoaderManager;
+ }
+
/**
* @see com.metamatrix.dqp.service.ConfigurationService#getLogFile()
* @since 4.3
@@ -838,6 +836,7 @@
* @since 4.3
*/
public void saveExtensionModule(ExtensionModule extModule) throws
MetaMatrixComponentException {
+ this.classLoaderManager.clearCache();
ExtensionModuleWriter.write(extModule, getExtensionPath());
}
@@ -846,6 +845,7 @@
* @since 4.3
*/
public void deleteExtensionModule(String extModuleName) throws
MetaMatrixComponentException {
+ this.classLoaderManager.clearCache();
ExtensionModuleWriter.deleteModule(extModuleName, getExtensionPath());
}
@@ -913,20 +913,14 @@
public void loadUDF() throws MetaMatrixComponentException {
URL udfFile = getUDFFile();
if(udfFile != null && exists(udfFile)) {
- Set<URL> urls = getCommonExtensionClasspath();
try {
// un-register the old UDF model, if there is one.
unloadUDF();
- if (urls == null || urls.isEmpty()) {
- this.udfSource = new UDFSource(udfFile);
- }
- else {
- this.udfSource = new UDFSource(udfFile, urls.toArray(new
URL[urls.size()]));
- }
+ this.udfSource = new UDFSource(udfFile.openStream(),
getCommonClassLoader(null));
FunctionLibraryManager.registerSource(this.udfSource);
- DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.udf_load", new
Object[] {udfFile, urls}); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_DQP,
DQPEmbeddedPlugin.Util.getString("EmbeddedConfigurationService.udf_load",
udfFile)); //$NON-NLS-1$
} catch (IOException e) {
LogManager.logError(LogConstants.CTX_DQP, e, e.getMessage());
}
Modified:
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java
===================================================================
---
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/embedded/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -22,7 +22,6 @@
package com.metamatrix.dqp.embedded.services;
-import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -30,7 +29,6 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import org.teiid.connector.api.ConnectorException;
@@ -43,20 +41,17 @@
import com.metamatrix.common.application.ApplicationEnvironment;
import com.metamatrix.common.application.exception.ApplicationInitializationException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
-import com.metamatrix.common.classloader.URLFilteringClassLoader;
import com.metamatrix.common.comm.api.ResultsReceiver;
import com.metamatrix.common.config.api.ComponentType;
import com.metamatrix.common.config.api.ComponentTypeDefn;
import com.metamatrix.common.config.api.ComponentTypeID;
import com.metamatrix.common.config.api.ConnectorBinding;
-import com.metamatrix.common.protocol.MetaMatrixURLStreamHandlerFactory;
import com.metamatrix.common.util.crypto.CryptoException;
import com.metamatrix.common.util.crypto.CryptoUtil;
import com.metamatrix.common.vdb.api.VDBArchive;
import com.metamatrix.common.vdb.api.VDBDefn;
import com.metamatrix.core.vdb.VDBStatus;
import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
-import com.metamatrix.dqp.embedded.configuration.ExtensionModuleReader;
import com.metamatrix.dqp.internal.datamgr.ConnectorID;
import com.metamatrix.dqp.message.AtomicRequestID;
import com.metamatrix.dqp.message.AtomicRequestMessage;
@@ -457,7 +452,8 @@
connectorProperties.setProperty(ConnectorPropertyNames.CONNECTOR_BINDING_NAME,
binding.getFullName());
try {
- ConnectorManager mgr = initConnectorManager(connectorProperties);
+ ConnectorManager mgr = new ConnectorManager();
+ mgr.setClassLoaderManager(this.getConfigurationService());
mgr.initialize(connectorProperties);
return mgr;
} catch(Exception e) {
@@ -558,65 +554,4 @@
return new DefaultIndexConnectorBinding();
}
- /**
- * Depending upon the setting for the connector manager either load the class in
- * same class loader or different class loader. Connector Bindings has property
- * called ConnectorClassPath which defines the class path.
- */
- ConnectorManager initConnectorManager(Properties connectorProperties)
- throws ApplicationLifecycleException{
-
- try {
- // Ask the configuration if we can use the extension class loader.
- boolean useExtensionClassPath =
(getConfigurationService().useExtensionClasspath());
- String classPath = buildClasspath(connectorProperties);
-
- if (classPath == null || classPath.length() == 0) {
- useExtensionClassPath = false;
- }
-
- if (!useExtensionClassPath) {
- return new ConnectorManager();
- }
-
- DQPEmbeddedPlugin.logInfo("DataService.useClassloader", new
Object[] {classPath}); //$NON-NLS-1$
-
- Set<URL> userPath =
ExtensionModuleReader.resolveExtensionClasspath(classPath,
getConfigurationService().getExtensionPath());
-
- // since we are using the extensions, get the common extension path
- Set<URL> commonExtensionPath =
getConfigurationService().getCommonExtensionClasspath();
-
- ArrayList<URL> urlPath = new ArrayList<URL>();
- urlPath.addAll(userPath);
-
- if (commonExtensionPath != null) {
- urlPath.addAll(commonExtensionPath);
- }
-
- ClassLoader classLoader = new URLFilteringClassLoader(urlPath.toArray(new
URL[urlPath.size()]), Thread.currentThread().getContextClassLoader(), new
MetaMatrixURLStreamHandlerFactory());
-
- ConnectorManager cm = new ConnectorManager();
- cm.setClassloader(classLoader);
- return cm;
- } catch (Exception e) {
- throw new ApplicationLifecycleException(e);
- }
- }
-
- private String buildClasspath(Properties connectorProperties) {
- StringBuilder sb = new StringBuilder();
- appendlasspath(connectorProperties.getProperty(ConnectorPropertyNames.CONNECTOR_CLASSPATH),
sb); // this is user defined, could be very specific to the binding
-
appendlasspath(connectorProperties.getProperty(ConnectorPropertyNames.CONNECTOR_TYPE_CLASSPATH),
sb); // this is system defined; type classpath
- return sb.toString();
- }
-
- private void appendlasspath(String path, StringBuilder builder) {
- if (path != null && path.length() > 0) {
- builder.append(path);
- if (!path.endsWith(";")) { //$NON-NLS-1$
- builder.append(";"); //$NON-NLS-1$
- }
- }
- }
-
}
Modified:
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedConfigurationService.java
===================================================================
---
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedConfigurationService.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/embedded/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedConfigurationService.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -31,7 +31,6 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.Set;
import junit.framework.TestCase;
@@ -539,9 +538,9 @@
// test common class path; also makes sure that the connect in position (1) has
the newly added module
service.userPreferences.setProperty("dqp.extension.CommonClasspath",
"extensionjar:added-ext.jar;extensionjar:extfile.jar"); //$NON-NLS-1$
//$NON-NLS-2$
- Iterator<URL> i = service.getCommonExtensionClasspath().iterator();
- assertEquals("mmfile:target/scratch/dqp/foo/added-ext.jar",
i.next().toString()); //$NON-NLS-1$
- assertEquals("mmfile:target/scratch/dqp/bar/extfile.jar",
i.next().toString()); //$NON-NLS-1$
+ URL[] urls =
service.getClassLoaderManager().parseURLs(service.getClassLoaderManager().getCommonExtensionClassPath());
+ assertEquals("mmfile:target/scratch/dqp/foo/added-ext.jar",
urls[0].toString()); //$NON-NLS-1$
+ assertEquals("mmfile:target/scratch/dqp/bar/extfile.jar",
urls[1].toString()); //$NON-NLS-1$
// test delete
service.deleteExtensionModule("added-ext.jar"); //$NON-NLS-1$
@@ -575,22 +574,11 @@
p.setProperty("dqp.extensions", "./foo/;./bar/");
//$NON-NLS-1$ //$NON-NLS-2$
service.userPreferences = p;
- assertNull(service.getCommonExtensionClasspath());
+ assertEquals("",
service.getClassLoaderManager().getCommonExtensionClassPath()); //$NON-NLS-1$
p.setProperty(DQPEmbeddedProperties.COMMON_EXTENSION_CLASPATH,
"extensionjar:extfile.jar"); //$NON-NLS-1$
- Set<URL> urls = service.getCommonExtensionClasspath();
- assertEquals("mmfile:target/scratch/dqp/bar/extfile.jar",
urls.iterator().next().toString()); //$NON-NLS-1$
-
- BasicConnectorBinding binding = new BasicConnectorBinding(new
ConfigurationID("foo"), new ConnectorBindingID(new
ConfigurationID("foo"), "foo"), new ComponentTypeID("foo
type")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- Properties props = new Properties();
- props.setProperty(ConnectorPropertyNames.CONNECTOR_CLASSPATH,
"extensionjar:driver.jar"); //$NON-NLS-1$
- binding.setProperties(props);
- service.loadedConnectorBindings.put("Foo", binding); //$NON-NLS-1$
-
- Iterator<URL> i = service.getCommonExtensionClasspath().iterator();
-
- assertEquals("mmfile:target/scratch/dqp/bar/extfile.jar",
i.next().toString()); //$NON-NLS-1$
- assertEquals("mmfile:target/scratch/dqp/bar/driver.jar",
i.next().toString()); //$NON-NLS-1$
+ URL[] urls =
service.getClassLoaderManager().parseURLs(service.getClassLoaderManager().getCommonExtensionClassPath());
+ assertEquals("mmfile:target/scratch/dqp/bar/extfile.jar",
urls[0].toString()); //$NON-NLS-1$
}
}
Added:
trunk/engine/src/main/java/com/metamatrix/common/application/AbstractClassLoaderManager.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/common/application/AbstractClassLoaderManager.java
(rev 0)
+++
trunk/engine/src/main/java/com/metamatrix/common/application/AbstractClassLoaderManager.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.common.application;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import com.metamatrix.common.classloader.PostDelegatingClassLoader;
+import com.metamatrix.common.classloader.URLFilteringClassLoader;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.protocol.MetaMatrixURLStreamHandlerFactory;
+import com.metamatrix.common.util.LogCommonConstants;
+
+public abstract class AbstractClassLoaderManager implements ClassLoaderManager {
+
+ private ClassLoader parentClassLoader;
+ private URLFilteringClassLoader commonExtensionClassloader;
+ private Map<String, PostDelegatingClassLoader> postdelegationClassLoaderCache =
new HashMap<String, PostDelegatingClassLoader>();
+ private boolean usePostDelegationCache;
+ private Object lock = new Object();
+
+ public AbstractClassLoaderManager(ClassLoader parentClassLoader, boolean
usePostDelegationCache) {
+ this.usePostDelegationCache = usePostDelegationCache;
+ this.parentClassLoader = parentClassLoader;
+ }
+
+ public ClassLoader getCommonClassLoader(String urls) {
+ synchronized (lock) {
+ if (this.commonExtensionClassloader == null) {
+ // since we are using the extensions, get the common extension path
+ this.commonExtensionClassloader = new
URLFilteringClassLoader(parseURLs(getCommonExtensionClassPath()), parentClassLoader, new
MetaMatrixURLStreamHandlerFactory());
+ }
+ if (urls != null && urls.trim().length() > 0) {
+ for (URL url : parseURLs(urls)) {
+ this.commonExtensionClassloader.addURL(url);
+ }
+ }
+ return this.commonExtensionClassloader;
+ }
+ }
+
+ public ClassLoader getPostDelegationClassLoader(String urls) {
+ synchronized (lock) {
+ PostDelegatingClassLoader cl = this.postdelegationClassLoaderCache.get(urls);
+ if (cl == null) {
+ if (urls != null && urls.trim().length() > 0) {
+ cl = new PostDelegatingClassLoader(parseURLs(urls),
getCommonClassLoader(null), new MetaMatrixURLStreamHandlerFactory());
+ if (usePostDelegationCache) {
+ this.postdelegationClassLoaderCache.put(urls, cl);
+ }
+ }
+ if (cl == null) {
+ return getCommonClassLoader(null);
+ }
+ }
+ return cl;
+ }
+ }
+
+ public void clearCache() {
+ synchronized (lock) {
+ this.commonExtensionClassloader = null;
+ this.postdelegationClassLoaderCache.clear();
+ }
+ }
+
+ public URL[] parseURLs(String delimitedUrls) {
+ StringTokenizer toke = new StringTokenizer(delimitedUrls, ";");
//$NON-NLS-1$
+ List<URL> urls = new ArrayList<URL>(toke.countTokens());
+ while (toke.hasMoreElements()) {
+ String urlString = toke.nextToken();
+ try {
+ URL url = parseURL(urlString);
+ if (url != null) {
+ urls.add(url);
+ }
+ } catch (MalformedURLException e) {
+ LogManager.logError(LogCommonConstants.CTX_EXTENSION_SOURCE, "Invalid extension
classpath entry " + urlString); //$NON-NLS-1$
+ }
+ }
+
+ return urls.toArray(new URL[urls.size()]);
+ }
+
+ public abstract URL parseURL(String url) throws MalformedURLException;
+
+ public abstract String getCommonExtensionClassPath();
+
+}
Property changes on:
trunk/engine/src/main/java/com/metamatrix/common/application/AbstractClassLoaderManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/engine/src/main/java/com/metamatrix/common/application/ClassLoaderManager.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/application/ClassLoaderManager.java
(rev 0)
+++
trunk/engine/src/main/java/com/metamatrix/common/application/ClassLoaderManager.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.common.application;
+
+public interface ClassLoaderManager {
+
+ /**
+ * Return the common class loader with the given urls appended
+ * @param urls
+ * @return
+ */
+ ClassLoader getCommonClassLoader(String urls);
+
+ /**
+ * Return a distinct post delgation class loader - which may be cached.
+ * @param urls
+ * @return
+ */
+ ClassLoader getPostDelegationClassLoader(String urls);
+
+}
Property changes on:
trunk/engine/src/main/java/com/metamatrix/common/application/ClassLoaderManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -30,6 +30,7 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.application.ApplicationService;
+import com.metamatrix.common.application.ClassLoaderManager;
import com.metamatrix.common.comm.api.ServerConnection;
import com.metamatrix.common.comm.api.ServerConnectionListener;
import com.metamatrix.common.config.api.ComponentType;
@@ -46,7 +47,7 @@
* for other services and also DQP configuration.
* @since 4.3
*/
-public interface ConfigurationService extends ApplicationService {
+public interface ConfigurationService extends ApplicationService, ClassLoaderManager {
public static final String NEXT_VDB_VERSION = "NEXT_VDB_VERSION";
//$NON-NLS-1$
public static final String USER_DEFINED_FUNCTION_MODEL =
"FunctionDefinitions.xmi"; //$NON-NLS-1$
/**
@@ -98,13 +99,6 @@
public URL getUDFFile();
/**
- * Get the user defined extension file classpath. The jar
- * files are loaded usually as the extension modules.
- * @return URL[] - Classpath for the UDF jar files
- */
- public Set<URL> getCommonExtensionClasspath();
-
- /**
* URL to Log file name
* @return URL or null if one not available
*/
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -60,6 +60,7 @@
import com.metamatrix.common.application.ApplicationEnvironment;
import com.metamatrix.common.application.ApplicationService;
+import com.metamatrix.common.application.ClassLoaderManager;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
import com.metamatrix.common.comm.api.ResultsReceiver;
import com.metamatrix.common.log.LogManager;
@@ -121,6 +122,8 @@
private BufferService bufferService;
private volatile Boolean started;
+
+ private ClassLoaderManager clManager;
// known requests
private ConcurrentHashMap<AtomicRequestID, ConnectorWorkItem> requestStates =
new ConcurrentHashMap<AtomicRequestID, ConnectorWorkItem>();
@@ -344,20 +347,51 @@
this.started = true;
}
+ private String buildClasspath(Properties connectorProperties) {
+ StringBuilder sb = new StringBuilder();
+ appendlasspath(connectorProperties.getProperty(ConnectorPropertyNames.CONNECTOR_CLASSPATH),
sb); // this is user defined, could be very specific to the binding
+
appendlasspath(connectorProperties.getProperty(ConnectorPropertyNames.CONNECTOR_TYPE_CLASSPATH),
sb); // this is system defined; type classpath
+ return sb.toString();
+ }
+
+ private void appendlasspath(String path, StringBuilder builder) {
+ if (path != null && path.length() > 0) {
+ builder.append(path);
+ if (!path.endsWith(";")) { //$NON-NLS-1$
+ builder.append(";"); //$NON-NLS-1$
+ }
+ }
+ }
+
/**
* Initialize and start the connector.
* @param env
* @throws ApplicationLifecycleException
*/
private void initStartConnector(ConnectorEnvironment env) throws
ApplicationLifecycleException {
+
String connectorClassName =
env.getProperties().getProperty(ConnectorPropertyNames.CONNECTOR_CLASS);
- if(classloader == null){
- classloader = getClass().getClassLoader();
+
+ String classPath = buildClasspath(env.getProperties());
+
+ Thread currentThread = Thread.currentThread();
+ ClassLoader threadContextLoader = currentThread.getContextClassLoader();
+
+ if (classPath == null || classPath.trim().length() == 0) {
+ classloader = threadContextLoader;
} else {
env.getProperties().setProperty(ConnectorPropertyNames.USING_CUSTOM_CLASSLOADER,
Boolean.TRUE.toString());
+
LogManager.logInfo(DQPPlugin.Util.getString("DataService.useClassloader"),
classPath); //$NON-NLS-1$
+
+ boolean postDelegation =
PropertiesUtils.getBooleanProperty(env.getProperties(),
ConnectorPropertyNames.USE_POST_DELEGATION, false);
+
+ if (postDelegation) {
+ this.classloader = this.clManager.getPostDelegationClassLoader(classPath);
+ } else {
+ this.classloader = this.clManager.getCommonClassLoader(classPath);
+ }
}
- Thread currentThread = Thread.currentThread();
- ClassLoader threadContextLoader = currentThread.getContextClassLoader();
+
try {
currentThread.setContextClassLoader(classloader);
Connector c;
@@ -650,8 +684,8 @@
return isXa;
}
- public void setClassloader(ClassLoader classloader) {
- this.classloader = classloader;
+ public void setClassLoaderManager(ClassLoaderManager clManager) {
+ this.clManager = clManager;
}
public void setWorkItemFactory(ConnectorWorkItemFactory workItemFactory) {
@@ -681,13 +715,11 @@
}
public Collection<ConnectionPoolStats> getConnectionPoolStats() {
- if (connector.getActualConnector() instanceof PooledConnector) {
- PooledConnector pc = (PooledConnector) connector;
-
- return pc.getConnectionPoolStats();
-
+ if (connector instanceof PooledConnector) {
+ PooledConnector pc = (PooledConnector) connector;
+
+ return pc.getConnectionPoolStats();
}
- return Collections.EMPTY_LIST;
-
+ return Collections.emptyList();
}
}
Modified:
trunk/server/src/main/java/com/metamatrix/common/extensionmodule/protocol/URLFactory.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/common/extensionmodule/protocol/URLFactory.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/server/src/main/java/com/metamatrix/common/extensionmodule/protocol/URLFactory.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -24,11 +24,13 @@
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.*;
-import java.util.Iterator;
+import java.util.ArrayList;
import java.util.List;
+import java.util.StringTokenizer;
import com.metamatrix.common.extensionmodule.protocol.extensionjar.Handler;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.util.LogCommonConstants;
/**
* Factory to convert String urls into URL objects. This factory
@@ -109,55 +111,4 @@
return result;
}
- /**
- * Parse the url string into a URL object
- * @param url String url
- * @return URL object
- * @throws MalformedURLException if url String is invalid
- */
- public static URL parseURL(String url) throws MalformedURLException {
- return parseURL(null, url);
- }
-
- /**
- * Parse the List of string urls into an array of
- * URL objects
- * @param urls List of String urls
- * @return array of URL objects
- * @throws MalformedURLException if any of the url Strings
- * are invalid
- */
- public static URL[] parseURLs(List urls) throws MalformedURLException{
- URL[] result = new URL[urls.size()];
-
- Iterator urlIter = urls.iterator();
- for (int i=0; urlIter.hasNext(); i++){
- result[i] = parseURL((String)urlIter.next());
- }
-
- return result;
- }
-
- /**
- * Parse the single delimited String of URLs into an array of URL objects
- * @param delimitedURLs a single String of delimiter-separated URL strings
- * @param delimiter delimiter of tokens in delmitedURLs - if this is null, a single
- * whitespace will be assumed as the delimiter
- * @return URL[] array
- * @throws MalformedURLException if any of the url Strings are invalid
- */
- public static URL[] parseURLs(String delimitedURLs, String delimiter) throws
MalformedURLException{
-
- if (delimiter == null){
- delimiter = " "; //$NON-NLS-1$
- }
- StringTokenizer toke = new StringTokenizer(delimitedURLs, delimiter);
- List urlStrings = new ArrayList(toke.countTokens());
- while (toke.hasMoreElements()) {
- String urlString = toke.nextToken();
- urlStrings.add(urlString);
- }
- return parseURLs(urlStrings);
- }
-
}
Modified:
trunk/server/src/main/java/com/metamatrix/platform/service/api/ServiceInterface.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/platform/service/api/ServiceInterface.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/server/src/main/java/com/metamatrix/platform/service/api/ServiceInterface.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -26,6 +26,7 @@
import java.util.Date;
import java.util.Properties;
+import com.metamatrix.common.application.ClassLoaderManager;
import com.metamatrix.common.comm.ClientServiceRegistry;
import com.metamatrix.common.config.api.DeployedComponentID;
import com.metamatrix.common.queue.WorkerPoolStats;
@@ -42,9 +43,10 @@
* service must notify any lifecycle listeners of its initialization
* using the unique service instance name returned.
* @param deployedComponentID Unique identifier of this deployed component.
+ * @param clManager
* @return The unique name of this service instance.
*/
- void init(ServiceID id, DeployedComponentID deployedComponentID, Properties props,
ClientServiceRegistry listenerRegistry);
+ void init(ServiceID id, DeployedComponentID deployedComponentID, Properties props,
ClientServiceRegistry listenerRegistry, ClassLoaderManager clManager);
/*
Modified:
trunk/server/src/main/java/com/metamatrix/platform/service/controller/AbstractService.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/platform/service/controller/AbstractService.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/server/src/main/java/com/metamatrix/platform/service/controller/AbstractService.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -32,6 +32,7 @@
import java.util.List;
import java.util.Properties;
+import com.metamatrix.common.application.ClassLoaderManager;
import com.metamatrix.common.comm.ClientServiceRegistry;
import com.metamatrix.common.config.CurrentConfiguration;
import com.metamatrix.common.config.api.DeployedComponentID;
@@ -85,7 +86,7 @@
* @param props the properties which define the service configuration
* @param controller ServiceBusInterface which supplies resources such as event
processing
*/
- public void init(ServiceID id, DeployedComponentID deployedComponentID, Properties
props, ClientServiceRegistry listenerRegistry) {
+ public void init(ServiceID id, DeployedComponentID deployedComponentID, Properties
props, ClientServiceRegistry listenerRegistry, ClassLoaderManager clManager) {
if (props == null) {
throw new ServiceException(ServiceMessages.SERVICE_0001,
ServicePlugin.Util.getString(ServiceMessages.SERVICE_0001));
Modified:
trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/server/src/main/java/com/metamatrix/platform/vm/controller/ProcessController.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -26,6 +26,7 @@
import java.lang.reflect.Proxy;
import java.net.InetAddress;
import java.net.MalformedURLException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EventObject;
@@ -41,7 +42,7 @@
import com.metamatrix.admin.server.ServerAdminImpl;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MultipleException;
-import com.metamatrix.common.classloader.URLFilteringClassLoader;
+import com.metamatrix.common.application.AbstractClassLoaderManager;
import com.metamatrix.common.comm.ClientServiceRegistry;
import com.metamatrix.common.comm.platform.socket.server.AdminAuthorizationInterceptor;
import com.metamatrix.common.comm.platform.socket.server.LogonImpl;
@@ -117,7 +118,7 @@
* This class is used to start up a server process and start all services that are
* configured under this server
*/
-public abstract class ProcessController implements ProcessManagement {
+public abstract class ProcessController extends AbstractClassLoaderManager implements
ProcessManagement {
public final static String SERVICE_ID = "Service"; //$NON-NLS-1$
@@ -154,7 +155,6 @@
protected ClientServiceRegistry clientServices;
private Map<ComponentTypeID, Properties> defaultPropertiesCache = new
HashMap<ComponentTypeID, Properties>();
- private ClassLoader commonExtensionClassLoader = null;
private String commonExtensionClasspath;
private int force_shutdown_time = DEFAULT_FORCE_SHUTDOWN_TIME;
@@ -168,6 +168,7 @@
* @throws Exception if an error occurs initializing vmController
*/
public ProcessController(Host host, String processname, ClusteredRegistryState
registry, ServerEvents serverEvents, MessageBus bus, HostManagement hostManagement) throws
Exception {
+ super(Thread.currentThread().getContextClassLoader(),
PropertiesUtils.getBooleanProperty(CurrentConfiguration.getInstance().getProperties(),
ServerPropertyNames.CACHE_CLASS_LOADERS, true));
this.host = host;
this.processName = processname;
@@ -191,10 +192,19 @@
this.registerSubSystemAdminAPIs(hostManagement);
- manageCommonExtensionClassloader();
+ manageClassloaders();
}
-
+ @Override
+ public URL parseURL(String url) throws MalformedURLException {
+ return URLFactory.parseURL(null, url);
+ }
+
+ @Override
+ public String getCommonExtensionClassPath() {
+ return
CurrentConfiguration.getInstance().getProperties().getProperty(ServerPropertyNames.COMMON_EXTENSION_CLASPATH,
""); //$NON-NLS-1$
+ }
+
/**
* Register the ServiceInterceptors for the SubSystemAdminAPIs
* @throws MetaMatrixComponentException
@@ -343,7 +353,6 @@
}
}
-
public void startService(ServiceID serviceID) {
logMessage(PlatformPlugin.Util.getString(LogMessageKeys.VM_0018, serviceID));
@@ -669,12 +678,13 @@
* Throw away the common extension class loader when there is change in the Extension
modules or has a changed extension
* classpath.
*/
- private void manageCommonExtensionClassloader() throws MessagingException {
+ private void manageClassloaders() throws MessagingException {
+ this.commonExtensionClasspath = getCommonExtensionClassPath();
this.messageBus.addListener(ExtensionModuleEvent.class, new EventObjectListener() {
@Override
public void processEvent(EventObject obj) {
if (obj instanceof ExtensionModuleEvent) {
- ProcessController.this.commonExtensionClassLoader = null;
+ clearCache();
}
}
});
@@ -683,42 +693,22 @@
@Override
public void processEvent(EventObject obj) {
if (obj instanceof ConfigurationChangeEvent) {
- String extensionClasspath =
CurrentConfiguration.getInstance().getProperties().getProperty(ServerPropertyNames.COMMON_EXTENSION_CLASPATH);
- if (extensionClasspath != null) {
- if (!extensionClasspath.equals(ProcessController.this.commonExtensionClasspath)) {
- ProcessController.this.commonExtensionClassLoader = null;
- }
+ String extensionClasspath = getCommonExtensionClassPath();
+ if (!extensionClasspath.equals(ProcessController.this.commonExtensionClasspath)) {
+ commonExtensionClasspath = extensionClasspath;
+ clearCache();
}
- else {
- ProcessController.this.commonExtensionClassLoader = null;
- }
}
}
});
}
- private ClassLoader getCommonExtensionClassloader() {
- if (this.commonExtensionClassLoader == null) {
- String extensionClasspath =
CurrentConfiguration.getInstance().getProperties().getProperty(ServerPropertyNames.COMMON_EXTENSION_CLASPATH);
- if (extensionClasspath != null && extensionClasspath.length() > 0) {
- try {
- this.commonExtensionClassLoader = new
URLFilteringClassLoader(URLFactory.parseURLs(extensionClasspath, ";"),
Thread.currentThread().getContextClassLoader()); //$NON-NLS-1$
- this.commonExtensionClasspath = extensionClasspath;
- logMessage(PlatformPlugin.Util.getString("commonextensionspath_in_use",
extensionClasspath)); //$NON-NLS-1$
- } catch (MalformedURLException e) {
- logMessage(PlatformPlugin.Util.getString("commonextensionspath_not_in_use",extensionClasspath));
//$NON-NLS-1$
- }
- }
- }
- return this.commonExtensionClassLoader;
- }
-
private void startService(ClientServiceRegistry serverListenerRegistry, ServiceID
serviceID, DeployedComponent deployedComponent,final String serviceClass,Properties
serviceProps) {
String serviceInstanceName = null;
ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
try {
- ClassLoader commonExtensionClassLoader = getCommonExtensionClassloader();
+ ClassLoader commonExtensionClassLoader = getCommonClassLoader(null);
if (commonExtensionClassLoader != null) {
Thread.currentThread().setContextClassLoader(commonExtensionClassLoader);
}
@@ -751,7 +741,7 @@
DeployedComponentID deployedComponentID = (DeployedComponentID)
deployedComponent.getID();
logMessage(PlatformPlugin.Util.getString("ServiceController.1",param1));
//$NON-NLS-1$
- service.init(serviceID, deployedComponentID, serviceProps,
serverListenerRegistry);
+ service.init(serviceID, deployedComponentID, serviceProps,
serverListenerRegistry, this);
logMessage(PlatformPlugin.Util.getString("ServiceController.2",param1));
//$NON-NLS-1$
logMessage(PlatformPlugin.Util.getString("ServiceController.3",param1));
//$NON-NLS-1$
Modified:
trunk/server/src/main/java/com/metamatrix/server/connector/service/ConnectorService.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/server/connector/service/ConnectorService.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/server/src/main/java/com/metamatrix/server/connector/service/ConnectorService.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -27,15 +27,12 @@
package com.metamatrix.server.connector.service;
import java.io.Serializable;
-import java.lang.ref.WeakReference;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
-import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.EventObject;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -50,9 +47,9 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.common.application.ApplicationEnvironment;
import com.metamatrix.common.application.ApplicationService;
+import com.metamatrix.common.application.ClassLoaderManager;
import com.metamatrix.common.application.exception.ApplicationInitializationException;
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
-import com.metamatrix.common.classloader.PostDelegatingClassLoader;
import com.metamatrix.common.comm.ClientServiceRegistry;
import com.metamatrix.common.comm.api.ResultsReceiver;
import com.metamatrix.common.config.CurrentConfiguration;
@@ -64,11 +61,7 @@
import com.metamatrix.common.config.api.ConnectorBinding;
import com.metamatrix.common.config.api.DeployedComponentID;
import com.metamatrix.common.config.api.exceptions.ConfigurationException;
-import com.metamatrix.common.extensionmodule.ExtensionModuleEvent;
-import com.metamatrix.common.extensionmodule.protocol.URLFactory;
import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.messaging.MessageBus;
-import com.metamatrix.common.messaging.MessagingException;
import com.metamatrix.common.object.PropertyDefinition;
import com.metamatrix.common.queue.WorkerPoolStats;
import com.metamatrix.common.stats.ConnectionPoolStats;
@@ -76,7 +69,6 @@
import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.common.util.crypto.CryptoException;
import com.metamatrix.common.util.crypto.CryptoUtil;
-import com.metamatrix.core.event.EventObjectListener;
import com.metamatrix.dqp.client.ClientSideDQP;
import com.metamatrix.dqp.internal.datamgr.ConnectorID;
import com.metamatrix.dqp.message.AtomicRequestID;
@@ -91,9 +83,7 @@
import com.metamatrix.platform.service.controller.AbstractService;
import com.metamatrix.platform.service.controller.ServicePropertyNames;
import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
-import com.metamatrix.server.ResourceFinder;
import com.metamatrix.server.ServerPlugin;
-import com.metamatrix.server.util.ServerPropertyNames;
/**
* ConnectorService.
@@ -106,53 +96,17 @@
private boolean monitoringEnabled = true;
private ClientServiceRegistry registry;
+ private ClassLoaderManager clManager;
- private static boolean cacheClassLoaders = true;
-
/**
- * Map of String (urls) to ClassLoader.
- * This is based on the assumption that two classloaders
- * with the same URLs should be identical.
- */
- private static Map<String, WeakReference<PostDelegatingClassLoader>>
classLoaderCache = new HashMap<String,
WeakReference<PostDelegatingClassLoader>> ();
-
- static {
- //read value of cacheClassLoaders
- cacheClassLoaders =
PropertiesUtils.getBooleanProperty(CurrentConfiguration.getInstance().getProperties(),
ServerPropertyNames.CACHE_CLASS_LOADERS, false);
- logOK("ConnectorService.Cache_class_loaders", new
Boolean(cacheClassLoaders)); //$NON-NLS-1$
- initExtensionModuleListener();
- }
-
- private static void initExtensionModuleListener() {
- MessageBus vmb = ResourceFinder.getMessageBus();
- EventObjectListener listener = new EventObjectListener() {
- public void processEvent(EventObject obj) {
- if (obj instanceof ExtensionModuleEvent) {
- ExtensionModuleEvent event = (ExtensionModuleEvent) obj;
-
- switch (event.getType()) {
- case ExtensionModuleEvent.TYPE_FILE_CHANGED:
- clearClassLoaderCache();
- break;
- }
- }
- }
- };
- try {
- vmb.addListener(ExtensionModuleEvent.class, listener);
- } catch (MessagingException e) {
- LogManager.logError(LogCommonConstants.CTX_CONFIG, e, e.getMessage());
- }
- }
-
- /**
* Initialize ConnectorService
*/
- public void init(ServiceID id, DeployedComponentID deployedComponentID, Properties
props, ClientServiceRegistry listenerRegistry) {
+ public void init(ServiceID id, DeployedComponentID deployedComponentID, Properties
props, ClientServiceRegistry listenerRegistry, ClassLoaderManager clManager) {
//this assumes that the dqp has already been initialized and i
this.registry = listenerRegistry;
+ this.clManager = clManager;
- super.init(id, deployedComponentID, props, listenerRegistry);
+ super.init(id, deployedComponentID, props, listenerRegistry, clManager);
//read value of monitoringEnabled
String monitoringEnabledString =
getProperties().getProperty(ServicePropertyNames.SERVICE_MONITORING_ENABLED);
if (monitoringEnabledString != null) {
@@ -190,44 +144,6 @@
this.connectorMgr.requstMore(request);
}
-
- //=========================================================================
- // Methods from AbstractService
- //=========================================================================
- /**
- * Build a custom class loader from a given set of urls.
- */
- private ClassLoader getCustomClassLoader(String urls) throws
ApplicationInitializationException{
- if(urls == null || urls.trim().length() == 0){
- LogManager.logDetail(LogCommonConstants.CTX_CONFIG,
ServerPlugin.Util.getString("ConnectorService.NoClassPath")); //$NON-NLS-1$
- return null;
- }
-
- synchronized (ConnectorService.class) {
- PostDelegatingClassLoader result = null;
- if (cacheClassLoaders) {
- WeakReference<PostDelegatingClassLoader> ref =
classLoaderCache.get(urls);
- if (ref != null) {
- result = ref.get();
- if (result != null) {
- return result;
- }
- }
- }
-
- try {
- result = new PostDelegatingClassLoader(URLFactory.parseURLs(urls,
";"), Thread.currentThread().getContextClassLoader()); //$NON-NLS-1$
- if (cacheClassLoaders) {
- classLoaderCache.put(urls, new
WeakReference<PostDelegatingClassLoader>(result));
- }
- return result;
- } catch (MalformedURLException e1) {
- String msg =
ServerPlugin.Util.getString("ConnectorService.IllegalClassPath", urls);
//$NON-NLS-1$
- throw new ApplicationInitializationException(msg);
- }
- }
- }
-
/**
* Build and intialize the Connector Manager class.
* @param deMaskedProps
@@ -235,16 +151,15 @@
* @throws ApplicationLifecycleException
* @throws ApplicationInitializationException
*/
- private ConnectorManager createConnectorManager(Properties deMaskedProps, ClassLoader
loader) throws ApplicationLifecycleException {
+ private ConnectorManager createConnectorManager(Properties deMaskedProps) throws
ApplicationLifecycleException {
ConnectorManager connectorManager = new ConnectorManager();
-
+ connectorManager.setClassLoaderManager(clManager);
// Create a stringified connector ID from the serviceID
ServiceID id = this.getID();
String connID = id.getHostName()+"|"+ id.getProcessName() +
"|" + id.getID(); //$NON-NLS-1$ //$NON-NLS-2$
deMaskedProps.put(ConnectorPropertyNames.CONNECTOR_ID, connID);
deMaskedProps.put(ConnectorPropertyNames.CONNECTOR_BINDING_NAME,
getInstanceName());
deMaskedProps.put(ConnectorPropertyNames.CONNECTOR_VM_NAME,
CurrentConfiguration.getInstance().getProcessName());
- connectorManager.setClassloader(loader);
connectorManager.initialize(deMaskedProps);
return connectorManager;
}
@@ -256,12 +171,9 @@
// Decrypt masked properties
Properties deMaskedProps = decryptMaskedProperties(props);
- String urls = buildClasspath(deMaskedProps);
-
- ClassLoader loader = getCustomClassLoader(urls);
// Build a Connector manager using the custom class loader and initialize
// the service.
- this.connectorMgr = createConnectorManager(deMaskedProps, loader);
+ this.connectorMgr = createConnectorManager(deMaskedProps);
ApplicationEnvironment env = new ApplicationEnvironment();
env.bindService(DQPServiceNames.REGISTRY_SERVICE, new
ClientServiceRegistryService(this.registry));
@@ -297,23 +209,7 @@
killService();
throw e;
}
- }
-
- private String buildClasspath(Properties connectorProperties) {
- StringBuilder sb = new StringBuilder();
- appendlasspath(connectorProperties.getProperty(ConnectorPropertyNames.CONNECTOR_CLASSPATH),
sb); // this is user defined, could be very specific to the binding
-
appendlasspath(connectorProperties.getProperty(ConnectorPropertyNames.CONNECTOR_TYPE_CLASSPATH),
sb); // this is system defined; type classpath
- return sb.toString();
- }
-
- private void appendlasspath(String path, StringBuilder builder) {
- if (path != null && path.length() > 0) {
- builder.append(path);
- if (!path.endsWith(";")) { //$NON-NLS-1$
- builder.append(";"); //$NON-NLS-1$
- }
- }
- }
+ }
/**
* Close the service to new work if applicable. After this method is called
@@ -521,12 +417,6 @@
}
}
- private synchronized static void clearClassLoaderCache() {
- LogManager.logInfo(LogCommonConstants.CTX_CONFIG, "ConnectorService clearing
ClassLoader cache"); //$NON-NLS-1$
-
- classLoaderCache.clear();
- }
-
private static void logOK(String messageProperty, Object value) {
LogManager.logInfo(LogCommonConstants.CTX_CONFIG,
ServerPlugin.Util.getString(messageProperty, value));
}
Modified:
trunk/server/src/main/java/com/metamatrix/server/query/service/QueryService.java
===================================================================
---
trunk/server/src/main/java/com/metamatrix/server/query/service/QueryService.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/server/src/main/java/com/metamatrix/server/query/service/QueryService.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -41,6 +41,7 @@
import com.metamatrix.api.exception.ComponentNotFoundException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.server.InvalidRequestIDException;
+import com.metamatrix.common.application.ClassLoaderManager;
import com.metamatrix.common.application.DQPConfigSource;
import com.metamatrix.common.comm.ClientServiceRegistry;
import com.metamatrix.common.config.CurrentConfiguration;
@@ -252,8 +253,8 @@
@Override
public void init(ServiceID id, DeployedComponentID deployedComponentID,
- Properties props, ClientServiceRegistry listenerRegistry) {
- super.init(id, deployedComponentID, props, listenerRegistry);
+ Properties props, ClientServiceRegistry listenerRegistry, ClassLoaderManager
clManager) {
+ super.init(id, deployedComponentID, props, listenerRegistry, clManager);
listenerRegistry.registerClientService(ClientSideDQP.class, this.dqp,
LogConstants.CTX_QUERY_SERVICE);
}
Modified: trunk/server/src/test/java/com/metamatrix/admin/server/FakeCacheAdmin.java
===================================================================
--- trunk/server/src/test/java/com/metamatrix/admin/server/FakeCacheAdmin.java 2009-05-20
02:07:14 UTC (rev 984)
+++ trunk/server/src/test/java/com/metamatrix/admin/server/FakeCacheAdmin.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -34,6 +34,7 @@
import com.metamatrix.admin.api.objects.Cache;
import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.common.application.ClassLoaderManager;
import com.metamatrix.common.comm.ClientServiceRegistry;
import com.metamatrix.common.config.api.DeployedComponentID;
import com.metamatrix.common.queue.WorkerPoolStats;
@@ -134,7 +135,7 @@
public void init(ServiceID id,
DeployedComponentID deployedComponentID,
Properties props,
- ClientServiceRegistry listenerRegistry) {
+ ClientServiceRegistry listenerRegistry, ClassLoaderManager
clManager) {
}
public boolean isAlive() {
Modified:
trunk/server/src/test/java/com/metamatrix/admin/server/FakeConfigurationService.java
===================================================================
---
trunk/server/src/test/java/com/metamatrix/admin/server/FakeConfigurationService.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/server/src/test/java/com/metamatrix/admin/server/FakeConfigurationService.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -38,6 +38,7 @@
import com.metamatrix.common.actions.ActionDefinition;
import com.metamatrix.common.actions.CreateObject;
import com.metamatrix.common.actions.ModificationException;
+import com.metamatrix.common.application.ClassLoaderManager;
import com.metamatrix.common.comm.ClientServiceRegistry;
import com.metamatrix.common.config.api.ComponentDefn;
import com.metamatrix.common.config.api.ComponentDefnID;
@@ -775,7 +776,7 @@
}
public void init(ServiceID id, DeployedComponentID deployedComponentID,
- Properties props, ClientServiceRegistry listenerRegistry) {
+ Properties props, ClientServiceRegistry listenerRegistry, ClassLoaderManager
clManager) {
}
public void setInitException(Throwable t) {
Modified: trunk/server/src/test/java/com/metamatrix/admin/server/FakeQueryService.java
===================================================================
---
trunk/server/src/test/java/com/metamatrix/admin/server/FakeQueryService.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/server/src/test/java/com/metamatrix/admin/server/FakeQueryService.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -41,6 +41,7 @@
import com.metamatrix.api.exception.ComponentNotFoundException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.server.InvalidRequestIDException;
+import com.metamatrix.common.application.ClassLoaderManager;
import com.metamatrix.common.comm.ClientServiceRegistry;
import com.metamatrix.common.config.api.DeployedComponentID;
import com.metamatrix.common.queue.WorkerPoolStats;
@@ -262,7 +263,7 @@
}
public void init(ServiceID id, DeployedComponentID deployedComponentID,
- Properties props, ClientServiceRegistry listenerRegistry){
+ Properties props, ClientServiceRegistry listenerRegistry, ClassLoaderManager
clManager){
}
public void setInitException(Throwable t) {
Modified:
trunk/server/src/test/java/com/metamatrix/admin/server/FakeServerSessionService.java
===================================================================
---
trunk/server/src/test/java/com/metamatrix/admin/server/FakeServerSessionService.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/server/src/test/java/com/metamatrix/admin/server/FakeServerSessionService.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -35,6 +35,7 @@
import com.metamatrix.api.exception.security.AuthorizationException;
import com.metamatrix.api.exception.security.MetaMatrixAuthenticationException;
import com.metamatrix.api.exception.security.SessionServiceException;
+import com.metamatrix.common.application.ClassLoaderManager;
import com.metamatrix.common.comm.ClientServiceRegistry;
import com.metamatrix.common.config.api.DeployedComponentID;
import com.metamatrix.common.queue.WorkerPoolStats;
@@ -253,7 +254,7 @@
}
public void init(ServiceID id, DeployedComponentID deployedComponentID,
- Properties props, ClientServiceRegistry listenerRegistry){
+ Properties props, ClientServiceRegistry listenerRegistry, ClassLoaderManager
clManager){
}
public void setInitException(Throwable t) {
Modified:
trunk/server/src/test/java/com/metamatrix/platform/service/controller/FakeService.java
===================================================================
---
trunk/server/src/test/java/com/metamatrix/platform/service/controller/FakeService.java 2009-05-20
02:07:14 UTC (rev 984)
+++
trunk/server/src/test/java/com/metamatrix/platform/service/controller/FakeService.java 2009-05-20
02:53:44 UTC (rev 985)
@@ -28,6 +28,7 @@
import java.util.HashSet;
import java.util.Properties;
+import com.metamatrix.common.application.ClassLoaderManager;
import com.metamatrix.common.comm.ClientServiceRegistry;
import com.metamatrix.common.config.api.DeployedComponentID;
import com.metamatrix.common.queue.WorkerPoolStats;
@@ -102,7 +103,7 @@
return this.test1Count;
}
public void init(ServiceID id, DeployedComponentID deployedComponentID,
- Properties props, ClientServiceRegistry listenerRegistry){
+ Properties props, ClientServiceRegistry listenerRegistry, ClassLoaderManager
clManager){
}
public void setInitException(Throwable t) {
}