diff options
Diffstat (limited to '')
69 files changed, 0 insertions, 5995 deletions
diff --git a/branches/sca-equinox/modules/data-engine-helper/LICENSE b/branches/sca-equinox/modules/data-engine-helper/LICENSE deleted file mode 100644 index 8aa906c321..0000000000 --- a/branches/sca-equinox/modules/data-engine-helper/LICENSE +++ /dev/null @@ -1,205 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - diff --git a/branches/sca-equinox/modules/data-engine-helper/META-INF/README b/branches/sca-equinox/modules/data-engine-helper/META-INF/README deleted file mode 100644 index 009570154d..0000000000 --- a/branches/sca-equinox/modules/data-engine-helper/META-INF/README +++ /dev/null @@ -1 +0,0 @@ -This directory contains a generated MANIFEST.MF file. diff --git a/branches/sca-equinox/modules/data-engine-helper/NOTICE b/branches/sca-equinox/modules/data-engine-helper/NOTICE deleted file mode 100644 index fdfa0e9faa..0000000000 --- a/branches/sca-equinox/modules/data-engine-helper/NOTICE +++ /dev/null @@ -1,6 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2008 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/branches/sca-equinox/modules/data-engine-helper/pom.xml b/branches/sca-equinox/modules/data-engine-helper/pom.xml deleted file mode 100644 index c8a4689650..0000000000 --- a/branches/sca-equinox/modules/data-engine-helper/pom.xml +++ /dev/null @@ -1,142 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-modules</artifactId> - <version>1.4-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> - <artifactId>tuscany-data-engine-helper</artifactId> - <name>Apache Tuscany SCA Data Engine Helper</name> - - <repositories> - <repository> - <id>apache.incubator</id> - <url>http://people.apache.org/repo/m2-incubating-repository</url> - </repository> - </repositories> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany.das</groupId> - <artifactId>tuscany-das-rdb</artifactId> - <version>1.0-SNAPSHOT</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-assembly</artifactId> - <version>1.4-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-core</artifactId> - <version>1.4-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-interface</artifactId> - <version>1.4-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-assembly-xml</artifactId> - <version>1.4-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-contribution-impl</artifactId> - <version>1.4-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-sca-api</artifactId> - <version>1.4-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-databinding</artifactId> - <version>1.4-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-implementation-java-runtime</artifactId> - <version>1.4-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-host-embedded</artifactId> - <version>1.4-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.easymock</groupId> - <artifactId>easymock</artifactId> - <version>2.2</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derby</artifactId> - <version>10.3.1.4</version> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <finalName>${artifactId}</finalName> - - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - - <configuration> - <instructions> - <Bundle-Version>${tuscany.version}</Bundle-Version> - <Bundle-SymbolicName>org.apache.tuscany.sca.data.engine.helper</Bundle-SymbolicName> - <Bundle-Description>${pom.name}</Bundle-Description> - <Export-Package>org.apache.tuscany.sca.data.engine*</Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> - -</project> diff --git a/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/ConnectionInfoArtifactProcessor.java b/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/ConnectionInfoArtifactProcessor.java deleted file mode 100644 index 99709857b8..0000000000 --- a/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/ConnectionInfoArtifactProcessor.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.data.engine; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl; -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; -import org.apache.tuscany.sca.contribution.service.ContributionResolveException; -import org.apache.tuscany.sca.contribution.service.ContributionWriteException; -import org.apache.tuscany.sca.data.engine.config.ConnectionInfo; -import org.apache.tuscany.sca.data.engine.config.ConnectionProperties; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.monitor.Problem; -import org.apache.tuscany.sca.monitor.Problem.Severity; - -/** - * Implements a StAX artifact processor for ConnectionInfo. - * This processor is shared between implementation.das and implementation.data component type implementations, - * and can be used for other applications that require database connectivity information. - * - * The artifact processor is responsible for processing <ConnectionInfo> - * elements in SCA assembly XML composite files. - * - * @version $Rev$ $Date$ - */ -public class ConnectionInfoArtifactProcessor implements StAXArtifactProcessor<ConnectionInfo> { - public static final QName CONNECTION_INFO = new QName(Constants.SCA10_TUSCANY_NS, "connectionInfo"); - private static final QName CONNECTION_PROPERTIES = new QName(Constants.SCA10_TUSCANY_NS, "connectionProperties"); - - private Monitor monitor; - public ConnectionInfoArtifactProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { - this.monitor = monitor; - } - - public QName getArtifactType() { - // Returns the QName of the XML element processed by this processor - return CONNECTION_INFO; - } - - /** - * Report a exception. - * - * @param problems - * @param message - * @param model - */ - private void error(String message, Object model, Exception ex) { - if (monitor != null) { - Problem problem = new ProblemImpl(this.getClass().getName(), "dataengine-helper-validation-messages", Severity.ERROR, model, message, ex); - monitor.problem(problem); - } - } - - public Class<ConnectionInfo> getModelType() { - // Returns the type of model processed by this processor - return ConnectionInfo.class; - } - - /* - * <component name="CompanyDataComponent"> - * <implementation.data table="company"> - * - * <connectionInfo> - * <connectionProperties - * driverClass="org.apache.derby.jdbc.EmbeddedDriver" - * databaseURL="jdbc:derby:target/test-classes/dastest; create = true" - * loginTimeout="600000"/> - * </connectionInfo> - * - * </implementation.data> - * </component> - */ - public ConnectionInfo read(XMLStreamReader reader) throws ContributionReadException { - assert CONNECTION_INFO.equals(reader.getName()); - - // Create a ConnectionInfo from the component type model - ConnectionInfo connectionInfo = new ConnectionInfo(); - - /* - * <connectionInfo dataSource="jdbc:derby:target/test-classes/dastest; create = true"/> - */ - String dataSource = reader.getAttributeValue(null, "datasource"); // exclusive with connection properties - if (dataSource != null && dataSource.length() > 0) { - connectionInfo.setDataSource(dataSource); - } else { - try { - int event = reader.next(); - while (event == XMLStreamConstants.CHARACTERS) { - event = reader.next(); - } - } catch (XMLStreamException e) { - ContributionReadException ce = new ContributionReadException(e); - error("ContributionReadException", reader, ce); - throw ce; - } - - QName element = reader.getName(); - - assert CONNECTION_PROPERTIES.equals(element); - - /* - * <connectionProperties - * driverClass="org.apache.derby.jdbc.EmbeddedDriver" - * databaseURL="jdbc:derby:target/test-classes/dastest; create = true" - * username="" - * password="" - * loginTimeout="600000"/> - */ - - String driverClass = reader.getAttributeValue(null, "driverClass"); - String databaseURL = reader.getAttributeValue(null, "databaseURL"); - String username = reader.getAttributeValue(null, "username"); - String password = reader.getAttributeValue(null, "password"); - String loginTimeout = reader.getAttributeValue(null, "loginTimeout"); - - // FIXME: validation sending info to monitor.... - ConnectionProperties connectionProperties = new ConnectionProperties(); - connectionProperties.setDriverClass(driverClass); - connectionProperties.setDatabaseURL(databaseURL); - connectionProperties.setUsername(username); - connectionProperties.setPassword(password); - if (loginTimeout != null) { - connectionProperties.setLoginTimeout(Integer.parseInt(loginTimeout)); - } - - connectionInfo.setConnectionProperties(connectionProperties); - } - - return connectionInfo; - } - - public void resolve(ConnectionInfo impl, ModelResolver resolver) throws ContributionResolveException { - - } - - public void write(ConnectionInfo connectionInfo, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { - - writer.writeStartElement(CONNECTION_INFO.getNamespaceURI(), CONNECTION_INFO.getLocalPart()); - - if (connectionInfo.getDataSource() != null) { - writer.writeAttribute("dataSource", connectionInfo.getDataSource()); - } - - ConnectionProperties connectionProperties = connectionInfo.getConnectionProperties(); - if (connectionProperties != null) { - writer.writeStartElement(CONNECTION_PROPERTIES.getNamespaceURI(), CONNECTION_PROPERTIES.getLocalPart()); - - if (connectionProperties.getDriverClass() != null) { - writer.writeAttribute("driverClass", connectionProperties.getDriverClass()); - } - if (connectionProperties.getDatabaseURL() != null) { - writer.writeAttribute("databaseURL", connectionProperties.getDatabaseURL()); - } - if (connectionProperties.getUsername() != null) { - writer.writeAttribute("username", connectionProperties.getUsername()); - } - if (connectionProperties.getPassword() != null) { - writer.writeAttribute("password", connectionProperties.getPassword()); - } - if (connectionProperties.getLoginTimeout() != null) { - writer.writeAttribute("loginTimeout", String.valueOf(connectionProperties.getLoginTimeout())); - } - - writer.writeEndElement(); - } - - - writer.writeEndElement(); - - } -} diff --git a/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/DataAccessEngine.java b/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/DataAccessEngine.java deleted file mode 100644 index aef9ac3261..0000000000 --- a/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/DataAccessEngine.java +++ /dev/null @@ -1,286 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.data.engine;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.das.rdb.Command;
-import org.apache.tuscany.das.rdb.DAS;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.Property;
-
-/**
- * Facade to hide DAS implementation details of handling commands
- *
- * @version $Rev$ $Date$
- */
-public class DataAccessEngine {
- private final DAS das;
-
- public DataAccessEngine(DAS das) {
- this.das = das;
- }
-
- public DataObject executeGet(ArrayList keyVals, String table, String key) {//TODO need to consider compound keys
- try {
- String sqlQuery = "select * from " + table.toUpperCase();
- List<String> keys = null;
-
- if(key == null) {
- if(keyVals != null && keyVals.size() == 1) {
- sqlQuery += " where ID = " + keyVals.get(0);
- }
- } else {//can be other than ID , can be compound keys
- keys = getKeys(key);
- if(keyVals.size() != keys.size()) {
- throw new RuntimeException("One or more PK values missing");
- }
-
- sqlQuery += " where ";
-
- for(int i=0; i<keys.size(); i++) {
- sqlQuery += keys.get(i)+" = ? AND ";
- }
-
- sqlQuery = sqlQuery.substring(0, sqlQuery.lastIndexOf(" AND "));
- }
-
- Command command = this.das.createCommand(sqlQuery);
-
- if(key != null) {
- for(int i=1; i<=keyVals.size(); i++) {
- command.setParameter(i, keyVals.get(i-1));
- }
- }
-
- DataObject returnDO = command.executeQuery();
- return returnDO;
- } catch (Exception e) {
- //e.printStackTrace();
- throw new RuntimeException(e);
- }
- }
-
- /**
- *
- * @param table table'e Type name - should be same as table name
- * @param key column's Property name - should be same as column name
- * @return
- */
- public Map<Object, DataObject> executeGetAll(String table, String key) {
- try {
- String sqlQuery = "select * from " + table.toUpperCase();
- Command command = this.das.createCommand(sqlQuery);
- DataObject result = command.executeQuery();
- List<String> keys = getKeys(key);
- List<DataObject> resultDataObjects = result.getList(table);
-
- return getMappedDataObjects(resultDataObjects, keys);
- } catch (Exception e) {
- //e.printStackTrace();
- throw new RuntimeException(e);
- }
- }
-
- public Map<Object, DataObject> executeQuery(String queryString, String table, String key) {
- try {
- Command command = this.das.createCommand(queryString);
- DataObject result = command.executeQuery();
- List<String> keys = getKeys(key);
- List<DataObject> resultDataObjects = result.getList(table);
-
- return getMappedDataObjects(resultDataObjects, keys);
- } catch (Exception e) {
- //e.printStackTrace();
- throw new RuntimeException(e);
- }
- }
-
- //origDataObject should be with change summary. table, pk is already known to DAS, so no need to have these here
- public void executePut(DataObject origDataObject) {
- this.das.applyChanges(origDataObject);
- return;
- }
-
- //return PK/s
- public ArrayList executePost(DataObject origDataObject, String table, String key){
- //TODO check that PKs are present before insert - this is not correct for auto incr PKs, so let it be upto user whether to send PK or not
- /*List<String> keys = getKeys(key);
- for(int i=0; i<keys.size(); i++) {
- String currentKey = keys.get(i);
- Object currentKeyValue = origDataObject.get(currentKey);
- if(currentKeyValue == null) {
- throw new RuntimeException("PK missing during INSERT");
- }
- }*/
-
- String sqlString = "insert into "+table+" (";
- List props = origDataObject.getType().getProperties();
- if(props.size() != 0) {
- for(int i=0; i<props.size(); i++) {
- String currPropName = ((Property)props.get(i)).getName();
- if(origDataObject.get(currPropName) != null) {
- sqlString += currPropName+",";
- }
- }
- sqlString = sqlString.substring(0, sqlString.length()-1);
- sqlString += ") values (";
- for(int i=0; i<props.size(); i++) {
- String currPropName = ((Property)props.get(i)).getName();
- if(origDataObject.get(currPropName) != null) {
- sqlString += "?,";
- }
- }
-
- sqlString = sqlString.substring(0, sqlString.length()-1);
- sqlString += ")";
-
- Command insertCommand = this.das.createCommand(sqlString);
- int paramIdx = 1;
- for(int i=1; i<=props.size(); i++) {
- String currPropName = ((Property)props.get(i-1)).getName();
- if(origDataObject.get(currPropName) != null) {
- insertCommand.setParameter(paramIdx, origDataObject.get(currPropName));
- paramIdx++;
- }
- }
-
- insertCommand.execute();
-
- //there can be different possibilities
- //1- there is autogen key - insertCommand.getGeneratedKey() will return value and not exception
- //2- there is no autogen key - insertCommand.getGeneratedKey() will return exception and value needs to be taken from origDataObject
- //for 2 it is straight forward to know the column name same as property name
- //for 1 it is possible for only 1 column so no question of compound PK
-
- //now get the PK/s to be returned
- ArrayList pks = new ArrayList();
-
- try {
- int newId = insertCommand.getGeneratedKey();
- pks.add(newId);
- return pks;
- } catch(Exception e) {
- List<String> keys = getKeys(key);
- for(int i=0; i<keys.size(); i++) {
- String currentKey = keys.get(i);
- Object currentKeyValue = origDataObject.get(currentKey);
- if(currentKeyValue == null) {
- throw new RuntimeException("PK missing during INSERT");
- }
- pks.add(currentKeyValue);
- }
- return pks;
- }
-
- }
- return null;
- }
-
- //when keyVal is null can be used as deleteAll
- public void executeDelete(ArrayList keyVals, String table, String key) {
- try {
- String sqlQuery = "select * from " + table.toUpperCase();
- List<String> keys = null;
-
- if(key == null) {
- if(keyVals != null && keyVals.size() == 1) {
- sqlQuery += " where ID = " + keyVals.get(0);
- }
- } else {//can be other than ID , can be compound keys
- keys = getKeys(key);
- if(keyVals.size() != keys.size()) {
- throw new RuntimeException("One or more PK values missing");
- }
-
- sqlQuery += " where ";
-
- for(int i=0; i<keys.size(); i++) {
- sqlQuery += keys.get(i)+" = ? AND ";
- }
-
- sqlQuery = sqlQuery.substring(0, sqlQuery.lastIndexOf(" AND "));
- }
-
- Command command = this.das.createCommand(sqlQuery);
-
- if(key != null) {
- for(int i=1; i<=keyVals.size(); i++) {
- command.setParameter(i, keyVals.get(i-1));
- }
- }
-
- DataObject result = command.executeQuery();
- List<DataObject> resultDOs = result.getList(table);
- if(resultDOs != null) {
- for(int i=0; i<resultDOs.size(); i++) {
- ((DataObject)resultDOs.get(i)).delete();
- }
- }
- this.das.applyChanges(result);
- } catch (Exception e) {
- //e.printStackTrace();
- throw new RuntimeException(e);
- }
- }
-
- public Map<Object, DataObject> getMappedDataObjects(List<DataObject> resultDataObjects, List<String> keys) {
- Map<Object, DataObject> resultMap = new HashMap<Object, DataObject>();
- ArrayList<Object> keyCols = null;
- for(int j=0; j<resultDataObjects.size(); j++) {
- DataObject currentDO = resultDataObjects.get(j);
-
- keyCols = new ArrayList<Object>();
- for(int i=0; i<keys.size(); i++) {
- String currentKey = keys.get(i);
- Object currentKeyValue = currentDO.get(currentKey);
- keyCols.add(currentKeyValue);
- }
-
- resultMap.put(keyCols, currentDO);
- }
- return resultMap;
- }
-
- public static List<String> getKeys(String key) {
- String[] keys = key.split(",");
- return Arrays.asList(keys);
- }
-
- public DataObject executeCommand(String commandName) {
- try {
- Command command = this.das.getCommand(commandName);
- return command.executeQuery();
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- }
-
- public DataObject executeCommand(String commandName, String xPath) {
- DataObject root = executeCommand(commandName);
- return root.getDataObject(xPath);
- }
-}
diff --git a/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/DataAccessEngineManager.java b/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/DataAccessEngineManager.java deleted file mode 100644 index 572c190037..0000000000 --- a/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/DataAccessEngineManager.java +++ /dev/null @@ -1,141 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.data.engine;
-
-import java.io.InputStream;
-import java.util.List;
-
-import org.apache.tuscany.das.rdb.ConfigHelper;
-import org.apache.tuscany.das.rdb.DAS;
-import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper;
-import org.apache.tuscany.sca.data.engine.config.ConnectionInfo;
-
-/**
- * The DataAccessEngineManager acts like a registry and factory for DAS instances
- * It holds DAS by it's config file name, reusing the same DAS for all components
- * using the same config file.
- *
- * @version $Rev$ $Date$
- */
-public class DataAccessEngineManager {
- //private final Map<String, DAS> registry = new HashMap<String, DAS>();
-
- public DataAccessEngineManager() {
- super();
- }
-
- protected DAS initializeDAS(String config, ConnectionInfo connectionInfo, String table, String pkColumns) throws MissingConfigFileException {
- //load the config file
- //System.out.println("Initializing DAS");
-
- ConfigHelper configHelper;
-
- if(config == null) {
- //no config information
- configHelper = new ConfigHelper();
- } else {
- //initialize the config helper by loading config file
- configHelper = new ConfigHelper(this.getConfigStream(config));
- }
-
- //add additional connectionInfo if provided in the SCA Composite file
- if( connectionInfo != null) {
- String dataSource = connectionInfo.getDataSource();
- if(dataSource != null && dataSource.length() > 0) {
- configHelper.addConnectionInfo(dataSource);
- } else {
- String driverClass = connectionInfo.getConnectionProperties().getDriverClass();
- String connectionURL = connectionInfo.getConnectionProperties().getDatabaseURL();
- String userName = connectionInfo.getConnectionProperties().getUsername();
- String password = connectionInfo.getConnectionProperties().getPassword();
- int loginTimeout = connectionInfo.getConnectionProperties().getLoginTimeout();
-
- configHelper.addConnectionInfo(driverClass, connectionURL, userName, password, loginTimeout);
- }
-
- }
-
- if(table != null && pkColumns != null) {
- MappingWrapper configWrapper = new MappingWrapper(configHelper.getConfig());
- List<String> pkColsList = DataAccessEngine.getKeys(pkColumns);
- for(int i=0; i<pkColsList.size(); i++) {
- configWrapper.addPrimaryKey(table+"."+pkColsList.get(i), pkColsList.get(i));
- }
- }
-
- DAS das = DAS.FACTORY.createDAS(configHelper.getConfig());
-
- return das;
- }
-
-/*
- public DAS getDAS(String config) throws MissingConfigFileException {
- //DAS das = registry.get(config);
- //if ( das == null) {
- // das = this.initializeDAS(config);
- // this.registry.put(config, das);
- //}
- return initializeDAS(config, null);
- }
-
- public DAS getDAS(ConnectionInfo connectionInfo) {
- assert connectionInfo != null;
-
- //FIXME: cache the das, we need to define the keys to use (datasource and databaseurl + hashed(username + password))
- DAS das = null;
- try {
- das = initializeDAS(null, connectionInfo);
- }catch (MissingConfigFileException e) {
- //this should never happen, as configFile == null
- }
-
- return das;
- }
-*/
- public DAS getDAS(String config, ConnectionInfo connectionInfo) throws MissingConfigFileException {
- assert connectionInfo != null;
-
- //FIXME: cache the das, we need to define the keys to use (datasource and databaseurl + hashed(username + password))
-
- return initializeDAS(config, connectionInfo, null, null);
- }
-
- public DAS getDAS(String config, ConnectionInfo connectionInfo, String table, String pkColumns) throws MissingConfigFileException {
- assert connectionInfo != null;
-
- //FIXME: cache the das, we need to define the keys to use (datasource and databaseurl + hashed(username + password))
-
- return initializeDAS(config, connectionInfo, table, pkColumns);
- }
-
- protected InputStream getConfigStream(String config) throws MissingConfigFileException{
- InputStream configStream = null;
-
- try {
- configStream = this.getClass().getClassLoader().getResourceAsStream(config);
- } catch (Exception e) {
- throw new MissingConfigFileException(config);
- }
-
- return configStream;
- }
-
-
-}
diff --git a/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/MissingConfigFileException.java b/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/MissingConfigFileException.java deleted file mode 100644 index a010e089e9..0000000000 --- a/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/MissingConfigFileException.java +++ /dev/null @@ -1,44 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.data.engine;
-
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-
-
-/**
- * Exception to be used when DAS configuration side file is not available
- *
- * @version $Rev$ $Date$
- */
-public class MissingConfigFileException extends ContributionReadException {
-
- private static final long serialVersionUID = -2616590185174691724L;
-
- public MissingConfigFileException(String message) {
- super(message);
- }
-
- public MissingConfigFileException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public MissingConfigFileException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/config/ConnectionInfo.java b/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/config/ConnectionInfo.java deleted file mode 100644 index c72308f733..0000000000 --- a/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/config/ConnectionInfo.java +++ /dev/null @@ -1,47 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.data.engine.config;
-
-/**
- * Database connection information to be used for implementation.data
- *
- * @version $Rev$ $Date$
- */
-public class ConnectionInfo {
- private ConnectionProperties connectionProperties;
-
- private String dataSource;
-
- public String getDataSource() {
- return this.dataSource;
- }
-
- public void setDataSource(String dataSource) {
- this.dataSource = dataSource;
- }
-
- public ConnectionProperties getConnectionProperties() {
- return this.connectionProperties;
- }
-
- public void setConnectionProperties(ConnectionProperties connectionProperties) {
- this.connectionProperties = connectionProperties;
- }
-
-}
diff --git a/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/config/ConnectionProperties.java b/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/config/ConnectionProperties.java deleted file mode 100644 index df08a970b3..0000000000 --- a/branches/sca-equinox/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/config/ConnectionProperties.java +++ /dev/null @@ -1,78 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.data.engine.config;
-
-/**
- * Database connection properties to be used for implementation.data
- *
- * @version $Rev$ $Date$
- */
-public class ConnectionProperties {
-
- private String driverClass;
-
- private String databaseURL;
-
- private String userName;
-
- private String password;
-
- private Integer loginTimeOut;
-
- public String getDriverClass() {
- return this.driverClass;
- }
-
- public void setDriverClass(String driverClass) {
- this.driverClass = driverClass;
- }
-
- public String getDatabaseURL() {
- return this.databaseURL;
- }
-
- public void setDatabaseURL(String databaseURL) {
- this.databaseURL = databaseURL;
- }
-
- public String getUsername() {
- return this.userName;
- }
-
- public void setUsername(String userName) {
- this.userName = userName;
- }
-
- public String getPassword() {
- return this.password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public Integer getLoginTimeout() {
- return this.loginTimeOut;
- }
-
- public void setLoginTimeout(Integer loginTimeOut) {
- this.loginTimeOut = loginTimeOut;
- }
-
-}
diff --git a/branches/sca-equinox/modules/data-engine-helper/src/main/resources/dataengine-helper-validation-messages.properties b/branches/sca-equinox/modules/data-engine-helper/src/main/resources/dataengine-helper-validation-messages.properties deleted file mode 100644 index b040d69cc5..0000000000 --- a/branches/sca-equinox/modules/data-engine-helper/src/main/resources/dataengine-helper-validation-messages.properties +++ /dev/null @@ -1,21 +0,0 @@ -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# -ContributionReadException = ContributionReadException occured due to :
\ No newline at end of file diff --git a/branches/sca-equinox/modules/implementation-das/LICENSE b/branches/sca-equinox/modules/implementation-das/LICENSE deleted file mode 100644 index 8aa906c321..0000000000 --- a/branches/sca-equinox/modules/implementation-das/LICENSE +++ /dev/null @@ -1,205 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - diff --git a/branches/sca-equinox/modules/implementation-das/META-INF/README b/branches/sca-equinox/modules/implementation-das/META-INF/README deleted file mode 100644 index 009570154d..0000000000 --- a/branches/sca-equinox/modules/implementation-das/META-INF/README +++ /dev/null @@ -1 +0,0 @@ -This directory contains a generated MANIFEST.MF file. diff --git a/branches/sca-equinox/modules/implementation-das/NOTICE b/branches/sca-equinox/modules/implementation-das/NOTICE deleted file mode 100644 index fdfa0e9faa..0000000000 --- a/branches/sca-equinox/modules/implementation-das/NOTICE +++ /dev/null @@ -1,6 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2008 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/branches/sca-equinox/modules/implementation-das/README b/branches/sca-equinox/modules/implementation-das/README deleted file mode 100644 index 763daafe46..0000000000 --- a/branches/sca-equinox/modules/implementation-das/README +++ /dev/null @@ -1,78 +0,0 @@ -Implementation CRUD Sample
-==========================
-This sample demonstrates how new implementation types are constructed for
-Apache Tuscany SCA.
-
-The README in the samples directory (the directory above this) provides
-general instructions about building and running samples. Take a look there
-first.
-
-If you want to try out the crud implementation type that this sample provides
-please see the implementation-crud-client sample that provides the necessary
-client code to bring up an application that uses this implementation-crud
-
-Sample Overview
----------------
-This sample contains a CRUD implementation type as an example of how to create
-new implementation types. Components using this implementation type always
-expose the same Create, Retrieve, Update and Delete interface. This sample
-uses a singleton ResourceManager to perform the CRUD operations but of course
-a real component would provide a real implementation.
-
-implementation-crud/
- src/
- main/
- java/
- crud/ - implementation model interfaces
- crud.backend/ - fake component implementation
- crud.impl/ - implementations of the model interfaces
- crud.module/ - gets the implementation-crud module registered
- with the SCA runtime
- crud.provider/ - runtime implementation
- resources/
- crud.composite - the SCA assembly used during unit testing
-
- build.xml - the Ant build file
- pom.xml - the Maven build file
-
-Building The Sample Extension Using Ant
------------------------------------------
-With the binary distribution the sample extension can be built using Ant as
-follows
-
-cd implementation-crud
-ant compile
-
-See the sample implementation-crud-client to run a sample that uses this
-binding.
-
-Building The Sample Using Maven
--------------------------------------------
-With either the binary or source distributions the sample can be built
-using Maven as follows.
-
-cd implementation-crud
-mvn
-
-Maven will also test that the sample extension built properly. You should see
-the following output from the test phase.
-
--------------------------------------------------------
- T E S T S
--------------------------------------------------------
-Running crud.CRUDTestCase
-Starting CRUDServiceComponent
-create(ABC) in tmp
-retrieve(0)
-update(0)
-retrieve(0)
-delete(0)
-retrieve(0)
-Stopping CRUDServiceComponent
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.212 sec
-
-Results :
-
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
-
-This shows that the Junit test cases have run successfully.
diff --git a/branches/sca-equinox/modules/implementation-das/build.xml b/branches/sca-equinox/modules/implementation-das/build.xml deleted file mode 100644 index ab0d93beb0..0000000000 --- a/branches/sca-equinox/modules/implementation-das/build.xml +++ /dev/null @@ -1,51 +0,0 @@ -<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<project name="implementation-crud" default="compile">
- <property name="test.jar" value="sample-implementation-crud.jar" />
-
- <target name="init">
- <mkdir dir="target/classes"/>
- </target>
-
- <target name="compile" depends="init">
- <javac srcdir="src/main/java"
- destdir="target/classes"
- debug="on"
- source="1.5"
- target="1.5">
- <classpath>
- <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
- </classpath>
- </javac>
- <copy todir="target/classes">
- <fileset dir="src/main/resources"/>
- </copy>
- <jar destfile="target/${test.jar}" basedir="target/classes">
- <manifest>
- <attribute name="Main-Class" value="${test.class}" />
- </manifest>
- </jar>
- </target>
-
- <target name="clean">
- <delete quiet="true" includeemptydirs="true">
- <fileset dir="target"/>
- </delete>
- </target>
-</project>
diff --git a/branches/sca-equinox/modules/implementation-das/company.sql b/branches/sca-equinox/modules/implementation-das/company.sql deleted file mode 100644 index 4911f9e62f..0000000000 --- a/branches/sca-equinox/modules/implementation-das/company.sql +++ /dev/null @@ -1,28 +0,0 @@ ---
--- Licensed to the Apache Software Foundation (ASF) under one
--- or more contributor license agreements. See the NOTICE file
--- distributed with this work for additional information
--- regarding copyright ownership. The ASF licenses this file
--- to you under the Apache License, Version 2.0 (the
--- "License"); you may not use this file except in compliance
--- with the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing,
--- software distributed under the License is distributed on an
--- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
--- KIND, either express or implied. See the License for the
--- specific language governing permissions and limitations
--- under the License.
---
-
-DROP TABLE COMPANY;
-
-CREATE TABLE COMPANY (
- ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY,
- NAME VARCHAR(30));
-
-INSERT INTO COMPANY (NAME) VALUES('ACME Publishing');
-INSERT INTO COMPANY (NAME) VALUES('Do-rite plumbing');
-INSERT INTO COMPANY (NAME) VALUES('MegaCorp');
\ No newline at end of file diff --git a/branches/sca-equinox/modules/implementation-das/pom.xml b/branches/sca-equinox/modules/implementation-das/pom.xml deleted file mode 100644 index b9e42fb6a9..0000000000 --- a/branches/sca-equinox/modules/implementation-das/pom.xml +++ /dev/null @@ -1,187 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-modules</artifactId>
- <version>1.4-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-implementation-das</artifactId>
- <name>Apache Tuscany SCA DAS Implementation Extension</name>
-
- <repositories>
- <repository>
- <id>apache.incubator</id>
- <url>http://people.apache.org/repo/m2-incubating-repository</url>
- </repository>
- </repositories>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.das</groupId>
- <artifactId>tuscany-das-rdb</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-data-engine-helper</artifactId>
- <version>1.4-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.3.1.4</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <finalName>${artifactId}</finalName>
-
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>sql-maven-plugin</artifactId>
- <!-- 1.1 due to MOJO-619 -->
- <version>1.1-SNAPSHOT</version>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.3.1.4</version>
- </dependency>
- </dependencies>
-
- <executions>
- <execution>
- <id>create-db</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
- <url>jdbc:derby:${pom.basedir}/target/test-classes/company;create=true</url>
- <autocommit>true</autocommit>
- <onError>continue</onError>
- <onConnectionError>skip</onConnectionError>
- <delimiter>;</delimiter>
- <srcFiles>
- <srcFile>${pom.basedir}/company.sql</srcFile>
- </srcFiles>
- </configuration>
- </execution>
-
- <!-- Shutdown DB in order to be able to run unit tests -->
- <execution>
- <id>shutdown-database-sothat-test-can-run</id>
- <phase>process-test-resources</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
- <url>jdbc:derby:${pom.basedir}/target/test-classes/company;shutdown=true</url>
- <skipOnConnectionError>true</skipOnConnectionError>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.das</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.das*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
-
- </build>
-
-</project>
diff --git a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/Constants.java b/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/Constants.java deleted file mode 100644 index b0b4b132e6..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/Constants.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.implementation.das; - -/** - * Generic constants used in this implementation - * - * @version $Rev$ $Date$ - */ -public interface Constants { - /** - * Identify Relation Database data store - */ - String DATA_ACCESS_TYPE_RDB = "rdb"; - -} diff --git a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DAS.java b/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DAS.java deleted file mode 100644 index 1fc46ea710..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DAS.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.implementation.das; - -import commonj.sdo.DataObject; - - -/** - * The service interface of a DAS service provided by DAS components. - * - * @version $Rev$ $Date$ - */ -public interface DAS { - - /** - * Execute a DAS Command specified on the DAS config file. - * @param commandName The name of the command - * @return - */ - DataObject executeCommand(String commandName); - - /**Execute a DAS Command specified on the DAS config file, - * and narrow the results based on the provided XPath - * - * @param commandName The name of the command - * @param xPath The xPath filter - * @return - */ - DataObject executeCommand(String commandName, String xPath); - - - -} diff --git a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DASImplementation.java b/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DASImplementation.java deleted file mode 100644 index 0e0c689b41..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DASImplementation.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.implementation.das; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.ConstrainingType; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.data.engine.config.ConnectionInfo; -import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; -import org.apache.tuscany.sca.interfacedef.java.JavaInterface; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; - - -/** - * The model representing a sample DAS implementation in an SCA assembly model. - * - * @version $Rev$ $Date$ - */ -public class DASImplementation implements Implementation { - - private String dasConfig; - private String dataAccessType; - - private ConnectionInfo connectionInfo; - - private boolean unresolved; - private List<Service> services = new ArrayList<Service>(); - - /** - * Constructs a new DAS implementation. - */ - public DASImplementation(AssemblyFactory assemblyFactory, - JavaInterfaceFactory javaFactory) { - - // DAS implementation always provide a single service exposing - // the DAS interface, and have no references and properties - Service dasService = null; - dasService = assemblyFactory.createService(); - dasService.setName("DAS"); - JavaInterface javaInterface; - try { - javaInterface = javaFactory.createJavaInterface(DAS.class); - } catch (InvalidInterfaceException e) { - throw new IllegalArgumentException(e); - } - JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract(); - interfaceContract.setInterface(javaInterface); - dasService.setInterfaceContract(interfaceContract); - - services.add(dasService); - } - - /* DAS Model Information */ - - public String getConfig() { - return this.dasConfig; - } - - public void setConfig(String config) { - this.dasConfig = config; - } - - public String getDataAccessType() { - return this.dataAccessType; - } - - public void setDataAccessType (String dataAccessType) { - this.dataAccessType = dataAccessType; - } - - public ConnectionInfo getConnectionInfo() { - return this.connectionInfo; - } - - public void setConnectionInfo(ConnectionInfo connectionInfo) { - this.connectionInfo = connectionInfo; - } - - /* SCA Model Information */ - - public ConstrainingType getConstrainingType() { - // DAS implementation does not support constrainingTypes - return null; - } - - public List<Property> getProperties() { - // DAS implementation does not support properties - return Collections.emptyList(); - } - - public List<Reference> getReferences() { - // DAS implementation does not support references - return Collections.emptyList(); - } - - public List<Service> getServices() { - return services; - } - - public String getURI() { - // DAS implementation does not have a URI - return null; - } - - public boolean isUnresolved() { - return unresolved; - } - - public void setConstrainingType(ConstrainingType constrainingType) { - // DAS implementation does not support constrainingTypes - } - - public void setURI(String uri) { - // DAS implementation does not have a URI - - } - - public void setUnresolved(boolean undefined) { - this.unresolved = undefined; - } - -} diff --git a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DASImplementationFactory.java b/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DASImplementationFactory.java deleted file mode 100644 index 93d22d2d5a..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DASImplementationFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.implementation.das; - -/** - * A factory for the sample DAS implementation model. - * - * @version $Rev$ $Date$ - */ -public interface DASImplementationFactory { - - /** - * Creates a new CRUD implementation. - * - * @return - */ - DASImplementation createDASImplementation(); - -} diff --git a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DASImplementationProcessor.java b/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DASImplementationProcessor.java deleted file mode 100644 index 0e90c90082..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DASImplementationProcessor.java +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.implementation.das; - -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.ComponentType; -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl; -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; -import org.apache.tuscany.sca.contribution.service.ContributionResolveException; -import org.apache.tuscany.sca.contribution.service.ContributionWriteException; -import org.apache.tuscany.sca.data.engine.ConnectionInfoArtifactProcessor; -import org.apache.tuscany.sca.data.engine.config.ConnectionInfo; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.monitor.Problem; -import org.apache.tuscany.sca.monitor.Problem.Severity; - - -/** - * Implements a StAX artifact processor for DAS implementations. - * - * The artifact processor is responsible for processing <implementation.das> - * elements in SCA assembly XML composite files and populating the DAS - * implementation model, resolving its references to other artifacts in the SCA - * contribution, and optionally write the model back to SCA assembly XML. - * - * @version $Rev$ $Date$ - */ -public class DASImplementationProcessor implements StAXArtifactProcessor<DASImplementation> { - private static final QName IMPLEMENTATION_DAS = new QName(Constants.SCA10_TUSCANY_NS, "implementation.das"); - - private DASImplementationFactory dasFactory; - - private final AssemblyFactory assemblyFactory; - private final JavaInterfaceFactory javaFactory; - private Monitor monitor; - private StAXArtifactProcessor<ConnectionInfo> connectionInfoProcessor; - - public DASImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { - assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); - javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class); - this.monitor = monitor; - this.dasFactory = new DefaultDASImplementationFactory(assemblyFactory, javaFactory); - this.connectionInfoProcessor = new ConnectionInfoArtifactProcessor(modelFactories, this.monitor); - } - - public QName getArtifactType() { - // Returns the QName of the XML element processed by this processor - return IMPLEMENTATION_DAS; - } - - public Class<DASImplementation> getModelType() { - // Returns the type of model processed by this processor - return DASImplementation.class; - } - - /** - * Report a error. - * - * @param problems - * @param message - * @param model - */ - private void error(String message, Object model, Object... messageParameters) { - if (monitor != null) { - Problem problem = new ProblemImpl(this.getClass().getName(), "impl-das-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters); - monitor.problem(problem); - } - } - - /* - * <component name="CompanyDataComponent"> - * <implementation.das config="/CompanyConfig.xml" dataAccessType="rdb"> - * <connectionInfo> - * <connectionProperties - * driverClass="org.apache.derby.jdbc.EmbeddedDriver" - * databaseURL="jdbc:derby:target/test-classes/dastest; create = true" - * loginTimeout="600000"/> - * </connectionInfo> - * </implementation.data> - * </component> - */ - public DASImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - assert IMPLEMENTATION_DAS.equals(reader.getName()); - - // Read an <implementation.das> element - - // Create an initialize the DAS implementation model - DASImplementation implementation = null; - - // Read the das config file attribute. - // This is das configuration side file to use - String config = reader.getAttributeValue(null, "config"); - - // Read the data access type attribute - // This is the type of data store in use (e.g RDB, XML, etc) - String dataAccessType = reader.getAttributeValue(null, "dataAccessType"); - - // Both config and dataAccessType are required attributes, hence validating. - if (config == null || dataAccessType == null) { - if (config == null) - error("ConfigAttributeMissing", reader); - if (dataAccessType == null) - error("DataAccessTypeAttributeMissing", reader); - return implementation; - } - - // Create an initialize the DAS implementation model - implementation = dasFactory.createDASImplementation(); - implementation.setConfig(config); - implementation.setDataAccessType(dataAccessType); - implementation.setUnresolved(true); - - while (true) { - int event = reader.next(); - switch (event) { - - case START_ELEMENT: - if (ConnectionInfoArtifactProcessor.CONNECTION_INFO.equals(reader.getName())) { - - // Read connection info - ConnectionInfo connectionInfo = (ConnectionInfo) connectionInfoProcessor.read(reader); - implementation.setConnectionInfo(connectionInfo); - } - break; - case XMLStreamConstants.END_ELEMENT: - if (IMPLEMENTATION_DAS.equals(reader.getName())) { - return implementation; - } - break; - } - } - } - - public void resolve(DASImplementation impl, ModelResolver resolver) throws ContributionResolveException { - if( impl != null && impl.isUnresolved()) { - //resolve component type - mergeComponentType(resolver, impl); - - //set current implementation resolved - impl.setUnresolved(false); - } - } - - public void write(DASImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { - - writer.writeStartElement(IMPLEMENTATION_DAS.getNamespaceURI(), IMPLEMENTATION_DAS.getLocalPart()); - - if (implementation.getConfig() != null) { - writer.writeAttribute("config", implementation.getConfig()); - } - if (implementation.getDataAccessType() != null) { - writer.writeAttribute("dataAccessType", implementation.getDataAccessType()); - } - - if (implementation.getConnectionInfo() != null) { - connectionInfoProcessor.write(implementation.getConnectionInfo(), writer); - } - - writer.writeEndElement(); - } - - /** - * Merge the componentType from introspection and external file - * @param resolver - * @param impl - */ - private void mergeComponentType(ModelResolver resolver, DASImplementation impl) { - // FIXME: Need to clarify how to merge - ComponentType componentType = getComponentType(resolver, impl); - if (componentType != null && !componentType.isUnresolved()) { - /* - Map<String, Reference> refMap = new HashMap<String, Reference>(); - for (Reference ref : impl.getReferences()) { - refMap.put(ref.getName(), ref); - } - for (Reference reference : componentType.getReferences()) { - refMap.put(reference.getName(), reference); - } - impl.getReferences().clear(); - impl.getReferences().addAll(refMap.values()); - - // Try to match references by type - Map<String, JavaElementImpl> refMembers = impl.getReferenceMembers(); - for (Reference ref : impl.getReferences()) { - if (ref.getInterfaceContract() != null) { - Interface i = ref.getInterfaceContract().getInterface(); - if (i instanceof JavaInterface) { - Class<?> type = ((JavaInterface)i).getJavaClass(); - if (!refMembers.containsKey(ref.getName())) { - JavaElementImpl e = getMemeber(impl, ref.getName(), type); - if (e != null) { - refMembers.put(ref.getName(), e); - } - } - } - } - }*/ - - Map<String, Service> serviceMap = new HashMap<String, Service>(); - for (Service svc : impl.getServices()) { - if(svc != null) { - serviceMap.put(svc.getName(), svc); - } - } - for (Service service : componentType.getServices()) { - serviceMap.put(service.getName(), service); - } - impl.getServices().clear(); - impl.getServices().addAll(serviceMap.values()); - - Map<String, Property> propMap = new HashMap<String, Property>(); - for (Property prop : impl.getProperties()) { - propMap.put(prop.getName(), prop); - } - } - } - - private String getFileName(String filePath) { - int pos = filePath.lastIndexOf("."); - - return filePath.substring(0, pos); - - } - - private ComponentType getComponentType(ModelResolver resolver, DASImplementation impl) { - String dasConfig = this.getFileName(impl.getConfig()); - String componentTypeURI = dasConfig.replace('.', '/') + ".componentType"; - ComponentType componentType = assemblyFactory.createComponentType(); - componentType.setUnresolved(true); - componentType.setURI(componentTypeURI); - componentType = resolver.resolveModel(ComponentType.class, componentType); - if (!componentType.isUnresolved()) { - return componentType; - } - return null; - } -} diff --git a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DefaultDASImplementationFactory.java b/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DefaultDASImplementationFactory.java deleted file mode 100644 index 2e18541b3b..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DefaultDASImplementationFactory.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.implementation.das; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; - - -/** - * A default factory for the DAS implementation model. - * - * @version $Rev$ $Date$ - */ -public class DefaultDASImplementationFactory implements DASImplementationFactory { - - private AssemblyFactory assemblyFactory; - private JavaInterfaceFactory javaFactory; - - public DefaultDASImplementationFactory(AssemblyFactory assemblyFactory, - JavaInterfaceFactory javaFactory) { - this.assemblyFactory = assemblyFactory; - this.javaFactory = javaFactory; - } - - public DASImplementation createDASImplementation() { - return new DASImplementation(assemblyFactory, javaFactory); - } - -} diff --git a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/annotations/Command.java b/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/annotations/Command.java deleted file mode 100644 index c8c3fd75e6..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/annotations/Command.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.implementation.das.annotations; - -/** - * - * @version $Rev$ $Date$ - */ -public @interface Command { - enum TYPE {SELECT, INSERT, DELETE, UPDATE} - - /** - * Defines an Ad hoc command query - * @return - */ - String query() default ""; - - TYPE type() default TYPE.SELECT; -} diff --git a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/provider/DASImplementationProvider.java b/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/provider/DASImplementationProvider.java deleted file mode 100644 index 40f414b7ef..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/provider/DASImplementationProvider.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.implementation.das.provider; - -import org.apache.tuscany.das.rdb.DAS; -import org.apache.tuscany.sca.data.engine.DataAccessEngine; -import org.apache.tuscany.sca.data.engine.DataAccessEngineManager; -import org.apache.tuscany.sca.implementation.das.DASImplementation; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; - -/** - * DAS Implementation provider - * - * @version $Rev$ $Date$ - */ -public class DASImplementationProvider implements ImplementationProvider { - - private RuntimeComponent component; - private DASImplementation implementation; - private final DataAccessEngineManager dataAccessEngineManager; - - /** - * Constructs a new DAS implementation. - */ - public DASImplementationProvider(RuntimeComponent component, DASImplementation implementation) { - this.component = component; - this.implementation = implementation; - this.dataAccessEngineManager = new DataAccessEngineManager(); - } - - public Invoker createInvoker(RuntimeComponentService service, Operation operation) { - DAS das = null; - try { - das = dataAccessEngineManager.getDAS(implementation.getConfig(), implementation.getConnectionInfo()); - } catch(Exception e) { - e.printStackTrace(); - //what now ? - } - DASInvoker invoker = new DASInvoker(operation, new DataAccessEngine(das) ); - return invoker; - } - - public boolean supportsOneWayInvocation() { - return false; - } - - public void start() { - System.out.println("Starting " + component.getName()); - } - - public void stop() { - System.out.println("Stopping " + component.getName()); - } - -} diff --git a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/provider/DASImplementationProviderFactory.java b/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/provider/DASImplementationProviderFactory.java deleted file mode 100644 index 3ce182347c..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/provider/DASImplementationProviderFactory.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.implementation.das.provider; - -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.implementation.das.DASImplementation; -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.provider.ImplementationProviderFactory; -import org.apache.tuscany.sca.runtime.RuntimeComponent; - -/** - * Factory for DAS Implementation Provider - * - * @version $Rev$ $Date$ - */ -public class DASImplementationProviderFactory implements ImplementationProviderFactory<DASImplementation> { - - /** - * Constructs a new DAS implementation. - */ - public DASImplementationProviderFactory(ExtensionPointRegistry extensionPoints) { - } - - public ImplementationProvider createImplementationProvider(RuntimeComponent component, DASImplementation implementation) { - return new DASImplementationProvider(component, implementation); - } - - public Class<DASImplementation> getModelType() { - return DASImplementation.class; - } -} diff --git a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/provider/DASInvoker.java b/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/provider/DASInvoker.java deleted file mode 100644 index 4cd227717c..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/provider/DASInvoker.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.implementation.das.provider; - -import java.lang.reflect.InvocationTargetException; - -import org.apache.tuscany.sca.data.engine.DataAccessEngine; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; - - -/** - * Implements a target invoker for DAS component implementations. - * - * The target invoker is responsible for dispatching invocations to the particular - * component implementation logic. The current component implementation will - * dispatch calls to the DAS APIs to retrieve the requested data from the back-end store - * - * @version $Rev$ $Date$ - */ -public class DASInvoker implements Invoker { - private final Operation operation; - private final DataAccessEngine dataAccessEngine; - - public DASInvoker(Operation operation, DataAccessEngine dataAccessEngine) { - this.operation = operation; - this.dataAccessEngine = dataAccessEngine; - } - - public Message invoke(Message msg) { - try { - Object[] args = msg.getBody(); - Object resp = doTheWork(args); - msg.setBody(resp); - } catch (InvocationTargetException e) { - msg.setFaultBody(e.getCause()); - } - return msg; - } - - public Object doTheWork(Object[] args) throws InvocationTargetException { - //check annotation -// try { -// Method methodDeclaration = this.getClass().getMethod(operation.getName(), null); -// methodDeclaration.getAnnotation(org.apache.tuscany.sca.implementation.das.annotations.Command.class); -// } catch (Exception e) { -// //ignore -// } - - //check if static way - if (operation.getName().equals("executeCommand")) { - String commandName, xPath; - - //simple execute command by name - if( args.length == 1){ - commandName = (String) args[0]; - return this.dataAccessEngine.executeCommand(commandName); - } else { - commandName = (String) args[0]; - xPath = (String) args[1]; - - return this.dataAccessEngine.executeCommand(commandName, xPath); - } - } else { // dynamic mapping to command - - return this.dataAccessEngine.executeCommand(operation.getName()); - } - } -} diff --git a/branches/sca-equinox/modules/implementation-das/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-equinox/modules/implementation-das/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor deleted file mode 100644 index 417195c684..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Implementation class for the artifact processor extension -org.apache.tuscany.sca.implementation.das.DASImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.das,model=org.apache.tuscany.sca.implementation.das.DASImplementation diff --git a/branches/sca-equinox/modules/implementation-das/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/branches/sca-equinox/modules/implementation-das/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory deleted file mode 100644 index 290f05d03e..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the implementation extension
-org.apache.tuscany.sca.implementation.das.provider.DASImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.das.DASImplementation
diff --git a/branches/sca-equinox/modules/implementation-das/src/main/resources/impl-das-validation-messages.properties b/branches/sca-equinox/modules/implementation-das/src/main/resources/impl-das-validation-messages.properties deleted file mode 100644 index a002d3cef0..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/main/resources/impl-das-validation-messages.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# -ConfigAttributeMissing = Attribute 'config' is missing. -DataAccessTypeAttributeMissing = Attribute 'dataAccessType' is missing. - diff --git a/branches/sca-equinox/modules/implementation-das/src/test/java/org/apache/tuscany/sca/implementation/das/DASImplementationProcessorTestCase.java b/branches/sca-equinox/modules/implementation-das/src/test/java/org/apache/tuscany/sca/implementation/das/DASImplementationProcessorTestCase.java deleted file mode 100644 index 8659280891..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/test/java/org/apache/tuscany/sca/implementation/das/DASImplementationProcessorTestCase.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.implementation.das; - -import java.io.StringReader; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamReader; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.data.engine.config.ConnectionInfo; -import org.apache.tuscany.sca.data.engine.config.ConnectionProperties; -import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.monitor.MonitorFactory; -import org.apache.tuscany.sca.monitor.Problem; -import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl; -import org.apache.tuscany.sca.monitor.impl.DefaultMonitorImpl; - -/** - * @version $Rev$ $Date$ - */ -public class DASImplementationProcessorTestCase extends TestCase { - - protected static final QName IMPLEMENTATION_DAS = new QName(Constants.SCA10_TUSCANY_NS, "implementation.das"); - - private static final String COMPOSITE_USING_DATASOURCE = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" - + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.0\" targetNamespace=\"http://data\" name=\"data\">" - + " <component name=\"DasComponent\">" - + " <tuscany:implementation.das config=\"config.xml\" dataAccessType=\"rdb\">" - + " <tuscany:connectionInfo datasource=\"dataSource\"/>" - + " </tuscany:implementation.das>" - + "</component>"; - - private static final String COMPOSITE_USING_CONNECTION_PROPERTIES = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" - + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.0\" targetNamespace=\"http://data\" name=\"data\">" - + " <component name=\"DasComponent\">" - + " <tuscany:implementation.das config=\"config.xml\" dataAccessType=\"rdb\">" - + " <tuscany:connectionInfo>" - + " <tuscany:connectionProperties" - + " driverClass=\"driverClass\"" - + " databaseURL=\"databaseURL\"" - + " loginTimeout=\"1\"/>" - + " </tuscany:connectionInfo>" - + " </tuscany:implementation.das>" - + "</component>"; - - private static final String INVALID_XML = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" - + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.0\" targetNamespace=\"http://data\" name=\"data\">" - + " <component name=\"DasComponent\">" - + " <tuscany:implementation.das>" - + " <tuscany:connectionInfo datasource=\"dataSource\"/>" - + " </tuscany:implementation.das>" - + "</component>"; - - private XMLInputFactory xmlFactory; - private ModelFactoryExtensionPoint modelFactories; - private Monitor monitor; - - @Override - protected void setUp() throws Exception { - super.setUp(); - xmlFactory = XMLInputFactory.newInstance(); - // Create a monitor - MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl(); - if (monitorFactory != null) - this.monitor = monitorFactory.createMonitor(); - modelFactories = new DefaultModelFactoryExtensionPoint(); - AssemblyFactory assemblyFactory = new DefaultAssemblyFactory(); - modelFactories.addFactory(assemblyFactory); - JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory(); - modelFactories.addFactory(javaFactory); - } - - public void testLoadCompositeUsingDatasource() throws Exception { - XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(COMPOSITE_USING_DATASOURCE)); - - DASImplementationProcessor dataProcessor = new DASImplementationProcessor(modelFactories, monitor); - - while(true) { - int event = reader.next(); - if(event == XMLStreamConstants.START_ELEMENT && IMPLEMENTATION_DAS.equals(reader.getName())) { - break; - } - } - - DASImplementation implementation = dataProcessor.read(reader); - - assertNotNull(implementation); - assertEquals("config.xml", implementation.getConfig()); - assertEquals("rdb", implementation.getDataAccessType()); - - ConnectionInfo connInfo = implementation.getConnectionInfo(); - assertNotNull(connInfo); - assertEquals("dataSource", connInfo.getDataSource()); - - ConnectionProperties connProperties = connInfo.getConnectionProperties(); - assertNull(connProperties); - } - - public void testLoadCompositeUsingConnectionProperties() throws Exception { - XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(COMPOSITE_USING_CONNECTION_PROPERTIES)); - - DASImplementationProcessor dataProcessor = new DASImplementationProcessor(modelFactories, monitor); - - while(true) { - int event = reader.next(); - if(event == XMLStreamConstants.START_ELEMENT && IMPLEMENTATION_DAS.equals(reader.getName())) { - break; - } - } - - DASImplementation implementation = dataProcessor.read(reader); - - assertNotNull(implementation); - assertEquals("config.xml", implementation.getConfig()); - assertEquals("rdb", implementation.getDataAccessType()); - - ConnectionInfo connInfo = implementation.getConnectionInfo(); - assertNotNull(connInfo); - assertNull("dataSource", connInfo.getDataSource()); - - ConnectionProperties connProperties = connInfo.getConnectionProperties(); - assertNotNull(connProperties); - assertEquals("driverClass",connProperties.getDriverClass()); - assertEquals("databaseURL",connProperties.getDatabaseURL()); - assertEquals(1,connProperties.getLoginTimeout().intValue()); - } - - /** - * Test loading an INVALID implementation.das element from a contribution metadata stream - */ - public void testLoadInvalid() throws Exception { - XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML)); - - DASImplementationProcessor dataProcessor = new DASImplementationProcessor(modelFactories, monitor); - - while(true) { - int event = reader.next(); - if(event == XMLStreamConstants.START_ELEMENT && IMPLEMENTATION_DAS.equals(reader.getName())) { - break; - } - } - - dataProcessor.read(reader); - Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); - assertNotNull(problem); - assertEquals("DataAccessTypeAttributeMissing", problem.getMessageId()); - } -} diff --git a/branches/sca-equinox/modules/implementation-das/src/test/java/org/apache/tuscany/sca/implementation/das/DASTestCase.java b/branches/sca-equinox/modules/implementation-das/src/test/java/org/apache/tuscany/sca/implementation/das/DASTestCase.java deleted file mode 100644 index 7d8b4181c1..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/test/java/org/apache/tuscany/sca/implementation/das/DASTestCase.java +++ /dev/null @@ -1,73 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.das;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-import commonj.sdo.DataObject;
-
-/**
- * Tests the DAS service
- *
- * @version $Rev$ $Date$
- */
-public class DASTestCase extends TestCase {
-
- private SCADomain scaDomain;
- private DAS dasService;
-
- /**
- * @throws java.lang.Exception
- */
- @Override
- protected void setUp() throws Exception {
- scaDomain = SCADomain.newInstance("das.composite");
- dasService = scaDomain.getService(DAS.class, "DASServiceComponent/DAS");
-
- }
-
- /**
- * @throws java.lang.Exception
- */
- @Override
- protected void tearDown() throws Exception {
- scaDomain.close();
- }
-
-
- public void testExecuteCommand() throws Exception {
- String commandName = "all companies";
-
- DataObject resultRoot= dasService.executeCommand(commandName);
- assertNotNull(resultRoot);
- assertEquals(3, resultRoot.getList("COMPANY").size());
- }
-
- public void testExecuteCommandWithFilter() throws Exception {
- String commandName = "all companies";
-
- DataObject resultRoot= dasService.executeCommand(commandName, "COMPANY[1]");
- assertNotNull(resultRoot);
- }
-
-
-}
diff --git a/branches/sca-equinox/modules/implementation-das/src/test/java/org/apache/tuscany/sca/implementation/das/company/CompanyService.java b/branches/sca-equinox/modules/implementation-das/src/test/java/org/apache/tuscany/sca/implementation/das/company/CompanyService.java deleted file mode 100644 index 63d0c92683..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/test/java/org/apache/tuscany/sca/implementation/das/company/CompanyService.java +++ /dev/null @@ -1,33 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.das.company;
-
-import org.apache.tuscany.sca.implementation.das.annotations.Command;
-
-import commonj.sdo.DataObject;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public interface CompanyService {
- @Command(query="select * from COMPANY")
- DataObject getCompanies();
-}
diff --git a/branches/sca-equinox/modules/implementation-das/src/test/java/org/apache/tuscany/sca/implementation/das/company/CompanyServiceTestCase.java b/branches/sca-equinox/modules/implementation-das/src/test/java/org/apache/tuscany/sca/implementation/das/company/CompanyServiceTestCase.java deleted file mode 100644 index 565a930ebe..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/test/java/org/apache/tuscany/sca/implementation/das/company/CompanyServiceTestCase.java +++ /dev/null @@ -1,62 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.das.company;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-import commonj.sdo.DataObject;
-
-/**
- * Tests the DAS service
- *
- * @version $Rev$ $Date$
- */
-public class CompanyServiceTestCase extends TestCase {
-
- private SCADomain scaDomain;
- private CompanyService dasCompanyService;
-
- /**
- * @throws java.lang.Exception
- */
- @Override
- protected void setUp() throws Exception {
- scaDomain = SCADomain.newInstance("company.composite");
- dasCompanyService = scaDomain.getService(CompanyService.class, "CompanyServiceComponent/CompanyService");
- }
-
- /**
- * @throws java.lang.Exception
- */
- @Override
- protected void tearDown() throws Exception {
- scaDomain.close();
- }
-
- public void testGetCompanies() throws Exception {
- DataObject root = dasCompanyService.getCompanies();
- assertNotNull(root);
- String nome = root.getString("COMPANY[1]/NAME");
- assertEquals("ACME Publishing", root.getString("COMPANY[1]/NAME"));
- }
-
-}
diff --git a/branches/sca-equinox/modules/implementation-das/src/test/resources/company.componentType b/branches/sca-equinox/modules/implementation-das/src/test/resources/company.componentType deleted file mode 100644 index 5017cfcffd..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/test/resources/company.componentType +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> -<!-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---> -<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" - xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - - <service name="CompanyService"> - <interface.java interface="org.apache.tuscany.sca.implementation.das.company.CompanyService"/> - </service> - -</componentType>
\ No newline at end of file diff --git a/branches/sca-equinox/modules/implementation-das/src/test/resources/company.composite b/branches/sca-equinox/modules/implementation-das/src/test/resources/company.composite deleted file mode 100644 index ee6104360e..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/test/resources/company.composite +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" - targetNamespace="http://sample/das" - name="das">
-
- <component name="CompanyServiceComponent">
- <tuscany:implementation.das config="company.xml" dataAccessType="rdb">
- <tuscany:connectionInfo>
- <tuscany:connectionProperties
- driverClass="org.apache.derby.jdbc.EmbeddedDriver"
- databaseURL="jdbc:derby:target/test-classes/company; create = true"
- loginTimeout="600000"/>
- </tuscany:connectionInfo>
- </tuscany:implementation.das>
- </component>
-</composite>
diff --git a/branches/sca-equinox/modules/implementation-das/src/test/resources/company.xml b/branches/sca-equinox/modules/implementation-das/src/test/resources/company.xml deleted file mode 100644 index 350c8b99ce..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/test/resources/company.xml +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- -->
-<Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
-
- <Command name="getCompanies" SQL="select * from COMPANY" kind="Select"/>
-
- <Command name="all companies" SQL="select * from COMPANY" kind="Select"/>
-
- <Command name="all companies and departments" SQL="select * from COMPANY left outer join DEPARTMENT on COMPANY.ID = DEPARTMENT.COMPANYID" kind="Select"/>
-
- <Command name="all departments for company" SQL="select * from COMPANY inner join DEPARTMENT on COMPANY.ID = DEPARTMENT.COMPANYID where COMPANY.ID = ?" kind="Select"/>
-
- <Command name="company by id with departments" SQL="select * from COMPANY left outer join DEPARTMENT on COMPANY.ID = DEPARTMENT.COMPANYID where COMPANY.ID = ?" kind="Select"/>
-
- <Table tableName="COMPANY">
- <Column columnName="ID" primaryKey="true" generated="true"/>
- </Table>
-
- <Table tableName="DEPARTMENT">
- <Column columnName="ID" primaryKey="true" generated="true"/>
- </Table>
-
- <Relationship name="departments" primaryKeyTable="COMPANY" foreignKeyTable="DEPARTMENT" many="true">
- <KeyPair primaryKeyColumn="ID" foreignKeyColumn="COMPANYID"/>
- </Relationship>
-
-
-</Config>
diff --git a/branches/sca-equinox/modules/implementation-das/src/test/resources/das.composite b/branches/sca-equinox/modules/implementation-das/src/test/resources/das.composite deleted file mode 100644 index e54f4390ac..0000000000 --- a/branches/sca-equinox/modules/implementation-das/src/test/resources/das.composite +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" - targetNamespace="http://sample/das" - name="das">
-
- <component name="DASServiceComponent">
- <tuscany:implementation.das config="company.xml" dataAccessType="rdb">
- <tuscany:connectionInfo>
- <tuscany:connectionProperties
- driverClass="org.apache.derby.jdbc.EmbeddedDriver"
- databaseURL="jdbc:derby:target/test-classes/company; create = true"
- loginTimeout="600000"/>
- </tuscany:connectionInfo>
- </tuscany:implementation.das>
- </component>
-</composite>
diff --git a/branches/sca-equinox/modules/implementation-data-xml/LICENSE b/branches/sca-equinox/modules/implementation-data-xml/LICENSE deleted file mode 100644 index 8aa906c321..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/LICENSE +++ /dev/null @@ -1,205 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - diff --git a/branches/sca-equinox/modules/implementation-data-xml/META-INF/README b/branches/sca-equinox/modules/implementation-data-xml/META-INF/README deleted file mode 100644 index 009570154d..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/META-INF/README +++ /dev/null @@ -1 +0,0 @@ -This directory contains a generated MANIFEST.MF file. diff --git a/branches/sca-equinox/modules/implementation-data-xml/NOTICE b/branches/sca-equinox/modules/implementation-data-xml/NOTICE deleted file mode 100644 index fdfa0e9faa..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/NOTICE +++ /dev/null @@ -1,6 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2008 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/branches/sca-equinox/modules/implementation-data-xml/README b/branches/sca-equinox/modules/implementation-data-xml/README deleted file mode 100644 index 763daafe46..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/README +++ /dev/null @@ -1,78 +0,0 @@ -Implementation CRUD Sample
-==========================
-This sample demonstrates how new implementation types are constructed for
-Apache Tuscany SCA.
-
-The README in the samples directory (the directory above this) provides
-general instructions about building and running samples. Take a look there
-first.
-
-If you want to try out the crud implementation type that this sample provides
-please see the implementation-crud-client sample that provides the necessary
-client code to bring up an application that uses this implementation-crud
-
-Sample Overview
----------------
-This sample contains a CRUD implementation type as an example of how to create
-new implementation types. Components using this implementation type always
-expose the same Create, Retrieve, Update and Delete interface. This sample
-uses a singleton ResourceManager to perform the CRUD operations but of course
-a real component would provide a real implementation.
-
-implementation-crud/
- src/
- main/
- java/
- crud/ - implementation model interfaces
- crud.backend/ - fake component implementation
- crud.impl/ - implementations of the model interfaces
- crud.module/ - gets the implementation-crud module registered
- with the SCA runtime
- crud.provider/ - runtime implementation
- resources/
- crud.composite - the SCA assembly used during unit testing
-
- build.xml - the Ant build file
- pom.xml - the Maven build file
-
-Building The Sample Extension Using Ant
------------------------------------------
-With the binary distribution the sample extension can be built using Ant as
-follows
-
-cd implementation-crud
-ant compile
-
-See the sample implementation-crud-client to run a sample that uses this
-binding.
-
-Building The Sample Using Maven
--------------------------------------------
-With either the binary or source distributions the sample can be built
-using Maven as follows.
-
-cd implementation-crud
-mvn
-
-Maven will also test that the sample extension built properly. You should see
-the following output from the test phase.
-
--------------------------------------------------------
- T E S T S
--------------------------------------------------------
-Running crud.CRUDTestCase
-Starting CRUDServiceComponent
-create(ABC) in tmp
-retrieve(0)
-update(0)
-retrieve(0)
-delete(0)
-retrieve(0)
-Stopping CRUDServiceComponent
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.212 sec
-
-Results :
-
-Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
-
-This shows that the Junit test cases have run successfully.
diff --git a/branches/sca-equinox/modules/implementation-data-xml/build.xml b/branches/sca-equinox/modules/implementation-data-xml/build.xml deleted file mode 100644 index ab0d93beb0..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/build.xml +++ /dev/null @@ -1,51 +0,0 @@ -<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<project name="implementation-crud" default="compile">
- <property name="test.jar" value="sample-implementation-crud.jar" />
-
- <target name="init">
- <mkdir dir="target/classes"/>
- </target>
-
- <target name="compile" depends="init">
- <javac srcdir="src/main/java"
- destdir="target/classes"
- debug="on"
- source="1.5"
- target="1.5">
- <classpath>
- <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
- </classpath>
- </javac>
- <copy todir="target/classes">
- <fileset dir="src/main/resources"/>
- </copy>
- <jar destfile="target/${test.jar}" basedir="target/classes">
- <manifest>
- <attribute name="Main-Class" value="${test.class}" />
- </manifest>
- </jar>
- </target>
-
- <target name="clean">
- <delete quiet="true" includeemptydirs="true">
- <fileset dir="target"/>
- </delete>
- </target>
-</project>
diff --git a/branches/sca-equinox/modules/implementation-data-xml/company.sql b/branches/sca-equinox/modules/implementation-data-xml/company.sql deleted file mode 100644 index 4911f9e62f..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/company.sql +++ /dev/null @@ -1,28 +0,0 @@ ---
--- Licensed to the Apache Software Foundation (ASF) under one
--- or more contributor license agreements. See the NOTICE file
--- distributed with this work for additional information
--- regarding copyright ownership. The ASF licenses this file
--- to you under the Apache License, Version 2.0 (the
--- "License"); you may not use this file except in compliance
--- with the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing,
--- software distributed under the License is distributed on an
--- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
--- KIND, either express or implied. See the License for the
--- specific language governing permissions and limitations
--- under the License.
---
-
-DROP TABLE COMPANY;
-
-CREATE TABLE COMPANY (
- ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY,
- NAME VARCHAR(30));
-
-INSERT INTO COMPANY (NAME) VALUES('ACME Publishing');
-INSERT INTO COMPANY (NAME) VALUES('Do-rite plumbing');
-INSERT INTO COMPANY (NAME) VALUES('MegaCorp');
\ No newline at end of file diff --git a/branches/sca-equinox/modules/implementation-data-xml/pom.xml b/branches/sca-equinox/modules/implementation-data-xml/pom.xml deleted file mode 100644 index 29b53a6d86..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/pom.xml +++ /dev/null @@ -1,209 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
---><project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-modules</artifactId>
- <version>1.4-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-implementation-data-xml</artifactId>
- <name>Apache Tuscany SCA Data Implementation Extension</name>
-
- <repositories>
- <repository>
- <id>apache.incubator</id>
- <url>http://people.apache.org/repo/m2-incubating-repository</url>
- </repository>
- </repositories>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.das</groupId>
- <artifactId>tuscany-das-rdb</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-data-engine-helper</artifactId>
- <version>1.4-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-atom-abdera</artifactId>
- <version>1.4-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.3.1.4</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-jetty</artifactId>
- <version>1.4-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.2</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-data-api</artifactId>
- <version>1.4-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-
- <build>
- <finalName>${artifactId}</finalName>
-
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>sql-maven-plugin</artifactId>
- <!-- 1.1 due to MOJO-619 -->
- <version>1.1-SNAPSHOT</version>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.1.2.1</version>
- </dependency>
- </dependencies>
-
- <executions>
- <execution>
- <id>create-db</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
- <url>jdbc:derby:${pom.basedir}/target/test-classes/company;create=true</url>
- <autocommit>true</autocommit>
- <onError>continue</onError>
- <onConnectionError>skip</onConnectionError>
- <delimiter>;</delimiter>
- <srcFiles>
- <srcFile>${pom.basedir}/company.sql</srcFile>
- </srcFiles>
- </configuration>
- </execution>
-
- <!-- Shutdown DB in order to be able to run unit tests -->
- <execution>
- <id>shutdown-database-sothat-test-can-run</id>
- <phase>process-test-resources</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
- <url>jdbc:derby:${pom.basedir}/target/test-classes/company;shutdown=true</url>
- <skipOnConnectionError>true</skipOnConnectionError>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.data.xml</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.data*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/DATA.java b/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/DATA.java deleted file mode 100644 index 3ce96e58da..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/DATA.java +++ /dev/null @@ -1,64 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.data;
-
-import javax.xml.stream.XMLStreamReader;
-
-/**
- * The service interface of a DAS service provided by DAS components.
- *
- * @version $Rev$ $Date$
- */
-public interface DATA {
-
- /**
- * Retrieve the Database table contents If a id is given, the results will
- * be filtered to a matching row
- *
- * @param id The PK that identifies the row on the table
- * @return The row content in XML format
- */
- XMLStreamReader get(String id);
-
- /**
- * Insert new content in the Database
- *
- * @param insertStream The insertion in XML format
- * @return The number of rows affected
- */
- int insert(XMLStreamReader insertStream);
-
- /**
- * Update the Database table contents
- *
- * @param updateStream The updates in XML format
- * @return The number of rows affected
- */
- int update(XMLStreamReader updateStream);
-
- /**
- * Delete the Database table contents If a id is given, only a specific row
- * will be deleted
- *
- * @param id The PK that identifies the row on the table
- * @return The number of rows affected
- */
- int delete(String id);
-
-}
diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/DATACollection.java b/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/DATACollection.java deleted file mode 100644 index 1dc5673fe5..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/DATACollection.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.implementation.data; - -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.sca.data.collection.Collection; - -public interface DATACollection extends Collection<String, XMLStreamReader> { - -} diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementation.java b/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementation.java deleted file mode 100644 index a50ad89b64..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementation.java +++ /dev/null @@ -1,161 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.data;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.data.engine.config.ConnectionInfo;
-import org.apache.tuscany.sca.implementation.data.jdbc.JDBCHelper;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-
-
-/**
- * The model representing a sample DATA implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-public class DATAImplementation implements Implementation {
- private AssemblyFactory assemblyFactory;
- private JavaInterfaceFactory javaFactory;
-
- private ConnectionInfo connectionInfo;
- private List<Service> services = new ArrayList<Service>();
-
- /**
- * Constructs a new DAS implementation.
- */
- public DATAImplementation(AssemblyFactory assemblyFactory,
- JavaInterfaceFactory javaFactory) {
-
- // DATA implementation provides one service per database table
- // exposing the DATA interface, and have no references and properties
- this.assemblyFactory = assemblyFactory;
- this.javaFactory = javaFactory;
- }
-
- private void introspectServices( AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
- Connection connection = null;
- try {
- connection = JDBCHelper.getConnection(connectionInfo);
- DatabaseMetaData databaseMetaData = connection.getMetaData();
- ResultSet tables = databaseMetaData.getTables(null, null, "%", null);
- while(tables.next()) {
- //create the SCA service for the table
- Service dataService = assemblyFactory.createService();
- Service dataCollectionService = assemblyFactory.createService();
-
- dataService.setName(tables.getString(3)+"_DATA");
- dataCollectionService.setName(tables.getString(3));
-
- JavaInterface dataInterface;
- JavaInterface dataCollectionInterface;
-
- try {
- dataInterface = javaFactory.createJavaInterface(DATA.class);
- dataCollectionInterface = javaFactory.createJavaInterface(DATACollection.class);
- } catch (InvalidInterfaceException e) {
- throw new IllegalArgumentException(e);
- }
- JavaInterfaceContract dataInterfaceContract = javaFactory.createJavaInterfaceContract();
- JavaInterfaceContract dataCollectionInterfaceContract = javaFactory.createJavaInterfaceContract();
-
- dataInterfaceContract.setInterface(dataInterface);
- dataCollectionInterfaceContract.setInterface(dataCollectionInterface);
-
- dataService.setInterfaceContract(dataInterfaceContract);
- dataCollectionService.setInterfaceContract(dataCollectionInterfaceContract);
-
- services.add(dataService);
- services.add(dataCollectionService);
-
- }
- } catch(SQLException e) {
-
- } finally {
- JDBCHelper.cleanupResources(connection, null, null);
- }
- }
-
- public ConnectionInfo getConnectionInfo() {
- return this.connectionInfo;
- }
-
- public void setConnectionInfo(ConnectionInfo connectionInfo) {
- this.connectionInfo = connectionInfo;
- }
-
- public ConstrainingType getConstrainingType() {
- // The sample DATA implementation does not support constrainingTypes
- return null;
- }
-
- public List<Property> getProperties() {
- // The sample DATA implementation does not support properties
- return Collections.emptyList();
- }
-
- public List<Service> getServices() {
- if(services == null || services.size() == 0) {
- introspectServices(assemblyFactory, javaFactory);
- }
- return services;
- }
-
- public List<Reference> getReferences() {
- // The sample DATA implementation does not support references
- return Collections.emptyList();
- }
-
- public String getURI() {
- // The sample DATA implementation does not have a URI
- return null;
- }
-
- public void setConstrainingType(ConstrainingType constrainingType) {
- // The sample DATA implementation does not support constrainingTypes
- }
-
- public void setURI(String uri) {
- // The sample DATA implementation does not have a URI
- }
-
- public boolean isUnresolved() {
- // The sample DATA implementation is always resolved
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- // The sample DATA implementation is always resolved
- }
-}
diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationFactory.java b/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationFactory.java deleted file mode 100644 index d4cf816dbf..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationFactory.java +++ /dev/null @@ -1,44 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.data;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-
-/**
- * A default factory for the DATA implementation model.
- *
- * @version $Rev$ $Date$
- */
-public class DATAImplementationFactory {
-
- private AssemblyFactory assemblyFactory;
- private JavaInterfaceFactory javaFactory;
-
- public DATAImplementationFactory(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
- this.assemblyFactory = assemblyFactory;
- this.javaFactory = javaFactory;
- }
-
- public DATAImplementation createDASImplementation() {
- return new DATAImplementation(assemblyFactory, javaFactory);
- }
-
-}
diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessor.java b/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessor.java deleted file mode 100644 index 16c5a370ec..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessor.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.implementation.data; - -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; -import org.apache.tuscany.sca.contribution.service.ContributionResolveException; -import org.apache.tuscany.sca.contribution.service.ContributionWriteException; -import org.apache.tuscany.sca.data.engine.ConnectionInfoArtifactProcessor; -import org.apache.tuscany.sca.data.engine.config.ConnectionInfo; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; -import org.apache.tuscany.sca.monitor.Monitor; - - -/** - * Implements a StAX artifact processor for DATA implementations. - * - * The artifact processor is responsible for processing <implementation.data> - * elements in SCA assembly XML composite files and populating the DATA - * implementation model, resolving its references to other artifacts in the SCA - * contribution, and optionally write the model back to SCA assembly XML. - * - * @version $Rev$ $Date$ - */ -public class DATAImplementationProcessor implements StAXArtifactProcessor<DATAImplementation> { - protected static final QName IMPLEMENTATION_DATA_XML = new QName(Constants.SCA10_TUSCANY_NS, "implementation.data.xml"); - - private DATAImplementationFactory dataFactory; - private Monitor monitor; - private StAXArtifactProcessor<ConnectionInfo> connectionInfoProcessor; - - public DATAImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { - AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); - JavaInterfaceFactory javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class); - this.monitor = monitor; - this.dataFactory = new DATAImplementationFactory(assemblyFactory, javaFactory); - this.connectionInfoProcessor = new ConnectionInfoArtifactProcessor(modelFactories, this.monitor); - } - - public QName getArtifactType() { - // Returns the qname of the XML element processed by this processor - return IMPLEMENTATION_DATA_XML; - } - - public Class<DATAImplementation> getModelType() { - // Returns the type of model processed by this processor - return DATAImplementation.class; - } - - /* - * <component name="CompanyDataComponent"> - * <implementation.data.xml> - * <connectionInfo> - * <connectionProperties - * driverClass="org.apache.derby.jdbc.EmbeddedDriver" - * databaseURL="jdbc:derby:target/test-classes/dastest; create = true" - * loginTimeout="600000"/> - * </connectionInfo> - * </implementation.data> - * </component> - */ - public DATAImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - assert IMPLEMENTATION_DATA_XML.equals(reader.getName()); - - // Read an <implementation.data.xml> element - - // Create an initialize the DAS implementation model - DATAImplementation implementation = dataFactory.createDASImplementation(); - - while (true) { - int event = reader.next(); - switch (event) { - - case START_ELEMENT: - if (ConnectionInfoArtifactProcessor.CONNECTION_INFO.equals(reader.getName())) { - - // Read connection info - ConnectionInfo connectionInfo = (ConnectionInfo) connectionInfoProcessor.read(reader); - implementation.setConnectionInfo(connectionInfo); - } - break; - case XMLStreamConstants.END_ELEMENT: - if (IMPLEMENTATION_DATA_XML.equals(reader.getName())) { - return implementation; - } - break; - } - } - - } - - public void resolve(DATAImplementation impl, ModelResolver resolver) throws ContributionResolveException { - } - - public void write(DATAImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { - writer.writeStartElement(IMPLEMENTATION_DATA_XML.getNamespaceURI(), IMPLEMENTATION_DATA_XML.getLocalPart()); - - if (implementation.getConnectionInfo() != null) { - connectionInfoProcessor.write(implementation.getConnectionInfo(), writer); - } - - writer.writeEndElement(); - } -} diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/jdbc/JDBCHelper.java b/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/jdbc/JDBCHelper.java deleted file mode 100644 index 265f250717..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/jdbc/JDBCHelper.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.implementation.data.jdbc; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Properties; - -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.sql.DataSource; - -import org.apache.tuscany.das.rdb.exception.DataSourceInitializationException; -import org.apache.tuscany.sca.data.engine.config.ConnectionInfo; - -/** - * JDBC Helper - * - JDBC Connection utility methods - * - JDBC Resource cleanup methods - * - * @version $Rev$ $Date$ - */ -public class JDBCHelper { - - /** - * protected constructor - */ - protected JDBCHelper() { - - } - - /** - * - * @param connectionInfo - * @return - */ - public static Connection getConnection(ConnectionInfo connectionInfo) { - if (connectionInfo.getDataSource() == null && connectionInfo.getConnectionProperties() == null) { - throw new IllegalArgumentException("Not enough information to create Database Connection."); - } - - if(connectionInfo.getDataSource() != null && connectionInfo.getConnectionProperties() != null) { - throw new IllegalArgumentException("Use either dataSource or ConnectionProperties. Can't use both !"); - } - - if(connectionInfo.getDataSource() != null) { - return getDataSourceConnection(connectionInfo); - } else { - return getDriverManagerConnection(connectionInfo); - } - } - - /** - * Initializes a DB connection on a managed environment (e.g inside Tomcat) - * - * @param connectionInfo - * @return - */ - private static Connection getDataSourceConnection(ConnectionInfo connectionInfo) { - Connection connection = null; - - InitialContext ctx; - try { - ctx = new InitialContext(); - } catch (NamingException e) { - throw new RuntimeException(e); - } - try { - DataSource ds = (DataSource) ctx.lookup(connectionInfo.getDataSource()); - try { - connection = ds.getConnection(); - if (connection == null) { - throw new RuntimeException("Could not obtain a Connection from DataSource"); - } - connection.setAutoCommit(false); - } catch (SQLException e) { - throw new RuntimeException(e); - } - } catch (NamingException e) { - throw new RuntimeException(e); - } - - return connection; - } - - /** - * Initialize a DB connection on a J2SE environment - * For more info, see http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/drivermanager.html - * - * @param connectionInfo - * @return - */ - private static Connection getDriverManagerConnection(ConnectionInfo connectionInfo) { - Connection connection = null; - - if (connectionInfo.getConnectionProperties() == null) { - throw new RuntimeException("No existing context and no connection properties"); - } - - if (connectionInfo.getConnectionProperties().getDriverClass() == null) { - throw new RuntimeException("No jdbc driver class specified!"); - } - - try { - Properties p = System.getProperties(); - p.put("derby.system.home", "target"); - - //initialize driver and register it with DriverManager - Class.forName(connectionInfo.getConnectionProperties().getDriverClass()); - - //prepare to initialize connection - String databaseUrl = connectionInfo.getConnectionProperties().getDatabaseURL(); - String userName = connectionInfo.getConnectionProperties().getUsername(); - String userPassword = connectionInfo.getConnectionProperties().getPassword(); - int loginTimeout = connectionInfo.getConnectionProperties().getLoginTimeout(); - - DriverManager.setLoginTimeout(loginTimeout); - if( (userName == null || userName.length() ==0) && (userPassword == null || userPassword.length()==0) ){ - //no username or password supplied - connection = DriverManager.getConnection(databaseUrl); - }else{ - connection = DriverManager.getConnection(databaseUrl, userName, userPassword); - } - - if(connection == null){ - throw new DataSourceInitializationException("Error initializing connection : null"); - } - - //FIXME we should make this flexible, we can't autocommit when participating in transactions - connection.setAutoCommit(true); - - }catch(ClassNotFoundException cnf){ - throw new DataSourceInitializationException("JDBC Driver '" + connectionInfo.getConnectionProperties().getDriverClass() + "' not found", cnf); - }catch(SQLException sqle){ - throw new DataSourceInitializationException(sqle.getMessage(), sqle); - } - - return connection; - } - - /** - * Cleanup and close all JDBC resources in the proper order and ignoring erros - * @param connection The connection to be closed - * @param queryStatement The statement to be closed - * @param resultSet The ResultSet to be closed - */ - public static void cleanupResources(Connection connection, PreparedStatement queryStatement, ResultSet resultSet) { - cleanupResultSet(resultSet); - cleanupPreparedStatement(queryStatement); - cleanupConnection(connection); - } - - /** - * Proper cleanup the ResultSet - * @param resultSet - */ - private static void cleanupResultSet(ResultSet resultSet) { - if (resultSet != null) { - try { - resultSet.close(); - } catch (SQLException e) { - // We should log the error. Since we're trying to close, we don't re-throw. - } - } - } - - /** - * Proper cleanup the prepared statement - * @param queryStatement - */ - private static void cleanupPreparedStatement(PreparedStatement queryStatement) { - if (queryStatement != null) { - try { - queryStatement.close(); - } catch (SQLException e) { - // We should log the error. Since we're trying to close, we don't re-throw. - } - } - } - - /** - * proper cleanup the connection - * @param connection - */ - private static void cleanupConnection(Connection connection) { - if (connection != null) { - try { - connection.close(); - } catch (SQLException e) { - // We should log the error. Since we're trying to close, we don't re-throw. - } - } - } - -} diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/jdbc/JDBCResultSetStreamReader.java b/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/jdbc/JDBCResultSetStreamReader.java deleted file mode 100644 index 316330243b..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/jdbc/JDBCResultSetStreamReader.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.implementation.data.jdbc; - -import java.sql.ResultSet; -import java.sql.SQLException; - -import javax.xml.stream.XMLStreamException; - -import org.apache.tuscany.sca.databinding.xml.XmlTreeStreamReaderImpl; - -/** - * JDBCResultSetStreamReader perform streaming of database tables as XML - * - * @version $Rev$ $Date$ - */ -public class JDBCResultSetStreamReader extends XmlTreeStreamReaderImpl { - private ResultSet resultSet; - - /** - * @param root - */ - public JDBCResultSetStreamReader(ResultSet resultSet) { - super(new ResultSetXmlNodeImpl(resultSet)); - this.resultSet = resultSet; - } - - @Override - public void close() throws XMLStreamException { - try { - resultSet.close(); - } catch (SQLException e) { - } - } -} - diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/jdbc/ResultSetXmlNodeImpl.java b/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/jdbc/ResultSetXmlNodeImpl.java deleted file mode 100644 index 576fe5605d..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/jdbc/ResultSetXmlNodeImpl.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.implementation.data.jdbc; - -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.databinding.xml.SimpleXmlNodeImpl; -import org.apache.tuscany.sca.databinding.xml.XmlNode; - -/** - * @version $Rev$ $Date$ - */ -public class ResultSetXmlNodeImpl implements XmlNode { - private static final String NS = ""; - private static final QName RESULT_SET = new QName(NS, "resultSet"); - private static final QName RECORD = new QName(NS, "record"); - private static final QName COLUMN = new QName(NS, "column"); - private static final QName NAME = new QName(NS, "name"); - - private ResultSet resultSet; - private String[] columnNames; - - /** - * @param resultSet - */ - public ResultSetXmlNodeImpl(ResultSet resultSet) { - super(); - this.resultSet = resultSet; - try { - ResultSetMetaData metaData = resultSet.getMetaData(); - columnNames = new String[metaData.getColumnCount()]; - for (int i = 0; i < columnNames.length; i++) { - columnNames[i] = metaData.getColumnName(i + 1); - } - } catch (SQLException e) { - throw new IllegalStateException(e); - } - } - - /** - * @see org.apache.tuscany.sca.databinding.xml.XmlNode#attributes() - */ - public List<XmlNode> attributes() { - return Collections.emptyList(); - } - - public Type getType() { - return Type.ELEMENT; - } - - - /** - * @see org.apache.tuscany.sca.databinding.xml.XmlNode#children() - */ - public Iterator<XmlNode> children() { - return new ResultSetIteraror(); - } - - private class ResultSetIteraror implements Iterator<XmlNode> { - private Boolean hasNext; - - public ResultSetIteraror() { - } - - public boolean hasNext() { - try { - if (hasNext == null) { - hasNext = resultSet.next(); - } - return hasNext; - } catch (SQLException e) { - throw new IllegalStateException(e); - } - } - - public XmlNode next() { - hasNext(); - hasNext = null; - return new RecordXmlNodeImpl(); - } - - public void remove() { - } - } - - /** - * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getName() - */ - public QName getName() { - return RESULT_SET; - } - - /** - * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getValue() - */ - public String getValue() { - return null; - } - - /** - * @see org.apache.tuscany.sca.databinding.xml.XmlNode#namespaces() - */ - public Map<String, String> namespaces() { - return Collections.emptyMap(); - } - - private class RecordXmlNodeImpl extends XmlNodeImpl { - int index = 0; - - @Override - public Iterator<XmlNode> children() { - return new Iterator<XmlNode>() { - - public boolean hasNext() { - return index < columnNames.length; - } - - public XmlNode next() { - return new ColumnXmlNodeImpl(index++); - } - - public void remove() { - } - - }; - } - - @Override - public QName getName() { - return RECORD; - } - - } - - private class ColumnXmlNodeImpl extends XmlNodeImpl { - private int index; - - /** - * @param index - */ - public ColumnXmlNodeImpl(int index) { - super(); - this.index = index; - } - - @Override - public List<XmlNode> attributes() { - XmlNode attr = new SimpleXmlNodeImpl(NAME, columnNames[index], XmlNode.Type.ATTRIBUTE); - return Arrays.asList(attr); - } - - @Override - public Iterator<XmlNode> children() { - XmlNode[] nodes = {new ValueXmlNodeImpl(index)}; - return Arrays.asList(nodes).iterator(); - } - - @Override - public QName getName() { - return COLUMN; - } - - } - - private class ValueXmlNodeImpl extends XmlNodeImpl { - private int index; - - /** - * @param index - */ - public ValueXmlNodeImpl(int index) { - super(); - this.index = index; - } - - @Override - public String getValue() { - try { - return String.valueOf(resultSet.getObject(index + 1)); - } catch (SQLException e) { - throw new IllegalStateException(e); - } - } - - @Override - public Type getType() { - return Type.CHARACTERS; - } - - } - - private static abstract class XmlNodeImpl implements XmlNode { - - public List<XmlNode> attributes() { - return Collections.emptyList(); - } - - public Iterator<XmlNode> children() { - return null; - } - - public QName getName() { - return null; - } - - public String getValue() { - return null; - } - - public boolean isLeaf() { - return false; - } - - public Map<String, String> namespaces() { - return Collections.emptyMap(); - } - - public Type getType() { - return Type.ELEMENT; - } - - } - - -} diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/provider/DATAImplementationProvider.java b/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/provider/DATAImplementationProvider.java deleted file mode 100644 index bbd963922c..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/provider/DATAImplementationProvider.java +++ /dev/null @@ -1,98 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.data.provider;
-
-import org.apache.tuscany.sca.implementation.data.DATAImplementation;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * DATA Implementation provider
- *
- * @version $Rev$ $Date$
- */
-public class DATAImplementationProvider implements ImplementationProvider {
- //private RuntimeComponent component;
- private DATAImplementation implementation;
-
- /**
- * Constructs a new DATA implementation.
- */
- public DATAImplementationProvider(RuntimeComponent component, DATAImplementation implementation) {
- //this.component = component;
- this.implementation = implementation;
- }
-
- public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
- String operationName = operation.getName();
- String tableName = service.getName();
-
- String interfaceFullName = operation.getInterface().toString();
- int index = interfaceFullName.lastIndexOf(".") + 1;
- String interfaceName = interfaceFullName.substring(index, interfaceFullName.length());
-
- if (interfaceName.equals("DATACollection")) {
-
- if (operationName.equals("getAll")) {
- return new DATAInvoker.GetAllInvoker(operation, implementation.getConnectionInfo(), tableName);
- } else if (operationName.equals("query")) {
- return new DATAInvoker.QueryInvoker(operation, implementation.getConnectionInfo(), tableName);
- } else if (operationName.equals("post")) {
- return new DATAInvoker.PostInvoker(operation, implementation.getConnectionInfo(), tableName);
- } else if (operationName.equals("get")) {
- return new DATAInvoker.GetInvoker(operation, implementation.getConnectionInfo(), tableName);
- } else if (operationName.equals("put")) {
- return new DATAInvoker.PutInvoker(operation, implementation.getConnectionInfo(), tableName);
- } else if (operationName.equals("delete")) {
- return new DATAInvoker.DeleteInvoker(operation, implementation.getConnectionInfo(), tableName);
- }
-
- } else if (interfaceName.equals("DATA")) {
-
- tableName = tableName.split("_")[0];
-
- if (operationName.equals("get")) {
- return new DATAInvoker.GetDATAInvoker(operation, implementation.getConnectionInfo(), tableName);
- } else if (operationName.equals("insert")) {
- return new DATAInvoker.InsertDATAInvoker(operation, implementation.getConnectionInfo(), tableName);
- } else if (operationName.equals("update")) {
- return new DATAInvoker.UpdateDATAInvoker(operation, implementation.getConnectionInfo(), tableName);
- } else if (operationName.equals("delete")) {
- return new DATAInvoker.DeleteDATAInvoker(operation, implementation.getConnectionInfo(), tableName);
- }
- }
-
- return new DATAInvoker(operation, implementation.getConnectionInfo(), tableName);
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
- // System.out.println("Starting " + component.getName());
- }
-
- public void stop() {
- // System.out.println("Stopping " + component.getName());
- }
-}
diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/provider/DATAImplementationProviderFactory.java b/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/provider/DATAImplementationProviderFactory.java deleted file mode 100644 index e1af9ecd92..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/provider/DATAImplementationProviderFactory.java +++ /dev/null @@ -1,47 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.data.provider;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.implementation.data.DATAImplementation;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * Factory for DATA Implementation Provider
- *
- * @version $Rev$ $Date$
- */
-public class DATAImplementationProviderFactory implements ImplementationProviderFactory<DATAImplementation> {
-
- /**
- * Constructs a new DATA implementation.
- */
- public DATAImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
- }
-
- public ImplementationProvider createImplementationProvider(RuntimeComponent component, DATAImplementation implementation) {
- return new DATAImplementationProvider(component, implementation);
- }
-
- public Class<DATAImplementation> getModelType() {
- return DATAImplementation.class;
- }
-}
diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/provider/DATAInvoker.java b/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/provider/DATAInvoker.java deleted file mode 100644 index e74bf4d134..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/main/java/org/apache/tuscany/sca/implementation/data/provider/DATAInvoker.java +++ /dev/null @@ -1,583 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.data.provider;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.data.engine.config.ConnectionInfo;
-import org.apache.tuscany.sca.implementation.data.jdbc.JDBCHelper;
-import org.apache.tuscany.sca.implementation.data.jdbc.JDBCResultSetStreamReader;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Implements a target invoker for DAS component implementations.
- *
- * The target invoker is responsible for dispatching invocations to the particular
- * component implementation logic. The current component implementation will
- * dispatch calls to the DAS APIs to retrieve the requested data from the back-end store
- *
- * @version $Rev$ $Date$
- */
-public class DATAInvoker implements Invoker {
-
- protected final Operation operation;
- protected final ConnectionInfo connectionInfo;
- protected final String table;
-
- public DATAInvoker(Operation operation, ConnectionInfo connectionInfo, String table) {
- this.operation = operation;
- this.connectionInfo = connectionInfo;
- this.table = table;
- }
-
- public Message invoke(Message msg) {
- // Shouldn't get here, as the only supported operations
- // are the ones defined DATA interface and implemented
- // by specific invoker subclasses
-
- throw new UnsupportedOperationException(operation.getName());
- }
-
- /****************************************************************
- *
- * Internal invoker implementations for each supported operation
- *
- *****************************************************************/
- /**
- * GetAll operation invoker
- */
- public static class GetAllInvoker extends DATAInvoker {
-
- public GetAllInvoker(Operation operation, ConnectionInfo connectionInfo, String table) {
- super(operation, connectionInfo, table);
- }
-
- @Override
- public Message invoke(Message msg) {
- return msg;
- }
- }
-
- /**
- * Query operation invoker
- */
- public static class QueryInvoker extends DATAInvoker {
-
- public QueryInvoker(Operation operation, ConnectionInfo connectionInfo, String table) {
- super(operation, connectionInfo, table);
- }
-
- @Override
- public Message invoke(Message msg) {
- return msg;
- }
- }
-
- /**
- * Post operation invoker
- */
- public static class PostInvoker extends DATAInvoker {
-
- public PostInvoker(Operation operation, ConnectionInfo connectionInfo, String table) {
- super(operation, connectionInfo, table);
- }
-
- @Override
- public Message invoke(Message msg) {
-
- StringBuilder sqlInsert = new StringBuilder();
- XMLStreamReader insertStream = (XMLStreamReader) ((Object[]) msg.getBody())[1];
-
- if (insertStream == null) {
- throw new IllegalArgumentException("The XMLStreamReader \"insertStream\" must not be null");
- }
-
-
- Connection connection = null;
- PreparedStatement inStmt = null;
-
- List<String> colNames = new ArrayList<String>();
- List<String> values = new ArrayList<String>();
-
- int result = 0;
- try {
-
- connection = JDBCHelper.getConnection(connectionInfo);
-
- while (insertStream.hasNext()) {
-
- insertStream.next();
- if (insertStream.isStartElement()) {
- if (insertStream.getLocalName().equals("record")) {
- sqlInsert.append("INSERT INTO " + this.table + " (");
- } else if (insertStream.getLocalName().equals("column")) {
- colNames.add(insertStream.getAttributeValue(0));
- insertStream.next();
- if (insertStream.isCharacters()) {
- values.add(insertStream.getText());
- }
- }
- } else if (insertStream.isEndElement() && insertStream.getLocalName().equals("record")) {
- for (String c : colNames) {
- sqlInsert.append(" " + c + ",");
- }
-
- sqlInsert.deleteCharAt(sqlInsert.length() - 1);
- sqlInsert.append(" ) VALUES (");
-
- for (String v : values) {
- sqlInsert.append(" '" + v + "',");
- }
-
- sqlInsert.deleteCharAt(sqlInsert.length() - 1);
- sqlInsert.append(" )");
-
- inStmt = connection.prepareStatement(sqlInsert.toString());
-
- result += inStmt.executeUpdate();
-
- // Clean up resources
- inStmt.close();
- sqlInsert.delete(0, sqlInsert.length());
- values.clear();
- colNames.clear();
- }
- }
- } catch (XMLStreamException e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- } catch (SQLException sqle) {
- sqle.printStackTrace();
- msg.setFaultBody(new ServiceRuntimeException(sqle.getCause()));
- } catch (Exception e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- } finally {
- JDBCHelper.cleanupResources(connection, inStmt, null);
- }
-
- msg.setBody(Integer.toString(result));
- return msg;
- }
- }
-
- /**
- * Get operation invoker
- */
- public static class GetInvoker extends DATAInvoker {
-
- public GetInvoker(Operation operation, ConnectionInfo connectionInfo, String table) {
- super(operation, connectionInfo, table);
- }
-
- @Override
- public Message invoke(Message msg) {
-
- // Get an entry
- String sqlQuery = null;
- String id = (String) ((Object[]) msg.getBody())[0];
-
- if (id == null) {
- sqlQuery = "SELECT * FROM " + this.table;
- } else {
- sqlQuery = "SELECT * FROM " + this.table + " WHERE ID = " + id;
- }
-
- Connection connection = null;
- PreparedStatement queryStatement = null;
- ResultSet resultSet = null;
- try {
- connection = JDBCHelper.getConnection(connectionInfo);
- queryStatement = connection.prepareStatement(sqlQuery);
- resultSet = queryStatement.executeQuery();
-
-
- } catch (SQLException sqle) {
- msg.setFaultBody(new ServiceRuntimeException(sqle.getCause()));
- JDBCHelper.cleanupResources(connection, queryStatement, resultSet);
- } catch (Exception e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- JDBCHelper.cleanupResources(connection, queryStatement, resultSet);
- } finally {
- //default we leave the connection open to pass to the JDBCStreamReader
- }
-
- msg.setBody(new JDBCResultSetStreamReader(resultSet));
- return msg;
- }
- }
-
- /**
- * Put operation invoker
- */
- public static class PutInvoker extends DATAInvoker {
-
- public PutInvoker(Operation operation, ConnectionInfo connectionInfo, String table) {
- super(operation, connectionInfo, table);
- }
-
- @Override
- public Message invoke(Message msg) {
-
- XMLStreamReader updateStream = (XMLStreamReader) ((Object[]) msg.getBody())[1];
-
- if (updateStream == null) {
- throw new IllegalArgumentException("The XMLStreamReader \"updateStream\" must not be null");
- }
-
- Connection connection = null;
- PreparedStatement upStmt = null;
-
- String id = null;
- String columnName = null;
- String newValue = null;
- int result = 0;
-
- try {
- connection = JDBCHelper.getConnection(connectionInfo);
- while (updateStream.hasNext()) {
- updateStream.next();
-
- if (updateStream.isStartElement() && updateStream.getLocalName().equals("column")) {
- columnName = updateStream.getAttributeValue(0);
- updateStream.next();
- if (updateStream.isCharacters()) {
- if (columnName.equals("ID")) {
- id = updateStream.getText();
- } else {
- newValue = updateStream.getText();
-
- upStmt = connection.prepareStatement("UPDATE " + this.table + " SET " + columnName + " = '" + newValue + "' WHERE ID = " + id);
-
- result += upStmt.executeUpdate();
- upStmt.close();
- }
- }
- }
- }
- } catch (XMLStreamException e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- } catch (SQLException sqle) {
- sqle.printStackTrace();
- msg.setFaultBody(new ServiceRuntimeException(sqle.getCause()));
- } catch (Exception e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- } finally {
- JDBCHelper.cleanupResources(connection, upStmt, null);
- }
-
- msg.setBody(result);
- return msg;
- }
- }
-
- /**
- * Delete operation invoker
- */
- public static class DeleteInvoker extends DATAInvoker {
-
- public DeleteInvoker(Operation operation, ConnectionInfo connectionInfo, String table) {
- super(operation, connectionInfo, table);
- }
-
- @Override
- public Message invoke(Message msg) {
-
- // Get an entry
- String sqlDelete = null;
- String id = (String) ((Object[]) msg.getBody())[0];
-
- if (id == null) {
- sqlDelete = "DELETE FROM " + this.table;
- } else {
- sqlDelete = "DELETE FROM " + this.table + " WHERE ID = " + id;
- }
-
- Connection connection = null;
- PreparedStatement deleteStatement = null;
- int result = -1;
-
- try {
- connection = JDBCHelper.getConnection(connectionInfo);
- deleteStatement = connection.prepareStatement(sqlDelete);
- result = deleteStatement.executeUpdate();
-
- } catch (SQLException sqle) {
- msg.setFaultBody(new ServiceRuntimeException(sqle.getCause()));
- } catch (Exception e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- } finally {
- JDBCHelper.cleanupResources(connection, deleteStatement, null);
- }
-
- msg.setBody(result);
- return msg;
- }
- }
- /**
- * Get operation invoker
- *
- * @version $Rev$ $Date$
- */
- public static class GetDATAInvoker extends DATAInvoker {
-
- public GetDATAInvoker(Operation operation, ConnectionInfo connectionInfo, String table) {
- super(operation, connectionInfo, table);
- }
-
- @Override
- public Message invoke(Message msg) {
-
- // Get an entry
- String sqlQuery = null;
- String id = (String) ((Object[]) msg.getBody())[0];
-
- if (id == null) {
- sqlQuery = "SELECT * FROM " + this.table;
- } else {
- sqlQuery = "SELECT * FROM " + this.table + " WHERE ID = " + id;
- }
-
- Connection connection = null;
- PreparedStatement queryStatement = null;
- ResultSet resultSet = null;
- try {
- connection = JDBCHelper.getConnection(connectionInfo);
- queryStatement = connection.prepareStatement(sqlQuery);
- resultSet = queryStatement.executeQuery();
-
-
- } catch (SQLException sqle) {
- msg.setFaultBody(new ServiceRuntimeException(sqle.getCause()));
- JDBCHelper.cleanupResources(connection, queryStatement, resultSet);
- } catch (Exception e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- JDBCHelper.cleanupResources(connection, queryStatement, resultSet);
- } finally {
- //default we leave the connection open to pass to the JDBCStreamReader
- }
-
- msg.setBody(new JDBCResultSetStreamReader(resultSet));
- return msg;
- }
- }
-
- /**
- * Insert operation invoker
- */
- public static class InsertDATAInvoker extends DATAInvoker {
-
- public InsertDATAInvoker(Operation operation,
- ConnectionInfo connectionInfo, String table) {
- super(operation, connectionInfo, table);
- }
-
- @Override
- public Message invoke(Message msg) throws IllegalArgumentException {
- StringBuilder sqlInsert = new StringBuilder();
- XMLStreamReader insertStream = (XMLStreamReader) ((Object[]) msg.getBody())[0];
-
- if (insertStream == null) {
- throw new IllegalArgumentException("The XMLStreamReader \"insertStream\" must not be null");
- }
-
-
- Connection connection = null;
- PreparedStatement inStmt = null;
-
- List<String> colNames = new ArrayList<String>();
- List<String> values = new ArrayList<String>();
-
- int result = 0;
- try {
-
- connection = JDBCHelper.getConnection(connectionInfo);
-
- while (insertStream.hasNext()) {
-
- insertStream.next();
- if (insertStream.isStartElement()) {
- if (insertStream.getLocalName().equals("record")) {
- sqlInsert.append("INSERT INTO " + this.table + " (");
- } else if (insertStream.getLocalName().equals("column")) {
- colNames.add(insertStream.getAttributeValue(0));
- insertStream.next();
- if (insertStream.isCharacters()) {
- values.add(insertStream.getText());
- }
- }
- } else if (insertStream.isEndElement() && insertStream.getLocalName().equals("record")) {
- for (String c : colNames) {
- sqlInsert.append(" " + c + ",");
- }
-
- sqlInsert.deleteCharAt(sqlInsert.length() - 1);
- sqlInsert.append(" ) VALUES (");
-
- for (String v : values) {
- sqlInsert.append(" '" + v + "',");
- }
-
- sqlInsert.deleteCharAt(sqlInsert.length() - 1);
- sqlInsert.append(" )");
-
- inStmt = connection.prepareStatement(sqlInsert.toString());
- result += inStmt.executeUpdate();
-
- // Clean up resources
- inStmt.close();
- sqlInsert.delete(0, sqlInsert.length());
- values.clear();
- colNames.clear();
- }
- }
- } catch (XMLStreamException e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- } catch (SQLException sqle) {
- sqle.printStackTrace();
- msg.setFaultBody(new ServiceRuntimeException(sqle.getCause()));
- } catch (Exception e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- } finally {
- JDBCHelper.cleanupResources(connection, inStmt, null);
- }
-
- msg.setBody(result);
- return msg;
- }
- }
-
- /**
- * Update operation invoker
- */
- public static class UpdateDATAInvoker extends DATAInvoker {
-
- public UpdateDATAInvoker(Operation operation,
- ConnectionInfo connectionInfo, String table) {
- super(operation, connectionInfo, table);
- }
-
- @Override
- public Message invoke(Message msg) throws IllegalArgumentException {
-
- XMLStreamReader updateStream = (XMLStreamReader) ((Object[]) msg.getBody())[0];
-
- if (updateStream == null) {
- throw new IllegalArgumentException("The XMLStreamReader \"updateStream\" must not be null");
- }
-
- Connection connection = null;
- PreparedStatement upStmt = null;
-
- String id = null;
- String columnName = null;
- String newValue = null;
- int result = 0;
-
- try {
- connection = JDBCHelper.getConnection(connectionInfo);
- while (updateStream.hasNext()) {
- updateStream.next();
-
- if (updateStream.isStartElement() && updateStream.getLocalName().equals("column")) {
- columnName = updateStream.getAttributeValue(0);
- updateStream.next();
- if (updateStream.isCharacters()) {
- if (columnName.equals("ID")) {
- id = updateStream.getText();
- } else {
- newValue = updateStream.getText();
-
- upStmt = connection.prepareStatement("UPDATE " + this.table + " SET " + columnName + " = '" + newValue + "' WHERE ID = " + id);
-
- result += upStmt.executeUpdate();
- upStmt.close();
- }
- }
- }
- }
- } catch (XMLStreamException e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- } catch (SQLException sqle) {
- sqle.printStackTrace();
- msg.setFaultBody(new ServiceRuntimeException(sqle.getCause()));
- } catch (Exception e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- } finally {
- JDBCHelper.cleanupResources(connection, upStmt, null);
- }
-
- msg.setBody(result);
- return msg;
- }
- }
-
- /**
- * Delete operation invoker
- */
- public static class DeleteDATAInvoker extends DATAInvoker {
-
- public DeleteDATAInvoker(Operation operation, ConnectionInfo connectionInfo, String table) {
- super(operation, connectionInfo, table);
- }
-
- @Override
- public Message invoke(Message msg) {
-
- // Get an entry
- String sqlDelete = null;
- String id = (String) ((Object[]) msg.getBody())[0];
-
- if (id == null) {
- sqlDelete = "DELETE FROM " + this.table;
- } else {
- sqlDelete = "DELETE FROM " + this.table + " WHERE ID = " + id;
- }
-
- Connection connection = null;
- PreparedStatement deleteStatement = null;
- int result = -1;
-
- try {
- connection = JDBCHelper.getConnection(connectionInfo);
- deleteStatement = connection.prepareStatement(sqlDelete);
- result = deleteStatement.executeUpdate();
-
- } catch (SQLException sqle) {
- msg.setFaultBody(new ServiceRuntimeException(sqle.getCause()));
- } catch (Exception e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- } finally {
- JDBCHelper.cleanupResources(connection, deleteStatement, null);
- }
-
- msg.setBody(result);
- return msg;
- }
- }
-}
diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-equinox/modules/implementation-data-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor deleted file mode 100644 index 5cd3334e3f..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Implementation class for the artifact processor extension -org.apache.tuscany.sca.implementation.data.DATAImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.data.xml,model=org.apache.tuscany.sca.implementation.data.DATAImplementation diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/branches/sca-equinox/modules/implementation-data-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory deleted file mode 100644 index e20f1a6379..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the implementation extension
-org.apache.tuscany.sca.implementation.data.provider.DATAImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.data.DATAImplementation
diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATACollectionTestCaseFIXME.java b/branches/sca-equinox/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATACollectionTestCaseFIXME.java deleted file mode 100644 index 458025dd66..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATACollectionTestCaseFIXME.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.implementation.data; - -import java.io.FileInputStream; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; -import junit.framework.TestCase; -import org.apache.tuscany.sca.databinding.xml.XMLStreamReader2String; -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.apache.tuscany.sca.implementation.data.DATACollection; - -public class DATACollectionTestCaseFIXME extends TestCase { - - private SCADomain scaDomain; - private DATACollection dataService; - - /** - * @throws java.lang.Exception - */ - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("data.composite"); - dataService = scaDomain.getService(DATACollection.class, "DataComponent/COMPANY"); - } - - /** - * @throws java.lang.Exception - */ - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testInsert() throws Exception { - System.out.println(">testInsert"); - - //Read and process the XML file - FileInputStream fileInputStream = new FileInputStream("src/test/resources/insert.xml"); - XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(fileInputStream); - - String result = dataService.post(null, reader); - assertEquals(result, "2"); - - System.out.println("Number of rows inserted: " + result); - - reader.close(); - } - - public void testGet() throws Exception { - - System.out.println(">testGet"); - - XMLStreamReader reader = dataService.get(null); - assertNotNull(reader); - String xml = new XMLStreamReader2String().transform(reader, null); - System.out.println(xml); - reader.close(); - } - - public void testUpdate() throws Exception { - - System.out.println(">testUpdate"); - - //Read and process the XML file - FileInputStream fileInputStream = new FileInputStream("src/test/resources/update.xml"); - XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(fileInputStream); - - dataService.put(null,reader); - - reader.close(); - } - - public void testGetByID() throws Exception { - System.out.println(">testGetByID"); - - Integer companyID = new Integer(4); - - XMLStreamReader reader = dataService.get(companyID.toString()); - assertNotNull(reader); - String xml = new XMLStreamReader2String().transform(reader, null); - System.out.println(xml); - reader.close(); - } - - public void testDeleteByID() throws Exception { - System.out.println(">testDeleteByID"); - - Integer companyID = new Integer(4); - dataService.delete(companyID.toString()); - } - - public void testDelete() throws Exception { - System.out.println(">testDelete"); - - dataService.delete(null); - - System.out.println("recreating database..."); - //Helper.createDB(); - System.out.println("done!"); - } -} diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessorTestCase.java b/branches/sca-equinox/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessorTestCase.java deleted file mode 100644 index dcf87d8c68..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATAImplementationProcessorTestCase.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.implementation.data; - -import java.io.StringReader; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.SCABindingFactory; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; -import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl; -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.data.engine.config.ConnectionInfo; -import org.apache.tuscany.sca.data.engine.config.ConnectionProperties; -import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; -import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl; -import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory; - -/** - * @version $Rev: 538445 $ $Date: 2007-05-15 23:20:37 -0700 (Tue, 15 May 2007) $ - */ -public class DATAImplementationProcessorTestCase extends TestCase { - - protected static final QName IMPLEMENTATION_DATA = new QName(Constants.SCA10_TUSCANY_NS, "implementation.data.xml"); - - private static final String COMPOSITE_USING_DATASOURCE = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" - + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.0\" targetNamespace=\"http://data\" name=\"data\">" - + " <component name=\"DataComponent\">" - + " <tuscany:implementation.data.xml>" - + " <tuscany:connectionInfo datasource=\"dataSource\"/>" - + " </tuscany:implementation.data.xml>" - + " </component>" - + "</composite>"; - - private static final String COMPOSITE_USING_CONNECTION_PROPERTIES = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" - + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.0\" targetNamespace=\"http://data\" name=\"data\">" - + " <component name=\"DataComponent\">" - + " <tuscany:implementation.data.xml>" - + " <tuscany:connectionInfo>" - + " <tuscany:connectionProperties" - + " driverClass=\"driverClass\"" - + " databaseURL=\"databaseURL\"" - + " loginTimeout=\"1\"/>" - + " </tuscany:connectionInfo>" - + " </tuscany:implementation.data.xml>" - + " </component>" - + "</composite>"; - - private XMLInputFactory inputFactory; - private StAXArtifactProcessor<Object> staxProcessor; - private CompositeBuilder compositeBuilder; - - @Override - protected void setUp() throws Exception { - DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); - inputFactory = XMLInputFactory.newInstance(); - StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints); - staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null); - - ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); - AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); - SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class); - UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class); - IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class); - compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null); - } - - public void testLoadCompositeUsingDatasource() throws Exception { - XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_USING_DATASOURCE)); - - Composite composite = (Composite)staxProcessor.read(reader); - DATAImplementation implementation = (DATAImplementation)composite.getComponents().get(0).getImplementation(); - assertNotNull(implementation); - - ConnectionInfo connInfo = implementation.getConnectionInfo(); - assertNotNull(connInfo); - assertEquals("dataSource", connInfo.getDataSource()); - - ConnectionProperties connProperties = connInfo.getConnectionProperties(); - assertNull(connProperties); - } - - public void testLoadCompositeUsingConnectionProperties() throws Exception { - XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_USING_CONNECTION_PROPERTIES)); - - Composite composite = (Composite)staxProcessor.read(reader); - DATAImplementation implementation = (DATAImplementation)composite.getComponents().get(0).getImplementation(); - assertNotNull(implementation); - - ConnectionInfo connInfo = implementation.getConnectionInfo(); - assertNotNull(connInfo); - assertNull("dataSource", connInfo.getDataSource()); - - ConnectionProperties connProperties = connInfo.getConnectionProperties(); - assertNotNull(connProperties); - assertEquals("driverClass",connProperties.getDriverClass()); - assertEquals("databaseURL",connProperties.getDatabaseURL()); - assertEquals(1,connProperties.getLoginTimeout().intValue()); - } -} diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATATestCase.java b/branches/sca-equinox/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATATestCase.java deleted file mode 100644 index 4010cb63d3..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/DATATestCase.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.implementation.data; - -import java.io.FileInputStream; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.databinding.xml.XMLStreamReader2String; -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.apache.tuscany.sca.implementation.data.DATA; - -/** - * Tests the DAS service - * - * @version $Rev$ $Date$ - */ -public class DATATestCase extends TestCase { - private SCADomain scaDomain; - private DATA dataService; - - /** - * @throws java.lang.Exception - */ - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("data.composite"); - dataService = scaDomain.getService(DATA.class, "DataComponent/COMPANY_DATA"); - } - - /** - * @throws java.lang.Exception - */ - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testInsert() throws Exception { - System.out.println(">testInsert"); - - //Read and process the XML file - FileInputStream fileInputStream = new FileInputStream("src/test/resources/insert.xml"); - XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(fileInputStream); - - int result = dataService.insert(reader); - assertEquals(result,2); - - System.out.println("Number of rows inserted: "+result); - - reader.close(); - } - - public void testGet() throws Exception { - - System.out.println(">testGet"); - - XMLStreamReader reader = dataService.get(null); - assertNotNull(reader); - String xml = new XMLStreamReader2String().transform(reader, null); - System.out.println(xml); - reader.close(); - } - - public void testUpdate() throws Exception { - - System.out.println(">testUpdate"); - - //Read and process the XML file - FileInputStream fileInputStream = new FileInputStream("src/test/resources/update.xml"); - XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(fileInputStream); - - int result = dataService.update(reader); - assertEquals(result,1); - System.out.println("Number of rows affected: "+result); - - reader.close(); - } - - public void testGetByID() throws Exception { - System.out.println(">testGetByID"); - - Integer companyID = new Integer(4); - - XMLStreamReader reader = dataService.get(companyID.toString()); - assertNotNull(reader); - String xml = new XMLStreamReader2String().transform(reader, null); - System.out.println(xml); - reader.close(); - } - - public void testDeleteByID() throws Exception { - System.out.println(">testDeleteByID"); - - Integer companyID = new Integer(4); - int result = dataService.delete(companyID.toString()); - assertEquals(result,1); - System.out.println("Number of rows deleted: "+result); - } - - public void testDelete() throws Exception { - System.out.println(">testDelete"); - - int result = dataService.delete(null); - assertEquals(result,4); - System.out.println("Number of rows deleted: "+result); - - System.out.println("recreating database..."); - //Helper.createDB(); - System.out.println("done!"); - } - -} diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/companyFeed/CompanyFeed.java b/branches/sca-equinox/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/companyFeed/CompanyFeed.java deleted file mode 100644 index 7f0707c0bc..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/companyFeed/CompanyFeed.java +++ /dev/null @@ -1,62 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.data.companyFeed;
-
-import org.apache.tuscany.sca.data.collection.Collection;
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.NotFoundException;
-import org.apache.tuscany.sca.implementation.data.DATA;
-import org.osoa.sca.annotations.Reference;
-
-import commonj.sdo.DataObject;
-
-public class CompanyFeed implements Collection<String, DataObject> {
-
- @Reference
- protected DATA dataService;
-
- public Entry<String, DataObject>[] getAll() {
- return null;
- }
-
- public DataObject get(String id) throws NotFoundException{
-
- DataObject data = null;//dataService.get(id);
- if(data == null) {
- throw new NotFoundException();
- } else {
- return data;
- }
- }
-
- public void delete(String id) throws NotFoundException {
- }
-
- public String post(String key, DataObject item) {
- return null;
- }
-
- public void put(String key, DataObject item) throws NotFoundException {
- }
-
- public Entry<String, DataObject>[] query(String queryString) {
- return null;
- }
-}
diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/companyFeed/CompanyFeedTestCaseFIXME.java b/branches/sca-equinox/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/companyFeed/CompanyFeedTestCaseFIXME.java deleted file mode 100644 index b72ff89e3b..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/test/java/org/apache/tuscany/sca/implementation/data/companyFeed/CompanyFeedTestCaseFIXME.java +++ /dev/null @@ -1,51 +0,0 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.data.companyFeed;
-
-import java.io.IOException;
-import java.net.Socket;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-/**
- * @version $Rev: 543175 $ $Date: 2007-05-31 09:09:12 -0700 (Thu, 31 May 2007) $
- */
-public class CompanyFeedTestCaseFIXME extends TestCase {
- private SCADomain scaDomain;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- scaDomain = SCADomain.newInstance("data-feed.composite");
- //System.in.read();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- scaDomain.close();
- }
-
- public void testPing() throws IOException {
- new Socket("127.0.0.1", 8085);
- }
-
-}
diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/test/resources/data-feed.composite b/branches/sca-equinox/modules/implementation-data-xml/src/test/resources/data-feed.composite deleted file mode 100644 index 40c755b134..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/test/resources/data-feed.composite +++ /dev/null @@ -1,50 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" - targetNamespace="http://data" - name="data-feed">
-
-
- <service name="CompanyFeed" promote="CompanyFeedComponent">
- <tuscany:binding.atom uri="http://localhost:8085/comnpanyfeed/*"/>
- </service>
-
- <component name="CompanyFeedComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.data.companyFeed.CompanyFeed"/>
- <reference name="dataService" target="CompanyDataComponent"/>
- </component>
-
- <!-- service name="CompanyDataServiceComponent" promote="CompanyDataComponent">
- <binding.atom uri="http://localhost:8085/comnpanyfeed/"/>
- </service -->
-
- <component name="CompanyDataComponent">
- <tuscany:implementation.data.xml table="company">
- <tuscany:connectionInfo>
- <tuscany:connectionProperties
- driverClass="org.apache.derby.jdbc.EmbeddedDriver"
- databaseURL="jdbc:derby:target/test-classes/company; create = true"
- loginTimeout="600000"/>
- </tuscany:connectionInfo>
- </tuscany:implementation.data.xml>
- </component>
-
-</composite>
diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/test/resources/data.composite b/branches/sca-equinox/modules/implementation-data-xml/src/test/resources/data.composite deleted file mode 100644 index f30b15e34c..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/test/resources/data.composite +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
- targetNamespace="http://data"
- name="data">
-
- <component name="DataComponent">
- <tuscany:implementation.data.xml>
- <tuscany:connectionInfo>
- <tuscany:connectionProperties
- driverClass="org.apache.derby.jdbc.EmbeddedDriver"
- databaseURL="jdbc:derby:target/test-classes/company; create = true"
- loginTimeout="600000"/>
- </tuscany:connectionInfo>
- </tuscany:implementation.data.xml>
- </component>
-
-</composite>
diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/test/resources/insert.xml b/branches/sca-equinox/modules/implementation-data-xml/src/test/resources/insert.xml deleted file mode 100644 index c0a5ada4bf..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/test/resources/insert.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<resultSet> - <record> - <column name="NAME">New Coorporation I</column> - </record> - <record> - <column name="NAME">New Coorporation II</column> - </record> -</resultSet> diff --git a/branches/sca-equinox/modules/implementation-data-xml/src/test/resources/update.xml b/branches/sca-equinox/modules/implementation-data-xml/src/test/resources/update.xml deleted file mode 100644 index c6cef75274..0000000000 --- a/branches/sca-equinox/modules/implementation-data-xml/src/test/resources/update.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<result_set> - <record> - <column name="ID">4</column> - <column name="NAME">Update Coorporation</column> - </record> -</result_set> diff --git a/branches/sca-equinox/modules/pom.xml b/branches/sca-equinox/modules/pom.xml index 113055a5e6..3632a41ab6 100644 --- a/branches/sca-equinox/modules/pom.xml +++ b/branches/sca-equinox/modules/pom.xml @@ -91,7 +91,6 @@ <module>databinding-saxon</module> <module>databinding-xmlbeans</module> <module>databinding-fastinfoset</module> - <module>data-engine-helper</module> <module>definitions</module> <module>definitions-xml</module> <module>domain-manager</module> @@ -123,7 +122,6 @@ <module>implementation-bpel</module> <module>implementation-bpel-ode</module> <module>implementation-bpel-jbpm</module> - <module>implementation-das</module> <module>implementation-ejb</module> <module>implementation-java</module> <module>implementation-java-xml</module> |