diff options
author | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
---|---|---|
committer | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
commit | bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch) | |
tree | 38a92061c0793434c4be189f1d70c3458b6bc41d /tags/java-M1-20060518/java/das/rdb/src/main |
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tags/java-M1-20060518/java/das/rdb/src/main')
73 files changed, 12057 insertions, 0 deletions
diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ApplyChangesCommand.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ApplyChangesCommand.java new file mode 100644 index 0000000000..75f81ca1e3 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ApplyChangesCommand.java @@ -0,0 +1,101 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb; + +import java.sql.Connection; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; + +/** + * An ApplyChangesCommand is used to flush the changes associated with a + * modified graph of DataObjects to a database. + * + * + */ +public interface ApplyChangesCommand { + + /** + * Adds a user-provided update command. In the absence of a user-provided + * command, the DAS will generate one. However this alternative may make + * sense if the user requires a SQL statement different from what the DAS + * generates. + * + * @param type + * The DataObject type this command applys to + * @param cmd + * The Command used to UPDATE data objects of the specified type + */ + public void addUpdateCommand(Type type, Command cmd); + + /** + * Adds a user-provided create command. In the absence of a user-provided + * command, the DAS will generate one. However this alternative may make + * sense if the user requires a SQL statement different from what the DAS + * generates. + * + * @param type + * The DataObject type this command applys to + * @param cmd + * The Command used to INSERT data objects of the specified type + */ + public void addCreateCommand(Type type, Command cmd); + + /** + * Adds a user-provided delete command. In the absence of a user-provided + * command, the DAS will generate one. However this alternative may make + * sense if the user requires a SQL statement different from what the DAS + * generates. + * + * @param type + * The DataObject type this command applys to + * @param cmd + * The Command used to DELETE data objects of the specified type + */ + public void addDeleteCommand(Type type, Command cmd); + + /** + * The change history is scanned and modifications to the graph of data + * objects are flushed to the database. + * + * @param root + * the topmost containing data object + */ + public void execute(DataObject root); + + /** + * Provides the java.sql.Connection to be used for this executing this + * command. + * + * @param connection + * the java.sql.Connection + */ + public void setConnection(Connection connection); + + /** + * Provides the java.sql.Connection to be used for this executing this + * command. + * + * @param connection + * the java.sql.Connection + * @param manageTransactions + * <code>true</code> if the DAS should perform tx + * commit/rollback + */ + public void setConnection(Connection connection, boolean manageTransactions); + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java new file mode 100644 index 0000000000..37d67fd10c --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java @@ -0,0 +1,222 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.impl.CommandFactoryImpl; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; + +/** + * A Command is used to execute a read or write to a database + * + * + */ +public interface Command { + + public static CommandFactory FACTORY = new CommandFactoryImpl(); + + /** + * Performs the function defined by the command + */ + public void execute(); + + /** + * Performs the function defined by the command and return the results in + * the root DataObject + * + * @return the root DataObject + */ + public DataObject executeQuery(); + + /** + * Returns the parameter associated with "name" + * + * @param name + * the name of the parameter + * @return the associated parameter + */ + public Parameter getParameter(String name); + + /** + * Returns the Parameter at index + * + * @param index + * the index of the Parameter + * @return the associated Parameter + */ + public Parameter getParameter(int index); + + /** + * Sets the value of the named Parameter + * + * @param name + * the name of this Parameter + * @param value + * the value for the Parameter + */ + public void setParameterValue(String name, Object value); + + /** + * Sets the value of the associated Parameter + * + * @param index + * the index of the Parameter + * @param value + * the value for the Parameter + */ + public void setParameterValue(int index, Object value); + + /** + * Sets the "type" of the associated Parameter + * + * @param name + * the name of this Parameter + * @param type + * the SDODataTypes-defined "type" for the Parameter. + */ + public void setParameterType(String string, Type dataType); + + /** + * Sets the "type" of the associated Parameter + * + * @param index + * the index of the Parameter + * @param type + * the SDODataTypes-defined "type" for the Parameter. + */ + public void setParameterType(int index, Type dataType); + + /** + * Returns the value of the associated Parameter + * + * @param name + * the name of the Parameter + * @return the value of the Parameter + */ + public Object getParameterValue(String name); + + /** + * Returns the value of the associated Parameter + * + * @param index + * the index of the Parameter + * @return the value of the Parameter + */ + public Object getParameterValue(int index); + + /** + * Adds a Parameter to the command + * + * @param index + * the index of the parameter + * @param sdoType + * the commonj.sdo.Type of the Parameter + */ + public void addParameter(int index, Type sdoType); + + /** + * Adds a Parameter to the command + * + * @param name + * the index of the parameter + * @param sdoType + * the commonj.sdo.Type of the Parameter + */ + public void addParameter(String name, Type sdoType); + + /** + * Adds a Parameter to the command + * + * @param index + * the index of the parameter + * @param direction + * the direction of the Parameter. Either Parameter.IN, + * Parameter.OUT or Parameter.INOUT + * @param sdoType + * specifies the type as a commonj.sdo.Type from + * {@link SDODataTypes} + */ + public void addParameter(int index, int direction, Type sdoType); + + /** + * Adds a Parameter to the command + * + * @param name + * the name associated with the Parameter + * @param direction + * the direction of the Parameter. Either Parameter.IN, + * Parameter.OUT or Parameter.INOUT + * @param sdoType + * specifies the type as a commonj.sdo.Type from + * {@link SDODataTypes} + */ + public void addParameter(String name, int direction, Type sdoType); + + /** + * Specifies an object model for a graph of DataObjects returned by + * #executeQuery() + * + * @param schema + * the model as a commonj.sdo.Type + */ + public void setDataObjectModel(Type schema); + + /** + * Defines the structure of the ResultSet returned by the JDBC Driver when + * this command is executed. If the shape is not specified then the shape is + * taken from the ResultSetMetatadta instance provided by the JDBC Driver. + * <p> + * This method is prvided primarily to support platforms (such as Oracle) + * that do not provide complete support for ResultSetMetadata + * + * @param shape + * the specified result set shape + * @see ResultSetShape + */ + public void setResultSetShape(ResultSetShape shape); + + /** + * Provides the java.sql.Connection to be used for this executing this + * command. + * + * @param connection + * the java.sql.Connection + */ + public void setConnection(Connection connection); + + /** + * Provides the java.sql.Connection to be used for this executing this + * command. + * + * @param connection + * the java.sql.Connection + * @param manageTransactions + * <code>true</code> if the DAS should perform tx + * commit/rollback + */ + public void setConnection(Connection connection, boolean manageTransactions); + + /** + * Cleans up and realeases all resources associated with this command. This + * should be called when the application is done with this command. + */ + public void close(); + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandFactory.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandFactory.java new file mode 100644 index 0000000000..2bf5e4143d --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandFactory.java @@ -0,0 +1,93 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb; + +import java.io.IOException; +import java.io.InputStream; + +import org.apache.tuscany.das.rdb.config.Config; + +/** + * A CommandFactory produces {@link Command} and {@link ApplyChangesCommand} + * instances. + * + * + */ +public interface CommandFactory { + + /** + * Creates a Command based on the provided SQL statement + * + * @param sql + * The SQL statement + * @return returns a Command instance + */ + public Command createCommand(String sql); + + /** + * Creates a Command based on the provided SQL statement and configuration + * + * @param sql + * The SQL statement + * @param mappingModel + * The congiguration as XML file stream + * @return returns a COmmand instance + */ + public Command createCommand(String sql, InputStream config); + + /** + * Creates a Command based on the provided SQL statement and configuration + * + * @param sql + * The SQL statement + * @param config + * The congiguration as Config instance + * @return returns a COmmand instance + */ + public Command createCommand(String sql, Config config); + + /** + * Creates an {@linkApplyChangesCommand} instance + * + * @return Returns the ApplyChangesCommand instance + */ + public ApplyChangesCommand createApplyChangesCommand(); + + /** + * Creates an {@linkApplyChangesCommand} instance with the provided + * configuration + * + * @param config + * The provided configuration as a stream over an xml file + * @return Returns an ApplyChangesCOmmand in stance + * @throws IOException + */ + public ApplyChangesCommand createApplyChangesCommand(InputStream config) throws IOException; + + + /** + * Creates an {@linkApplyChangesCommand} instance with the provided + * configuration + * + * @param config + * The provided configuration as a Config instance + * @return Returns an ApplyChangesCommand in stance + * @throws IOException + */ + public ApplyChangesCommand createApplyChangesCommand(Config config); + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandGroup.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandGroup.java new file mode 100644 index 0000000000..c41f9dcfdc --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandGroup.java @@ -0,0 +1,63 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.impl.CommandGroupFactoryImpl; + +/** + * A CommandGroup represents a set of {@link Command} and single + * {@link ApplyChangesCommand} that are created from a common config file. + * + * + */ +public interface CommandGroup { + + public static CommandGroupFactory FACTORY = new CommandGroupFactoryImpl(); + + /** + * Return the ApplyChangesCommnad for this configured factory + * + * @return Returns an instance of ApplyChangesCommand + */ + public ApplyChangesCommand getApplyChangesCommand(); + + /** + * Gets the named command from this factory's inventory + * + * @param name + * The identifying name of the requested command + * @return Returns the identified command + */ + public Command getCommand(String name); + + /** + * Set the default connection for all command in the group + * + * @param connection + */ + public void setConnection(Connection connection); + + /** + * If the CommandGroup is managing connections then this method + * must be called when the client is done with the instance. + * + */ + public void releaseResources(); + +}
\ No newline at end of file diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandGroupFactory.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandGroupFactory.java new file mode 100644 index 0000000000..dfcdd81823 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandGroupFactory.java @@ -0,0 +1,37 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb; + +import java.io.InputStream; + +/** + * A CommandGroupFactory produces {@link CommandGroup} instances. + * + * + */ +public interface CommandGroupFactory { + + /** + * Creates a CommandGroup based on the provided config file stream + * + * @param configStream + * A stream over a DAS config file + * @return returns a CommandGroup instance + */ + public CommandGroup createCommandGroup(InputStream configStream); + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java new file mode 100644 index 0000000000..c7357fbe09 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java @@ -0,0 +1,67 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb; + +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConfigFactory; +import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; + +/** + * A ConfigHelper is used as an aid in programmatic construction of Config instances. + * Manual contrution fo COnfig is an alternative to providing needed configuration + * information in an XML file + * + */public class ConfigHelper { + + private Config config; + + private MappingWrapper configWrapper; + + private ConfigFactory factory = ConfigFactoryImpl.eINSTANCE; + + public ConfigHelper() { + config = factory.createConfig(); + configWrapper = new MappingWrapper(config); + } + + public ConfigHelper(Config config) { + this.config = config; + configWrapper = new MappingWrapper(config); + } + + public Config newInstance() { + return factory.createConfig(); + } + + public void addPrimaryKey(String columnName) { + configWrapper.addPrimaryKey(columnName); + } + + public void addRelationship(String parentName, String childName) { + configWrapper.addRelationship(parentName, childName); + } + + public void addTable(String name, String propertyName) { + configWrapper.addTable(name, propertyName); + } + + public Config getConfig() { + return config; + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java new file mode 100644 index 0000000000..eb1ed24230 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java @@ -0,0 +1,52 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb; + +/** + * A lightweight Table-column <--> DataObject-property converter framework. + * Converters allow a user to insert a transformation between a column value and + * is destination DataObject property value. For example, by default, a VARCHAR + * column will be represented as a String in its corresponding DataObject + * property. A user could insert a converter that transforms the the VARCHAR + * value to an Integer. If this is done then although the column returns + * character data, the DataObject property will be an Integer + * + * + */ +public interface Converter { + + /** + * Transform the columnData object to a new value and possibly new type. + * This should be the invers operation of #getColumnValue + * + * @param columnData + * The column value to transorm + * @return Returns the transformed value + */ + public Object getPropertyValue(Object columnData); + + /** + * Transform the columnData object to a new value and possibly new type. + * This should be the invers operation of #getPropertyValue + * + * @param propertyData + * The property value to transform + * @return Returns the transformed value + */ + public Object getColumnValue(Object propertyData); + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Key.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Key.java new file mode 100644 index 0000000000..4622b2a8fb --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Key.java @@ -0,0 +1,58 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb; + +import java.util.ArrayList; +import java.util.List; + +/** + * A key instance is used to describe a Table key definition. This is used + * primarily for compound keys since simple keys are described with a name. + * + * + */public class Key { + + private List columnNames = new ArrayList(); + + /** + * Contructor for a single column key + * @param columnName The single column fo rthe key + */ + public Key(String columnName) { + super(); + this.columnNames.add(columnName); + } + + /** + * Constructor for a compound key + * @param columns The array of column names that compose the key + */ + public Key(String[] columns) { + for (int i=0;i<columns.length; i++) { + this.columnNames.add(columns[i]); + } + } + + /** + * Returns a List of column names that compose the key + * @return a list of column names + */ + public List getColumNames() { + return this.columnNames; + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Pager.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Pager.java new file mode 100644 index 0000000000..4edb447e31 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Pager.java @@ -0,0 +1,62 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb; + +import commonj.sdo.DataObject; + +/** + * An iterator-like interface to conveniently move through chunks of data. The + * idea is that a Pager works with a read Command. The read command returns a + * large amount of data and the client wants to work with chunks of it at a + * time. So the Pager is created on the command and each call to next returns + * the next chunk of data. This is done completely disconnected. No cursor is + * maintained between calls to #next. + * + * TODO - This is very preliminary. We need to look at this interface in the + * context of disonnected scenarios such as a web app. The Pager instance will + * probably be saved in session so it must be very light and cannot reference a + * connection. Also, we probably need to define a factory or add a method to set + * page size. + * + * + */ +public interface Pager { + + /** + * Get the next page of data + * + * @return the next page of data + */ + public DataObject next(); + + /** + * Get the page prior to the last page returned + * + * @return the previous page + */ + public DataObject previous(); + + /** + * Return a specific identified page. + * + * @param page + * The number of the page to return + * @return the indicated page + */ + public DataObject getPage(int page); + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Parameter.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Parameter.java new file mode 100644 index 0000000000..89251cbd0f --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Parameter.java @@ -0,0 +1,128 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb; + +import commonj.sdo.Type; + +/** + * Describes a single parameter for a parameterized SQL statement. + * + * + */ +public interface Parameter { + + /** + * Value for "Direction" that indicates that a parameter is soley for input. + */ + final static int IN = 1; + + /** + * Value for "Direction" that indicates that a parameter is soley for + * output. Out parameters only apply to Stored Procedures + */ + final static int OUT = 2; + + /** + * Value for "Direction" that indicates that a parameter is for both input + * and output. In-out parameters only apply to stored procedures + */ + final static int IN_OUT = 3; + + /** + * A parameter has a type in terms of SDO2 DataTypes. Legal values are + * provided in {@link SDODataTypes} + * <p> + * Explicit definition of type is required only for OUT parameters of stored + * procedures commands + * + * @param type + */ + public void setType(Type type); + + /** + * Set the index of the parameter. For example, if a SQL statement requires + * two parameters, the first one has an index of one. + * + * @param index + * The index of the parameter + */ + public void setIndex(int index); + + /** + * Sets the name of the parameter + * + * @param name + * the parameter name + */ + public void setName(String name); + + /** + * Sets the value of the parameter. All IN and IN_OUT parameters must be set + * beore a command can be executed. + * + * @param value + * The value for the parameter + */ + public void setValue(Object value); + + /** + * Parameters are typically IN and this is the default. A parameter's + * direction must be set when the parameter is OUT or IN_OUT. + * + * @param direction + * the parameters direction + */ + public void setDirection(int direction); + + /** + * TODO Not sure this method is needed. + * @param converter + */ + public void setConverter(Converter converter); + + /** + * @return the type of the paramater in terms of {@link SDODataTypes} + */ + public Type getType(); + + /** + * TODO Not sure this is is needed. + * @return + */ + public Converter getConverter(); + + /** + * @return the index of the parameter + */ + public int getIndex(); + + /** + * @return the name of the parameter + */ + public String getName(); + + /** + * @return the value of the parameter + */ + public Object getValue(); + + /** + * @return the direction of the parameter + */ + public int getDirection(); + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ResultSetShape.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ResultSetShape.java new file mode 100644 index 0000000000..46838778d1 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ResultSetShape.java @@ -0,0 +1,96 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb; + +import java.sql.ResultSetMetaData; +import java.sql.SQLException; + +import org.apache.tuscany.das.rdb.graphbuilder.schema.ResultSetTypeMap; + +import commonj.sdo.Type; + +/** + * Describes the structure of the result set returned from execution + * of a SELECT statement. This description is typcially not required since the + * shape can be retreived from the JDBC ResultSetMetadata. However, some platforms + * such as Oracle do not support fully suport ResultSetMedata. + * <p> + * There may also be a performance boost when using this interface. + * + * + */ +public class ResultSetShape { + + private final String[] columns; + private final String[] tables; + private final Type[] types; + + public ResultSetShape(String[] t, String[] c, Type[] dataTypes) { + this.columns = c; + this.tables = t; + this.types = dataTypes; + } + + public ResultSetShape(ResultSetMetaData metadata) throws SQLException { + columns = new String[metadata.getColumnCount()]; + tables = new String[metadata.getColumnCount()]; + types = new Type[metadata.getColumnCount()]; + + ResultSetTypeMap typeMap = ResultSetTypeMap.instance; + for (int i = 1; i <= metadata.getColumnCount(); i++) { + tables[i-1] = metadata.getTableName(i); + columns[i-1] = metadata.getColumnName(i); + types[i-1] = typeMap.getType(metadata.getColumnType(i), true); + } + } + + public int getColumnCount() { + return columns.length; + } + + public String getTableName(int i) { + return tables[i-1]; + } + + public String getColumnName(int i) { + return columns[i-1]; + } + + public Type getColumnType(int i) { + return types[i-1]; + } + + + public String toString() { + StringBuffer result = new StringBuffer(); + result.append(" column/table/type: "); + for (int i=0; i < columns.length; i++) { + result.append(columns[i]); + result.append('\t'); + result.append(tables[i]); + result.append('\t'); + if ( types[i] == null ) + result.append("null"); + else + result.append(types[i].getName()); + result.append('\n'); + } + + return result.toString(); + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/SDODataTypes.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/SDODataTypes.java new file mode 100644 index 0000000000..683d5092c7 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/SDODataTypes.java @@ -0,0 +1,64 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb; + +import commonj.sdo.Type; +import commonj.sdo.helper.TypeHelper; + +/** + * Defines SDO data types. This is used primalirly to type stored procedure OUT parameters. + * + */public class SDODataTypes { + + static TypeHelper helper = TypeHelper.INSTANCE; + + final public static Type BOOLEAN = helper.getType("commonj.sdo", "Boolean"); + final public static Type BYTE = helper.getType("commonj.sdo", "Byte"); + final public static Type BYTES = helper.getType("commonj.sdo", "ByteArray"); + final public static Type CHARACTER = helper.getType("commonj.sdo", "Char"); + final public static Type DATE = helper.getType("commonj.sdo", "Date"); + final public static Type DATETIME = helper.getType("commonj.sdo", "Date"); + final public static Type DAY = helper.getType("commonj.sdo", "Date"); + final public static Type DECIMAL = helper.getType("commonj.sdo", "Float"); + final public static Type DOUBLE =helper.getType("commonj.sdo", "Double"); + final public static Type DURATION = helper.getType("commonj.sdo", "Date"); + final public static Type FLOAT = helper.getType("commonj.sdo", "Float"); + final public static Type INT = helper.getType("commonj.sdo", "Int"); + final public static Type INTEGER = helper.getType("commonj.sdo", "Integer"); + final public static Type LONG = helper.getType("commonj.sdo", "Long"); + final public static Type MONTH = helper.getType("commonj.sdo", "Date"); + final public static Type MONTHDAY = helper.getType("commonj.sdo", "Date"); + final public static Type OBJECT = helper.getType("commonj.sdo", "Object"); + final public static Type SHORT = helper.getType("commonj.sdo", "Short"); + final public static Type STRING = helper.getType("commonj.sdo", "String"); + final public static Type STRINGS = helper.getType("commonj.sdo", "String"); + final public static Type TIME = helper.getType("commonj.sdo", "Date"); + final public static Type URI = helper.getType("commonj.sdo", "String"); + final public static Type YEAR = helper.getType("commonj.sdo", "Date"); + final public static Type YEARMONTH = helper.getType("commonj.sdo", "Date"); + final public static Type YEARMONTHDAY = helper.getType("commonj.sdo", "Date"); + final public static Type BOOLEANOBJECT = helper.getType("commonj.sdo", "BooleanObject"); + final public static Type BYTEOBJECT = helper.getType("commonj.sdo", "ByteObject"); + final public static Type CHARACTEROBJECT = helper.getType("commonj.sdo", "CharacterObject"); + final public static Type DOUBLEOBJECT = helper.getType("commonj.sdo", "DoubleObject"); + final public static Type FLOATOBJECT = helper.getType("commonj.sdo", "FloatObject"); + final public static Type INTEGEROBJECT = helper.getType("commonj.sdo", "IntObject"); + final public static Type LONGOBJECT = helper.getType("commonj.sdo", "LongObject"); + final public static Type SHORTOBJECT = helper.getType("commonj.sdo", "ShortObject"); + + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java new file mode 100644 index 0000000000..b9c4dae0be --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java @@ -0,0 +1,411 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.config.wrapper; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.Key; +import org.apache.tuscany.das.rdb.config.Column; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConfigFactory; +import org.apache.tuscany.das.rdb.config.KeyPair; +import org.apache.tuscany.das.rdb.config.Relationship; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.Property; + +public class MappingWrapper { + + private static final ConfigFactory factory = ConfigFactoryImpl.eINSTANCE; + + private static final boolean debug = false; + + private Config config; + + public MappingWrapper() { + // Empty Constructor + } + + public MappingWrapper(Config mapping) { + this.config = mapping; + } + + public Config getConfig() { + return this.config; + } + + public Table getTable(String name) { + if (config == null) + return null; + DebugUtil.debugln(getClass(), debug, "Looking for table " + name); + Iterator i = config.getTable().iterator(); + while (i.hasNext()) { + Table t = (Table) i.next(); + if (name.equals(t.getName())) + return t; + } + + return null; + } + + public Table getTableByPropertyName(String name) { + if (config == null) + return null; + DebugUtil.debugln(getClass(), debug, "Looking for table by property: " + name); + Iterator i = config.getTable().iterator(); + while (i.hasNext()) { + Table t = (Table) i.next(); + TableWrapper wrapper = new TableWrapper(t); + if (name.equals(wrapper.getPropertyName())) + return t; + } + return null; + + // throw new RuntimeException("Table with property name " + name + // + " not found."); + + } + + public void addRelationship(String parentName, String childName) { + + if (config == null) + config = factory.createConfig(); + + QualifiedColumn parent = new QualifiedColumn(parentName); + QualifiedColumn child = new QualifiedColumn(childName); + + Relationship r = factory.createRelationship(); + r.setName(child.getTableName()); + r.setPrimaryKeyTable(parent.getTableName()); + r.setForeignKeyTable(child.getTableName()); + DebugUtil.debugln(getClass(), debug, "Created relationship from " + r.getPrimaryKeyTable() + " to " + + r.getForeignKeyTable() + " named " + r.getName()); + + KeyPair pair = factory.createKeyPair(); + pair.setPrimaryKeyColumn(parent.getColumnName()); + pair.setForeignKeyColumn(child.getColumnName()); + + r.getKeyPair().add(pair); + r.setMany(true); + + config.getRelationship().add(r); + + } + + public void addRelationship(Key parentKey, Key childKey) { + + if (config == null) + config = factory.createConfig(); + + QualifiedColumn parent = new QualifiedColumn((String) parentKey.getColumNames().get(0)); + QualifiedColumn child = new QualifiedColumn((String) childKey.getColumNames().get(0)); + + Relationship r = factory.createRelationship(); + r.setName(child.getTableName()); + r.setPrimaryKeyTable(parent.getTableName()); + r.setForeignKeyTable(child.getTableName()); + DebugUtil.debugln(getClass(), debug, "Created relationship from " + r.getPrimaryKeyTable() + " to " + + r.getForeignKeyTable() + " named " + r.getName()); + + Iterator i = parentKey.getColumNames().iterator(); + Iterator j = childKey.getColumNames().iterator(); + while (i.hasNext() && j.hasNext()) { + parent = new QualifiedColumn((String) i.next()); + child = new QualifiedColumn((String) j.next()); + KeyPair pair = factory.createKeyPair(); + pair.setPrimaryKeyColumn(parent.getColumnName()); + pair.setForeignKeyColumn(child.getColumnName()); + + r.getKeyPair().add(pair); + } + r.setMany(true); + config.getRelationship().add(r); + + } + + public void addPrimaryKey(String columnName) { + Key k = new Key(columnName); + addPrimaryKey(k, false); + } + + public void addPrimaryKey(Key key) { + addPrimaryKey(key, false); + } + + public void addGeneratedPrimaryKey(String columnName) { + Key key = new Key(columnName); + addPrimaryKey(key, true); + } + + private void addPrimaryKey(Key key, boolean generated) { + if (config == null) + config = factory.createConfig(); + + Iterator i = key.getColumNames().iterator(); + while (i.hasNext()) { + String columnName = (String) i.next(); + + QualifiedColumn pkColumn = new QualifiedColumn(columnName); + Table t = findOrCreateTable(pkColumn.getTableName()); + Column c = findOrCreateColumn(t, pkColumn.getColumnName()); + c.setPrimaryKey(true); + if (generated) + c.setGenerated(true); + } + } + + public String getTablePropertyName(String tableName) { + Table t = getTable(tableName); + if (t == null) + return tableName; + String propertyName = t.getPropertyName(); + + if (propertyName == null) + return tableName; + + return propertyName; + } + + public Column getColumn(Table t, String name) { + if (t == null) + return null; + Iterator i = t.getColumn().iterator(); + while (i.hasNext()) { + Column c = (Column) i.next(); + if (c.getName().equals(name)) { + return c; + } + } + DebugUtil + .debugln(getClass(), debug, "WARNING: Could not find column " + name + " in table " + t.getName()); + return null; + } + + public Column getColumnByPropertyName(Table t, String propertyName) { + if (t == null) + return null; + Iterator i = t.getColumn().iterator(); + while (i.hasNext()) { + Column c = (Column) i.next(); + if (c.getName().equals(propertyName)) + return c; + if (c.getPropertyName() != null && c.getPropertyName().equals(propertyName)) + return c; + } + DebugUtil.debugln(getClass(), debug, "WARNING: Could not find column " + propertyName + " in table " + + t.getName()); + return null; + } + + public String getColumnPropertyName(String tableName, String columnName) { + Table t = getTable(tableName); + Column c = getColumn(t, columnName); + if (c == null) + return columnName; + + String propertyName = c.getPropertyName(); + if (propertyName == null) + return c.getName(); + + return propertyName; + } + + public void addCollisionColumn(String columnName) { + + if (config == null) + config = factory.createConfig(); + + QualifiedColumn occColumn = new QualifiedColumn(columnName); + Table t = findOrCreateTable(occColumn.getTableName()); + Column c = findOrCreateColumn(t, occColumn.getColumnName()); + c.setCollision(true); + + config.getTable().add(t); + } + + public void addTable(String tableName, String propertyName) { + Table table = getTable(tableName); + if (table != null) + throw new Error("Table " + tableName + "already exists"); + + table = ConfigFactoryImpl.eINSTANCE.createTable(); + table.setName(tableName); + table.setPropertyName(propertyName); + config.getTable().add(table); + + } + + private Table findOrCreateTable(String tableName) { + Table table = getTable(tableName); + if (table == null) { + table = ConfigFactoryImpl.eINSTANCE.createTable(); + table.setName(tableName); + config.getTable().add(table); + } + return table; + + } + + private Column findOrCreateColumn(Table t, String name) { + Iterator i = t.getColumn().iterator(); + while (i.hasNext()) { + Column c = (Column) i.next(); + if (name.equals(c.getName())) + return c; + } + + Column c = ConfigFactoryImpl.eINSTANCE.createColumn(); + c.setName(name); + t.getColumn().add(c); + return c; + } + + public boolean hasRecursiveRelationships() { + if (config != null) { + Iterator i = getConfig().getRelationship().iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + if (r.getPrimaryKeyTable().equals(r.getForeignKeyTable())) + return true; + } + } + return false; + } + + public Collection getRelationshipsByChildTable(String name) { + ArrayList results = new ArrayList(); + if (config != null) { + Iterator i = getConfig().getRelationship().iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + if (name.equals(r.getForeignKeyTable())) + results.add(r); + } + } + return results; + } + + // TODO optimize + public ArrayList getInsertOrder() { + DebugUtil.debugln(getClass(), debug, "Getting insert order"); + ArrayList inserts = new ArrayList(); + HashMap parentToChild = new HashMap(); + + ArrayList parents = new ArrayList(); + ArrayList children = new ArrayList(); + if (config != null) { + Iterator i = getConfig().getRelationship().iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + parents.add(r.getPrimaryKeyTable()); + children.add(r.getForeignKeyTable()); + parentToChild.put(r.getPrimaryKeyTable(), r.getForeignKeyTable()); + } + + while (parents.size() > 0) { + String parent = (String) parents.get(0); + if (!children.contains(parent)) { + if (!inserts.contains(parent)) + inserts.add(parent); + + String child = (String) parentToChild.get(parent); + if (!inserts.contains(child)) + inserts.add(child); + + parents.remove(parent); + children.remove(child); + } else { + parents.add(parents.remove(0)); + } + } + inserts.addAll(children); + + } + + DebugUtil.debugln(getClass(), debug, inserts); + return inserts; + } + + public ArrayList getDeleteOrder() { + ArrayList deleteOrder = new ArrayList(); + deleteOrder.addAll(getInsertOrder()); + Collections.reverse(deleteOrder); + return deleteOrder; + } + + public void addConverter(String name, String converter) { + if (config == null) + config = factory.createConfig(); + + QualifiedColumn column = new QualifiedColumn(name); + Table t = findOrCreateTable(column.getTableName()); + Column c = findOrCreateColumn(t, column.getColumnName()); + c.setConverterClassName(converter); + + } + + public String getConverter(String tableName, String columnName) { + Table t = getTable(tableName); + Column c = getColumn(t, columnName); + if (c != null) + return c.getConverterClassName(); + return null; + } + + public HashMap getConverters(Table table) { + HashMap converters = new HashMap(); + + Iterator columns = table.getColumn().iterator(); + while (columns.hasNext()) { + Column c = (Column) columns.next(); + if (c.getConverterClassName() != null) { + String property = c.getPropertyName(); + if (property == null) + property = c.getName(); + converters.put(property, c.getConverterClassName()); + } + } + return converters; + } + + public Relationship getRelationshipByReference(Property ref) { + Iterator i = config.getRelationship().iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + if (ref.getName().equals(r.getName()) || ref.getOpposite().getName().equals(r.getName())) + return r; + } + throw new RuntimeException("Could not find relationship " + ref.getName() + " in the configuration"); + } + + public Relationship getRelationshipByName(String name) { + Iterator i = config.getRelationship().iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + if (name.equals(r.getName())) + return r; + } + throw new RuntimeException("Could not find relationship " + name + " in the configuration"); + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java new file mode 100644 index 0000000000..6babe0c349 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java @@ -0,0 +1,41 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.config.wrapper; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + +public class QualifiedColumn { + + private final String tableName; + private final String columnName; + private static boolean debug = false; + + public QualifiedColumn(String name) { + tableName = name.substring(0, name.indexOf('.')); + columnName = name.substring(name.indexOf('.') + 1); + DebugUtil.debugln(getClass(), debug, tableName); + DebugUtil.debugln(getClass(), debug, columnName); + } + + public String getTableName() { + return this.tableName; + } + + public String getColumnName() { + return this.columnName; + } +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java new file mode 100644 index 0000000000..14403367d8 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java @@ -0,0 +1,44 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.config.wrapper; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.config.KeyPair; +import org.apache.tuscany.das.rdb.config.Relationship; + +public class RelationshipWrapper { + + private Relationship relationship; + + public RelationshipWrapper(Relationship r) { + this.relationship = r; + } + + public Collection getForeignKeys() { + ArrayList keys = new ArrayList(); + Iterator i = this.relationship.getKeyPair().iterator(); + while ( i.hasNext()) { + KeyPair pair = (KeyPair) i.next(); + keys.add(pair.getForeignKeyColumn()); + } + return keys; + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java new file mode 100644 index 0000000000..2c2d1dc677 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java @@ -0,0 +1,124 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* 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. +*/ +package org.apache.tuscany.das.rdb.config.wrapper; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.config.Column; +import org.apache.tuscany.das.rdb.config.Table; + +public class TableWrapper { + + private Table table; + + public TableWrapper(Table table) { + this.table = table; + } + + public String getPropertyName() { + return table.getPropertyName() == null ? table.getName() : table + .getPropertyName(); + } + + public Collection getPrimaryKeyNames() { + ArrayList pkNames = new ArrayList(); + Iterator i = table.getColumn().iterator(); + while (i.hasNext()) { + Column c = (Column) i.next(); + if (c.isPrimaryKey()) + pkNames.add(c.getName()); + } + return pkNames; + } + + public Collection getPrimaryKeyProperties() { + + ArrayList keyProperties = new ArrayList(); + Iterator columns = table.getColumn().iterator(); + while (columns.hasNext()) { + Column c = (Column) columns.next(); + if (c.isPrimaryKey()) { + keyProperties.add(getColumnPropertyName(c)); + } + } + + return keyProperties; + } + + private String getColumnPropertyName(Column c) { + if (c.getPropertyName() != null) + return c.getPropertyName(); + else + return c.getName(); + } + + public boolean isGeneratedColumnProperty(String name) { + Column c = getColumnByPropertyName(name); + return c == null ? false : c.isGenerated(); + } + + // public Object getColumnNameByProperty(String propertyName) { + // Iterator i = table.getColumn().iterator(); + // while (i.hasNext()) { + // Column c = (Column) i.next(); + // if (propertyName.equals(c.getPropertyName())) + // return c.getName(); + // } + // return propertyName; + // } + + public String getConverter(String propertyName) { + Column c = getColumnByPropertyName(propertyName); + return (c == null) ? null : c.getConverterClassName(); + } + + public Column getColumnByPropertyName(String propertyName) { + Iterator columns = table.getColumn().iterator(); + while (columns.hasNext()) { + Column c = (Column) columns.next(); + String property = c.getPropertyName(); + if (property == null) + property = c.getName(); + if (propertyName.equals(property)) + return c; + } + + return null; + } + + public Column getCollisionColumn() { + Iterator columns = table.getColumn().iterator(); + while (columns.hasNext()) { + Column c = (Column) columns.next(); + if ( c.isCollision() ) + return c; + } + + return null; + + } + + public String getCollisionColumnPropertyName() { + Column c = getCollisionColumn(); + if ( c.getPropertyName() != null ) + return c.getPropertyName(); + else + return c.getName(); + } +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/CudGenerator.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/CudGenerator.java new file mode 100644 index 0000000000..411104fa3f --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/CudGenerator.java @@ -0,0 +1,64 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* 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. +*/ +package org.apache.tuscany.das.rdb.generator.impl; + +import java.util.Collection; + +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.impl.DeleteCommandImpl; +import org.apache.tuscany.das.rdb.impl.InsertCommandImpl; +import org.apache.tuscany.das.rdb.impl.UpdateCommandImpl; + +import commonj.sdo.DataObject; + +public class CudGenerator { + + private static final UpdateGenerator updateGenerator = UpdateGenerator.instance; + + private static final InsertGenerator insertGenerator = InsertGenerator.instance; + + private static final DeleteGenerator deleteGenerator = DeleteGenerator.instance; + + public DeleteCommandImpl getDeleteCommand(Table t) { + return deleteGenerator.getDeleteCommand(t); + } + + public Collection getDeleteParameters(Table table) { + return deleteGenerator.getDeleteParameters(table); + } + + public Collection getCreateParameters(MappingWrapper mapping, DataObject changedObject, Table table) { + return insertGenerator.getInsertParameters(mapping, changedObject, table); + } + + public InsertCommandImpl getInsertCommand(MappingWrapper mapping, DataObject changedObject, + Table table) { + return insertGenerator.getInsertCommand(mapping, changedObject, table); + } + + public UpdateCommandImpl getUpdateCommand(MappingWrapper mapping, + DataObject changedObject, Table table) { + return updateGenerator.getUpdateCommand(mapping, changedObject, table); + } + + public Collection getUpdateParameters(DataObject changedObject, Table table) { + return updateGenerator.getUpdateParameters(changedObject, table); + } + +} + diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java new file mode 100644 index 0000000000..c2d312b56d --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java @@ -0,0 +1,98 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* 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. +*/ +package org.apache.tuscany.das.rdb.generator.impl; + +import java.util.Collection; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.Converter; +import org.apache.tuscany.das.rdb.Parameter; +import org.apache.tuscany.das.rdb.SDODataTypes; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper; +import org.apache.tuscany.das.rdb.impl.DeleteCommandImpl; +import org.apache.tuscany.das.rdb.impl.ParameterImpl; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +public class DeleteGenerator { + + public static final DeleteGenerator instance = new DeleteGenerator(); + + private static final boolean debug = false; + + public DeleteGenerator() { + super(); + } + + public String getDeleteStatement(Table t) { + TableWrapper table = new TableWrapper(t); + + StringBuffer statement = new StringBuffer(); + statement.append("delete from "); + statement.append(t.getName()); + statement.append(" where "); + + Iterator names = table.getPrimaryKeyNames().iterator(); + Iterator properties = table.getPrimaryKeyProperties().iterator(); + while (names.hasNext() && properties.hasNext()) { + String name = (String) names.next(); + statement.append(name); + statement.append(" = ?"); + if (names.hasNext() && properties.hasNext()) + statement.append(" and "); + } + + DebugUtil.debugln(getClass(), debug, statement.toString()); + return statement.toString(); + } + + public Collection getDeleteParameters(Table table) { + TableWrapper wrapper = new TableWrapper(table); + return wrapper.getPrimaryKeyProperties(); + } + + public DeleteCommandImpl getDeleteCommand(Table t) { + DeleteCommandImpl deleteCommand = new DeleteCommandImpl(getDeleteStatement(t)); + + Iterator i = getDeleteParameters(t).iterator(); + for(int idx=1; i.hasNext(); idx++) { + String property = (String) i.next(); + Parameter p = new ParameterImpl(); + p.setName(property); + p.setType(SDODataTypes.OBJECT); + p.setConverter(getConverter(t, property)); + p.setIndex(idx); + deleteCommand.addParameter(p); + } + return deleteCommand; + } + + private Converter getConverter(Table t, String name) { + TableWrapper tw = new TableWrapper(t); + String converter = tw.getConverter(name); + if ( converter != null ) { + try { + return (Converter) Class.forName(converter).newInstance(); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + return null; + } + +} + diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java new file mode 100644 index 0000000000..5653b23aa2 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java @@ -0,0 +1,179 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* 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. +*/ +package org.apache.tuscany.das.rdb.generator.impl; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import org.apache.tuscany.das.rdb.Converter; +import org.apache.tuscany.das.rdb.Parameter; +import org.apache.tuscany.das.rdb.config.Relationship; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.config.wrapper.RelationshipWrapper; +import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper; +import org.apache.tuscany.das.rdb.impl.InsertCommandImpl; +import org.apache.tuscany.das.rdb.impl.ParameterImpl; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; + +public class InsertGenerator { + + public static final InsertGenerator instance = new InsertGenerator(); + + private static final boolean debug = false; + + public InsertGenerator() { + super(); + } + + public InsertCommandImpl getInsertCommand(MappingWrapper config, + DataObject changedObject, Table t) { + ArrayList parameters = new ArrayList(); + TableWrapper table = new TableWrapper(t); + StringBuffer statement = new StringBuffer("insert into "); + statement.append(t.getName()); + + Iterator i = getAttributeProperties(changedObject, config).iterator(); + + ArrayList attributes = new ArrayList(); + while (i.hasNext()) { + Property attr = (Property) i.next(); + if (!table.isGeneratedColumnProperty(attr.getName())) { + attributes.add(attr.getName()); + parameters.add(changedObject.getType().getProperty( + attr.getName())); + } + } + + statement.append("("); + Iterator attrs = attributes.iterator(); + while (attrs.hasNext()) { + String name = (String) attrs.next(); + statement.append(""); + statement.append(name); + if (attrs.hasNext()) + statement.append(", "); + else + statement.append(")"); + } + + statement.append(" values ("); + for (int idx = 1; idx <= attributes.size(); idx++) { + statement.append('?'); + if (idx < attributes.size()) + statement.append(", "); + else + statement.append(")"); + } + + InsertCommandImpl cmd = new InsertCommandImpl(statement.toString()); + Iterator params = parameters.iterator(); + for (int idx = 1; params.hasNext(); idx++) { + Property property = (Property) params.next(); + Parameter p = new ParameterImpl(); + p.setName(property.getName()); + p.setType(property.getType()); + p.setConverter(getConverter(table, property.getName())); + p.setIndex(idx); + cmd.addParameter(p); + + } + DebugUtil.debugln(getClass(), debug, statement.toString()); + return cmd; + + } + + private Converter getConverter(TableWrapper tw, String name) { + String converter = tw.getConverter(name); + if ( converter != null ) { + try { + return (Converter) Class.forName(converter).newInstance(); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + return null; + } + + private List getAttributeProperties(DataObject obj, MappingWrapper config) { + ArrayList fields = new ArrayList(); + Iterator i = obj.getType().getProperties().iterator(); + while (i.hasNext()) { + Property p = (Property) i.next(); + if (p.getType().isDataType()) { + if (obj.isSet(p)) + fields.add(p); + } else { + if ( obj.isSet(p) ) { + Relationship relationship = config.getRelationshipByReference(p); + if ( p.getOpposite().isMany() || (hasState(config, relationship, obj))) { + RelationshipWrapper r = new RelationshipWrapper( + relationship); + Iterator keys = r.getForeignKeys().iterator(); + while (keys.hasNext()) { + String key = (String) keys.next(); + Property keyProp = obj.getType().getProperty(key); + fields.add(keyProp); + } + } + + } + } + } + + return fields; + + } + + public Collection getInsertParameters(MappingWrapper config, + DataObject changedObject, Table table) { + ArrayList parameters = new ArrayList(); + TableWrapper wrapper = new TableWrapper(table); + + Iterator i = getAttributeProperties(changedObject, config).iterator(); + + while (i.hasNext()) { + Property attr = (Property) i.next(); + if (!wrapper.isGeneratedColumnProperty(attr.getName())) + parameters.add(changedObject.getType().getProperty( + attr.getName())); + } + + return parameters; + } + + private boolean hasState(MappingWrapper config, Relationship rel, DataObject changedObject) { + + if ( !rel.isMany()) { + Table t = config.getTableByPropertyName(changedObject.getType().getName()); + TableWrapper tw = new TableWrapper(t); + RelationshipWrapper rw = new RelationshipWrapper(rel); + if (( rel.getForeignKeyTable().equals(t.getName())) && + ( Collections.disjoint(tw.getPrimaryKeyProperties(),rw.getForeignKeys()) )) + return true; + } + + return false; + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java new file mode 100644 index 0000000000..3243ba2388 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java @@ -0,0 +1,206 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* 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. +*/ +package org.apache.tuscany.das.rdb.generator.impl; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import org.apache.tuscany.das.rdb.Converter; +import org.apache.tuscany.das.rdb.Parameter; +import org.apache.tuscany.das.rdb.config.Column; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.config.wrapper.RelationshipWrapper; +import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper; +import org.apache.tuscany.das.rdb.impl.OptimisticWriteCommandImpl; +import org.apache.tuscany.das.rdb.impl.ParameterImpl; +import org.apache.tuscany.das.rdb.impl.UpdateCommandImpl; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; + +public class UpdateGenerator { + + private boolean debug = false; + + public static UpdateGenerator instance = new UpdateGenerator(); + + public UpdateGenerator() { + super(); + } + + public UpdateCommandImpl getUpdateCommand(MappingWrapper mapping, DataObject changedObject, Table table) { + ArrayList parameters = new ArrayList(); + Type type = changedObject.getType(); + TableWrapper t = new TableWrapper(table); + StringBuffer statement = new StringBuffer("update "); + statement.append(table.getName()); + statement.append(" set "); + + + ChangeSummary summary = changedObject.getDataGraph().getChangeSummary(); + Iterator i = getChangedFields(mapping, summary, changedObject).iterator(); + + while (i.hasNext()) { + Property attr = (Property) i.next(); + Column c = t.getColumnByPropertyName(attr.getName()); + if ((c != null) && (c.isCollision() || c.isPrimaryKey())) { + // get rid of comma if OCC or PK is last field + if (!i.hasNext()) { + statement + .delete(statement.length() - 2, statement.length()); + } + } else { + parameters.add(attr); + statement.append(c == null ? attr.getName() : c.getName()); + statement.append(" = ?"); + if (i.hasNext()) + statement.append(", "); + } + } + + statement.append(" where "); + + Iterator names = t.getPrimaryKeyNames().iterator(); + Iterator properties = t.getPrimaryKeyProperties().iterator(); + while (names.hasNext() && properties.hasNext()) { + String name = (String) names.next(); + String property = (String) properties.next(); + statement.append(name); + statement.append(" = ?"); + if (names.hasNext() && properties.hasNext()) + statement.append(" and "); + parameters.add(type.getProperty(property)); + } + + if (t.getCollisionColumn() != null) { + statement.append(" and "); + statement.append(t.getCollisionColumn().getName()); + statement.append(" = ?"); + parameters.add(type.getProperty(t.getCollisionColumnPropertyName())); + } + + + UpdateCommandImpl updateCommand; + if ( t.getCollisionColumn() != null ) + updateCommand = new OptimisticWriteCommandImpl(statement.toString()); + else + updateCommand = new UpdateCommandImpl(statement.toString()); + + Iterator params = parameters.iterator(); + for (int idx = 1; params.hasNext(); idx++ ) { + Property p = (Property)params.next(); + Parameter param = new ParameterImpl(); + param.setName(p.getName()); + param.setType(p.getType()); + param.setConverter(getConverter(t, p.getName())); + param.setIndex(idx); + updateCommand.addParameter(param); + } + DebugUtil.debugln(getClass(), debug, statement.toString()); + return updateCommand; + } + + private List getAttributeProperties(DataObject obj) { + ArrayList fields = new ArrayList(); + Iterator i = obj.getType().getProperties().iterator(); + while ( i.hasNext() ) { + Property p = (Property) i.next(); + if ( p.getType().isDataType()) + fields.add(p); + } + return fields; + } + + + private List getChangedFields(MappingWrapper mapping, ChangeSummary summary, DataObject obj) { + ArrayList changes = new ArrayList(); + Iterator i = summary.getOldValues(obj).iterator(); + while (i.hasNext()) { + ChangeSummary.Setting setting = (ChangeSummary.Setting) i.next(); + if (setting.getProperty().getType().isDataType()) { + changes.add(setting.getProperty()); + } else { + Property ref = setting.getProperty(); + if ( !ref.isMany() ) { + RelationshipWrapper r = new RelationshipWrapper(mapping.getRelationshipByReference(ref)); + + Iterator keys = r.getForeignKeys().iterator(); + while ( keys.hasNext()) { + String key = (String) keys.next(); + Property p = obj.getType().getProperty(key); + changes.add(p); + } + } + + } + } + return changes; + } + + + private Converter getConverter(TableWrapper tw, String name) { + String converter = tw.getConverter(name); + if ( converter != null ) { + try { + return (Converter) Class.forName(converter).newInstance(); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + return null; + } + + public Collection getUpdateParameters(DataObject changedObject, Table table) { + Type type = changedObject.getType(); + TableWrapper wrapper = new TableWrapper(table); + Collection pkNames = wrapper.getPrimaryKeyProperties(); + ArrayList parameters = new ArrayList(); + ArrayList pkParams = new ArrayList(); + + Iterator i = getAttributeProperties(changedObject).iterator(); + while (i.hasNext()) { + Property attr = (Property) i.next(); + String field = attr.getName(); + + Parameter p = getParameter(wrapper, type.getProperty(field)); + if (pkNames.contains(field)) { + pkParams.add(p); + } else { + parameters.add(p); + } + } + parameters.addAll(pkParams); + return parameters; + + } + + private Parameter getParameter(TableWrapper wrapper, Property property) { + Parameter param = new ParameterImpl(); + param.setName(property.getName()); + param.setType(property.getType()); + param.setConverter(getConverter(wrapper, property.getName())); + + return param; + } +} + diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java new file mode 100644 index 0000000000..2d58c0f269 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java @@ -0,0 +1,120 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; +import commonj.sdo.helper.DataFactory; + +public class DataObjectMaker { + + private final DataObject rootObject; + + private boolean debug = false; + + public DataObjectMaker(DataObject root) { + this.rootObject = root; + } + + /** + * @param tableData + * @return + */ + public DataObject createAndAddDataObject(TableData tableData, + ResultMetadata resultMetadata) { + // Get a Type from the package and create a standalone DataObject + + DebugUtil.debugln(getClass(), this.debug, "Looking for Type for " + + tableData.getTableName()); + + Type tableClass = findTableTypeByPropertyName(tableData.getTableName()); + + if (tableClass == null) + throw new RuntimeException("An SDO Type with name " + + tableData.getTableName() + " was not found"); + + DataObject obj = DataFactory.INSTANCE.create(tableClass); + + // Now, check to see if the root data object has a containment reference + // to this EClass. If so, add it to the graph. If not, it will be taken + // care + // of when we process relationships + + Iterator i = this.rootObject.getType().getProperties().iterator(); + while (i.hasNext()) { + Property p = (Property) i.next(); + + if (p.isContainment() && p.getType().equals(tableClass)) { + if (p.isMany()) + rootObject.getList(p).add(obj); + // TODO This was a performance optimization for EMF in SDO 1.1, + // check to see if there is + // something equivalent in SDO 2.0 + // ((InternalEList) this.dataGraph.eGet(ref)).addUnique(obj); + else + this.rootObject.set(p, obj); + } + + } + + Iterator columnNames = resultMetadata.getColumnNames( + tableData.getTableName()).iterator(); + while (columnNames.hasNext()) { + String columnName = (String) columnNames.next(); + DataObject dataObject = (DataObject) obj; + Property p = findProperty(dataObject.getType(), columnName); + Object value = tableData.getColumnData(columnName); + + dataObject.set(p, value); + } + + return obj; + } + + // temporary, ignoring case + private Property findProperty(Type type, String columnName) { + Iterator properties = type.getProperties().iterator(); + while (properties.hasNext()) { + Property p = (Property) properties.next(); + if (columnName.equalsIgnoreCase(p.getName())) + return p; + } + return null; + } + + private Type findTableTypeByPropertyName(String tableName) { + Iterator i = rootObject.getType().getProperties().iterator(); + while (i.hasNext()) { + Property p = (Property) i.next(); + // System.out.println(p.getType().getName()); + if (tableName.equals(p.getType().getName())) + return p.getType(); + } + + return null; + } + + private Type findTableTypeByRootReference(String refName) { + return rootObject.getProperty(refName).getType(); + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java new file mode 100644 index 0000000000..54c536d95c --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java @@ -0,0 +1,91 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.sql.Blob; +import java.sql.SQLException; + +import org.apache.tuscany.das.rdb.Converter; + + +public class DefaultConverter implements Converter { + + public DefaultConverter() { + super(); + } + + public Object getColumnValue(Object data) { + return data; + } + + public Object getPropertyValue(Object data) { +// if (type.isInstance(data)) +// return data; +// +// if ( data == null ) +// return null; +// +// String name = type.getInstanceClass().getName(); +// if (name == "java.lang.Byte" || name == "byte") { +// return new Byte(data.toString()); +// } +// +// else if (name == "java.lang.Double" || name == "double") { +// return new Double(data.toString()); +// } +// +// else if (name == "java.lang.Float" || name == "float") { +// return new Float(data.toString()); +// } +// +// else if (name == "java.lang.Integer" || name == "int") { +// return new Integer(data.toString()); +// } +// +// else if (name == "java.lang.Long" || name == "long") { +// return new Long(data.toString()); +// } +// +// else if (name == "java.lang.Short" || name == "short") { +// return new Short(data.toString()); +// } +// +// else if (name == "java.lang.String") { +// return String.valueOf(data.toString()); +// } + + if ( data instanceof Blob ) { + Blob b = (Blob) data; + try { + return b.getBytes(1, (int)b.length()); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } else { + return data; + } + + + +// else { +// +// throw new IllegalArgumentException("The database value of type " +// + data.getClass().getName() + " must be converted to type " +// + type.getInstanceClass().getName()); +// } + } +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java new file mode 100644 index 0000000000..6247dea757 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java @@ -0,0 +1,98 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.ResultSetShape; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.graphbuilder.schema.ESchemaMaker; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.Type; + + +/** + */ +public class GraphBuilderMetadata { + + private Config mappingModel; + private final Collection resultSets = new ArrayList(); + private boolean debug = false; + private Type schema; + + + public GraphBuilderMetadata(Collection results, Type schema, Config model, ResultSetShape shape) throws SQLException { + this.mappingModel = model; + this.schema = schema; + + Iterator i = results.iterator(); + while (i.hasNext()) { + ResultSet rs = (ResultSet) i.next(); + ResultMetadata resultMetadata = new ResultMetadata(rs, mappingModel, shape); + resultSets.add(resultMetadata); + } + + DebugUtil.debugln(getClass(), debug, "Mapping model: " + mappingModel); + } + + + public Collection getResultMetadata() { + return this.resultSets; + } + + + public boolean hasMappingModel() { + return mappingModel == null ? false : true; + } + + + /** + * @return + */ + + public Collection getRelationships() { + if (!hasMappingModel()) { + DebugUtil.debugln(getClass(), debug, "No relationships to return"); + return Collections.EMPTY_LIST; + } + + return mappingModel.getRelationship(); + } + + + /** + * @return + */ + public Type getSchema() { + if ( this.schema == null ) { + ESchemaMaker schemaMaker = new ESchemaMaker(this); + return schemaMaker.createTypes(); + } else { + return this.schema; + } + } + + public Config getMapping() { + return this.mappingModel; + } +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java new file mode 100644 index 0000000000..142aee5c60 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java @@ -0,0 +1,105 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; + + + +/** + * + * Used to store and look up table objects based on primary key + * This could be a lot more efficient if we could use LinkedHashMap from JDK 1.4 + */ +public class MultiTableRegistry implements TableRegistry { + + private HashMap tableNameMap; + private HashMap tableValueMap; + private boolean debug = false; + + + public MultiTableRegistry() { + tableNameMap = new HashMap(); + tableValueMap = new HashMap(); + } + + + + /** + * Get the table with the specified name and primary key + * @param tableName + * @param primaryKey + * @return EDataObject + */ + public DataObject get(String tableName, List primaryKey) { + if ( debug ) { + DebugUtil.debugln(getClass(), debug, "Looking for table " + tableName + " with PK " + primaryKey); + DebugUtil.debugln(getClass(), debug, ("\tReturning " + getPkMap(tableName).get(primaryKey))); + } + return (DataObject) getPkMap(tableName).get(primaryKey); + } + + /** + * Add the table with the specified name and primary key + * @param tableName + * @param primaryKey + * @param value + */ + public void put(String tableName, List primaryKey, DataObject value) { + if ( getPkMap(tableName).put(primaryKey, value) == null ) + getCreateValueList(tableName).add(value); + } + + /** + * Get the HashMap that contains the primary key to table object + * mappings. + * @param tableName + * @return HashMap + */ + private HashMap getPkMap(String tableName) { + HashMap pkMap = (HashMap)tableNameMap.get(tableName); + if ( pkMap == null ) { + pkMap = new HashMap(); + tableNameMap.put(tableName, pkMap); + } + return pkMap; + } + + private List getCreateValueList(String tableName) { + List values = (List) tableValueMap.get(tableName); + if ( values == null ) { + values = new ArrayList(); + tableValueMap.put(tableName, values); + } + return values; + } + + + + public boolean contains(String tableName, List primaryKey) { + return get(tableName,primaryKey) == null ? false : true; + + } + + +}
\ No newline at end of file diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java new file mode 100644 index 0000000000..04c873db13 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java @@ -0,0 +1,293 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.Converter; +import org.apache.tuscany.das.rdb.ResultSetShape; +import org.apache.tuscany.das.rdb.config.Column; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.Type; + +public class ResultMetadata { + + private HashMap tableToColumnMap = new HashMap(); + + private ArrayList tablePropertyNames = new ArrayList(); + + private ArrayList columnPropertyNames = new ArrayList(); + + private final ResultSet resultSet; + + private final ResultSetShape resultSetShape; + + private final MappingWrapper mappingWrapper; + + private Converter[] converters; + + private static boolean debug = false; + + public ResultMetadata(ResultSet rs, Config model, ResultSetShape shape) + throws SQLException { + debug("Creating new ResultMetadata with mapping model " + model); + this.resultSet = rs; + this.mappingWrapper = new MappingWrapper(model); + + if (shape == null) + this.resultSetShape = new ResultSetShape(rs.getMetaData()); + else + this.resultSetShape = shape; + + this.converters = new Converter[resultSetShape.getColumnCount()]; + + for (int i = 1; i <= resultSetShape.getColumnCount(); i++) { + String tableName = resultSetShape.getTableName(i); + + String tableProperty = mappingWrapper + .getTablePropertyName(tableName); + String columnProperty = mappingWrapper.getColumnPropertyName( + tableName, resultSetShape.getColumnName(i)); + String converter = mappingWrapper.getConverter(tableName, + resultSetShape.getColumnName(i)); + if (converter != null) { + + try { + + Class converterClazz= Class.forName(converter, true, Thread.currentThread().getContextClassLoader()); + if(null != converterClazz) + converters[i - 1]= (Converter) converterClazz.newInstance(); + + }catch( Exception e){ + //try loading below.... + converters[i - 1]= null; //safety + } + + + if(null == converters[i - 1] ) + try{ + + + Converter convInstance = (Converter) Class.forName( + converter).newInstance(); + converters[i - 1] = convInstance; + } catch (Exception ex) { + throw new RuntimeException(ex); + } + + } else { + // TODO make static + converters[i - 1] = new DefaultConverter(); + } + DebugUtil.debugln(getClass(), debug, "Adding table/column: " + + tableProperty + "/" + columnProperty); + tablePropertyNames.add(tableProperty); + columnPropertyNames.add(columnProperty); + + Collection columns = (Collection) tableToColumnMap + .get(tableProperty); + if (columns == null) + columns = new ArrayList(); + columns.add(columnProperty); + tableToColumnMap.put(tableProperty, columns); + } + + // Add any tables defined in the model but not included in the ResultSet + // to the list of propertyNames + if (model != null) { + Iterator tablesFromModel = model.getTable().iterator(); + while (tablesFromModel.hasNext()) { + TableWrapper t = new TableWrapper((Table) tablesFromModel + .next()); + if (tableToColumnMap.get(t.getPropertyName()) == null) + tableToColumnMap.put(t.getPropertyName(), + Collections.EMPTY_LIST); + } + } + + if (debug) { + DebugUtil.debugln(getClass(), debug, toString()); + DebugUtil + .debugln(getClass(), debug, this.resultSetShape.toString()); + } + + } + + private void debug(Object string) { + if (debug) + DebugUtil.debugln(getClass(), debug, string); + } + + public Collection getColumnNames() { + return columnPropertyNames; + } + + public String getColumnPropertyName(int i) { + return (String) columnPropertyNames.get(i - 1); + } + + public String getDatabaseColumnName(int i) { + return resultSetShape.getColumnName(i); + } + + public String getTableName(String columnName) { + return (String) tablePropertyNames.get(columnPropertyNames + .indexOf(columnName)); + } + + public int getTableSize(String tableName) { + return ((Collection) tableToColumnMap.get(tableName)).size(); + } + + public Type getDataType(String columnName) { + return resultSetShape.getColumnType(columnPropertyNames + .indexOf(columnName)); + } + + public String getTablePropertyName(int i) { + return (String) tablePropertyNames.get(i - 1); + } + + public Collection getAllTablePropertyNames() { + return tableToColumnMap.keySet(); + } + + public String toString() { + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (Table Names: "); + Iterator i = tablePropertyNames.iterator(); + while (i.hasNext()) { + String tableName = (String) i.next(); + result.append(' '); + result.append(tableName); + result.append(','); + } + + result.append(" columnNames: "); + + i = columnPropertyNames.iterator(); + while (i.hasNext()) { + String columnName = (String) i.next(); + result.append(' '); + result.append(columnName); + result.append(','); + } + + result.append(" mappingModel: "); + result.append(this.mappingWrapper.getConfig()); + + result.append(" resultSet: "); + result.append(resultSet); + + result.append(" resultSetSize: "); + result.append(resultSetShape.getColumnCount()); + result.append(')'); + return result.toString(); + + } + + /** + * @return + */ + public int getNumberOfTables() { + return tableToColumnMap.keySet().size(); + } + + /** + * Return whether the column at the given position is part of a primary key. + * If we don't have this information, we assume every column is a primary + * key. This results in uniqueness checks using all columns in a table. + * + * @param i + * @return + */ + public boolean isPKColumn(int i) { + if (debug) { + DebugUtil.debugln(getClass(), debug, "Checking to see if " + + getColumnPropertyName(i) + " is a PK column in " + + getTablePropertyName(i)); + } + if (!hasMappingModel()) { + if (debug) + DebugUtil + .debugln(getClass(), debug, + "No mapping model exists, all columns will be considered PK columns"); + return true; + } else { + Table t = mappingWrapper.getTable(getTablePropertyName(i)); + if (t == null) + return true; + Column c = mappingWrapper.getColumn(t, getDatabaseColumnName(i)); + + if (c == null) + return false; + + if (c.isPrimaryKey()) + return true; + } + return false; + } + + public boolean hasMappingModel() { + return mappingWrapper.getConfig() == null ? false : true; + } + + /** + * @param i + * @return + */ + public Type getDataType(int i) { + return resultSetShape.getColumnType(i); + } + + /** + * @param tableName + * @return + */ + public Collection getColumnNames(String tableName) { + return (Collection) tableToColumnMap.get(tableName); + } + + public ResultSet getResultSet() { + return this.resultSet; + } + + public int getResultSetSize() { + return resultSetShape.getColumnCount(); + } + + public boolean isRecursive() { + return mappingWrapper.hasRecursiveRelationships(); + } + + public Converter getConverter(int i) { + return converters[i - 1]; + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java new file mode 100644 index 0000000000..8ccc0aee12 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java @@ -0,0 +1,137 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; + +/** + * + * A ResultSetProcessor is used to transform the data in a ResultSet into a set + * of inter-related EDataObjects. + */ +public class ResultSetProcessor { + + private TableRegistry registry; + + private GraphBuilderMetadata metadata; + + private boolean debug = false; + + private final DataObjectMaker doMaker; + + public ResultSetProcessor(DataObject g, GraphBuilderMetadata gbmd) { + + this.metadata = gbmd; + if (metadata.getRelationships().size() == 0) + registry = new SingleTableRegistry(); + else + registry = new MultiTableRegistry(); + + doMaker = new DataObjectMaker(g); + + debug(metadata); + + } + + private void debug(Object output) { + DebugUtil.debugln(getClass(), debug, output); + } + + /** + * Process the ResultSet. For each row in the ResultSet, a + * + * @link ResultSetRow object will be created to represent the row as a set + * of EDataObjects. Then, the relevant relationships will be + * constructed between each object in the + * @link ResultSetRow. + * + * @param rs + * The ResultSet + */ + public void processResults(int start, int end) throws SQLException { + + Iterator i = metadata.getResultMetadata().iterator(); + while ( i.hasNext()) { + ResultMetadata resultMetadata = (ResultMetadata)i.next(); + ResultSet results = resultMetadata.getResultSet(); + + processResultSet(results, resultMetadata, start, end); + + //TODO These statements HAVE to be closed or we will have major problems + //results.getStatement().close(); + results.close(); + } + + } + + + private void processResultSet(ResultSet rs, ResultMetadata rsMetadata, + int start, int end) throws SQLException { + + if ( rs.getType() == ResultSet.TYPE_FORWARD_ONLY) { + while (rs.next() && start < end) { + ResultSetRow rsr = new ResultSetRow(rs, rsMetadata); + addRowToGraph(rsr, rsMetadata); + ++start; + } + } else { + while (rs.absolute(start) && start < end) { + ResultSetRow rsr = new ResultSetRow(rs, rsMetadata); + addRowToGraph(rsr, rsMetadata); + ++start; + } + } + } + + /** + * @param row + * @param resultMetadata + */ + private void addRowToGraph(ResultSetRow row, ResultMetadata resultMetadata) { + RowObjects tableObjects = new RowObjects(metadata, registry); + Iterator tables = row.getAllTableData().iterator(); + while (tables.hasNext()) { + TableData rawDataFromRow = (TableData) tables.next(); + + if ( (resultMetadata.hasMappingModel()) && (!rawDataFromRow.hasValidPrimaryKey() ) ) + continue; + + String tableName = rawDataFromRow.getTableName(); + DataObject tableObject = registry.get(tableName, rawDataFromRow + .getPrimaryKeyValues()); + if (tableObject == null) { + tableObject = doMaker.createAndAddDataObject(rawDataFromRow, resultMetadata); + + debug("Putting table " + tableName + " with PK " + rawDataFromRow.getPrimaryKeyValues() + " into registry"); + + registry.put(tableName, rawDataFromRow.getPrimaryKeyValues(), + tableObject); + } + tableObjects.put(tableName, tableObject); + } + + tableObjects.processRelationships(); + + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java new file mode 100644 index 0000000000..f68f48fc06 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java @@ -0,0 +1,169 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + + +/** + * + * A ResultSetRow is used to transform a single row of a ResultSet into a set of + * EDataObjects. + */ +public class ResultSetRow { + + private final ResultMetadata metadata; + + private HashMap tableMap = new HashMap(); + + private ArrayList allTableData; + + private boolean debug = false; + + /** + * Method ResultSetRow. + * + * @param rs + * A ResultSet positioned on the desired row + * @param ePackage + * The package used to create EDataObjects + */ + public ResultSetRow(ResultSet rs, ResultMetadata m) throws SQLException { + this.metadata = m; + if (m.isRecursive()) + processRecursiveRow(rs); + else + processRow(rs); + } + + /** + * Processes a single row in the ResultSet Method processRow. + * + * @param rs + */ + private void processRow(ResultSet rs) throws SQLException { + + DebugUtil.debugln(getClass(), debug, ""); + for (int i = 1; i <= metadata.getResultSetSize(); i++) { + Object data = getObject(rs, i); + + TableData table = getRawData(metadata.getTablePropertyName(i)); + DebugUtil.debugln(getClass(), debug, "Adding column: " + + metadata.getColumnPropertyName(i) + "\tValue: " + data + + "\tTable: " + metadata.getTablePropertyName(i)); + table.addData(metadata.getColumnPropertyName(i), metadata + .isPKColumn(i), data); + } + + } + + public void processRecursiveRow(ResultSet rs) throws SQLException { + this.allTableData = new ArrayList(); + int i = 1; + DebugUtil.debugln(getClass(), debug, ""); + while (i <= metadata.getResultSetSize()) { + DebugUtil.debugln(getClass(), debug, ""); + TableData table = new TableData(metadata.getTablePropertyName(i)); + this.allTableData.add(table); + + while ( (i <= metadata.getResultSetSize()) && (metadata.isPKColumn(i))) { + Object data = getObject(rs, i); + DebugUtil.debugln(getClass(), debug, "Adding column: " + + metadata.getColumnPropertyName(i) + "\tValue: " + data + + "\tTable: " + metadata.getTablePropertyName(i)); + table.addData(metadata.getColumnPropertyName(i), true, data); + i++; + } + + while ( (i <= metadata.getResultSetSize()) && + (!metadata.isPKColumn(i))) { + Object data = getObject(rs, i); + DebugUtil.debugln(getClass(), debug, "Adding column: " + + metadata.getColumnPropertyName(i) + "\tValue: " + data + + "\tTable: " + metadata.getTablePropertyName(i)); + table.addData(metadata.getColumnPropertyName(i), false, data); + i++; + } + } + } + + /** + * @param rs + * @param metadata + * @param i + * @return + */ + private Object getObject(ResultSet rs, int i) + throws SQLException { + + Object data = rs.getObject(i); + + if (rs.wasNull()) + return null; + else + return metadata.getConverter(i).getPropertyValue(data); + } + + /** + * Returns a HashMap that holds data for the specified table + * + * @param tableName + * The name of the table + * @return HashMap + */ + public TableData getTable(String tableName) { + return (TableData) tableMap.get(tableName); + } + + /** + * Returns a HashMap that holds data for the specified table If the HashMap + * doesn't exist, it will be created. This is used internally to build the + * ResultSetRow, whereas getTable is used externally to retrieve existing + * table data. + * + * @param tableName + * The name of the table + * @return HashMap + */ + private TableData getRawData(String tableName) { + + TableData table = (TableData) tableMap.get(tableName); + + if (table == null) { + table = new TableData(tableName); + tableMap.put(tableName, table); + } + + return table; + } + + public ArrayList getAllTableData() { + if ( this.allTableData == null ) { + this.allTableData = new ArrayList(); + this.allTableData.addAll(tableMap.values()); + } + DebugUtil.debugln(getClass(), debug, allTableData); + + return this.allTableData; + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java new file mode 100644 index 0000000000..f0df0ab7c3 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java @@ -0,0 +1,140 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* 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. +*/ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.config.KeyPair; +import org.apache.tuscany.das.rdb.config.Relationship; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; + + +public class RowObjects { + + private HashMap objectsByTableName; + + private ArrayList tableObjects; + + private static final boolean debug = false; + + private final GraphBuilderMetadata metadata; + + private final TableRegistry registry; + + public RowObjects(GraphBuilderMetadata metadata, TableRegistry registry) { + objectsByTableName = new HashMap(); + tableObjects = new ArrayList(); + this.metadata = metadata; + this.registry = registry; + } + + public void put(String key, DataObject value) { + objectsByTableName.put(key, value); + tableObjects.add(value); + } + + public DataObject get(String tablePropertyName) { + return (DataObject) objectsByTableName.get(tablePropertyName); + } + + void processRelationships() { + MappingWrapper wrapper = new MappingWrapper(metadata.getMapping()); + if (wrapper.hasRecursiveRelationships()) { + processRecursiveRelationships(wrapper); + return; + } + + Iterator i = metadata.getRelationships().iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + + + DataObject parentTable = get(wrapper + .getTablePropertyName(r.getPrimaryKeyTable())); + DataObject childTable = get(wrapper + .getTablePropertyName(r.getForeignKeyTable())); + + DebugUtil.debugln(getClass(), debug, "Parent table: " + parentTable); + DebugUtil.debugln(getClass(), debug, "Child table: " + childTable); + + if ((parentTable == null) || (childTable == null)) + continue; + + Property p = parentTable.getType().getProperty(r.getName()); + setOrAdd(parentTable, childTable, p); + + } + } + + + + private void processRecursiveRelationships(MappingWrapper wrapper) { + Iterator i = tableObjects.iterator(); + while (i.hasNext()) { + DataObject table = (DataObject) i.next(); + + Iterator relationships = wrapper.getRelationshipsByChildTable(table.getType().getName()).iterator(); + while ( relationships.hasNext() ) { + Relationship r = (Relationship) relationships.next(); + + DataObject parentTable = findParentTable(table, r, wrapper); + + if (parentTable == null) + continue; + + Property p = parentTable.getType().getProperty(r.getName()); + setOrAdd(parentTable, table, p); + } + + } + } + + private void setOrAdd(DataObject parent, DataObject child, Property p) { + if (p.isMany()) { + parent.getList(p).add(child); + } else { + parent.set(p, child); + } + } + + private DataObject findParentTable(DataObject childTable, + Relationship r, MappingWrapper wrapper) { + + ArrayList fkValue = new ArrayList(); + Iterator keyPairs = r.getKeyPair().iterator(); + while (keyPairs.hasNext()) { + KeyPair pair = (KeyPair) keyPairs.next(); + String childProperty = wrapper.getColumnPropertyName(r.getPrimaryKeyTable(), pair.getForeignKeyColumn()); + + Property p = childTable.getType().getProperty(childProperty); + fkValue.add(childTable.get(p)); + } + + DebugUtil.debugln(getClass(), debug, "Trying to find parent of " + r.getForeignKeyTable() + " with FK " + + fkValue); + DataObject parentTable = registry.get(r.getPrimaryKeyTable(), fkValue); + DebugUtil.debugln(getClass(), debug, "Parent table from registry: " + parentTable); + return parentTable; + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java new file mode 100644 index 0000000000..f00ef2770d --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java @@ -0,0 +1,52 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.util.List; + +import commonj.sdo.DataObject; + +/** + */ +public class SingleTableRegistry implements TableRegistry { + + //private HashMap<List,DataObject> values = new HashMap<List,DataObject>(); + + public SingleTableRegistry() { + // Empty Constructor + } + + /* (non-Javadoc) + * @see com.ibm.ws.sdo.mediator.jdbc.graphbuilder.impl.TableRegistry#get(java.lang.String, java.util.List) + */ + public DataObject get(String tableName, List primaryKey) { + return null; + } + + /* (non-Javadoc) + * @see com.ibm.ws.sdo.mediator.jdbc.graphbuilder.impl.TableRegistry#put(java.lang.String, java.util.List, java.lang.Object) + */ + public void put(String tableName, List primaryKey, DataObject value) { + // do nothing + + } + + public boolean contains(String name, List list) { + return false; + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java new file mode 100644 index 0000000000..48b6dc0187 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java @@ -0,0 +1,75 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + + +/** + * + */ +public class TableData { + + private HashMap columnData = new HashMap(); + private ArrayList primaryKey = new ArrayList(); + private final String name; + private boolean hasValidPrimaryKey = true; + private static final boolean debug = false; + + public TableData(String tableName) { + DebugUtil.debugln(getClass(), debug, "Creating TableData for table " + tableName); + this.name = tableName; + } + + + public void addData(String columnName, boolean isPrimaryKeyColumn, Object data) { + DebugUtil.debugln(getClass(), debug, "Adding column " + columnName + " with value " + data); + columnData.put(columnName, data); + if ( isPrimaryKeyColumn ) { + if ( data == null ) { + DebugUtil.debugln(getClass(), debug, "Column " + columnName + " is a primary key column and is null"); + hasValidPrimaryKey = false; + } + primaryKey.add(data); + } + } + + public Object getColumnData(String columnName) { + return columnData.get(columnName); + } + + public String getTableName() { + return this.name; + } + + + /** + * @return + */ + public List getPrimaryKeyValues() { + return primaryKey; + } + + + public boolean hasValidPrimaryKey() { + return hasValidPrimaryKey; + } +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java new file mode 100644 index 0000000000..4b5a3677ae --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.util.List; + +import commonj.sdo.DataObject; + +/** + */ +public interface TableRegistry { + /** + * Get the table with the specified name and primary key + * @param tableName + * @param primaryKey + * @return EDataObject + */ + public DataObject get(String tableName, List primaryKey); + + /** + * Add the table with the specified name and primary key + * @param tableName + * @param primaryKey + * @param value + */ + public void put(String tableName, List primaryKey, DataObject value); + + public boolean contains(String name, List list); +}
\ No newline at end of file diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ESchemaMaker.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ESchemaMaker.java new file mode 100644 index 0000000000..3082384160 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ESchemaMaker.java @@ -0,0 +1,171 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.graphbuilder.schema; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.config.Relationship; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.graphbuilder.impl.GraphBuilderMetadata; +import org.apache.tuscany.das.rdb.graphbuilder.impl.ResultMetadata; +import org.apache.tuscany.das.rdb.util.DebugUtil; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.apache.tuscany.sdo.util.SDOUtil; + +import commonj.sdo.Property; +import commonj.sdo.Type; +import commonj.sdo.helper.TypeHelper; + +/** + * + * An ESchemaMaker is used to create an EMF Schema from an instance of JDBC + * Mediator Metadata. + * + */ +public class ESchemaMaker { + + private final GraphBuilderMetadata metadata; + + private boolean debug = false; + + /** + * Constructor for ESchemaMaker. Creates an SDO model based on the metadata + * passed in. + * + * @param metadata + */ + public ESchemaMaker(GraphBuilderMetadata metadata) { + this.metadata = metadata; + } + + /** + * Creates an EMF Schema by using the + * + * @link TableMaker and + * @link RelationshipMaker to transform + * @link Metadata elements into EMF Schema elements. + */ + + public Type createTypes() { + TypeHelper types = SDOUtil.createTypeHelper(); + + DataObjectUtil.initRuntime(); + SDOUtil.createDataGraph(); + + + Type rootType = SDOUtil.createType(types, getURI(), "DataGraphRoot", false); + + Iterator iter = metadata.getResultMetadata().iterator(); + while (iter.hasNext()) { + + ResultMetadata resultMetadata = (ResultMetadata) iter.next(); + + Iterator names = resultMetadata.getAllTablePropertyNames() + .iterator(); + while (names.hasNext()) { + String tableName = (String) names.next(); + + Type tableType = SDOUtil.createType(types, getURI(), tableName, false); + Property property = SDOUtil.createProperty(rootType, tableName, tableType); + SDOUtil.setMany(property,true); + SDOUtil.setContainment(property, true); + } + + // TODO tablePropertyMap is temporary until Tuscany-203 is fixed + HashMap tablePropertyMap = new HashMap(); + + for (int i = 1; i <= resultMetadata.getColumnNames().size(); i++) { + + Property ref = rootType.getProperty(resultMetadata.getTablePropertyName(i)); + + // TODO Temporary code to check to see if a property has already been added. + // Replace when Tuscany-203 is fixed + ArrayList addedProperties = (ArrayList) tablePropertyMap.get(ref.getName()); + if ( addedProperties == null ) { + addedProperties = new ArrayList(); + tablePropertyMap.put(ref.getName(), addedProperties); + } + + if (ref == null) + throw new RuntimeException("Could not find table " + + resultMetadata.getTablePropertyName(i) + + " in the SDO model"); + + String columnName = resultMetadata.getColumnPropertyName(i); + + // TODO temporary check until Tuscany-203 is fixed + if ( !addedProperties.contains(columnName)) { + addedProperties.add(columnName); + Type atype = (Type) resultMetadata.getDataType(i); + + SDOUtil.createProperty(ref.getType(), columnName, atype); + + DebugUtil.debugln(getClass(), debug, "Adding column " + + columnName + " to " + + resultMetadata.getTablePropertyName(i)); + } + + } + } + + if (metadata.hasMappingModel()) { + MappingWrapper wrapper = new MappingWrapper(metadata.getMapping()); + Iterator i = metadata.getRelationships().iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + + Type parent = rootType.getProperty( + wrapper.getTablePropertyName(r.getPrimaryKeyTable())).getType(); + Type child = rootType.getProperty( + wrapper.getTablePropertyName(r.getForeignKeyTable())).getType(); + if (parent == null) { + throw new RuntimeException("The parent table (" + + r.getPrimaryKeyTable() + ") in relationship " + + r.getName() + + " was not found in the mapping information."); + } else if (child == null) { + throw new RuntimeException("The child table (" + + r.getForeignKeyTable() + ") in relationship " + + r.getName() + + " was not found in the mapping information."); + } + + // ReferenceImpl ref = refMaker.createReference(r, parent, child); + + Property parentProp = SDOUtil.createProperty(parent, r.getName(), child); + Property childProp = SDOUtil.createProperty(child, r.getName() + "_opposite", parent); + SDOUtil.setOpposite(parentProp, childProp); + SDOUtil.setOpposite(childProp, parentProp); + SDOUtil.setMany(parentProp, r.isMany()); + + + + } + + } + + return rootType; + } + + private String getURI() { + return "http:///org.apache.tuscany.das.rdb/das"; + } + + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java new file mode 100644 index 0000000000..832cfeac7e --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java @@ -0,0 +1,133 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.graphbuilder.schema; + +import java.sql.Types; + +import org.apache.tuscany.sdo.SDOPackage; + +import commonj.sdo.Type; +import commonj.sdo.helper.TypeHelper; + +/** + */ +public class ResultSetTypeMap { + + public static ResultSetTypeMap instance = new ResultSetTypeMap(); + + /** + * Constructor for ResultSetTypeMap. + */ + protected ResultSetTypeMap() { + // Empty Constructor + } + + /** + * These mappings taken primarily from "JDBC API and Tutorial and Reference" by + * Fisher, Ellis and Bruce. + * + * @param type + * @param isNullable + * @return + */ + public Type getEDataType(int type, boolean isNullable) { + + TypeHelper helper = TypeHelper.INSTANCE; + SDOPackage.eINSTANCE.eClass(); + switch (type) { + + case Types.CHAR: + case Types.VARCHAR: + case Types.LONGVARCHAR: + return helper.getType("commonj.sdo", "String"); + + case Types.NUMERIC: + case Types.DECIMAL: + return helper.getType("commonj.sdo", "Decimal"); + + case Types.BIT: + case Types.BOOLEAN: + if (isNullable) + return helper.getType("commonj.sdo", "Boolean"); + else + return helper.getType("commonj.sdo", "boolean"); + + case Types.TINYINT: + case Types.SMALLINT: + case Types.INTEGER: + if (isNullable) { + return helper.getType("commonj.sdo", "IntObject"); + } else + return helper.getType("commonj.sdo", "Int"); + + case Types.BIGINT: + if (isNullable) + return helper.getType("commonj.sdo", "Long"); + else + return helper.getType("commonj.sdo", "long"); + + case Types.REAL: + if (isNullable) + return helper.getType("commonj.sdo", "Float"); + else + return helper.getType("commonj.sdo", "float"); + + case Types.FLOAT: + case Types.DOUBLE: + if (isNullable) + return helper.getType("commonj.sdo", "Double"); + else + return helper.getType("commonj.sdo", "double"); + + case Types.BINARY: + case Types.VARBINARY: + case Types.LONGVARBINARY: + return helper.getType("commonj.sdo", "ByteArray"); + + case Types.DATE: + case Types.TIME: + case Types.TIMESTAMP: + return helper.getType("commonj.sdo", "Date"); + + case Types.CLOB: + return helper.getType("commonj.sdo", "Clob"); + + case Types.BLOB: + return helper.getType("commonj.sdo", "Blob"); + + case Types.ARRAY: + return helper.getType("commonj.sdo", "Array"); + + case Types.DISTINCT: + case Types.STRUCT: + case Types.REF: + case Types.DATALINK: + case Types.JAVA_OBJECT: + return helper.getType("commonj.sdo", "Object"); + + default: + return helper.getType("commonj.sdo", "Object"); + } + + } + + + public Type getType(int columnType, boolean b) { + return getEDataType(columnType, b); + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java new file mode 100644 index 0000000000..79baf3c299 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java @@ -0,0 +1,111 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.Connection; +import java.sql.DriverManager; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConnectionProperties; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; + +/** + * + */ +public class ApplyChangesCommandImpl extends BaseCommandImpl implements ApplyChangesCommand { + + private static final boolean debug = false; + + private ChangeSummarizer summarizer = new ChangeSummarizer(); + + public ApplyChangesCommandImpl() { + } + + public ApplyChangesCommandImpl(Config config){ + this.configWrapper = new MappingWrapper(config); + if (config.getConnectionProperties() != null) + setConnection(config.getConnectionProperties()); + } + + public ApplyChangesCommandImpl(Config config, Connection connection){ + this.configWrapper = new MappingWrapper(config); + setConnection(connection); + } + + public void setConnection(ConnectionImpl connection) { + summarizer.setConnection(connection); + } + + public void setConnection(ConnectionProperties c) { + try { + Connection connection = null; + Class.forName(c.getDriverClassName()); + if (c.getDriverUserName() == null) + connection = DriverManager.getConnection(c.getDriverURL()); + else + connection = DriverManager.getConnection(c.getDriverURL(), c.getDriverUserName(), c.getDriverPassword()); + connection.setAutoCommit(false); + setConnection(connection); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + + public void addCreateCommand(Type type, Command cmd) { + summarizer.addCreateCommand(type, cmd); + } + + public void addUpdateCommand(Type type, Command cmd) { + summarizer.addUpdateCommand(type, cmd); + } + + public void addDeleteCommand(Type type, Command cmd) { + summarizer.addDeleteCommand(type, cmd); + } + + public void execute(DataObject root) { + DebugUtil.debugln(getClass(), debug, "Executing ApplyChangesCmd"); + + if (summarizer.getConnection() == null) + throw new RuntimeException("A connection must be provided"); + + if (!root.equals(root.getDataGraph().getRootObject())) + throw new RuntimeException("'root' argument must be the root of the datagraph"); + + summarizer.setMapping(configWrapper); + + Changes changes = summarizer.loadChanges(root); + + boolean success = false; + try { + changes.execute(); + success = true; + } finally { + if (success) + summarizer.getConnection().cleanUp(); + else + summarizer.getConnection().errorCleanUp(); + } + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java new file mode 100644 index 0000000000..e827426383 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java @@ -0,0 +1,68 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.Key; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; + +public abstract class BaseCommandImpl { + + protected MappingWrapper configWrapper = new MappingWrapper(); + + public void setConnection(Connection connection) { + setConnection(new ConnectionImpl(connection)); + } + + public void setConnection(Connection connection, boolean manageTransaction) { + ConnectionImpl c = new ConnectionImpl(connection); + c.setManageTransactions(manageTransaction); + setConnection(c); + } + + public abstract void setConnection(ConnectionImpl c); + + public void addRelationship(String parentName, String childName) { + configWrapper.addRelationship(parentName, childName); + } + + public void addRelationship(Key parentKey, Key childKey) { + configWrapper.addRelationship(parentKey, childKey); + } + + public void addPrimaryKey(String pk) { + configWrapper.addPrimaryKey(pk); + } + + public void addPrimaryKey(Key pk) { + configWrapper.addPrimaryKey(pk); + } + + public void addConverter(String name, String converter) { + configWrapper.addConverter(name, converter); + } + + public void addCollisionColumn(String columnName) { + configWrapper.addCollisionColumn(columnName); + } + + public void addGeneratedPrimaryKey(String columnName) { + configWrapper.addGeneratedPrimaryKey(columnName); + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java new file mode 100644 index 0000000000..c56c55c636 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java @@ -0,0 +1,199 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* 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. +*/ +package org.apache.tuscany.das.rdb.impl; + +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.SDODataTypes; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper; +import org.apache.tuscany.das.rdb.generator.impl.CudGenerator; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; + +public class ChangeFactory { + + private final Type type; + + private InsertCommandImpl createCommand; + + private UpdateCommandImpl updateCommand; + + private DeleteCommandImpl deleteCommand; + + private static final boolean debug = false; + + private CudGenerator cudGenerator; + + private final MappingWrapper mapping; + + private final ConnectionImpl connection; + + public ChangeFactory(Type type, MappingWrapper mapping, ConnectionImpl connection) { + this.type = type; + this.mapping = mapping; + this.connection = connection; + } + + public Type getType() { + return this.type; + } + + public void setCreateCommand(InsertCommandImpl cmd) { + createCommand = cmd; + } + + public void setUpdateCommand(UpdateCommandImpl cmd) { + DebugUtil.debugln(getClass(), debug, "Setting Update Command to " + cmd); + updateCommand = cmd; + } + + public void setDeleteCommand(DeleteCommandImpl cmd) { + deleteCommand = cmd; + } + + private CudGenerator getCudGenerator() { + if (this.cudGenerator == null) + this.cudGenerator = new CudGenerator(); + return this.cudGenerator; + } + + ChangeOperation createUpdateOperation(DataObject changedObject, String propagatedID) { + return new UpdateOperation(getUpdateCommand(changedObject), changedObject, propagatedID); + } + ChangeOperation createUpdateOperation(DataObject changedObject) { + return createUpdateOperation(changedObject, null); + } + + ChangeOperation createDeleteOperation(DataObject changedObject) { + return new DeleteOperation(getDeleteCommand(changedObject), changedObject); + } + + ChangeOperation createInsertOperation(DataObject changedObject, String propagatedID) { + return new CreateOperation(getCreateCommand(changedObject), changedObject, propagatedID); + } + + ChangeOperation createInsertOperation(DataObject changedObject) { + return createInsertOperation(changedObject, null); + } + + + private InsertCommandImpl getCreateCommand(DataObject changedObject) { + + if ( createCommand == null ) { + Table table = mapping.getTableByPropertyName(changedObject.getType().getName()); + if (table == null ) { + if (changedObject.getType().getProperty("ID") != null ) { + // If the table is not defined in the config, assume it has a primary key of "ID" + mapping.addPrimaryKey(changedObject.getType().getName() + ".ID"); + table = mapping.getTableByPropertyName(changedObject.getType().getName()); + } else { + throw new RuntimeException("Table " + changedObject.getType().getName() + " was changed in the DataGraph but is not present in the Config"); + } + } + + + String createStatement = table.getCreate(); + if ( createStatement == null ) { + createCommand = getCudGenerator().getInsertCommand(mapping, changedObject, table); + } else { + createCommand = new InsertCommandImpl(createStatement); + Iterator i = getCudGenerator().getCreateParameters(mapping, changedObject, table).iterator(); + while (i.hasNext()) { + Property p = (Property)i.next(); + createCommand.addParameter(p.getName(), p.getType()); + } + } + createCommand.setConnection(connection); + createCommand.configWrapper = mapping; + } + return createCommand; + } + + private DeleteCommandImpl getDeleteCommand(DataObject changedObject) { + + if ( deleteCommand == null ) { + Table table = mapping.getTableByPropertyName(changedObject.getType().getName()); + if (table == null ) { + if (changedObject.getType().getProperty("ID") != null ) { + // If the table is not defined in the config, assume it has a primary key of "ID" + mapping.addPrimaryKey(changedObject.getType().getName() + ".ID"); + table = mapping.getTableByPropertyName(changedObject.getType().getName()); + } else { + throw new RuntimeException("Table " + changedObject.getType().getName() + " was changed in the DataGraph but is not present in the Config"); + } + } + + String deleteStatement = table.getDelete(); + if ( deleteStatement == null ) { + deleteCommand = getCudGenerator().getDeleteCommand(table); + } else { + deleteCommand = new DeleteCommandImpl(deleteStatement); + Iterator i = getCudGenerator().getDeleteParameters(table).iterator(); + while (i.hasNext()) { + deleteCommand.addParameter((String)i.next(), SDODataTypes.OBJECT); + } + } + deleteCommand.setConnection(connection); + } + return deleteCommand; + } + + private UpdateCommandImpl getUpdateCommand(DataObject changedObject) { + + if ( updateCommand == null ) { + Table table = mapping.getTableByPropertyName(changedObject.getType().getName()); + if (table == null ) { + if (changedObject.getType().getProperty("ID") != null ) { + // If the table is not defined in the config, assume it has a primary key of "ID" + mapping.addPrimaryKey(changedObject.getType().getName() + ".ID"); + table = mapping.getTableByPropertyName(changedObject.getType().getName()); + } else { + throw new RuntimeException("Table " + changedObject.getType().getName() + " was changed in the DataGraph but is not present in the Config"); + } + } + String updateStatement = table.getUpdate(); + if ( updateStatement == null ) { + updateCommand = getCudGenerator().getUpdateCommand(mapping, changedObject,table); + } else { + TableWrapper t = new TableWrapper(table); + if ( t.getCollisionColumn() != null ) + updateCommand = new OptimisticWriteCommandImpl(updateStatement); + else + updateCommand = new UpdateCommandImpl(updateStatement); + + + updateCommand.addParameters(getCudGenerator().getUpdateParameters(changedObject, table)); + + } + updateCommand.setConnection(connection); + updateCommand.configWrapper = mapping; + } + DebugUtil.debugln(getClass(), debug, "Returning updateCommand: " + updateCommand); + return updateCommand; + } + + public MappingWrapper getConfig() { + return this.mapping; + } + + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java new file mode 100644 index 0000000000..c5221dda5c --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java @@ -0,0 +1,79 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.Parameter; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; + +/** + */ +public abstract class ChangeOperation { + + private final WriteCommandImpl writeCommand; + + protected DatabaseObject dObject; + + private static final boolean debug = false; + + protected String propagatedID = null; + + private boolean isInsert = false; + + public ChangeOperation(DeleteCommandImpl command) { + writeCommand = command; + } + + public ChangeOperation(InsertCommandImpl command, DataObject changedObject) { + writeCommand = command; + dObject = new DatabaseObject(command.getMappingModel(), changedObject); + this.isInsert = true; + } + + public ChangeOperation(UpdateCommandImpl command, DataObject changedObject) { + writeCommand = command; + dObject = new DatabaseObject(command.getMappingModel(), changedObject); + } + + public void execute() { + DebugUtil.debugln(getClass(), debug, "Executing change operation"); + + Iterator i = writeCommand.getParameters().iterator(); + while (i.hasNext()) { + Parameter parm = (Parameter) i.next(); + DebugUtil.debugln(getClass(), debug, "setting " + parm.getName() + " to " + dObject.get(parm.getName())); + parm.setValue(dObject.get(parm.getName())); + } + + writeCommand.execute(); + + if ( isInsert && ( propagatedID != null )) { + DebugUtil.debugln(getClass(), debug, "Propagating key " + propagatedID); + int id = writeCommand.getGeneratedKey(); + dObject.setPropagatedID(propagatedID, id); + } + } + + public String getTableName() { + return dObject.getTableName(); + } + + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java new file mode 100644 index 0000000000..10984d9d4b --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java @@ -0,0 +1,266 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* 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. +*/ +package org.apache.tuscany.das.rdb.impl; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.Key; +import org.apache.tuscany.das.rdb.config.Column; +import org.apache.tuscany.das.rdb.config.Relationship; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.config.wrapper.QualifiedColumn; +import org.apache.tuscany.das.rdb.config.wrapper.RelationshipWrapper; +import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper; +import org.apache.tuscany.das.rdb.util.DebugUtil; +import org.apache.tuscany.sdo.impl.ChangeSummaryImpl; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; + +public class ChangeSummarizer { + + private static final boolean debug = false; + + private Changes changes = new Changes(); + + private FactoryRegistry registry; + + private MappingWrapper mapping = new MappingWrapper(); + + private ConnectionImpl connection; + + private HashMap generatedKeys = new HashMap(); + + public ChangeSummarizer() { + // Empty Constructor + } + + public Changes loadChanges(DataObject root) { + ChangeSummary changeSummary = root.getDataGraph().getChangeSummary(); + if (changeSummary.isLogging()) + ((ChangeSummaryImpl) changeSummary).summarize(); + + List changedObjects = changeSummary.getChangedDataObjects(); + DebugUtil.debugln(getClass(), debug, + "List of changed objects contains " + changedObjects.size() + + " object(s)"); + + changes.setInsertOrder(mapping.getInsertOrder()); + changes.setDeleteOrder(mapping.getDeleteOrder()); + + Iterator i = changedObjects.iterator(); + while (i.hasNext()) { + DataObject o = (DataObject) i.next(); + + if (!(o.equals(root))) { + createChange(changeSummary, o); + } + } + + return changes; + } + + public void createChange(ChangeSummary changeSummary, + DataObject changedObject) { + + if (changeSummary.isCreated(changedObject)) { + DebugUtil.debugln(getClass(), debug, "Change is a create"); + if (!changeSummary.isDeleted(changedObject)) { + ChangeFactory factory = getRegistry().getFactory( + changedObject.getType()); + String propagatedID = (String) generatedKeys.get(changedObject + .getType().getName()); + changes.addInsert(factory.createInsertOperation(changedObject, + propagatedID)); + } + } else if (changeSummary.isDeleted(changedObject)) { + ChangeFactory factory = getRegistry().getFactory( + changedObject.getType()); + DebugUtil.debugln(getClass(), debug, "Change is a delete"); + changes.addDelete(factory.createDeleteOperation(changedObject)); + } else { + // bumpCollisionField(changedObject); + DebugUtil.debugln(getClass(), debug, "Change is a modify"); + List attrList = changeSummary.getOldValues(changedObject); + if (hasAttributeChange(attrList)) { + ChangeFactory factory = getRegistry().getFactory( + changedObject.getType()); + DebugUtil.debugln(getClass(), debug, "Attribute Change for " + + changedObject.getType().getName()); + String propagatedID = (String) generatedKeys.get(changedObject + .getType().getName()); + changes.addUpdate(factory.createUpdateOperation(changedObject, + propagatedID)); + } else { + // Reference change + List values = changeSummary.getOldValues(changedObject); + Iterator i = values.iterator(); + while (i.hasNext()) { + ChangeSummary.Setting setting = (ChangeSummary.Setting) i + .next(); + + if (!setting.getProperty().getType().isDataType()) { + DebugUtil.debugln(getClass(), debug, + "Reference change for " + + changedObject.getType().getName()); + + Property ref = setting.getProperty(); + + DebugUtil.debugln(getClass(), debug, ref.getName()); + if (hasState(ref, changedObject) ) { + ChangeFactory factory = getRegistry().getFactory( + changedObject.getType()); + changes.addUpdate(factory + .createUpdateOperation(changedObject)); + } + + } + } + } + } + + } + + private boolean hasState(Property ref, DataObject changedObject) { + if ( ref.getOpposite().isMany() ) { + return true; + } else { + MappingWrapper mw = this.mapping; + if ( mw.getConfig() == null ) + mw = registry.getFactory(changedObject.getType()).getConfig(); + if ( mw.getConfig() == null ) + return false; + + Relationship rel = mw.getRelationshipByReference(ref); + + if ( !rel.isMany()) { + // This is a one-one relationship + Table t = mapping.getTableByPropertyName(changedObject.getType().getName()); + TableWrapper tw = new TableWrapper(t); + RelationshipWrapper rw = new RelationshipWrapper(rel); + if (( rel.getForeignKeyTable().equals(t.getName())) && + ( Collections.disjoint(tw.getPrimaryKeyProperties(),rw.getForeignKeys()) )) + return true; + + } + + } + return false; + } + + private boolean hasAttributeChange(List theChanges) { + Iterator i = theChanges.iterator(); + while (i.hasNext()) { + ChangeSummary.Setting setting = (ChangeSummary.Setting) i.next(); + if (setting.getProperty().getType().isDataType()) + return true; + } + return false; + } + + public void addCreateCommand(Type type, Command cmd) { + ChangeFactory cf = getRegistry().getFactory(type); + cf.setCreateCommand((InsertCommandImpl) cmd); + ((CommandImpl) cmd).setConnection(connection); + } + + public void addUpdateCommand(Type type, Command cmd) { + ChangeFactory cf = getRegistry().getFactory(type); + cf.setUpdateCommand((UpdateCommandImpl) cmd); + ((CommandImpl) cmd).setConnection(connection); + } + + public void addDeleteCommand(Type type, Command cmd) { + ChangeFactory cf = getRegistry().getFactory(type); + cf.setDeleteCommand((DeleteCommandImpl) cmd); + ((CommandImpl) cmd).setConnection(connection); + + } + + private FactoryRegistry getRegistry() { + if (this.registry == null) { + this.registry = new FactoryRegistry(mapping, connection); + } + return this.registry; + } + + public void setConnection(ConnectionImpl connection) { + this.connection = connection; + } + + public void setMapping(MappingWrapper map) { + this.mapping = map; + + if ( mapping.getConfig() == null ) + return; + + Iterator i = mapping.getConfig().getTable().iterator(); + while (i.hasNext()) { + Table t = (Table) i.next(); + Iterator columns = t.getColumn().iterator(); + while ( columns.hasNext()) { + Column c = (Column) columns.next(); + if ( c.isPrimaryKey() && c.isGenerated()) { + DebugUtil.debugln(getClass(), debug, "adding generated key " + + t.getName() + "." + + c.getName()); + generatedKeys.put(t.getName(), c.getName()); + } + } + } + } + + public void addRelationship(String parentName, String childName) { + mapping.addRelationship(parentName, childName); + } + + public void addPrimaryKey(String columnName) { + mapping.addPrimaryKey(columnName); + } + + public void addCollisionColumn(String columnName) { + mapping.addCollisionColumn(columnName); + } + + public void addPrimarykey(Key key) { + mapping.addPrimaryKey(key); + } + + public void addGeneratedPrimaryKey(String columnName) { + QualifiedColumn col = new QualifiedColumn(columnName); + generatedKeys.put(col.getTableName(), col.getColumnName()); + mapping.addGeneratedPrimaryKey(columnName); + } + + public void addConverter(String name, String converterName) { + mapping.addConverter(name, converterName); + } + + public ConnectionImpl getConnection() { + return this.connection; + } + + + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java new file mode 100644 index 0000000000..77198fe589 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java @@ -0,0 +1,80 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.ArrayList; +import java.util.Iterator; + +/** + * Mangages a set of graph-change operations. This simple implementaiton can be + * replaced with a version that provides R/I sorting + * + */ +public class Changes { + + private InsertList inserts = new InsertList(); + private UpdateList updates = new UpdateList(); + private DeleteList deletes = new DeleteList(); + + + public void addInsert(ChangeOperation c) { + inserts.add(c); + } + + public void addUpdate(ChangeOperation c) { + updates.add(c); + } + + public void addDelete(ChangeOperation c) { + deletes.add(c); + } + + /** + * Execute all my change + */ + public void execute() { + + Iterator i = inserts.getSortedList().iterator(); + while ( i.hasNext() ) { + ChangeOperation c = (ChangeOperation) i.next(); + c.execute(); + } + + i = updates.getSortedList().iterator(); + while ( i.hasNext() ) { + ChangeOperation c = (ChangeOperation) i.next(); + c.execute(); + } + + + i = deletes.getSortedList().iterator(); + while (i.hasNext() ) { + ChangeOperation c = (ChangeOperation) i.next(); + c.execute(); + } + + } + + public void setInsertOrder(ArrayList insertOrder) { + inserts.setOrder(insertOrder); + } + + public void setDeleteOrder(ArrayList deleteOrder) { + deletes.setOrder(deleteOrder); + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandFactoryImpl.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandFactoryImpl.java new file mode 100644 index 0000000000..25c2223f13 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandFactoryImpl.java @@ -0,0 +1,77 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.io.IOException; +import java.io.InputStream; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.CommandFactory; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.util.ConfigUtil; + +public class CommandFactoryImpl implements CommandFactory { + + public Command createCommand(String sql) { + return baseCreateCommand(sql, null); + } + + public Command createCommand(String sql, InputStream configStream) { + return baseCreateCommand(sql, ConfigUtil.loadConfig(configStream)); + } + + public Command createCommand(String sql, Config config) { + return baseCreateCommand(sql, config); + } + + public ApplyChangesCommand createApplyChangesCommand() { + return new ApplyChangesCommandImpl(); + } + + public ApplyChangesCommand createApplyChangesCommand(InputStream configStream) throws IOException { + return new ApplyChangesCommandImpl(ConfigUtil.loadConfig(configStream)); + } + + public ApplyChangesCommand createApplyChangesCommand(Config config) { + return new ApplyChangesCommandImpl(config); + } + + // Utilities + + private Command baseCreateCommand(String sql, Config config) { + + sql = sql.trim(); // Remove leading white space + char firstChar = Character.toUpperCase(sql.charAt(0)); + switch (firstChar) { + case 'S': + return new ReadCommandImpl(sql, config); + case 'I': + return new InsertCommandImpl(sql); + case 'U': + return new UpdateCommandImpl(sql); + case 'D': + return new DeleteCommandImpl(sql); + case '{': + return new SPCommandImpl(sql, config); + default: + throw new Error("SQL => " + sql + " is not valid"); + } + + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandGroupFactoryImpl.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandGroupFactoryImpl.java new file mode 100644 index 0000000000..196751857e --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandGroupFactoryImpl.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.io.InputStream; + +import org.apache.tuscany.das.rdb.CommandGroup; +import org.apache.tuscany.das.rdb.CommandGroupFactory; + +public class CommandGroupFactoryImpl implements CommandGroupFactory { + + + public CommandGroup createCommandGroup(InputStream configStream) { + return new CommandGroupImpl(configStream); + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandGroupImpl.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandGroupImpl.java new file mode 100644 index 0000000000..aeaf3a7c57 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandGroupImpl.java @@ -0,0 +1,207 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.io.InputStream; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.sql.DataSource; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.CommandGroup; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConnectionProperties; +import org.apache.tuscany.das.rdb.util.ConfigUtil; + +/** + * An ConfiguredCommandFactory produces instances of Command and + * ApplyChangesCommand. This factory is initialized with a configuration that + * defines the commands it produces. + * + */ +public class CommandGroupImpl implements CommandGroup { + + private Config config; + + private Connection connection; + + private Map commands = new HashMap(); + + public CommandGroupImpl(InputStream stream) { + super(); + config = ConfigUtil.loadConfig(stream); + initialize(); + } + + private void initialize() { + + Iterator i = config.getCommand().iterator(); + while (i.hasNext()) { + org.apache.tuscany.das.rdb.config.Command commandConfig = (org.apache.tuscany.das.rdb.config.Command) i + .next(); + String kind = commandConfig.getKind(); + if (kind.equalsIgnoreCase("select")) + //TODO - Need to refactor Command heirarchy based on Datasource + if (config.getConnectionProperties() != null) + commands.put(commandConfig.getName(), new ReadCommandImpl(commandConfig.getSQL(), config, getConnection())); + else + commands.put(commandConfig.getName(), new ReadCommandImpl(commandConfig.getSQL(), config)); + else if (kind.equalsIgnoreCase("update")) + commands.put(commandConfig.getName(), new UpdateCommandImpl(commandConfig.getSQL())); + else if (kind.equalsIgnoreCase("insert")) + commands.put(commandConfig.getName(), new InsertCommandImpl(commandConfig.getSQL())); + else if (kind.equalsIgnoreCase("delete")) + commands.put(commandConfig.getName(), new DeleteCommandImpl(commandConfig.getSQL())); + else + throw new Error("Invalid kind of command: " + kind); + + } + + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.das.rdb.CommandGroup#getApplyChangesCommand() + */ + public ApplyChangesCommand getApplyChangesCommand() { + ApplyChangesCommand cmd = new ApplyChangesCommandImpl(config, connection); + return cmd; + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.das.rdb.CommandGroup#getCommand(java.lang.String) + */ + public Command getCommand(String name) { + if (!commands.containsKey(name)) + throw new RuntimeException("CommandGroup has no command named: " + name); + Command cmd = (Command) commands.get(name); + cmd.setConnection(getConnection()); + return cmd; + } + + + public void setConnection(Connection connection) { + this.connection = connection; + } + + public Connection getConnection() { + if (connection == null) + initializeConnection(); + return connection; + } + + private void initializeConnection() { + + ConnectionProperties cp = config.getConnectionProperties(); + if (cp == null) + throw new Error( + "No connection properties have been configured and no connection has been provided"); + + if (cp.getDataSource() != null) + initViaDataSource(cp); + else + initViaDriverManager(cp); + + } + + private void initViaDriverManager(ConnectionProperties cp) { + Connection connection = null; + + try { + Class.forName(cp.getDriverClassName()); + if (cp.getDriverUserName() == null) + connection = DriverManager.getConnection(cp.getDriverURL()); + else + connection = DriverManager.getConnection(cp.getDriverURL(), cp.getDriverUserName(), cp + .getDriverPassword()); + connection.setAutoCommit(false); + setConnection(connection); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + + } + + // TODO - Refactor to eliminate common initialization code after connection + // is got + private void initViaDataSource(ConnectionProperties cp) { + + Connection connection = null; + + InitialContext ctx; + try { + ctx = new InitialContext(); + } catch (NamingException e) { + throw new Error(e); + } + try { + // TODO - I think we should rename this getDataSourceURL? + DataSource ds = (DataSource) ctx.lookup(cp.getDataSource()); + try { + connection = ds.getConnection(); + connection.setAutoCommit(false); + setConnection(connection); + } catch (SQLException e) { + throw new Error(e); + } + } catch (NamingException e) { + throw new Error(e); + } + + } + + public void releaseResources() { + + if (managingConnections()) + closeConnection(); + } + + private void closeConnection() { + if (connection != null) + try { + connection.close(); + connection = null; + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + /** + * If the config has connection properties then we are "manageing" the + * connection via DriverManager or DataSource + */ + private boolean managingConnections() { + + if (config.getConnectionProperties() == null) + return false; + else + return true; + + } + +}
\ No newline at end of file diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java new file mode 100644 index 0000000000..2ac9e324da --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java @@ -0,0 +1,145 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.List; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.Parameter; +import org.apache.tuscany.das.rdb.ResultSetShape; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.helper.XSDHelper; + +public abstract class CommandImpl extends BaseCommandImpl implements Command { + + protected Statement statement; + + protected Parameters parameters = new Parameters(); + + protected static final boolean debug = false; + + protected ResultSetShape resultSetShape; + + public CommandImpl(String sqlString) { + statement = new Statement(sqlString); + + try { + URL url = getClass().getResource("/xml/sdoJava.xsd"); + if (url == null) + throw new RuntimeException( + "Could not find resource: xml/sdoJava.xsd"); + + InputStream inputStream = url.openStream(); + XSDHelper.INSTANCE.define(inputStream, url.toString()); + inputStream.close(); + } catch ( IOException ex ) { + throw new RuntimeException(ex); + } + + } + + public abstract void execute(); + + public abstract DataObject executeQuery(); + + public void setParameterValue(String name, Object value) { + parameters.setParameter(name, value); + } + + public void setParameterValue(int index, Object value) { + parameters.setParameter(index, value); + } + + public void setParameterType(String name, Type dataType) { + parameters.setParameterWithType(name, dataType); + } + + public void setParameterType(int index, Type dataType) { + parameters.setParameterWithType(index, dataType); + } + + public void addParameter(int index, Type sdoType) { + addParameter(index, Parameter.IN, sdoType); + } + + public void addParameter(int index, int direction, Type sdoType) { + parameters.findOrCreateParameterWithIndex(index, direction, sdoType); + } + + public void addParameter(String name, Type sdoType) { + addParameter(name, Parameter.IN, sdoType); + } + + public void addParameter(String name, int direction, Type sdoType) { + parameters.setParameterWithType(name, sdoType); + } + + public void addParameter(Parameter param) { + parameters.add(param); + } + + public Parameter getParameter(String name) { + return parameters.get(name); + } + + public Parameter getParameter(int index) { + return parameters.get(index); + + } + + public List getParameters() { + return parameters.parameterList(); + } + + public Object getParameterValue(String name) { + Parameter p = parameters.get(name); + if (p == null) + throw new RuntimeException("Parameter with name " + name + + " not found"); + + return p; + } + + public Object getParameterValue(int index) { + return parameters.parameterWithIndex(index).getValue(); + } + + public void setConnection(ConnectionImpl connection) { + statement.setConnection(connection); + } + + protected ConnectionImpl getConnection() { + return statement.getConnection(); + } + + + + public void setResultSetShape(ResultSetShape shape) { + this.resultSetShape = shape; + } + + + public void close() { + statement.close(); + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java new file mode 100644 index 0000000000..2da21bf930 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java @@ -0,0 +1,95 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + + +public class ConnectionImpl { + + private Connection connection; + private static final boolean debug = false; + + private boolean managingTransaction = true; + + public ConnectionImpl(Connection connection) { + this.connection = connection; + + try { + if (connection.getAutoCommit()) + throw new RuntimeException("AutoCommit must be off!"); + } catch (SQLException e) { + throw new RuntimeException(e); + } + + } + + public Connection getJDBCConnection() { + return connection; + } + + public void cleanUp() { + try { + if (managingTransaction) { + DebugUtil.debugln(getClass(), debug, "Committing Transaction"); + connection.commit(); + } + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + public void errorCleanUp() { + try { + if (managingTransaction) { + DebugUtil.debugln(getClass(), debug, "Rolling back Transaction"); + connection.rollback(); + } + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + public PreparedStatement prepareStatement(QueryString queryString) + throws SQLException { + DebugUtil.debugln(getClass(), debug, "Preparing Statement: " + queryString.getPreparedString()); + return connection.prepareStatement(queryString.getPreparedString(), java.sql.Statement.RETURN_GENERATED_KEYS); + } + + public PreparedStatement preparePagedStatement(QueryString queryString) throws SQLException { + DebugUtil.debugln(getClass(), debug, "Preparing Statement: " + queryString.getPreparedString()); + return connection.prepareStatement(queryString.getPreparedString(), ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + } + + public void setManageTransactions(boolean manageTransactions) { + managingTransaction = manageTransactions; + + } + + public CallableStatement prepareCall(QueryString queryString) throws SQLException { + return connection.prepareCall(queryString.getPreparedString()); + } + + + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java new file mode 100644 index 0000000000..5c70dc1e6f --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + + +import commonj.sdo.DataObject; + +public class CreateOperation extends ChangeOperation { + + public CreateOperation(InsertCommandImpl command, DataObject changedObject, String ID) { + super(command, changedObject); + this.propagatedID = ID; + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java new file mode 100644 index 0000000000..eaf56a6c2c --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java @@ -0,0 +1,148 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import org.apache.tuscany.das.rdb.config.Column; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.KeyPair; +import org.apache.tuscany.das.rdb.config.Relationship; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; + +/** + * DatabaseObject wraps DataObject. If a field is an FK field, it will return + * the value from the parent. + * + * + */ +public class DatabaseObject { + + private final MappingWrapper mappingWrapper; + + private final DataObject dataObject; + + private Property parentReference; + + private static final boolean debug = false; + + private HashMap keyMappings = new HashMap(); + + public DatabaseObject(Config model, DataObject changedObject) { + this.mappingWrapper = new MappingWrapper(model); + this.dataObject = changedObject; + initialize(); + } + + // Initialize Key Mappings + private void initialize() { + if (mappingWrapper.getConfig() != null) { + List relationships = mappingWrapper.getConfig().getRelationship(); + Iterator i = relationships.iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + DebugUtil.debugln(getClass(), debug, "Initializing relationship: " + r.getName()); + if (r.getForeignKeyTable().equals(getTypeName())) { + List pairs = r.getKeyPair(); + Iterator iter = pairs.iterator(); + while (iter.hasNext()) { + KeyPair pair = (KeyPair) iter.next(); + keyMappings.put(pair.getForeignKeyColumn(), r); + } + } + } + } + } + + public Object get(String parameter) { + + if (isPartOfPrimaryKey(parameter)) + return dataObject.get(parameter); + + Relationship r = (Relationship) keyMappings.get(parameter); + if (r == null) + return dataObject.get(parameter); + + Property parentRef = getParentReference(r.getPrimaryKeyTable()); + DataObject parent = dataObject.getDataObject(parentRef); + if (parent == null) + return null; + String parentKey = getParentKey(r, parameter); + return parent.get(parentKey); + + } + + private String getParentKey(Relationship r, String parameter) { + List keyPairs = r.getKeyPair(); + Iterator i = keyPairs.iterator(); + while (i.hasNext()) { + KeyPair pair = (KeyPair) i.next(); + if (pair.getForeignKeyColumn().equals(parameter)) + return pair.getPrimaryKeyColumn(); + } + return null; + } + + public Property getParentReference(String parentName) { + if (this.parentReference == null) { + + Iterator i = dataObject.getType().getProperties().iterator(); + while (i.hasNext()) { + Property ref = (Property) i.next(); + if ((!ref.getType().isDataType()) && (ref.getType().getName().equals(parentName))) { + this.parentReference = ref; + } + } + } + return this.parentReference; + } + + public String getTableName() { + if (mappingWrapper.getConfig() != null) + return mappingWrapper.getTableByPropertyName(getTypeName()).getName(); + else + return null; + } + + public String getTypeName() { + return dataObject.getType().getName(); + } + + public void setPropagatedID(String propagatedID, int id) { + dataObject.setInt(propagatedID, id); + } + + private boolean isPartOfPrimaryKey(String parameter) { + if (mappingWrapper.getConfig() == null) + return false; + Table t = mappingWrapper.getTable(getTableName()); + if (t == null) + return false; + Column c = mappingWrapper.getColumnByPropertyName(t, parameter); + if (c == null) + return false; + return c.isPrimaryKey(); + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java new file mode 100644 index 0000000000..3502784b6f --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +public class DeleteCommandImpl extends WriteCommandImpl { + + public DeleteCommandImpl(String sqlString) { + super(sqlString); + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java new file mode 100644 index 0000000000..8650c6119c --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java @@ -0,0 +1,72 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; + +/** + * DeleteList will sort delete operations so that child objects are deleted + * before their parents + * + * + */ +public class DeleteList { + + private HashMap opsByTableName = new HashMap(); + + private ArrayList order; + + private ArrayList deleteOperations = new ArrayList(); + + public DeleteList() { + super(); + } + + public void add(ChangeOperation op) { + if (( order == null ) || ( op.getTableName() == null ) ) { + deleteOperations.add(op); + } else { + String name = op.getTableName(); + ArrayList ops = (ArrayList) opsByTableName.get(name); + if (ops == null) + ops = new ArrayList(); + + ops.add(op); + opsByTableName.put(name, ops); + } + } + + public Collection getSortedList() { + if (( order != null ) && ( opsByTableName.keySet().size() > 0) ) { + Iterator i = this.order.iterator(); + while (i.hasNext()) { + String name = (String) i.next(); + deleteOperations.addAll((Collection) opsByTableName.get(name)); + } + } + + return deleteOperations; + } + + public void setOrder(ArrayList deleteOrder) { + this.order = deleteOrder; + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java new file mode 100644 index 0000000000..7b71e0ace9 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java @@ -0,0 +1,38 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import org.apache.tuscany.das.rdb.util.DataObjectUtil; + +import commonj.sdo.DataObject; + +public class DeleteOperation extends ChangeOperation { + + + /** + * @param command + * @param changedObject + * Objects deleted from the graph have lost their "settings" and must + * be restored + */ + public DeleteOperation(DeleteCommandImpl command, DataObject changedObject) { + super(command); + this.dObject = new DatabaseObject(command.getMappingModel(),DataObjectUtil.getRestoredCopy(changedObject)); + + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java new file mode 100644 index 0000000000..ce09c748f4 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java @@ -0,0 +1,49 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.HashMap; + +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.Type; + +public class FactoryRegistry { + + private HashMap registry = new HashMap(); + private static final boolean debug = false; + private final MappingWrapper mapping; + private final ConnectionImpl connection; + + public FactoryRegistry(MappingWrapper mapping, ConnectionImpl connection) { + this.mapping = mapping; + this.connection = connection; + } + + public ChangeFactory getFactory(Type type) { + ChangeFactory factory = (ChangeFactory)registry.get(type); + if ( factory == null ) { + DebugUtil.debugln(getClass(), debug, "Creating new ChangeFactory for type " + type.getName()); + factory = new ChangeFactory(type, mapping, connection); + registry.put(type, factory); + } + return factory; + } + + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java new file mode 100644 index 0000000000..9c890c7106 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java @@ -0,0 +1,79 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.SQLException; + +public class InsertCommandImpl extends WriteCommandImpl { + + private int generatedKey; + + private boolean hasGeneratedKey = false; + + public InsertCommandImpl(String sqlString) { + super(sqlString); + } + + protected boolean isInsert() { + return true; + } + + public int getGeneratedKey() { + + if (hasGeneratedKey) + return generatedKey; + + throw new RuntimeException("No generated key is available"); + } + + public Object getParameterValue(String name) { + + if (name.equals("generated_key")) + if (hasGeneratedKey) + return new Integer(generatedKey); + else + throw new RuntimeException("No generated key available"); + + return super.getParameterValue(name); + } + + protected void subtypeProcessing() throws SQLException { + loadGeneratedKey(); + } + + private void loadGeneratedKey() throws SQLException { + Integer key = statement.getGeneratedKey(); + if (key != null) { + hasGeneratedKey = true; + generatedKey = key.intValue(); + } + + } + + public String toString() { + + String superString = super.toString(); + StringBuffer buffer = new StringBuffer(superString); + + buffer.append("\nGenerating key: " + hasGeneratedKey); + if (hasGeneratedKey) + buffer.append("\nGenerated key: " + generatedKey); + + return buffer.toString(); + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java new file mode 100644 index 0000000000..dee6546cfe --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java @@ -0,0 +1,82 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + +/** + * InsertList will sort ChangeOperation objects so that parents are inserted + * before children + * + * + */ +public class InsertList { + + private HashMap opsByTableName = new HashMap(); + + private ArrayList insertOperations = new ArrayList(); + + private ArrayList order; + + private static final boolean debug = false; + + public void add(ChangeOperation op) { + DebugUtil.debugln(getClass(), debug, "Adding insert operation "); + // If nothing has been added yet, or this is no ordering, simply + // add the operation to the list + if ((order.size() == 0) || (op.getTableName() == null)) { + insertOperations.add(op); + } else { + String name = op.getTableName(); + ArrayList ops = (ArrayList) opsByTableName.get(name); + if (ops == null) + ops = new ArrayList(); + + ops.add(op); + opsByTableName.put(name, ops); + } + } + + public Collection getSortedList() { + DebugUtil.debugln(getClass(), debug, "Getting sorted insert list"); + if ((order.size() > 0) && opsByTableName.keySet().size() > 0) { + Iterator i = this.order.iterator(); + while (i.hasNext()) { + String name = (String) i.next(); + DebugUtil.debugln(getClass(), debug, + "Adding operations for table " + name); + // A null here means a table is in the config but hasn't been changed here + if (opsByTableName.get(name) != null) + insertOperations.addAll((Collection) opsByTableName + .get(name)); + } + } + DebugUtil.debugln(getClass(), debug, "Returning " + + insertOperations.size() + " insert operations"); + return insertOperations; + } + + public void setOrder(ArrayList insertOrder) { + this.order = insertOrder; + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java new file mode 100644 index 0000000000..22ff822bb0 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.SQLException; + +public class OptimisticWriteCommandImpl extends UpdateCommandImpl { + + public OptimisticWriteCommandImpl(String sqlString) { + super(sqlString); + } + + public void execute() { + + boolean success = false; + try { + int rowsAffected = statement.executeUpdate(parameters); + success = true; + if ( rowsAffected == 0 ) + throw new RuntimeException("OCC Exception"); + } catch (SQLException e) { + throw new RuntimeException(e); + } finally { + if (success) + statement.getConnection().cleanUp(); + else + statement.getConnection().errorCleanUp(); + } + + } +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java new file mode 100644 index 0000000000..32b17ef3e7 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java @@ -0,0 +1,64 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.Pager; + +import commonj.sdo.DataObject; + +public class PagerImpl implements Pager { + + private final ReadCommandImpl command; + private final int size; + private int idx = 1; + + public PagerImpl(Command command, int size) { + this.command = (ReadCommandImpl)command; + this.command.enablePaging(); + this.size = size; + } + + public DataObject next() { + int start = idx; + int end = idx + size; + idx += size; + command.setStartRow(start); + command.setEndRow(end); + return command.executeQuery(); + } + + public DataObject getPage(int page) { + int end = (page * size) + 1; + int start = end - size; + idx = end; + command.setStartRow(start); + command.setEndRow(end); + return command.executeQuery(); + } + + public DataObject previous() { + int start = idx - (2 * size); + if ( start < 1 ) + start = 1; + int end = start + size; + idx = end; + command.setStartRow(start); + command.setEndRow(end); + return command.executeQuery(); + } +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java new file mode 100644 index 0000000000..4528661b2c --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java @@ -0,0 +1,107 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import org.apache.tuscany.das.rdb.Converter; +import org.apache.tuscany.das.rdb.Parameter; + +import commonj.sdo.Type; + +public class ParameterImpl implements Parameter { + + private int index; + private Type type; + private String name; + private Object value; + private int direction = IN; + private Converter converter; + + public ParameterImpl() { + super(); + } + + public ParameterImpl(String name) { + this.name = name; + } + + public ParameterImpl(int index) { + this.index = index; + } + + public void setType(Type type) { + this.type = type; + } + + public void setIndex(int index) { + if ( index == 0 ) + throw new RuntimeException("Index of zero not allowed"); + this.index = index; + } + + public void setName(String name) { + this.name = name; + } + + public void setValue(Object value) { + this.value = value; + } + + public void setDirection(int direction) { + this.direction = direction; + } + + public Type getType() { + return this.type; + } + + public int getIndex() { + return this.index; + } + + public String getName() { + return this.name; + } + + public Object getValue() { + if ( getConverter() != null ) { + return getConverter().getColumnValue(this.value); + } else { + return this.value; + } + } + + public int getDirection() { + return this.direction; + } + + public void setConverter(Converter converter) { + this.converter = converter; + } + + public Converter getConverter() { + return this.converter; + } + + + public String toString() { + StringBuffer buffer = new StringBuffer(); + buffer.append("Index: " + getIndex()); + buffer.append("\nName: " + getName()); + buffer.append("\nValue: " + getValue()); + return buffer.toString(); + } +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java new file mode 100644 index 0000000000..4ea42f41b2 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java @@ -0,0 +1,150 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import org.apache.tuscany.das.rdb.Parameter; +import org.apache.tuscany.das.rdb.SDODataTypes; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.Type; + +public class Parameters { + + private ArrayList parameters = new ArrayList(); + + private ArrayList inParams = new ArrayList(); + + private ArrayList outParams = new ArrayList(); + + private HashMap parametersByName = new HashMap(); + + private static boolean debug = false; + + public Parameters() { + super(); + } + + public Parameter get(String name) { + return (Parameter) parametersByName.get(name); + } + + public Parameter get(int index) { + return (Parameter) parameters.get(index); + } + + public List outParams() { + return outParams; + } + + public List inParams() { + return inParams; + } + + private void addParameter(Parameter param) { + if (param.getDirection() == Parameter.IN) + inParams.add(param); + else if ((param.getDirection() == Parameter.OUT) + || (param.getDirection() == Parameter.IN_OUT)) + outParams.add(param); + + this.parameters.add(param); + parametersByName.put(param.getName(), param); + } + + public void add(Parameter param) { + addParameter(param); + } + + public Parameter findOrCreateParameterNamed(String name) { + Parameter param = get(name); + if (param == null) { + param = new ParameterImpl(name); + addParameter(param); + } + return param; + } + + public Parameter findOrCreateParameterWithIndex(int index, int direction, + Type sdoType) { + Iterator i = parameters.iterator(); + while (i.hasNext()) { + Parameter param = (Parameter) i.next(); + + if (param.getIndex() == index) + return param; + } + DebugUtil.debugln(getClass(), debug, + "Creating new parameter with index " + index); + Parameter newParam = new ParameterImpl(index); + newParam.setDirection(direction); + newParam.setType(sdoType); + addParameter(newParam); + return newParam; + } + + public List parameterList() { + return parameters; + } + + public Parameter findOrCreateParameterWithIndex(int index) { + return findOrCreateParameterWithIndex(index, Parameter.IN, + SDODataTypes.OBJECT); + } + + public void setParameter(int index, Object value) { + Parameter param = findOrCreateParameterWithIndex(index); + param.setValue(value); + } + + public void setParameter(String name, Object value) { + if (name == null) + throw new RuntimeException("Null parameter name not allowed"); + Parameter param = findOrCreateParameterNamed(name); + param.setValue(value); + } + + public void setParameterWithType(String name, Type sdoType) { + if (name == null) + throw new RuntimeException("Null parameter name not allowed"); + Parameter p = findOrCreateParameterNamed(name); + p.setType(sdoType); + } + + public void setParameterWithType(int index, Type sdoType) { + if (index == 0) + throw new RuntimeException("Null parameter index not allowed"); + Parameter p = findOrCreateParameterWithIndex(index); + p.setType(sdoType); + } + + public Parameter parameterWithIndex(int index) { + Iterator i = parameters.iterator(); + while (i.hasNext()) { + Parameter param = (Parameter) i.next(); + + if (param.getIndex() == index) + return param; + } + return null; + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/QueryString.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/QueryString.java new file mode 100644 index 0000000000..8304457a72 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/QueryString.java @@ -0,0 +1,87 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + + +public class QueryString { + + private final String unmodifiedQueryString; + private final String preparedString; + private HashMap parameters = new HashMap(); + private static final boolean debug = false; + + public QueryString(String originalString) { + this.unmodifiedQueryString = originalString; + this.preparedString = replaceNamesAndSetIndexes(originalString); + } + + public String getPreparedString() { + return this.preparedString; + } + + public String getUnmodifiedString() { + return this.unmodifiedQueryString; + } + + public int getParameterIndex(String name) { + DebugUtil.debugln(getClass(), debug, "Looking for parameter index for: " + name); + //System.out.println(toString()); + return ((Integer)parameters.get(name)).intValue(); + } + + private String replaceNamesAndSetIndexes(String query) { + DebugUtil.debugln(getClass(), debug, "Parameterizing query: " + query); + Pattern p = Pattern.compile(":[\\S&&[^,()]]*"); + Matcher m = p.matcher(query); + + int index = 1; + while (m.find()) { + parameters.put(m.group().substring(1), new Integer(index)); + query = m.replaceFirst("?"); + m = p.matcher(query); + index++; + } + + DebugUtil.debugln(getClass(), debug, "Parameterized query: " + query); + return query; + } + + + public String toString() { + StringBuffer buffer = new StringBuffer(); + buffer.append("\nOriginal SQL: "); + buffer.append(unmodifiedQueryString); + buffer.append("\nPrepared SQL: "); + buffer.append(preparedString); + buffer.append("\nParameters: "); + Iterator i = parameters.keySet().iterator(); + while ( i.hasNext() ) { + String key = (String)i.next(); + buffer.append("\n"); + buffer.append(key); + } + return buffer.toString(); + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ReadCommandImpl.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ReadCommandImpl.java new file mode 100644 index 0000000000..708fd88b38 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ReadCommandImpl.java @@ -0,0 +1,168 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConnectionProperties; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.graphbuilder.impl.GraphBuilderMetadata; +import org.apache.tuscany.das.rdb.graphbuilder.impl.ResultSetProcessor; +import org.apache.tuscany.sdo.util.SDOUtil; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataGraph; +import commonj.sdo.DataObject; +import commonj.sdo.Type; + +public class ReadCommandImpl extends CommandImpl { + + private Type schema; + + private int startRow = 1; + + private int endRow = Integer.MAX_VALUE; + + public ReadCommandImpl(String sqlString) { + super(sqlString); + } + + public ReadCommandImpl(String sqlString, Config mapping) { + this(sqlString); + if (mapping != null) + setMappingModel(mapping); + } + + //TODO - Need to refactor based on use of DataSource and CommandGroup + public ReadCommandImpl(String sqlString, Config mapping, Connection connection) { + this(sqlString); + setConnection(connection); + if (mapping != null) + setMappingModel(mapping); + } + + public void execute() { + throw new UnsupportedOperationException(); + } + + public DataObject executeQuery() { + + if (statement.getConnection() == null) + throw new RuntimeException("A DASConnection object must be specified before executing the query."); + + boolean success = false; + try { + ResultSet rs = statement.executeQuery(parameters); + success = true; + return buildGraph(rs); + } catch (SQLException e) { + throw new RuntimeException(e); + } finally { + if (success) + statement.getConnection().cleanUp(); + else + statement.getConnection().errorCleanUp(); + } + } + + protected DataObject buildGraph(ResultSet result) throws SQLException { + + List results = new ArrayList(); + results.add(result); + + // Before we use the mappingModel, do some checking/updating. If + // inferrable information + // isn't specified, add it in. + + GraphBuilderMetadata gbmd = new GraphBuilderMetadata(results, getSchema(), configWrapper.getConfig(), + resultSetShape); + + // Create the DataGraph + DataGraph g = SDOUtil.createDataGraph(); + + // Create the root object + g.createRootObject(gbmd.getSchema()); + + ChangeSummary summary = g.getChangeSummary(); + + ResultSetProcessor rsp = new ResultSetProcessor(g.getRootObject(), gbmd); + rsp.processResults(getStartRow(), getEndRow()); + + summary.beginLogging(); + + return g.getRootObject(); + } + + private Type getSchema() { + return (Type) schema; + } + + protected int getStartRow() { + return startRow; + } + + protected int getEndRow() { + return endRow; + } + + protected void setStartRow(int startRow) { + this.startRow = startRow; + } + + protected void setEndRow(int endRow) { + this.endRow = endRow; + } + + private void setMappingModel(Config config) { + configWrapper = new MappingWrapper(config); + //TODO - need to refactor and take into regression that lost ability to use Datasource + if (getConnection() == null) + if (config.getConnectionProperties() != null) + setConnection(config.getConnectionProperties()); + } + + public void setConnection(ConnectionProperties c) { + try { + Connection connection = null; + Class.forName(c.getDriverClassName()); + if (c.getDriverUserName() == null) + connection = DriverManager.getConnection(c.getDriverURL()); + else + connection = DriverManager.getConnection(c.getDriverURL(), c.getDriverUserName(), c + .getDriverPassword()); + connection.setAutoCommit(false); + setConnection(connection); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + + public void setDataObjectModel(Type schema) { + this.schema = schema; + } + + protected void enablePaging() { + statement.enablePaging(); + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java new file mode 100644 index 0000000000..7afa3b8563 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java @@ -0,0 +1,100 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.Types; + +import org.apache.tuscany.das.rdb.SDODataTypes; + +import commonj.sdo.Type; + +public class SDODataTypeHelper { + + static public int sqlTypeFor(Type sdoType) { + if ( sdoType == SDODataTypes.BOOLEAN) + return Types.BOOLEAN; + else if ( sdoType == SDODataTypes.STRING) + return Types.VARCHAR; + else if ( sdoType == SDODataTypes.BYTE) + return Types.TINYINT; + else if ( sdoType == SDODataTypes.BYTES) + return Types.BINARY; + else if ( sdoType == SDODataTypes.CHARACTER) + return Types.CHAR; + else if ( sdoType == SDODataTypes.DATE) + return Types.DATE; + else if ( sdoType == SDODataTypes.DATETIME) + return Types.DATE; + else if ( sdoType == SDODataTypes.DAY ) + return java.sql.Types.BINARY; + else if ( sdoType == SDODataTypes.DECIMAL ) + return java.sql.Types.DECIMAL; + else if ( sdoType == SDODataTypes.DOUBLE ) + return java.sql.Types.DOUBLE; + else if ( sdoType == SDODataTypes.DURATION ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.FLOAT ) + return java.sql.Types.REAL; + else if ( sdoType == SDODataTypes.INT ) + return java.sql.Types.INTEGER; + else if ( sdoType == SDODataTypes.INTEGER ) + return java.sql.Types.INTEGER; + else if ( sdoType == SDODataTypes.LONG ) + return java.sql.Types.BIGINT; + else if ( sdoType == SDODataTypes.MONTH ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.MONTHDAY ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.OBJECT ) + return java.sql.Types.JAVA_OBJECT; + else if ( sdoType == SDODataTypes.SHORT ) + return java.sql.Types.SMALLINT; + else if ( sdoType == SDODataTypes.STRING ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.STRINGS ) + return java.sql.Types.OTHER; + else if ( sdoType == SDODataTypes.TIME ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.URI ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.YEAR ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.YEARMONTH ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.YEARMONTHDAY ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.BOOLEANOBJECT ) + return java.sql.Types.BOOLEAN; + else if ( sdoType == SDODataTypes.BYTEOBJECT ) + return java.sql.Types.TINYINT; + else if ( sdoType == SDODataTypes.CHARACTEROBJECT ) + return java.sql.Types.CHAR; + else if ( sdoType == SDODataTypes.DOUBLEOBJECT ) + return java.sql.Types.DOUBLE; + else if ( sdoType == SDODataTypes.FLOATOBJECT ) + return java.sql.Types.REAL; + else if ( sdoType == SDODataTypes.INTEGEROBJECT ) + return java.sql.Types.INTEGER; + else if ( sdoType == SDODataTypes.LONGOBJECT ) + return java.sql.Types.BIGINT; + else if ( sdoType == SDODataTypes.SHORTOBJECT ) + return java.sql.Types.SMALLINT; + else + throw new RuntimeException("Not a valid SDO Type " + sdoType); + + } +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java new file mode 100644 index 0000000000..0fb647815d --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java @@ -0,0 +1,73 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; + +public class SPCommandImpl extends ReadCommandImpl { + + public SPCommandImpl(String sqlString) { + super(sqlString); + } + + public SPCommandImpl(String sqlString, Config config) { + super(sqlString, config); + } + + public DataObject executeQuery() { + + boolean success = false; + try { + ResultSet rs = statement.executeCall(parameters); + success = true; + + return buildGraph(rs); + } catch (SQLException e) { + DebugUtil.debugln(getClass(), debug, e); + throw new RuntimeException(e); + } finally { + if (success) + statement.getConnection().cleanUp(); + else + statement.getConnection().errorCleanUp(); + } + } + + public void execute() { + + boolean success = false; + try { + statement.executeUpdateCall(parameters); + success = true; + } catch (SQLException e) { + throw new RuntimeException(e); + } finally { + if (success) + statement.getConnection().cleanUp(); + else + statement.getConnection().errorCleanUp(); + } + + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java new file mode 100644 index 0000000000..6bc18dc229 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java @@ -0,0 +1,206 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.Parameter; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +//TODO - Can use some refactoring. Much code is duplicated in "execute" methods +public class Statement { + + protected final QueryString queryString; + + protected ConnectionImpl jdbcConnection; + + private static final boolean debug = false; + + private PreparedStatement preparedStatement; + + private boolean isPaging = false; + + public Statement(String sqlString) { + this.queryString = new QueryString(sqlString); + } + + public ResultSet executeQuery(Parameters parameters) throws SQLException { + + PreparedStatement ps = getPreparedStatement(); + ps = setParameters(ps, parameters); + ResultSet rs = ps.executeQuery(); + + return rs; + } + + public ResultSet executeCall(Parameters parameters) throws SQLException { + try { + CallableStatement cs = jdbcConnection.prepareCall(queryString); + + Iterator inParams = parameters.inParams().iterator(); + while (inParams.hasNext()) { + Parameter param = (Parameter) inParams.next(); + if (param.getIndex() == 0) + param.setIndex(queryString.getParameterIndex(param.getName())); + cs.setObject(param.getIndex(), param.getValue()); + } + + // register out parameters + Iterator outParams = parameters.outParams().iterator(); + while (outParams.hasNext()) { + Parameter param = (Parameter) outParams.next(); + if (param.getIndex() == 0) + param.setIndex(queryString.getParameterIndex(param.getName())); + DebugUtil.debugln(getClass(), debug, "Registering parameter " + param.getName()); + cs.registerOutParameter(param.getIndex(), SDODataTypeHelper.sqlTypeFor(param.getType())); + } + + // Using execute because Derby does not currenlty support + // executeQuery + // for SP + cs.execute(); + ResultSet results = cs.getResultSet(); + + Iterator i = parameters.outParams().iterator(); + while (i.hasNext()) { + Parameter param = (Parameter) i.next(); + param.setValue(cs.getObject(param.getIndex())); + } + + return results; + } catch (SQLException ex) { + ex.printStackTrace(); + throw ex; + } + + } + + public void executeUpdateCall(Parameters parameters) throws SQLException { + CallableStatement cs = jdbcConnection.prepareCall(queryString); + + Iterator inParams = parameters.inParams().iterator(); + while (inParams.hasNext()) { + Parameter param = (Parameter) inParams.next(); + if (param.getIndex() == 0) + param.setIndex(queryString.getParameterIndex(param.getName())); + cs.setObject(param.getIndex(), param.getValue()); + } + + // register out parameters + Iterator outParams = parameters.outParams().iterator(); + while (outParams.hasNext()) { + Parameter param = (Parameter) outParams.next(); + if (param.getIndex() == 0) + param.setIndex(queryString.getParameterIndex(param.getName())); + DebugUtil.debugln(getClass(), debug, "Registering parameter " + param.getName()); + cs.registerOutParameter(param.getIndex(), SDODataTypeHelper.sqlTypeFor(param.getType())); + } + + cs.execute(); + + Iterator out = parameters.outParams().iterator(); + while (out.hasNext()) { + Parameter param = (Parameter) out.next(); + param.setValue(cs.getObject(param.getIndex())); + } + + } + + /** + * TODO - We need to look at using specific ps.setXXX methods when a type + * has been specified and try setObject otherwise. + */ + public int executeUpdate(Parameters parameters) throws SQLException { + DebugUtil.debugln(getClass(), debug, "Executing statement " + queryString.getPreparedString()); + PreparedStatement ps = getPreparedStatement(); + Iterator i = parameters.inParams().iterator(); + while (i.hasNext()) { + Parameter param = (Parameter) i.next(); + if (param.getIndex() == 0) + param.setIndex(queryString.getParameterIndex(param.getName())); + Object value = param.getValue(); + DebugUtil.debugln(getClass(), debug, "Setting parameter " + param.getIndex() + " to " + value); + if (value == null) { + ps.setNull(param.getIndex(), SDODataTypeHelper.sqlTypeFor(param.getType())); + } else { + ps.setObject(param.getIndex(), value); + } + } + return ps.executeUpdate(); + } + + protected PreparedStatement setParameters(PreparedStatement ps, Parameters parameters) + throws SQLException { + Iterator i = parameters.inParams().iterator(); + while (i.hasNext()) { + Parameter param = (Parameter) i.next(); + if (param.getIndex() == 0) + param.setIndex(queryString.getParameterIndex(param.getName())); + ps.setObject(param.getIndex(), param.getValue()); + } + return ps; + } + + public void setConnection(ConnectionImpl jdbcConnection) { + this.jdbcConnection = jdbcConnection; + } + + public ConnectionImpl getConnection() { + return this.jdbcConnection; + } + + private PreparedStatement getPreparedStatement() throws SQLException { + DebugUtil.debugln(getClass(), debug, "Getting prepared statement"); + if (preparedStatement == null) + if (isPaging) + preparedStatement = jdbcConnection.preparePagedStatement(queryString); + else + preparedStatement = jdbcConnection.prepareStatement(queryString); + + return preparedStatement; + } + + public Integer getGeneratedKey() throws SQLException { + + ResultSet rs = getPreparedStatement().getGeneratedKeys(); + if (rs.next()) + return new Integer(rs.getInt(1)); + + return null; + } + + protected void enablePaging() { + isPaging = true; + } + + public void close() { + + if (this.preparedStatement != null) { + try { + preparedStatement.close(); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java new file mode 100644 index 0000000000..7fffe97d5d --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +public class UpdateCommandImpl extends WriteCommandImpl { + + public UpdateCommandImpl(String sqlString) { + super(sqlString); + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java new file mode 100644 index 0000000000..1ab2f16fca --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.ArrayList; +import java.util.Collection; + +/** + * Updates don't have to be sorted, so this class is a simple wrapper of ArrayList. + * + */ +public class UpdateList { + + private ArrayList updates = new ArrayList(); + + public UpdateList() { + super(); + } + + public void add(ChangeOperation c) { + updates .add(c); + } + + public Collection getSortedList() { + return updates; + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java new file mode 100644 index 0000000000..cbe73a16e4 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java @@ -0,0 +1,30 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.impl; + + +import commonj.sdo.DataObject; + + +public class UpdateOperation extends ChangeOperation { + + public UpdateOperation(UpdateCommandImpl command, DataObject changedObject, String id) { + super(command, changedObject); + this.propagatedID = id; + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java new file mode 100644 index 0000000000..ff1ac385d4 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java @@ -0,0 +1,97 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* 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. +*/ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.SQLException; +import java.util.Collection; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.Parameter; +import org.apache.tuscany.das.rdb.config.Config; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; + +public abstract class WriteCommandImpl extends CommandImpl { + + + public WriteCommandImpl(String sqlString) { + super(sqlString); + } + + public void execute() { + + boolean success = false; + try { + statement.executeUpdate(parameters); + subtypeProcessing(); + success = true; + } catch (SQLException e) { + throw new RuntimeException(e); + } finally { + if (success) + statement.getConnection().cleanUp(); + else + statement.getConnection().errorCleanUp(); + } + + } + + public DataObject executeQuery() { + throw new UnsupportedOperationException(); + } + + public Config getMappingModel() { + return configWrapper.getConfig(); + } + + + /** + * Subclasses add specific bahavior + * Default is to do nothing + */ + protected void subtypeProcessing() throws SQLException { + if ( false ) + throw new SQLException(); + } + + public void setDataObjectModel(Type schema) { + // don't really care what the model is here + } + + public String toString() { + + StringBuffer buffer = new StringBuffer(); + buffer.append("\nSQL: " + statement.queryString.getUnmodifiedString()); + buffer.append("\nModified SQL: " + statement.queryString.getPreparedString()); + return buffer.toString(); + } + + public int getGeneratedKey() { + throw new RuntimeException("No generated key is available"); + } + + public void addParameters(Collection updateParameters) { + Iterator i = updateParameters.iterator(); + while ( i.hasNext()) { + Parameter p = (Parameter) i.next(); + addParameter(p); + } + } + + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/merge/impl/GraphMerger.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/merge/impl/GraphMerger.java new file mode 100644 index 0000000000..15943da067 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/merge/impl/GraphMerger.java @@ -0,0 +1,166 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.merge.impl; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.logging.Logger; + +import org.apache.tuscany.das.rdb.config.wrapper.QualifiedColumn; +import org.apache.tuscany.das.rdb.graphbuilder.impl.MultiTableRegistry; +import org.apache.tuscany.das.rdb.graphbuilder.impl.TableRegistry; +import org.apache.tuscany.sdo.impl.ChangeSummaryImpl; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataObject; +import commonj.sdo.Property; + +public class GraphMerger { + + private HashMap keys = new HashMap(); + + private TableRegistry registry = new MultiTableRegistry(); + + private static Logger logger = Logger.getLogger("GraphMerger"); + + //TODO lots of cleanup/design + public GraphMerger() { + // Empty Constructor + } + + public DataObject merge(List graphs) { + DataObject primaryGraph = (DataObject) graphs.get(0); + + Iterator i = graphs.iterator(); + if (i.hasNext()) + i.next(); + while (i.hasNext()) { + primaryGraph = merge(primaryGraph, (DataObject) i.next()); + } + + return primaryGraph; + } + + public DataObject merge(DataObject primary, DataObject secondary) { + addGraphToRegistry(primary); + + ChangeSummary summary = primary + .getDataGraph().getChangeSummary(); + summary.endLogging(); + Iterator i = secondary.getType().getProperties().iterator(); + + while (i.hasNext()) { + Property p = (Property) i.next(); + + Iterator objects = secondary.getList(p.getName()).iterator(); + while (objects.hasNext()) { + DataObject object = (DataObject) objects.next(); + createObjectWithSubtree(primary, p, object); + } + } + ((ChangeSummaryImpl)summary).resumeLogging(); + return primary; + } + + private void createObjectWithSubtree(DataObject root, Property p, + DataObject object) { + Object pk = getPrimaryKey(object); + + if (!registry.contains(object.getType().getName(), Collections + .singletonList(pk))) { + // logger.info("creating " + object.getType().getName() + " with pk " + pk); + DataObject newObject = root.createDataObject(p.getName()); + + + + Iterator attrs = object.getType().getProperties().iterator(); + while (attrs.hasNext()) { + Property attr = (Property) attrs.next(); + if ( attr.getType().isDataType()) { + newObject.set(attr.getName(), object.get(attr)); + } + } + registry.put(object.getType().getName(), Collections + .singletonList(pk), newObject); + + Iterator refs = object.getType().getProperties().iterator(); + while (refs.hasNext()) { + Property ref = (Property) refs.next(); + if ( !ref.getType().isDataType()) { + List refObjects; + if (!ref.isMany()) { + refObjects = Collections.singletonList(object.get(ref)); + } else { + refObjects = (List) object.get(ref); + } + + Iterator iter = refObjects.iterator(); + while (iter.hasNext()) { + DataObject refObject = (DataObject) iter.next(); + createObjectWithSubtree(root, refObject + .getContainmentProperty(), refObject); + + refObject = (DataObject) registry.get(refObject.getType().getName(), Collections.singletonList(getPrimaryKey(refObject))); + if (ref.isMany()) { + newObject.getList( + newObject.getType().getProperty(ref.getName())) + .add(refObject); + } else + newObject.set(newObject.getType().getProperty( + ref.getName()), refObject); + } + } + + } + + } + + } + + private void addGraphToRegistry(DataObject graph1) { + Iterator i = graph1.getType().getProperties().iterator(); + while (i.hasNext()) { + Property p = (Property) i.next(); + Iterator objects = graph1.getList(p).iterator(); + while (objects.hasNext()) { + DataObject object = (DataObject) objects.next(); + Object pk = object.get(getPrimaryKeyName(object)); + logger.finest("Adding object with pk " + pk + " to registry"); + registry.put(object.getType().getName(), Collections + .singletonList(pk), object); + } + } + } + + private Object getPrimaryKey(DataObject object) { + String pkName = getPrimaryKeyName(object); + return object.get(pkName); + } + + private String getPrimaryKeyName(DataObject object) { + return (String) keys.get(object.getType().getName()); + } + + public void addPrimaryKey(String key) { + QualifiedColumn column = new QualifiedColumn(key); + logger.finest("Adding " + column.getTableName() + " " + + column.getColumnName() + " to keys"); + keys.put(column.getTableName(), column.getColumnName()); + } +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java new file mode 100644 index 0000000000..c0d7f41e8b --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.util; + +import java.io.IOException; +import java.io.InputStream; + +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConfigFactory; +import org.apache.tuscany.sdo.util.SDOUtil; + +import commonj.sdo.helper.XMLHelper; + +/** + * Config util provides config-related utilities such as loading a Config + * instance from an InputStream + * + */ +public class ConfigUtil { + + public static Config loadConfig(InputStream configStream) { + + if (configStream == null) + throw new Error( + "Cannot load configuration from a null InputStream. Possibly caused by an incorrect config xml file name"); + + SDOUtil.registerStaticTypes(ConfigFactory.class); + XMLHelper helper = XMLHelper.INSTANCE; + + try { + return (Config) helper.load(configStream).getRootObject(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java new file mode 100644 index 0000000000..7f96f9aef4 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java @@ -0,0 +1,73 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.util; + +import java.util.Iterator; +import java.util.List; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.ChangeSummary.Setting; +import commonj.sdo.helper.DataFactory; + +/** + */ +public class DataObjectUtil { + + //Utilities + public static DataObject getRestoredCopy(DataObject changedDO) { + DataObject changedCopy = getCopy(changedDO); + restoreAttributeValues(changedCopy, changedDO); + return changedCopy; + } + + public static DataObject getCopy(DataObject original) { + + DataObject copy = DataFactory.INSTANCE.create(original.getType()); + + //Fill in values + Iterator i = original.getType().getProperties().iterator(); + while (i.hasNext()) { + Property feature = (Property) i.next(); + copy.set(feature, original.get(feature)); + } + return copy; + } + + /** + * @param changedCopy + * @return + */ + private static void restoreAttributeValues(DataObject changedCopy, DataObject changedDO) { + + ChangeSummary changeSummary = changedDO.getDataGraph().getChangeSummary(); + List changes = changeSummary.getOldValues(changedDO); + if ( changes == null ) + return; + + Iterator i = changes.iterator(); + while (i.hasNext()) { + Setting s = (Setting) i.next(); + if ( s.getProperty().getType().isDataType() ) + changedCopy.set(s.getProperty(), s.getValue()); + } + } + + + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugFormatter.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugFormatter.java new file mode 100644 index 0000000000..ed2e1063d6 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugFormatter.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.util; + +import java.util.logging.Formatter; +import java.util.logging.LogRecord; + +public class DebugFormatter extends Formatter { + + public String format(LogRecord record) { + StringBuffer message = new StringBuffer(); + message.append("["); + message.append(record.getSourceClassName()); + message.append("] "); + message.append(record.getMessage()); + message.append("\n"); + return message.toString(); + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugUtil.java b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugUtil.java new file mode 100644 index 0000000000..745fe8cb7e --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugUtil.java @@ -0,0 +1,66 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * 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. + */ +package org.apache.tuscany.das.rdb.util; + +import java.util.logging.ConsoleHandler; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.Logger; + +//TODO Restructure Logging +public class DebugUtil { + + private static StringBuffer buffer = new StringBuffer(); + private static final Logger logger = Logger.getAnonymousLogger(); + + static { + logger.setUseParentHandlers(false); + Handler h = new ConsoleHandler(); + h.setFormatter(new DebugFormatter()); + logger.addHandler(h); + } + public static void debugln(Class c, boolean flag, Object obj) { + + if ( flag ) { + logger.logp(Level.INFO, getClassName(c), null, obj.toString() ); + } + } + + public static void debug(Class c, boolean flag, Object obj) { + if ( flag ) { + System.out.print("[" + getClassName(c) + "] " + obj ); + } + } + + public static void buffer(boolean flag, Object obj) { + if ( flag ) + buffer.append(obj); + } + + public static void flushBuffer(Class c, boolean flag) { + if ( flag ) { + System.out.println("[" + getClassName(c) + "] " + buffer.toString()); + buffer = new StringBuffer(); + } + } + + private static String getClassName(Class c) { + String className = c.getName(); + return className.substring(className.lastIndexOf(".") + 1); + } + +} diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/resources/META-INF/MANIFEST.MF b/tags/java-M1-20060518/java/das/rdb/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..cb460db0f0 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,8 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: rdbdas +Bundle-SymbolicName: rdbdas +Bundle-Version: 1.0.0 +Bundle-Localization: plugin +Require-Bundle: org.junit,
+ org.eclipse.emf.ecore.sdo diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/resources/config.xsd b/tags/java-M1-20060518/java/das/rdb/src/main/resources/config.xsd new file mode 100644 index 0000000000..031f5a9546 --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/resources/config.xsd @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. + + 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. + --> +<xsd:schema xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:org.apache.tuscany.das.rdb.config="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ecore:nsPrefix="org.apache.tuscany.das.rdb.config" ecore:package="org.apache.tuscany.das.rdb.config" targetNamespace="http:///org.apache.tuscany.das.rdb/config.xsd"> + <xsd:import namespace="http://www.eclipse.org/emf/2002/Ecore" schemaLocation="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.xsd"/> + <xsd:element ecore:ignore="true" name="Config" type="org.apache.tuscany.das.rdb.config:Config"/> + <xsd:element ecore:ignore="true" name="Command" type="org.apache.tuscany.das.rdb.config:Command"/> + <xsd:element ecore:ignore="true" name="ConnectionProperties" type="org.apache.tuscany.das.rdb.config:ConnectionProperties"/> + <xsd:element ecore:ignore="true" name="Parameter" type="org.apache.tuscany.das.rdb.config:Parameter"/> + <xsd:element ecore:ignore="true" name="Relationship" type="org.apache.tuscany.das.rdb.config:Relationship"/> + <xsd:element ecore:ignore="true" name="Table" type="org.apache.tuscany.das.rdb.config:Table"/> + <xsd:element ecore:ignore="true" name="KeyPair" type="org.apache.tuscany.das.rdb.config:KeyPair"/> + <xsd:element ecore:ignore="true" name="Column" type="org.apache.tuscany.das.rdb.config:Column"/> + <xsd:element ecore:ignore="true" name="ResultDescriptor" type="org.apache.tuscany.das.rdb.config:ResultDescriptor"/> + <xsd:complexType name="Config"> + <xsd:sequence> + <xsd:element ecore:opposite="Config" ecore:resolveProxies="true" maxOccurs="unbounded" minOccurs="0" name="Command" type="org.apache.tuscany.das.rdb.config:Command"/> + <xsd:element ecore:opposite="Config" ecore:resolveProxies="true" minOccurs="0" name="ConnectionProperties" type="org.apache.tuscany.das.rdb.config:ConnectionProperties"/> + <xsd:element ecore:opposite="Config" ecore:resolveProxies="true" maxOccurs="unbounded" minOccurs="0" name="Table" type="org.apache.tuscany.das.rdb.config:Table"/> + <xsd:element ecore:opposite="Config" ecore:resolveProxies="true" maxOccurs="unbounded" minOccurs="0" name="Relationship" type="org.apache.tuscany.das.rdb.config:Relationship"/> + </xsd:sequence> + <xsd:attribute name="uri" type="xsd:string"/> + </xsd:complexType> + <xsd:complexType name="Command"> + <xsd:sequence> + <xsd:element ecore:opposite="Command" ecore:resolveProxies="true" maxOccurs="unbounded" minOccurs="0" name="Parameter" type="org.apache.tuscany.das.rdb.config:Parameter"/> + <xsd:element ecore:opposite="Command" ecore:resolveProxies="true" maxOccurs="unbounded" minOccurs="0" name="ResultDescriptor" type="org.apache.tuscany.das.rdb.config:ResultDescriptor"/> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string"/> + <xsd:attribute name="SQL" type="xsd:string"/> + <xsd:attribute name="kind" type="xsd:string"/> + <xsd:attribute ecore:opposite="Command" ecore:reference="org.apache.tuscany.das.rdb.config:Config" ecore:transient="true" name="Config" type="xsd:anyURI"/> + </xsd:complexType> + <xsd:complexType name="ConnectionProperties"> + <xsd:attribute name="dataSource" type="xsd:string"/> + <xsd:attribute name="driverClassName" type="xsd:string"/> + <xsd:attribute name="driverURL" type="xsd:string"/> + <xsd:attribute name="driverPassword" type="xsd:string"/> + <xsd:attribute name="driverUserName" type="xsd:string"/> + <xsd:attribute ecore:opposite="ConnectionProperties" ecore:reference="org.apache.tuscany.das.rdb.config:Config" ecore:transient="true" name="Config" type="xsd:anyURI"/> + </xsd:complexType> + <xsd:complexType name="Parameter"> + <xsd:attribute name="name" type="xsd:string"/> + <xsd:attribute name="columnType" type="xsd:string"/> + <xsd:attribute ecore:opposite="Parameter" ecore:reference="org.apache.tuscany.das.rdb.config:Command" ecore:transient="true" name="Command" type="xsd:anyURI"/> + </xsd:complexType> + <xsd:complexType name="Relationship"> + <xsd:sequence> + <xsd:element ecore:opposite="Relationship" ecore:resolveProxies="true" maxOccurs="unbounded" minOccurs="0" name="KeyPair" type="org.apache.tuscany.das.rdb.config:KeyPair"/> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string"/> + <xsd:attribute name="primaryKeyTable" type="xsd:string"/> + <xsd:attribute name="foreignKeyTable" type="xsd:string"/> + <xsd:attribute name="many" type="xsd:boolean"/> + <xsd:attribute ecore:opposite="Relationship" ecore:reference="org.apache.tuscany.das.rdb.config:Config" ecore:transient="true" name="Config" type="xsd:anyURI"/> + </xsd:complexType> + <xsd:complexType name="Table"> + <xsd:sequence> + <xsd:element ecore:opposite="Table" ecore:resolveProxies="true" maxOccurs="unbounded" minOccurs="0" name="Column" type="org.apache.tuscany.das.rdb.config:Column"/> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string"/> + <xsd:attribute name="propertyName" type="xsd:string"/> + <xsd:attribute name="create" type="xsd:string"/> + <xsd:attribute name="update" type="xsd:string"/> + <xsd:attribute name="delete" type="xsd:string"/> + <xsd:attribute ecore:opposite="Table" ecore:reference="org.apache.tuscany.das.rdb.config:Config" ecore:transient="true" name="Config" type="xsd:anyURI"/> + </xsd:complexType> + <xsd:complexType name="KeyPair"> + <xsd:attribute name="primaryKeyColumn" type="xsd:string"/> + <xsd:attribute name="foreignKeyColumn" type="xsd:string"/> + <xsd:attribute ecore:opposite="KeyPair" ecore:reference="org.apache.tuscany.das.rdb.config:Relationship" ecore:transient="true" name="Relationship" type="xsd:anyURI"/> + </xsd:complexType> + <xsd:complexType name="Column"> + <xsd:attribute name="name" type="xsd:string"/> + <xsd:attribute name="propertyName" type="xsd:string"/> + <xsd:attribute name="converterClassName" type="xsd:string"/> + <xsd:attribute name="columnType" type="xsd:string"/> + <xsd:attribute name="primaryKey" type="xsd:boolean"/> + <xsd:attribute name="generated" type="xsd:boolean"/> + <xsd:attribute name="collision" type="xsd:boolean"/> + <xsd:attribute ecore:opposite="Column" ecore:reference="org.apache.tuscany.das.rdb.config:Table" ecore:transient="true" name="Table" type="xsd:anyURI"/> + </xsd:complexType> + <xsd:complexType name="ResultDescriptor"> + <xsd:attribute name="columnName" type="xsd:string"/> + <xsd:attribute name="tableName" type="xsd:string"/> + <xsd:attribute name="columnType" type="xsd:string"/> + <xsd:attribute name="converter" type="xsd:string"/> + <xsd:attribute ecore:opposite="ResultDescriptor" ecore:reference="org.apache.tuscany.das.rdb.config:Command" ecore:transient="true" name="Command" type="xsd:anyURI"/> + </xsd:complexType> +</xsd:schema> diff --git a/tags/java-M1-20060518/java/das/rdb/src/main/resources/dasmodel4.mdl b/tags/java-M1-20060518/java/das/rdb/src/main/resources/dasmodel4.mdl new file mode 100644 index 0000000000..1de7601cab --- /dev/null +++ b/tags/java-M1-20060518/java/das/rdb/src/main/resources/dasmodel4.mdl @@ -0,0 +1,4645 @@ +
+(object Petal
+ version 42
+ _written "Rose 4.5.8163.3"
+ charSet 0)
+
+(object Design "Logical View"
+ is_unit TRUE
+ is_loaded TRUE
+ defaults (object defaults
+ rightMargin 0.250000
+ leftMargin 0.250000
+ topMargin 0.250000
+ bottomMargin 0.500000
+ pageOverlap 0.250000
+ clipIconLabels TRUE
+ autoResize TRUE
+ snapToGrid TRUE
+ gridX 31
+ gridY 31
+ defaultFont (object Font
+ size 10
+ face "Arial"
+ bold FALSE
+ italics FALSE
+ underline FALSE
+ strike FALSE
+ color 0
+ default_color TRUE)
+ showMessageNum 3
+ showClassOfObject TRUE
+ notation "Unified")
+ root_usecase_package (object Class_Category "Use Case View"
+ quid "4362A29901BA"
+ exportControl "Public"
+ global TRUE
+ logical_models (list unit_reference_list)
+ logical_presentations (list unit_reference_list
+ (object UseCaseDiagram "Main"
+ quid "4362A2990259"
+ title "Main"
+ zoom 100
+ max_height 28350
+ max_width 21600
+ origin_x 0
+ origin_y 0
+ items (list diagram_item_list))))
+ root_category (object Class_Category "Logical View"
+ quid "4362A29901B9"
+ exportControl "Public"
+ global TRUE
+ subsystem "Component View"
+ quidu "4362A29901BB"
+ logical_models (list unit_reference_list
+ (object Class_Category "config"
+ attributes (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "nsURI"
+ value "http:///org.apache.tuscany.das.rdb/config.xsd")
+ (object Attribute
+ tool "Ecore"
+ name "basePackage"
+ value "org.apache.tuscany.das.rdb"))
+ quid "4362A2A10169"
+ exportControl "Public"
+ logical_models (list unit_reference_list
+ (object Class "Config"
+ quid "4362A2DE0045"
+ class_attributes (list class_attribute_list
+ (object ClassAttribute "uri"
+ quid "4362A337006B"
+ type "String")))
+ (object Class "Command"
+ quid "4362A2EC01FE"
+ class_attributes (list class_attribute_list
+ (object ClassAttribute "name"
+ quid "4362A3EC02EC"
+ type "String")
+ (object ClassAttribute "SQL"
+ quid "4362A3EF0246"
+ type "String")
+ (object ClassAttribute "kind"
+ quid "437903E60321"
+ type "String")))
+ (object Class "ConnectionProperties"
+ quid "4362A2FD0085"
+ class_attributes (list class_attribute_list
+ (object ClassAttribute "dataSource"
+ quid "4362A35A035A"
+ type "String")
+ (object ClassAttribute "driverClassName"
+ quid "4362A36D0203"
+ type "String")
+ (object ClassAttribute "driverURL"
+ quid "4362A3740330"
+ type "String")
+ (object ClassAttribute "driverPassword"
+ quid "4362A384022E"
+ type "String")
+ (object ClassAttribute "driverUserName"
+ quid "4378E1B303C2"
+ type "String")))
+ (object Class "Parameter"
+ quid "4362A3C902BA"
+ class_attributes (list class_attribute_list
+ (object ClassAttribute "name"
+ quid "4362A40600D7"
+ type "String")
+ (object ClassAttribute "columnType"
+ quid "4362A4090280"
+ type "String")))
+ (object Class "Relationship"
+ quid "4362A42E03A5"
+ class_attributes (list class_attribute_list
+ (object ClassAttribute "name"
+ quid "4362A73A0216"
+ type "String")
+ (object ClassAttribute "primaryKeyTable"
+ quid "4362A73D0329"
+ type "String")
+ (object ClassAttribute "foreignKeyTable"
+ quid "4362A74002FB"
+ type "String")
+ (object ClassAttribute "many"
+ quid "4362A7430241"
+ type "boolean")))
+ (object Class "Table"
+ quid "4362A43C0002"
+ class_attributes (list class_attribute_list
+ (object ClassAttribute "name"
+ quid "4362A7B2031D"
+ type "String")
+ (object ClassAttribute "propertyName"
+ quid "4362A7C203A2"
+ type "String")
+ (object ClassAttribute "create"
+ quid "4362A7D0024E"
+ type "String")
+ (object ClassAttribute "update"
+ quid "4362A7D30220"
+ type "String")
+ (object ClassAttribute "delete"
+ quid "4362A7E1031B"
+ type "String")))
+ (object Class "KeyPair"
+ quid "4362A72E0010"
+ class_attributes (list class_attribute_list
+ (object ClassAttribute "primaryKeyColumn"
+ quid "4362A8E702A9"
+ type "String")
+ (object ClassAttribute "foreignKeyColumn"
+ quid "4362A8ED01AE"
+ type "String")))
+ (object Class "Column"
+ quid "4362A75C016B"
+ class_attributes (list class_attribute_list
+ (object ClassAttribute "name"
+ quid "4362A8BD02E5"
+ type "String")
+ (object ClassAttribute "propertyName"
+ quid "4362A8C001C7"
+ type "String")
+ (object ClassAttribute "converterClassName"
+ quid "4362A8C303A2"
+ type "String")
+ (object ClassAttribute "columnType"
+ quid "4362A8C903A0"
+ type "String")
+ (object ClassAttribute "primaryKey"
+ quid "437907F200F9"
+ type "boolean")
+ (object ClassAttribute "generated"
+ quid "4379083900BF"
+ type "boolean")
+ (object ClassAttribute "collision"
+ quid "437908E5012B"
+ type "boolean")))
+ (object Class "ResultDescriptor"
+ quid "437B57EF0008"
+ class_attributes (list class_attribute_list
+ (object ClassAttribute "columnName"
+ quid "437B5A6503BB"
+ type "String")
+ (object ClassAttribute "tableName"
+ quid "437B5A6B016B"
+ type "String")
+ (object ClassAttribute "columnType"
+ quid "437B5A6D033A"
+ type "String")
+ (object ClassAttribute "converter"
+ quid "437B5A6F0153"
+ type "String"))
+ language "Java")
+ (object Association "$UNNAMED$0"
+ quid "4362A3030323"
+ roles (list role_list
+ (object Role "$UNNAMED$1"
+ quid "4362A3040108"
+ supplier "Logical View::config::Config"
+ quidu "4362A2DE0045"
+ is_navigable TRUE
+ is_aggregate TRUE)
+ (object Role "$UNNAMED$2"
+ quid "4362A3040109"
+ supplier "Logical View::config::Command"
+ quidu "4362A2EC01FE"
+ client_cardinality (value cardinality "0..n")
+ Containment "By Value"
+ is_navigable TRUE)))
+ (object Association "$UNNAMED$3"
+ quid "4362A308010D"
+ roles (list role_list
+ (object Role "$UNNAMED$4"
+ quid "4362A3090015"
+ supplier "Logical View::config::Config"
+ quidu "4362A2DE0045"
+ is_navigable TRUE
+ is_aggregate TRUE)
+ (object Role "$UNNAMED$5"
+ quid "4362A3090016"
+ supplier "Logical View::config::ConnectionProperties"
+ quidu "4362A2FD0085"
+ client_cardinality (value cardinality "0..1")
+ Containment "By Value"
+ is_navigable TRUE)))
+ (object Association "$UNNAMED$6"
+ quid "4362A3D302FA"
+ roles (list role_list
+ (object Role "$UNNAMED$7"
+ quid "4362A3D40143"
+ supplier "Logical View::config::Command"
+ quidu "4362A2EC01FE"
+ is_navigable TRUE
+ is_aggregate TRUE)
+ (object Role "$UNNAMED$8"
+ quid "4362A3D40144"
+ supplier "Logical View::config::Parameter"
+ quidu "4362A3C902BA"
+ client_cardinality (value cardinality "0..n")
+ Containment "By Value"
+ is_navigable TRUE)))
+ (object Association "$UNNAMED$9"
+ quid "4362A448026C"
+ roles (list role_list
+ (object Role "$UNNAMED$10"
+ quid "4362A4490105"
+ supplier "Logical View::config::Config"
+ quidu "4362A2DE0045"
+ is_navigable TRUE
+ is_aggregate TRUE)
+ (object Role "$UNNAMED$11"
+ quid "4362A4490106"
+ supplier "Logical View::config::Table"
+ quidu "4362A43C0002"
+ client_cardinality (value cardinality "0..n")
+ Containment "By Value"
+ is_navigable TRUE)))
+ (object Association "$UNNAMED$12"
+ quid "4362A44B0298"
+ roles (list role_list
+ (object Role "$UNNAMED$13"
+ quid "4362A44C01AA"
+ supplier "Logical View::config::Config"
+ quidu "4362A2DE0045"
+ is_navigable TRUE
+ is_aggregate TRUE)
+ (object Role "$UNNAMED$14"
+ quid "4362A44C01AB"
+ supplier "Logical View::config::Relationship"
+ quidu "4362A42E03A5"
+ client_cardinality (value cardinality "0..n")
+ Containment "By Value"
+ is_navigable TRUE)))
+ (object Association "$UNNAMED$15"
+ quid "4362A76302A1"
+ roles (list role_list
+ (object Role "$UNNAMED$16"
+ quid "4362A7640090"
+ supplier "Logical View::config::Table"
+ quidu "4362A43C0002"
+ is_navigable TRUE
+ is_aggregate TRUE)
+ (object Role "$UNNAMED$17"
+ quid "4362A7640091"
+ supplier "Logical View::config::Column"
+ quidu "4362A75C016B"
+ client_cardinality (value cardinality "0..n")
+ Containment "By Value"
+ is_navigable TRUE)))
+ (object Association "$UNNAMED$18"
+ quid "4362A771032E"
+ roles (list role_list
+ (object Role "$UNNAMED$19"
+ quid "4362A7720108"
+ supplier "Logical View::config::Relationship"
+ quidu "4362A42E03A5"
+ is_navigable TRUE
+ is_aggregate TRUE)
+ (object Role "$UNNAMED$20"
+ quid "4362A7720109"
+ supplier "Logical View::config::KeyPair"
+ quidu "4362A72E0010"
+ client_cardinality (value cardinality "0..n")
+ Containment "By Value"
+ is_navigable TRUE)))
+ (object Association "$UNNAMED$21"
+ quid "437B59A10066"
+ roles (list role_list
+ (object Role "$UNNAMED$22"
+ quid "437B59A30145"
+ supplier "Logical View::config::Command"
+ quidu "4362A2EC01FE"
+ Containment "By Value"
+ is_navigable TRUE
+ is_aggregate TRUE)
+ (object Role "$UNNAMED$23"
+ quid "437B59A30146"
+ supplier "Logical View::config::ResultDescriptor"
+ quidu "437B57EF0008"
+ client_cardinality (value cardinality "0..n")
+ Containment "By Value"
+ is_navigable TRUE))))
+ logical_presentations (list unit_reference_list
+ (object ClassDiagram "Main"
+ quid "4362A2A900AD"
+ title "Main"
+ zoom 100
+ max_height 28350
+ max_width 21600
+ origin_x 0
+ origin_y 0
+ items (list diagram_item_list
+ (object ClassView "Class" "Logical View::config::KeyPair" @1
+ ShowCompartmentStereotypes TRUE
+ IncludeAttribute TRUE
+ IncludeOperation TRUE
+ location (1054, 1333)
+ label (object ItemLabel
+ Parent_View @1
+ location (809, 1227)
+ fill_color 13434879
+ nlines 1
+ max_width 490
+ justify 0
+ label "KeyPair")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "4362A72E0010"
+ width 508
+ height 236
+ autoResize TRUE)
+ (object ClassView "Class" "Logical View::config::Column" @2
+ ShowCompartmentStereotypes TRUE
+ IncludeAttribute TRUE
+ IncludeOperation TRUE
+ location (2015, 1519)
+ label (object ItemLabel
+ Parent_View @2
+ location (1756, 1288)
+ fill_color 13434879
+ nlines 1
+ max_width 518
+ justify 0
+ label "Column")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "4362A75C016B"
+ width 536
+ height 486
+ autoResize TRUE)
+ (object ClassView "Class" "Logical View::config::ConnectionProperties" @3
+ ShowCompartmentStereotypes TRUE
+ IncludeAttribute TRUE
+ IncludeOperation TRUE
+ location (2542, 248)
+ label (object ItemLabel
+ Parent_View @3
+ location (2317, 67)
+ fill_color 13434879
+ nlines 1
+ max_width 450
+ justify 0
+ label "ConnectionProperties")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "4362A2FD0085"
+ width 468
+ height 386
+ autoResize TRUE)
+ (object ClassView "Class" "Logical View::config::Relationship" @4
+ ShowCompartmentStereotypes TRUE
+ IncludeAttribute TRUE
+ IncludeOperation TRUE
+ location (1054, 744)
+ label (object ItemLabel
+ Parent_View @4
+ location (829, 588)
+ fill_color 13434879
+ nlines 1
+ max_width 450
+ justify 0
+ label "Relationship")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "4362A42E03A5"
+ width 468
+ height 336
+ autoResize TRUE)
+ (object AssociationViewNew "$UNNAMED$18" @5
+ location (1081, 1063)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A771032E"
+ roleview_list (list RoleViews
+ (object RoleView "$UNNAMED$19" @6
+ Parent_View @5
+ location (-97, -84)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A7720108"
+ client @5
+ supplier @4
+ line_style 3
+ origin_attachment (1080, 1063)
+ terminal_attachment (1080, 912))
+ (object RoleView "$UNNAMED$20" @7
+ Parent_View @5
+ location (-97, -84)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A7720109"
+ client @5
+ supplier @1
+ line_style 3
+ origin_attachment (1080, 1063)
+ terminal_attachment (1080, 1215)
+ label (object SegLabel @8
+ Parent_View @7
+ location (1135, 1112)
+ anchor 2
+ anchor_loc 1
+ nlines 1
+ max_width 15
+ justify 0
+ label "0..*"
+ pctDist 0.327273
+ height 55
+ orientation 0))))
+ (object ClassView "Class" "Logical View::config::Table" @9
+ ShowCompartmentStereotypes TRUE
+ IncludeAttribute TRUE
+ IncludeOperation TRUE
+ location (1984, 837)
+ label (object ItemLabel
+ Parent_View @9
+ location (1784, 656)
+ fill_color 13434879
+ nlines 1
+ max_width 400
+ justify 0
+ label "Table")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "4362A43C0002"
+ width 418
+ height 386
+ autoResize TRUE)
+ (object AssociationViewNew "$UNNAMED$15" @10
+ location (1778, 1153)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A76302A1"
+ roleview_list (list RoleViews
+ (object RoleView "$UNNAMED$16" @11
+ Parent_View @10
+ location (1003, 6)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A7640090"
+ client @10
+ supplier @9
+ line_style 3
+ origin_attachment (1778, 1153)
+ terminal_attachment (1778, 1030))
+ (object RoleView "$UNNAMED$17" @12
+ Parent_View @10
+ location (1003, 6)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A7640091"
+ client @10
+ supplier @2
+ line_style 3
+ origin_attachment (1778, 1153)
+ terminal_attachment (1778, 1276)
+ label (object SegLabel @13
+ Parent_View @12
+ location (1832, 1166)
+ anchor 2
+ anchor_loc 1
+ nlines 1
+ max_width 15
+ justify 0
+ label "0..*"
+ pctDist 0.109091
+ height 54
+ orientation 0))))
+ (object ClassView "Class" "Logical View::config::Parameter" @14
+ ShowCompartmentStereotypes TRUE
+ IncludeAttribute TRUE
+ IncludeOperation TRUE
+ location (186, 806)
+ label (object ItemLabel
+ Parent_View @14
+ location (4, 700)
+ fill_color 13434879
+ nlines 1
+ max_width 364
+ justify 0
+ label "Parameter")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "4362A3C902BA"
+ width 382
+ height 236
+ autoResize TRUE)
+ (object ClassView "Class" "Logical View::config::Config" @15
+ ShowCompartmentStereotypes TRUE
+ IncludeAttribute TRUE
+ IncludeOperation TRUE
+ location (1054, 155)
+ label (object ItemLabel
+ Parent_View @15
+ location (959, 74)
+ fill_color 13434879
+ nlines 1
+ max_width 190
+ justify 0
+ label "Config")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "4362A2DE0045"
+ width 208
+ height 186
+ autoResize TRUE)
+ (object AssociationViewNew "$UNNAMED$3" @16
+ location (1733, 184)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A308010D"
+ roleview_list (list RoleViews
+ (object RoleView "$UNNAMED$4" @17
+ Parent_View @16
+ location (307, -498)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A3090015"
+ client @16
+ supplier @15
+ line_style 3
+ origin_attachment (1733, 184)
+ terminal_attachment (1158, 184))
+ (object RoleView "$UNNAMED$5" @18
+ Parent_View @16
+ location (307, -498)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A3090016"
+ client @16
+ supplier @3
+ line_style 3
+ origin_attachment (1733, 184)
+ terminal_attachment (2308, 184)
+ label (object SegLabel @19
+ Parent_View @18
+ location (2194, 126)
+ anchor 2
+ anchor_loc 1
+ nlines 1
+ max_width 15
+ justify 0
+ label "0..1"
+ pctDist 0.801805
+ height 59
+ orientation 0))))
+ (object AssociationViewNew "$UNNAMED$12" @20
+ location (1054, 411)
+ label (object SegLabel @21
+ Parent_View @20
+ location (1054, 352)
+ font (object Font
+ italics TRUE)
+ hidden TRUE
+ anchor 1
+ anchor_loc 1
+ nlines 1
+ max_width 600
+ justify 0
+ label ""
+ pctDist 0.500000
+ height 60
+ orientation 0)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A44B0298"
+ roleview_list (list RoleViews
+ (object RoleView "$UNNAMED$13" @22
+ Parent_View @20
+ location (-93, -395)
+ label (object SegLabel @23
+ Parent_View @22
+ location (1013, 281)
+ hidden TRUE
+ anchor 1
+ anchor_loc 1
+ nlines 1
+ max_width 252
+ justify 0
+ label ""
+ pctDist 0.800000
+ height 42
+ orientation 0)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A44C01AA"
+ client @20
+ supplier @15
+ line_style 0)
+ (object RoleView "$UNNAMED$14" @24
+ Parent_View @20
+ location (-93, -395)
+ label (object SegLabel @25
+ Parent_View @24
+ location (1013, 509)
+ hidden TRUE
+ anchor 1
+ anchor_loc 1
+ nlines 1
+ max_width 252
+ justify 0
+ label ""
+ pctDist 0.597561
+ height 42
+ orientation 1)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A44C01AB"
+ client @20
+ supplier @4
+ line_style 0
+ label (object SegLabel @26
+ Parent_View @24
+ location (1011, 558)
+ anchor 2
+ anchor_loc 1
+ nlines 1
+ max_width 15
+ justify 0
+ label "0..*"
+ pctDist 0.899471
+ height 44
+ orientation 1))))
+ (object AssociationViewNew "$UNNAMED$9" @27
+ location (1666, 248)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A448026C"
+ roleview_list (list RoleViews
+ (object RoleView "$UNNAMED$10" @28
+ Parent_View @27
+ location (860, -558)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A4490105"
+ client @27
+ supplier @15
+ line_style 3
+ origin_attachment (1667, 247)
+ terminal_attachment (1158, 247))
+ (object RoleView "$UNNAMED$11" @29
+ Parent_View @27
+ location (860, -558)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A4490106"
+ client @27
+ supplier @9
+ vertices (list Points
+ (1667, 247)
+ (1972, 247)
+ (1972, 644))
+ line_style 3
+ origin_attachment (1667, 247)
+ terminal_attachment (1972, 644)
+ label (object SegLabel @30
+ Parent_View @29
+ location (2031, 380)
+ anchor 2
+ anchor_loc 1
+ nlines 1
+ max_width 15
+ justify 0
+ label "0..*"
+ pctDist 0.625538
+ height 59
+ orientation 0))))
+ (object ClassView "Class" "Logical View::config::Command" @31
+ ShowCompartmentStereotypes TRUE
+ IncludeAttribute TRUE
+ IncludeOperation TRUE
+ location (186, 217)
+ label (object ItemLabel
+ Parent_View @31
+ location (63, 86)
+ fill_color 13434879
+ nlines 1
+ max_width 246
+ justify 0
+ label "Command")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "4362A2EC01FE"
+ width 264
+ height 286
+ autoResize TRUE)
+ (object AssociationViewNew "$UNNAMED$6" @32
+ location (186, 523)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A3D302FA"
+ roleview_list (list RoleViews
+ (object RoleView "$UNNAMED$7" @33
+ Parent_View @32
+ location (-279, -500)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A3D40143"
+ client @32
+ supplier @31
+ line_style 0)
+ (object RoleView "$UNNAMED$8" @34
+ Parent_View @32
+ location (-279, -500)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A3D40144"
+ client @32
+ supplier @14
+ line_style 0
+ label (object SegLabel @35
+ Parent_View @34
+ location (241, 600)
+ anchor 2
+ anchor_loc 1
+ nlines 1
+ max_width 15
+ justify 0
+ label "0..*"
+ pctDist 0.473684
+ height 55
+ orientation 0))))
+ (object AssociationViewNew "$UNNAMED$0" @36
+ location (634, 212)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A3030323"
+ roleview_list (list RoleViews
+ (object RoleView "$UNNAMED$1" @37
+ Parent_View @36
+ location (200, -470)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A3040108"
+ client @36
+ supplier @15
+ line_style 3
+ origin_attachment (634, 212)
+ terminal_attachment (950, 212))
+ (object RoleView "$UNNAMED$2" @38
+ Parent_View @36
+ location (200, -470)
+ stereotype TRUE
+ line_color 3342489
+ quidu "4362A3040109"
+ client @36
+ supplier @31
+ line_style 3
+ origin_attachment (634, 212)
+ terminal_attachment (318, 212)
+ label (object SegLabel @39
+ Parent_View @38
+ location (371, 260)
+ anchor 2
+ anchor_loc 1
+ nlines 1
+ max_width 15
+ justify 0
+ label "0..*"
+ pctDist 0.831858
+ height 48
+ orientation 0))))
+ (object ClassView "Class" "Logical View::config::ResultDescriptor" @40
+ ShowCompartmentStereotypes TRUE
+ IncludeAttribute TRUE
+ IncludeOperation TRUE
+ location (465, 1240)
+ label (object ItemLabel
+ Parent_View @40
+ location (248, 1084)
+ fill_color 13434879
+ nlines 1
+ max_width 434
+ justify 0
+ label "ResultDescriptor")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "437B57EF0008"
+ width 452
+ height 336
+ annotation 8
+ autoResize TRUE)
+ (object AssociationViewNew "$UNNAMED$21" @41
+ location (484, 626)
+ stereotype TRUE
+ line_color 3342489
+ quidu "437B59A10066"
+ roleview_list (list RoleViews
+ (object RoleView "$UNNAMED$22" @42
+ Parent_View @41
+ location (50, -614)
+ stereotype TRUE
+ line_color 3342489
+ quidu "437B59A30145"
+ client @41
+ supplier @31
+ vertices (list Points
+ (484, 626)
+ (484, 347)
+ (318, 347))
+ line_style 3
+ origin_attachment (484, 626)
+ terminal_attachment (318, 347))
+ (object RoleView "$UNNAMED$23" @43
+ Parent_View @41
+ location (50, -614)
+ stereotype TRUE
+ line_color 3342489
+ quidu "437B59A30146"
+ client @41
+ supplier @40
+ line_style 3
+ origin_attachment (484, 626)
+ terminal_attachment (484, 1072)
+ label (object SegLabel @44
+ Parent_View @43
+ location (538, 1027)
+ anchor 2
+ anchor_loc 1
+ nlines 1
+ max_width 15
+ justify 0
+ label "0..*"
+ pctDist 0.900000
+ height 54
+ orientation 0)))))))))
+ logical_presentations (list unit_reference_list
+ (object ClassDiagram "Main"
+ quid "4362A299025A"
+ title "Main"
+ zoom 100
+ max_height 28350
+ max_width 21600
+ origin_x 0
+ origin_y 0
+ items (list diagram_item_list
+ (object CategoryView "Logical View::config" @45
+ location (682, 589)
+ label (object ItemLabel
+ Parent_View @45
+ location (538, 505)
+ fill_color 13434879
+ nlines 2
+ max_width 288
+ justify 0
+ label "config")
+ icon_style "Icon"
+ line_color 3342489
+ fill_color 13434879
+ quidu "4362A2A10169"
+ width 300
+ height 180)))))
+ root_subsystem (object SubSystem "Component View"
+ quid "4362A29901BB"
+ physical_models (list unit_reference_list)
+ physical_presentations (list unit_reference_list
+ (object Module_Diagram "Main"
+ quid "4362A2990258"
+ title "Main"
+ zoom 100
+ max_height 28350
+ max_width 21600
+ origin_x 0
+ origin_y 0
+ items (list diagram_item_list))))
+ process_structure (object Processes
+ quid "4362A29901BC"
+ ProcsNDevs (list
+ (object Process_Diagram "Deployment View"
+ quid "4362A29901BE"
+ title "Deployment View"
+ zoom 100
+ max_height 28350
+ max_width 21600
+ origin_x 0
+ origin_y 0
+ items (list diagram_item_list))))
+ properties (object Properties
+ attributes (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "propertyId"
+ value "809135969")
+ (object Attribute
+ tool "Ecore"
+ name "default__Category"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "packageName"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "nsPrefix"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "nsURI"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "basePackage"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "prefix"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "annotation"
+ value "")))
+ (object Attribute
+ tool "Ecore"
+ name "default__Class"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "classifierName"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "constraints"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "xmlName"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "xmlContentKind"
+ value ("ContentKind" 0))
+ (object Attribute
+ tool "Ecore"
+ name "ContentKind"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "Unspecified"
+ value 0)
+ (object Attribute
+ tool "Ecore"
+ name "Empty"
+ value 1)
+ (object Attribute
+ tool "Ecore"
+ name "Simple"
+ value 2)
+ (object Attribute
+ tool "Ecore"
+ name "Mixed"
+ value 3)
+ (object Attribute
+ tool "Ecore"
+ name "ElementOnly"
+ value 4)))
+ (object Attribute
+ tool "Ecore"
+ name "annotation"
+ value "")))
+ (object Attribute
+ tool "Ecore"
+ name "default__Operation"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "operationName"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "isUnique"
+ value TRUE)
+ (object Attribute
+ tool "Ecore"
+ name "annotation"
+ value "")))
+ (object Attribute
+ tool "Ecore"
+ name "default__Attribute"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "attributeName"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "isTransient"
+ value FALSE)
+ (object Attribute
+ tool "Ecore"
+ name "isVolatile"
+ value FALSE)
+ (object Attribute
+ tool "Ecore"
+ name "isChangeable"
+ value TRUE)
+ (object Attribute
+ tool "Ecore"
+ name "isUnsettable"
+ value FALSE)
+ (object Attribute
+ tool "Ecore"
+ name "isUnique"
+ value TRUE)
+ (object Attribute
+ tool "Ecore"
+ name "isID"
+ value FALSE)
+ (object Attribute
+ tool "Ecore"
+ name "visibility"
+ value ("VisibilityKind" 0))
+ (object Attribute
+ tool "Ecore"
+ name "VisibilityKind"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "Unspecified"
+ value 0)
+ (object Attribute
+ tool "Ecore"
+ name "None"
+ value 1)
+ (object Attribute
+ tool "Ecore"
+ name "Read-only"
+ value 2)
+ (object Attribute
+ tool "Ecore"
+ name "Read-write"
+ value 3)
+ (object Attribute
+ tool "Ecore"
+ name "Read-only unsettable"
+ value 4)
+ (object Attribute
+ tool "Ecore"
+ name "Read-write unsettable"
+ value 5)))
+ (object Attribute
+ tool "Ecore"
+ name "xmlName"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "xmlNamespace"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "xmlFeatureKind"
+ value ("FeatureKind" 0))
+ (object Attribute
+ tool "Ecore"
+ name "FeatureKind"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "Unspecified"
+ value 0)
+ (object Attribute
+ tool "Ecore"
+ name "Simple"
+ value 1)
+ (object Attribute
+ tool "Ecore"
+ name "Attribute"
+ value 2)
+ (object Attribute
+ tool "Ecore"
+ name "Element"
+ value 4)))
+ (object Attribute
+ tool "Ecore"
+ name "annotation"
+ value "")))
+ (object Attribute
+ tool "Ecore"
+ name "default__Role"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "referenceName"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "isTransient"
+ value FALSE)
+ (object Attribute
+ tool "Ecore"
+ name "isVolatile"
+ value FALSE)
+ (object Attribute
+ tool "Ecore"
+ name "isChangeable"
+ value TRUE)
+ (object Attribute
+ tool "Ecore"
+ name "isUnsettable"
+ value FALSE)
+ (object Attribute
+ tool "Ecore"
+ name "isResolveProxies"
+ value TRUE)
+ (object Attribute
+ tool "Ecore"
+ name "visibility"
+ value ("VisibilityKind" 0))
+ (object Attribute
+ tool "Ecore"
+ name "VisibilityKind"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "Unspecified"
+ value 0)
+ (object Attribute
+ tool "Ecore"
+ name "None"
+ value 1)
+ (object Attribute
+ tool "Ecore"
+ name "Read-only"
+ value 2)
+ (object Attribute
+ tool "Ecore"
+ name "Read-write"
+ value 3)
+ (object Attribute
+ tool "Ecore"
+ name "Read-only unsettable"
+ value 4)
+ (object Attribute
+ tool "Ecore"
+ name "Read-write unsettable"
+ value 5)))
+ (object Attribute
+ tool "Ecore"
+ name "xmlName"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "xmlNamespace"
+ value "")
+ (object Attribute
+ tool "Ecore"
+ name "xmlFeatureKind"
+ value ("FeatureKind" 0))
+ (object Attribute
+ tool "Ecore"
+ name "FeatureKind"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Ecore"
+ name "Unspecified"
+ value 0)
+ (object Attribute
+ tool "Ecore"
+ name "Simple"
+ value 1)
+ (object Attribute
+ tool "Ecore"
+ name "Attribute"
+ value 2)
+ (object Attribute
+ tool "Ecore"
+ name "Element"
+ value 4)))
+ (object Attribute
+ tool "Ecore"
+ name "annotation"
+ value "")))
+ (object Attribute
+ tool "DDL"
+ name "propertyId"
+ value "809135966")
+ (object Attribute
+ tool "DDL"
+ name "default__Project"
+ value (list Attribute_Set
+ (object Attribute
+ tool "DDL"
+ name "Directory"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "DDL"
+ name "DataBase"
+ value ("DataBaseSet" 800))
+ (object Attribute
+ tool "DDL"
+ name "DataBaseSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "DDL"
+ name "ANSI"
+ value 800)
+ (object Attribute
+ tool "DDL"
+ name "Oracle"
+ value 801)
+ (object Attribute
+ tool "DDL"
+ name "SQLServer"
+ value 802)
+ (object Attribute
+ tool "DDL"
+ name "Sybase"
+ value 803)
+ (object Attribute
+ tool "DDL"
+ name "Watcom"
+ value 804)))
+ (object Attribute
+ tool "DDL"
+ name "PrimaryKeyColumnName"
+ value "Id")
+ (object Attribute
+ tool "DDL"
+ name "PrimaryKeyColumnType"
+ value "NUMBER(5)")
+ (object Attribute
+ tool "DDL"
+ name "ViewName"
+ value "V_")
+ (object Attribute
+ tool "DDL"
+ name "TableName"
+ value "T_")
+ (object Attribute
+ tool "DDL"
+ name "InheritSuffix"
+ value "_V")
+ (object Attribute
+ tool "DDL"
+ name "DropClause"
+ value FALSE)
+ (object Attribute
+ tool "DDL"
+ name "BaseViews"
+ value FALSE)
+ (object Attribute
+ tool "DDL"
+ name "DDLScriptFilename"
+ value "DDL1.SQL")))
+ (object Attribute
+ tool "DDL"
+ name "default__Attribute"
+ value (list Attribute_Set
+ (object Attribute
+ tool "DDL"
+ name "ColumnType"
+ value "VARCHAR")
+ (object Attribute
+ tool "DDL"
+ name "Length"
+ value "")
+ (object Attribute
+ tool "DDL"
+ name "NullsOK"
+ value TRUE)
+ (object Attribute
+ tool "DDL"
+ name "PrimaryKey"
+ value FALSE)
+ (object Attribute
+ tool "DDL"
+ name "Unique"
+ value FALSE)
+ (object Attribute
+ tool "DDL"
+ name "CompositeUnique"
+ value FALSE)
+ (object Attribute
+ tool "DDL"
+ name "CheckConstraint"
+ value "")))
+ (object Attribute
+ tool "DDL"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "framework"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "propertyId"
+ value "809135966")
+ (object Attribute
+ tool "IDL"
+ name "default__Project"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "CreateMissingDirectories"
+ value TRUE)
+ (object Attribute
+ tool "IDL"
+ name "StopOnError"
+ value TRUE)
+ (object Attribute
+ tool "IDL"
+ name "Directory"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "IDL"
+ name "GeneratePreserveRegions"
+ value TRUE)))
+ (object Attribute
+ tool "IDL"
+ name "default__Class"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "ImplementationType"
+ value "")
+ (object Attribute
+ tool "IDL"
+ name "ConstValue"
+ value "")
+ (object Attribute
+ tool "IDL"
+ name "GenerateDefaultSpecifier"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "DefaultSpecifier"
+ value "")
+ (object Attribute
+ tool "IDL"
+ name "IDLElement"
+ value TRUE)
+ (object Attribute
+ tool "IDL"
+ name "IDLSpecificationType"
+ value ("IDLSpecSet" 22))
+ (object Attribute
+ tool "IDL"
+ name "IDLSpecSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "Interface"
+ value 22)
+ (object Attribute
+ tool "IDL"
+ name "Typedef"
+ value 54)
+ (object Attribute
+ tool "IDL"
+ name "Enumeration"
+ value 8)
+ (object Attribute
+ tool "IDL"
+ name "Const"
+ value 71)
+ (object Attribute
+ tool "IDL"
+ name "Exception"
+ value 61)
+ (object Attribute
+ tool "IDL"
+ name "Struct"
+ value 51)
+ (object Attribute
+ tool "IDL"
+ name "Union"
+ value 81)))))
+ (object Attribute
+ tool "IDL"
+ name "default__Module-Spec"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "Generate"
+ value TRUE)
+ (object Attribute
+ tool "IDL"
+ name "CmIdentification"
+ value (value Text " %X% %Q% %Z% %W%"))
+ (object Attribute
+ tool "IDL"
+ name "CopyrightNotice"
+ value (value Text ""))
+ (object Attribute
+ tool "IDL"
+ name "FileName"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "IDL"
+ name "GenerateIDLModule"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "InclusionProtectionSymbol"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "IDL"
+ name "AdditionalIncludes"
+ value (value Text ""))
+ (object Attribute
+ tool "IDL"
+ name "IncludeBySimpleName"
+ value FALSE)))
+ (object Attribute
+ tool "IDL"
+ name "default__Module-Body"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "CmIdentification"
+ value (value Text " %X% %Q% %Z% %W%"))
+ (object Attribute
+ tool "IDL"
+ name "CopyrightNotice"
+ value (value Text ""))
+ (object Attribute
+ tool "IDL"
+ name "FileName"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "IDL"
+ name "AdditionalIncludes"
+ value (value Text ""))
+ (object Attribute
+ tool "IDL"
+ name "IncludeBySimpleName"
+ value FALSE)))
+ (object Attribute
+ tool "IDL"
+ name "default__Operation"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "OperationIsOneWay"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "Context"
+ value "")
+ (object Attribute
+ tool "IDL"
+ name "Raises"
+ value "")))
+ (object Attribute
+ tool "IDL"
+ name "default__Attribute"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "CaseSpecifier"
+ value "")
+ (object Attribute
+ tool "IDL"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "IDL"
+ name "DataMemberName"
+ value "$relationship")
+ (object Attribute
+ tool "IDL"
+ name "IsReadOnly"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "IsConst"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "ConstValue"
+ value "")))
+ (object Attribute
+ tool "IDL"
+ name "default__Has"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "NameIfUnlabeled"
+ value "the_$supplier")
+ (object Attribute
+ tool "IDL"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "IDL"
+ name "DataMemberName"
+ value "$relationship")
+ (object Attribute
+ tool "IDL"
+ name "GenerateForwardReference"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "IsReadOnly"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "BoundedHasRelType"
+ value ("HasRelTypeSet" 47))
+ (object Attribute
+ tool "IDL"
+ name "HasRelTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "Array"
+ value 24)
+ (object Attribute
+ tool "IDL"
+ name "Sequence"
+ value 47)))))
+ (object Attribute
+ tool "IDL"
+ name "default__Role"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "NameIfUnlabeled"
+ value "the_$supplier")
+ (object Attribute
+ tool "IDL"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "IDL"
+ name "DataMemberName"
+ value "$relationship")
+ (object Attribute
+ tool "IDL"
+ name "GenerateForwardReference"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "IsReadOnly"
+ value FALSE)
+ (object Attribute
+ tool "IDL"
+ name "BoundedRoleType"
+ value ("AssocTypeSet" 47))
+ (object Attribute
+ tool "IDL"
+ name "AssocTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "Array"
+ value 24)
+ (object Attribute
+ tool "IDL"
+ name "Sequence"
+ value 47)))))
+ (object Attribute
+ tool "IDL"
+ name "default__Uses"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "GenerateForwardReference"
+ value FALSE)))
+ (object Attribute
+ tool "IDL"
+ name "default__Subsystem"
+ value (list Attribute_Set
+ (object Attribute
+ tool "IDL"
+ name "Directory"
+ value "AUTO GENERATE")))
+ (object Attribute
+ tool "IDL"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "propertyId"
+ value "809135966")
+ (object Attribute
+ tool "Java"
+ name "default__Project"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Java"
+ name "CreateMissingDirectories"
+ value TRUE)
+ (object Attribute
+ tool "Java"
+ name "StopOnError"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Directory"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "Java"
+ name "UsePrefixes"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "InstanceVariablePrefix"
+ value "m_")
+ (object Attribute
+ tool "Java"
+ name "ClassVariablePrefix"
+ value "s_")
+ (object Attribute
+ tool "Java"
+ name "DefaultAttributeDataType"
+ value "int")
+ (object Attribute
+ tool "Java"
+ name "DefaultOperationReturnType"
+ value "void")))
+ (object Attribute
+ tool "Java"
+ name "default__Class"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Java"
+ name "Final"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "GenerateDefaultConstructor"
+ value TRUE)
+ (object Attribute
+ tool "Java"
+ name "ConstructorIs"
+ value ("Ctor_Set" 62))
+ (object Attribute
+ tool "Java"
+ name "Ctor_Set"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Java"
+ name "Public"
+ value 62)
+ (object Attribute
+ tool "Java"
+ name "Protected"
+ value 63)
+ (object Attribute
+ tool "Java"
+ name "Private"
+ value 64)))
+ (object Attribute
+ tool "Java"
+ name "GenerateFinalizer"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "GenerateStaticInitializer"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "GenerateInstanceInitializer"
+ value FALSE)))
+ (object Attribute
+ tool "Java"
+ name "default__Module-Spec"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Java"
+ name "Generate"
+ value TRUE)
+ (object Attribute
+ tool "Java"
+ name "CmIdentification"
+ value (value Text ""))
+ (object Attribute
+ tool "Java"
+ name "CopyrightNotice"
+ value (value Text ""))
+ (object Attribute
+ tool "Java"
+ name "AdditionalImports"
+ value (value Text ""))))
+ (object Attribute
+ tool "Java"
+ name "default__Module-Body"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Java"
+ name "Generate"
+ value TRUE)
+ (object Attribute
+ tool "Java"
+ name "CmIdentification"
+ value (value Text ""))
+ (object Attribute
+ tool "Java"
+ name "CopyrightNotice"
+ value (value Text ""))
+ (object Attribute
+ tool "Java"
+ name "AdditionalImports"
+ value (value Text ""))))
+ (object Attribute
+ tool "Java"
+ name "default__Operation"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Java"
+ name "Abstract"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Static"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Final"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Native"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Synchronized"
+ value FALSE)))
+ (object Attribute
+ tool "Java"
+ name "default__Attribute"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Java"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "Java"
+ name "Final"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Transient"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Volatile"
+ value FALSE)))
+ (object Attribute
+ tool "Java"
+ name "default__Role"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Java"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "Java"
+ name "ContainerClass"
+ value "")
+ (object Attribute
+ tool "Java"
+ name "InitialValue"
+ value "")
+ (object Attribute
+ tool "Java"
+ name "Final"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Transient"
+ value FALSE)
+ (object Attribute
+ tool "Java"
+ name "Volatile"
+ value FALSE)))
+ (object Attribute
+ tool "Java"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "propertyId"
+ value "360000002")
+ (object Attribute
+ tool "Oracle8"
+ name "default__Project"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "DDLScriptFilename"
+ value "DDL1.SQL")
+ (object Attribute
+ tool "Oracle8"
+ name "DropClause"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "PrimaryKeyColumnName"
+ value "_ID")
+ (object Attribute
+ tool "Oracle8"
+ name "PrimaryKeyColumnType"
+ value "NUMBER(5,0)")
+ (object Attribute
+ tool "Oracle8"
+ name "SchemaNamePrefix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "SchemaNameSuffix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "TableNamePrefix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "TableNameSuffix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "TypeNamePrefix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "TypeNameSuffix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "ViewNamePrefix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "ViewNameSuffix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "VarrayNamePrefix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "VarrayNameSuffix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "NestedTableNamePrefix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "NestedTableNameSuffix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "ObjectTableNamePrefix"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "ObjectTableNameSuffix"
+ value "")))
+ (object Attribute
+ tool "Oracle8"
+ name "default__Module-Spec"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "IsSchema"
+ value FALSE)))
+ (object Attribute
+ tool "Oracle8"
+ name "default__Class"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "OID"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "WhereClause"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "CheckConstraint"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "CollectionTypeLength"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "CollectionTypePrecision"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "CollectionTypeScale"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "CollectionOfREFS"
+ value FALSE)))
+ (object Attribute
+ tool "Oracle8"
+ name "default__Operation"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "MethodKind"
+ value ("MethodKindSet" 1903))
+ (object Attribute
+ tool "Oracle8"
+ name "OverloadID"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "OrderNumber"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "IsReadNoDataState"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "IsReadNoProcessState"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "IsWriteNoDataState"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "IsWriteNoProcessState"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "IsSelfish"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerType"
+ value ("TriggerTypeSet" 1801))
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerEvent"
+ value ("TriggerEventSet" 1601))
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerText"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerReferencingNames"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerForEach"
+ value ("TriggerForEachSet" 1701))
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerWhenClause"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "MethodKindSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "MapMethod"
+ value 1901)
+ (object Attribute
+ tool "Oracle8"
+ name "OrderMethod"
+ value 1902)
+ (object Attribute
+ tool "Oracle8"
+ name "Function"
+ value 1903)
+ (object Attribute
+ tool "Oracle8"
+ name "Procedure"
+ value 1904)
+ (object Attribute
+ tool "Oracle8"
+ name "Operator"
+ value 1905)
+ (object Attribute
+ tool "Oracle8"
+ name "Constructor"
+ value 1906)
+ (object Attribute
+ tool "Oracle8"
+ name "Destructor"
+ value 1907)
+ (object Attribute
+ tool "Oracle8"
+ name "Trigger"
+ value 1908)
+ (object Attribute
+ tool "Oracle8"
+ name "Calculated"
+ value 1909)))
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "AFTER"
+ value 1801)
+ (object Attribute
+ tool "Oracle8"
+ name "BEFORE"
+ value 1802)
+ (object Attribute
+ tool "Oracle8"
+ name "INSTEAD OF"
+ value 1803)))
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerForEachSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "ROW"
+ value 1701)
+ (object Attribute
+ tool "Oracle8"
+ name "STATEMENT"
+ value 1702)))
+ (object Attribute
+ tool "Oracle8"
+ name "TriggerEventSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "INSERT"
+ value 1601)
+ (object Attribute
+ tool "Oracle8"
+ name "UPDATE"
+ value 1602)
+ (object Attribute
+ tool "Oracle8"
+ name "DELETE"
+ value 1603)
+ (object Attribute
+ tool "Oracle8"
+ name "INSERT OR UPDATE"
+ value 1604)
+ (object Attribute
+ tool "Oracle8"
+ name "INSERT OR DELETE"
+ value 1605)
+ (object Attribute
+ tool "Oracle8"
+ name "UPDATE OR DELETE"
+ value 1606)
+ (object Attribute
+ tool "Oracle8"
+ name "INSERT OR UPDATE OR DELETE"
+ value 1607)))))
+ (object Attribute
+ tool "Oracle8"
+ name "default__Role"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "OrderNumber"
+ value "")))
+ (object Attribute
+ tool "Oracle8"
+ name "default__Attribute"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Oracle8"
+ name "OrderNumber"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "IsUnique"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "NullsAllowed"
+ value TRUE)
+ (object Attribute
+ tool "Oracle8"
+ name "Length"
+ value "")
+ (object Attribute
+ tool "Oracle8"
+ name "Precision"
+ value "2")
+ (object Attribute
+ tool "Oracle8"
+ name "Scale"
+ value "6")
+ (object Attribute
+ tool "Oracle8"
+ name "IsIndex"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "IsPrimaryKey"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "CompositeUnique"
+ value FALSE)
+ (object Attribute
+ tool "Oracle8"
+ name "CheckConstraint"
+ value "")))
+ (object Attribute
+ tool "Oracle8"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "Repository"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "propertyId"
+ value "809135966")
+ (object Attribute
+ tool "cg"
+ name "default__Project"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "UseMSVC"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "HeaderFileExtension"
+ value "h")
+ (object Attribute
+ tool "cg"
+ name "HeaderFileBackupExtension"
+ value "h~")
+ (object Attribute
+ tool "cg"
+ name "HeaderFileTemporaryExtension"
+ value "h#")
+ (object Attribute
+ tool "cg"
+ name "CodeFileExtension"
+ value "cpp")
+ (object Attribute
+ tool "cg"
+ name "CodeFileBackupExtension"
+ value "cp~")
+ (object Attribute
+ tool "cg"
+ name "CodeFileTemporaryExtension"
+ value "cp#")
+ (object Attribute
+ tool "cg"
+ name "CreateMissingDirectories"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "StopOnError"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "ErrorLimit"
+ value 30)
+ (object Attribute
+ tool "cg"
+ name "Directory"
+ value "$ROSECPP_SOURCE")
+ (object Attribute
+ tool "cg"
+ name "PathSeparator"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "FileNameFormat"
+ value "128vx_b")
+ (object Attribute
+ tool "cg"
+ name "BooleanType"
+ value "int")
+ (object Attribute
+ tool "cg"
+ name "AllowTemplates"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "AllowExplicitInstantiations"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "AllowProtectedInheritance"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "CommentWidth"
+ value 60)
+ (object Attribute
+ tool "cg"
+ name "OneByValueContainer"
+ value "$targetClass")
+ (object Attribute
+ tool "cg"
+ name "OneByReferenceContainer"
+ value "$targetClass *")
+ (object Attribute
+ tool "cg"
+ name "OptionalByValueContainer"
+ value "OptionalByValue<$targetClass>")
+ (object Attribute
+ tool "cg"
+ name "OptionalByReferenceContainer"
+ value "$targetClass *")
+ (object Attribute
+ tool "cg"
+ name "FixedByValueContainer"
+ value "$targetClass[$limit]")
+ (object Attribute
+ tool "cg"
+ name "UnorderedFixedByValueContainer"
+ value "$targetClass[$limit]")
+ (object Attribute
+ tool "cg"
+ name "FixedByReferenceContainer"
+ value "$targetClass *[$limit]")
+ (object Attribute
+ tool "cg"
+ name "UnorderedFixedByReferenceContainer"
+ value "$targetClass *[$limit]")
+ (object Attribute
+ tool "cg"
+ name "BoundedByValueContainer"
+ value "BoundedListByValue<$targetClass,$limit>")
+ (object Attribute
+ tool "cg"
+ name "UnorderedBoundedByValueContainer"
+ value "BoundedSetByValue<$targetClass,$limit>")
+ (object Attribute
+ tool "cg"
+ name "BoundedByReferenceContainer"
+ value "BoundedListByReference<$targetClass,$limit>")
+ (object Attribute
+ tool "cg"
+ name "UnorderedBoundedByReferenceContainer"
+ value "BoundedSetByReference<$targetClass,$limit>")
+ (object Attribute
+ tool "cg"
+ name "UnboundedByValueContainer"
+ value "UnboundedListByValue<$targetClass>")
+ (object Attribute
+ tool "cg"
+ name "UnorderedUnboundedByValueContainer"
+ value "UnboundedSetByValue<$targetClass>")
+ (object Attribute
+ tool "cg"
+ name "UnboundedByReferenceContainer"
+ value "UnboundedListByReference<$targetClass>")
+ (object Attribute
+ tool "cg"
+ name "UnorderedUnboundedByReferenceContainer"
+ value "UnboundedSetByReference<$targetClass>")
+ (object Attribute
+ tool "cg"
+ name "QualifiedByValueContainer"
+ value "AssociationByValue<$qualtype, $qualcont>")
+ (object Attribute
+ tool "cg"
+ name "UnorderedQualifiedByValueContainer"
+ value "DictionaryByValue<$qualtype, $qualcont>")
+ (object Attribute
+ tool "cg"
+ name "QualifiedByReferenceContainer"
+ value "AssociationByReference<$qualtype, $qualcont>")
+ (object Attribute
+ tool "cg"
+ name "UnorderedQualifiedByReferenceContainer"
+ value "DictionaryByReference<$qualtype, $qualcont>")
+ (object Attribute
+ tool "cg"
+ name "GeneratePreserveRegions"
+ value TRUE)))
+ (object Attribute
+ tool "cg"
+ name "default__Class"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "CodeName"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "ImplementationType"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "ClassKey"
+ value "class")
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegions"
+ value ("GenerateEmptyRegionSet" 3))
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegionSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "None"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Preserved"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Unpreserved"
+ value 2)
+ (object Attribute
+ tool "cg"
+ name "All"
+ value 3)))
+ (object Attribute
+ tool "cg"
+ name "PutBodiesInSpec"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateDefaultConstructor"
+ value ("GenerateSet" 199))
+ (object Attribute
+ tool "cg"
+ name "DefaultConstructorVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "InlineDefaultConstructor"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "ExplicitDefaultConstructor"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateCopyConstructor"
+ value ("GenerateSet" 199))
+ (object Attribute
+ tool "cg"
+ name "CopyConstructorVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "InlineCopyConstructor"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "ExplicitCopyConstructor"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateDestructor"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "DestructorVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "DestructorKind"
+ value ("ThreeKindSet" 200))
+ (object Attribute
+ tool "cg"
+ name "InlineDestructor"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateAssignmentOperation"
+ value ("GenerateSet" 199))
+ (object Attribute
+ tool "cg"
+ name "AssignmentVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "AssignmentKind"
+ value ("ThreeKindSet" 200))
+ (object Attribute
+ tool "cg"
+ name "InlineAssignmentOperation"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateEqualityOperations"
+ value ("GenerateSet" 199))
+ (object Attribute
+ tool "cg"
+ name "EqualityVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "EqualityKind"
+ value ("FriendKindSet" 200))
+ (object Attribute
+ tool "cg"
+ name "InlineEqualityOperations"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateRelationalOperations"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "RelationalVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "RelationalKind"
+ value ("FriendKindSet" 200))
+ (object Attribute
+ tool "cg"
+ name "InlineRelationalOperations"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateStorageMgmtOperations"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "StorageMgmtVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "InlineStorageMgmtOperations"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateSubscriptOperation"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "SubscriptVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "SubscriptKind"
+ value ("ThreeKindSet" 200))
+ (object Attribute
+ tool "cg"
+ name "SubscriptResultType"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "InlineSubscriptOperation"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateDereferenceOperation"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "DereferenceVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "DereferenceKind"
+ value ("ThreeKindSet" 200))
+ (object Attribute
+ tool "cg"
+ name "DereferenceResultType"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "InlineDereferenceOperation"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateIndirectionOperation"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "IndirectionVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "IndirectionKind"
+ value ("ThreeKindSet" 200))
+ (object Attribute
+ tool "cg"
+ name "IndirectionResultType"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "InlineIndirectionOperation"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateStreamOperations"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "StreamVisibility"
+ value ("VisibilitySet" 45))
+ (object Attribute
+ tool "cg"
+ name "InlineStreamOperations"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "ThreeKindSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Common"
+ value 200)
+ (object Attribute
+ tool "cg"
+ name "Virtual"
+ value 201)
+ (object Attribute
+ tool "cg"
+ name "Abstract"
+ value 202)))
+ (object Attribute
+ tool "cg"
+ name "KindSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Common"
+ value 200)
+ (object Attribute
+ tool "cg"
+ name "Virtual"
+ value 201)
+ (object Attribute
+ tool "cg"
+ name "Abstract"
+ value 202)
+ (object Attribute
+ tool "cg"
+ name "Static"
+ value 203)))
+ (object Attribute
+ tool "cg"
+ name "FriendKindSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Common"
+ value 200)
+ (object Attribute
+ tool "cg"
+ name "Virtual"
+ value 201)
+ (object Attribute
+ tool "cg"
+ name "Abstract"
+ value 202)
+ (object Attribute
+ tool "cg"
+ name "Friend"
+ value 204)))
+ (object Attribute
+ tool "cg"
+ name "GenerateSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "DeclareAndDefine"
+ value 199)
+ (object Attribute
+ tool "cg"
+ name "DeclareOnly"
+ value 205)
+ (object Attribute
+ tool "cg"
+ name "DoNotDeclare"
+ value 206)))
+ (object Attribute
+ tool "cg"
+ name "VisibilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Public"
+ value 45)
+ (object Attribute
+ tool "cg"
+ name "Protected"
+ value 44)
+ (object Attribute
+ tool "cg"
+ name "Private"
+ value 43)
+ (object Attribute
+ tool "cg"
+ name "Implementation"
+ value 14)))
+ (object Attribute
+ tool "cg"
+ name "ConstValue"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "GenerateDefaultSpecifier"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "DefaultSpecifier"
+ value "")))
+ (object Attribute
+ tool "cg"
+ name "default__Module-Spec"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Generate"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegions"
+ value ("GenerateEmptyRegionSet" 3))
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegionSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "None"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Preserved"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Unpreserved"
+ value 2)
+ (object Attribute
+ tool "cg"
+ name "All"
+ value 3)))
+ (object Attribute
+ tool "cg"
+ name "CmIdentification"
+ value (value Text " %X% %Q% %Z% %W%"))
+ (object Attribute
+ tool "cg"
+ name "CopyrightNotice"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "FileName"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "cg"
+ name "AllowExtensionlessFileName"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "InclusionProtectionSymbol"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "cg"
+ name "IncludeFormat"
+ value (value Text
+|// $package
+|#include "$file"
+|
+ ))
+ (object Attribute
+ tool "cg"
+ name "IncludeBySimpleName"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "IncludePrecompiledHeader"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "IncludeOrder"
+ value "AMIR")
+ (object Attribute
+ tool "cg"
+ name "AdditionalIncludes"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "InliningStyle"
+ value ("InliningStyleSet" 207))
+ (object Attribute
+ tool "cg"
+ name "InliningStyleSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "InClassDeclaration"
+ value 208)
+ (object Attribute
+ tool "cg"
+ name "FollowingClassDeclaration"
+ value 207)))
+ (object Attribute
+ tool "cg"
+ name "TypesDefined"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "IncludeClosure"
+ value (value Text ""))))
+ (object Attribute
+ tool "cg"
+ name "default__Module-Body"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Generate"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegions"
+ value ("GenerateEmptyRegionSet" 3))
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegionSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "None"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Preserved"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Unpreserved"
+ value 2)
+ (object Attribute
+ tool "cg"
+ name "All"
+ value 3)))
+ (object Attribute
+ tool "cg"
+ name "CmIdentification"
+ value (value Text " %X% %Q% %Z% %W%"))
+ (object Attribute
+ tool "cg"
+ name "CopyrightNotice"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "FileName"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "cg"
+ name "AllowExtensionlessFileName"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "IncludeFormat"
+ value (value Text
+|// $package
+|#include "$file"
+|
+ ))
+ (object Attribute
+ tool "cg"
+ name "IncludeBySimpleName"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "IncludePrecompiledHeader"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "IncludeOrder"
+ value "AMIR")
+ (object Attribute
+ tool "cg"
+ name "AdditionalIncludes"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "InliningStyle"
+ value ("InliningStyleSet" 207))
+ (object Attribute
+ tool "cg"
+ name "InliningStyleSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "InClassDeclaration"
+ value 208)
+ (object Attribute
+ tool "cg"
+ name "FollowingClassDeclaration"
+ value 207)))
+ (object Attribute
+ tool "cg"
+ name "TypesDefined"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "IncludeClosure"
+ value (value Text ""))))
+ (object Attribute
+ tool "cg"
+ name "default__Operation"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "CodeName"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "OperationKind"
+ value ("OperationKindSet" 200))
+ (object Attribute
+ tool "cg"
+ name "OperationKindSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Common"
+ value 200)
+ (object Attribute
+ tool "cg"
+ name "Virtual"
+ value 201)
+ (object Attribute
+ tool "cg"
+ name "Abstract"
+ value 202)
+ (object Attribute
+ tool "cg"
+ name "Static"
+ value 203)
+ (object Attribute
+ tool "cg"
+ name "Friend"
+ value 204)))
+ (object Attribute
+ tool "cg"
+ name "OperationIsConst"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "OperationIsExplicit"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "Inline"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "EntryCode"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "ExitCode"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegions"
+ value ("GenerateEmptyRegionSet" 3))
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegionSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "None"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Preserved"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Unpreserved"
+ value 2)
+ (object Attribute
+ tool "cg"
+ name "All"
+ value 3)))
+ (object Attribute
+ tool "cg"
+ name "BodyAnnotations"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "OperationIsOneWay"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "Context"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "Raises"
+ value "")))
+ (object Attribute
+ tool "cg"
+ name "default__Has"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "CodeName"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "Ordered"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "NameIfUnlabeled"
+ value "the_$supplier")
+ (object Attribute
+ tool "cg"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "DataMemberName"
+ value "$relationship")
+ (object Attribute
+ tool "cg"
+ name "DataMemberVisibility"
+ value ("DataMemberVisibilitySet" 14))
+ (object Attribute
+ tool "cg"
+ name "DataMemberVisibilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Public"
+ value 45)
+ (object Attribute
+ tool "cg"
+ name "Protected"
+ value 44)
+ (object Attribute
+ tool "cg"
+ name "Private"
+ value 43)
+ (object Attribute
+ tool "cg"
+ name "Implementation"
+ value 14)
+ (object Attribute
+ tool "cg"
+ name "AtRelationshipVisibility"
+ value 210)))
+ (object Attribute
+ tool "cg"
+ name "DataMemberMutability"
+ value ("DataMemberMutabilitySet" 0))
+ (object Attribute
+ tool "cg"
+ name "DataMemberMutabilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Unrestricted"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Mutable"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Const"
+ value 2)))
+ (object Attribute
+ tool "cg"
+ name "DataMemberIsVolatile"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "DataMemberFieldSize"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "InitialValue"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "GenerateGetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateSetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GetName"
+ value "get_$relationship")
+ (object Attribute
+ tool "cg"
+ name "SetName"
+ value "set_$relationship")
+ (object Attribute
+ tool "cg"
+ name "GetSetKinds"
+ value ("GetSetKindsSet" 200))
+ (object Attribute
+ tool "cg"
+ name "GetSetKindsSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Common"
+ value 200)
+ (object Attribute
+ tool "cg"
+ name "Virtual"
+ value 201)
+ (object Attribute
+ tool "cg"
+ name "Abstract"
+ value 202)
+ (object Attribute
+ tool "cg"
+ name "Static"
+ value 203)
+ (object Attribute
+ tool "cg"
+ name "Friend"
+ value 204)))
+ (object Attribute
+ tool "cg"
+ name "ContainerClass"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "SelectorName"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "SelectorType"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "GetIsConst"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GetResultIsConst"
+ value ("GetResultIsConstSet" 2))
+ (object Attribute
+ tool "cg"
+ name "GetResultIsConstSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "False"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "True"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Same_As_Function"
+ value 2)))
+ (object Attribute
+ tool "cg"
+ name "GetSetByReference"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "InlineGet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "SetReturnsValue"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "InlineSet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "ForwardReferenceOnly"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateForwardReference"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "IsReadOnly"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "BoundedHasRelType"
+ value ("HasRelTypeSet" 47))
+ (object Attribute
+ tool "cg"
+ name "HasRelTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Array"
+ value 24)
+ (object Attribute
+ tool "cg"
+ name "Sequence"
+ value 47)))))
+ (object Attribute
+ tool "cg"
+ name "default__Association"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "NameIfUnlabeled"
+ value "the_$targetClass")))
+ (object Attribute
+ tool "cg"
+ name "default__Inherit"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "InstanceArguments"
+ value "")))
+ (object Attribute
+ tool "cg"
+ name "default__Role"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "CodeName"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "ForwardReferenceOnly"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "NameIfUnlabeled"
+ value "the_$targetClass")
+ (object Attribute
+ tool "cg"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "DataMemberName"
+ value "$target")
+ (object Attribute
+ tool "cg"
+ name "DataMemberVisibility"
+ value ("DataMemberVisibilitySet" 14))
+ (object Attribute
+ tool "cg"
+ name "DataMemberVisibilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Public"
+ value 45)
+ (object Attribute
+ tool "cg"
+ name "Protected"
+ value 44)
+ (object Attribute
+ tool "cg"
+ name "Private"
+ value 43)
+ (object Attribute
+ tool "cg"
+ name "Implementation"
+ value 14)
+ (object Attribute
+ tool "cg"
+ name "AtRelationshipVisibility"
+ value 210)))
+ (object Attribute
+ tool "cg"
+ name "DataMemberMutability"
+ value ("DataMemberMutabilitySet" 0))
+ (object Attribute
+ tool "cg"
+ name "DataMemberMutabilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Unrestricted"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Mutable"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Const"
+ value 2)))
+ (object Attribute
+ tool "cg"
+ name "DataMemberIsVolatile"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "DataMemberFieldSize"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "InitialValue"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "ContainerClass"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "ContainerGet"
+ value "$data.get($keys)")
+ (object Attribute
+ tool "cg"
+ name "ContainerSet"
+ value "$data.set($keys,$value)")
+ (object Attribute
+ tool "cg"
+ name "QualifiedContainer"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "AssocClassContainer"
+ value "$supplier *")
+ (object Attribute
+ tool "cg"
+ name "AssocClassInitialValue"
+ value (value Text ""))
+ (object Attribute
+ tool "cg"
+ name "GetSetKinds"
+ value ("GetSetKindsSet" 200))
+ (object Attribute
+ tool "cg"
+ name "GetSetKindsSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Common"
+ value 200)
+ (object Attribute
+ tool "cg"
+ name "Virtual"
+ value 201)
+ (object Attribute
+ tool "cg"
+ name "Abstract"
+ value 202)
+ (object Attribute
+ tool "cg"
+ name "Static"
+ value 203)
+ (object Attribute
+ tool "cg"
+ name "Friend"
+ value 204)))
+ (object Attribute
+ tool "cg"
+ name "GetSetByReference"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateGetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GetName"
+ value "get_$target")
+ (object Attribute
+ tool "cg"
+ name "GetIsConst"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GetResultIsConst"
+ value ("GetResultIsConstSet" 2))
+ (object Attribute
+ tool "cg"
+ name "GetResultIsConstSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "False"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "True"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Same_As_Function"
+ value 2)))
+ (object Attribute
+ tool "cg"
+ name "InlineGet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateSetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "SetName"
+ value "set_$target")
+ (object Attribute
+ tool "cg"
+ name "SetReturnsValue"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "InlineSet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "QualifiedGetSetByReference"
+ value ("QualifiedGetSetByReferenceSet" 2))
+ (object Attribute
+ tool "cg"
+ name "QualifiedGetSetByReferenceSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "False"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "True"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Same_As_GetSetByReference"
+ value 2)))
+ (object Attribute
+ tool "cg"
+ name "GenerateQualifiedGetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "QualifiedGetName"
+ value "get_$target")
+ (object Attribute
+ tool "cg"
+ name "QualifiedGetIsConst"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "QualifiedGetResultIsConst"
+ value ("GetResultIsConstSet" 2))
+ (object Attribute
+ tool "cg"
+ name "InlineQualifiedGet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateQualifiedSetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "QualifiedSetName"
+ value "set_$target")
+ (object Attribute
+ tool "cg"
+ name "QualifiedSetReturnsValue"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "InlineQualifiedSet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateAssocClassDataMember"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "AssocClassDataMemberName"
+ value "$target")
+ (object Attribute
+ tool "cg"
+ name "AssocClassDataMemberVisibility"
+ value ("DataMemberVisibilitySet" 14))
+ (object Attribute
+ tool "cg"
+ name "DataMemberVisibilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Public"
+ value 45)
+ (object Attribute
+ tool "cg"
+ name "Protected"
+ value 44)
+ (object Attribute
+ tool "cg"
+ name "Private"
+ value 43)
+ (object Attribute
+ tool "cg"
+ name "Implementation"
+ value 14)
+ (object Attribute
+ tool "cg"
+ name "AtRelationshipVisibility"
+ value 210)))
+ (object Attribute
+ tool "cg"
+ name "AssocClassDataMemberMutability"
+ value ("DataMemberMutabilitySet" 0))
+ (object Attribute
+ tool "cg"
+ name "DataMemberMutabilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Unrestricted"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Mutable"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Const"
+ value 2)))
+ (object Attribute
+ tool "cg"
+ name "AssocClassDataMemberIsVolatile"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "AssocClassGetSetKinds"
+ value ("GetSetKindsSet" 200))
+ (object Attribute
+ tool "cg"
+ name "GenerateAssocClassGetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "AssocClassGetName"
+ value "get_$target")
+ (object Attribute
+ tool "cg"
+ name "AssocClassGetIsConst"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "AssocClassGetResultIsConst"
+ value ("GetResultIsConstSet" 2))
+ (object Attribute
+ tool "cg"
+ name "InlineAssocClassGet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateAssocClassSetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "AssocClassSetName"
+ value "set_$target")
+ (object Attribute
+ tool "cg"
+ name "AssocClassSetReturnsValue"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "InlineAssocClassSet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "AssocClassForwardReferenceOnly"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateForwardReference"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "IsReadOnly"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "BoundedRoleType"
+ value ("AssocTypeSet" 47))
+ (object Attribute
+ tool "cg"
+ name "AssocTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Array"
+ value 24)
+ (object Attribute
+ tool "cg"
+ name "Sequence"
+ value 47)))))
+ (object Attribute
+ tool "cg"
+ name "default__Attribute"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "CodeName"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "DataMemberName"
+ value "$attribute")
+ (object Attribute
+ tool "cg"
+ name "DataMemberVisibility"
+ value ("DataMemberVisibilitySet" 14))
+ (object Attribute
+ tool "cg"
+ name "DataMemberVisibilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Public"
+ value 45)
+ (object Attribute
+ tool "cg"
+ name "Protected"
+ value 44)
+ (object Attribute
+ tool "cg"
+ name "Private"
+ value 43)
+ (object Attribute
+ tool "cg"
+ name "Implementation"
+ value 14)
+ (object Attribute
+ tool "cg"
+ name "AtAttributeVisibility"
+ value 211)))
+ (object Attribute
+ tool "cg"
+ name "DataMemberMutability"
+ value ("DataMemberMutabilitySet" 0))
+ (object Attribute
+ tool "cg"
+ name "DataMemberMutabilitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Unrestricted"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Mutable"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Const"
+ value 2)))
+ (object Attribute
+ tool "cg"
+ name "DataMemberIsVolatile"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "DataMemberFieldSize"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "GenerateGetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GenerateSetOperation"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GetName"
+ value "get_$attribute")
+ (object Attribute
+ tool "cg"
+ name "SetName"
+ value "set_$attribute")
+ (object Attribute
+ tool "cg"
+ name "GetSetKinds"
+ value ("GetSetKindsSet" 200))
+ (object Attribute
+ tool "cg"
+ name "GetSetKindsSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Common"
+ value 200)
+ (object Attribute
+ tool "cg"
+ name "Virtual"
+ value 201)
+ (object Attribute
+ tool "cg"
+ name "Abstract"
+ value 202)
+ (object Attribute
+ tool "cg"
+ name "Static"
+ value 203)
+ (object Attribute
+ tool "cg"
+ name "Friend"
+ value 204)))
+ (object Attribute
+ tool "cg"
+ name "GetIsConst"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "GetResultIsConst"
+ value ("GetResultIsConstSet" 2))
+ (object Attribute
+ tool "cg"
+ name "GetResultIsConstSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "False"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "True"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Same_As_Function"
+ value 2)))
+ (object Attribute
+ tool "cg"
+ name "GetSetByReference"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "InlineGet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "SetReturnsValue"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "InlineSet"
+ value TRUE)
+ (object Attribute
+ tool "cg"
+ name "CaseSpecifier"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "IsReadOnly"
+ value FALSE)))
+ (object Attribute
+ tool "cg"
+ name "default__Uses"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "ForwardReferenceOnly"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "BodyReferenceOnly"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "GenerateForwardReference"
+ value FALSE)))
+ (object Attribute
+ tool "cg"
+ name "default__Subsystem"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "Directory"
+ value "AUTO GENERATE")
+ (object Attribute
+ tool "cg"
+ name "DirectoryIsOnSearchList"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "PrecompiledHeader"
+ value "")))
+ (object Attribute
+ tool "cg"
+ name "default__Category"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "IsNamespace"
+ value FALSE)
+ (object Attribute
+ tool "cg"
+ name "Indent"
+ value 2)
+ (object Attribute
+ tool "cg"
+ name "CodeName"
+ value "")
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegions"
+ value ("GenerateEmptyRegionSet" 3))
+ (object Attribute
+ tool "cg"
+ name "GenerateEmptyRegionSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "cg"
+ name "None"
+ value 0)
+ (object Attribute
+ tool "cg"
+ name "Preserved"
+ value 1)
+ (object Attribute
+ tool "cg"
+ name "Unpreserved"
+ value 2)
+ (object Attribute
+ tool "cg"
+ name "All"
+ value 3)))))
+ (object Attribute
+ tool "MSVC"
+ name "propertyId"
+ value "809135966")
+ (object Attribute
+ tool "MSVC"
+ name "default__Project"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Version"
+ value "5.0")))
+ (object Attribute
+ tool "MSVC"
+ name "default__Class"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Type"
+ value ("MSVCClassTypeSet" 0))
+ (object Attribute
+ tool "MSVC"
+ name "MSVCClassTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Normal"
+ value 0)
+ (object Attribute
+ tool "MSVC"
+ name "Interface_Part"
+ value 1)
+ (object Attribute
+ tool "MSVC"
+ name "Connection_Part"
+ value 2)
+ (object Attribute
+ tool "MSVC"
+ name "Class_Factory"
+ value 3)))
+ (object Attribute
+ tool "MSVC"
+ name "CObjectFunctionality"
+ value ("CObjectFunctionalitySet" 0))
+ (object Attribute
+ tool "MSVC"
+ name "CObjectFunctionalitySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "None"
+ value 0)
+ (object Attribute
+ tool "MSVC"
+ name "Dynamic"
+ value 1)
+ (object Attribute
+ tool "MSVC"
+ name "Dyncreate"
+ value 2)
+ (object Attribute
+ tool "MSVC"
+ name "Serial"
+ value 3)))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateOverrideGroup"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "GenerateDataGroup"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_DATA_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateFieldGroup"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_FIELD_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateMessageGroup"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "GenerateMessageMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_MSG_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "MESSAGE_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "OLEFactory"
+ value ("OLEFactorySet" 0))
+ (object Attribute
+ tool "MSVC"
+ name "OLEFactorySet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "None"
+ value 0)
+ (object Attribute
+ tool "MSVC"
+ name "Built_in"
+ value 1)
+ (object Attribute
+ tool "MSVC"
+ name "Simple"
+ value 2)
+ (object Attribute
+ tool "MSVC"
+ name "Licensed"
+ value 3)))
+ (object Attribute
+ tool "MSVC"
+ name "OLEName"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "OLEClassID"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "GenerateOLECtlType"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "OLECtlType"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "GenerateOLETypeLib"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "OLETypeLibID"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "OLETypeLibMajor"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "OLETypeLibMinor"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "GeneratePropPageIDs"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "OLEPropPageIDs"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateDispatchMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_DISPATCH_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "StockProperties"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "StockFunctions"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DispatchDefValue"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "GenerateDispIdEnum"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_DISP_ID_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateInterfaceMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "INTERFACE_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "InitInterface"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "GenerateEventMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_EVENT_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_EVENT_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "EVENT_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "StockEvents"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateEventSinkMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_EVENTSINK_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_EVENTSINK_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "EVENTSINK_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "PropNotifySinks"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateConnectionMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "CONNECTION_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "ConnectionPointIID"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "InheritanceType"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "DeclSpec"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "OLECommands"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "MFCDeclares"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "MFCImplements"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "ATL_Declares"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateCOMMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "COM_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateConnectionPointMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "CONNECTION_POINT_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateMsgMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "MSG_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GeneratePropertyMap"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "PROPERTY_MAP_Entries"
+ value (value Text ""))))
+ (object Attribute
+ tool "MSVC"
+ name "default__Operation"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Type"
+ value ("MSVCOperationTypeSet" 0))
+ (object Attribute
+ tool "MSVC"
+ name "MSVCOperationTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Normal"
+ value 0)
+ (object Attribute
+ tool "MSVC"
+ name "Virtual_Override"
+ value 1)
+ (object Attribute
+ tool "MSVC"
+ name "Message_Handler"
+ value 2)
+ (object Attribute
+ tool "MSVC"
+ name "Dispatch_Handler"
+ value 3)
+ (object Attribute
+ tool "MSVC"
+ name "Event_Firing_Function"
+ value 4)
+ (object Attribute
+ tool "MSVC"
+ name "Event_Sink_Handler"
+ value 5)
+ (object Attribute
+ tool "MSVC"
+ name "Std_OLE_Method"
+ value 6)
+ (object Attribute
+ tool "MSVC"
+ name "Command_Parser"
+ value 7)
+ (object Attribute
+ tool "MSVC"
+ name "Property_Get_Function"
+ value 8)
+ (object Attribute
+ tool "MSVC"
+ name "Property_Set_Function"
+ value 9)
+ (object Attribute
+ tool "MSVC"
+ name "Property_Notify_Function"
+ value 10)
+ (object Attribute
+ tool "MSVC"
+ name "Macro_Generated_Function"
+ value 11)))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_MSG_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "MESSAGE_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_EVENT_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "EVENT_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_EVENTSINK_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "EVENTSINK_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "CallType"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "DeclSpec"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "BodyImage"
+ value (value Text ""))))
+ (object Attribute
+ tool "MSVC"
+ name "default__Role"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Type"
+ value ("MSVCAttributeTypeSet" 0))
+ (object Attribute
+ tool "MSVC"
+ name "MSVCAttributeTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Normal"
+ value 0)
+ (object Attribute
+ tool "MSVC"
+ name "Member_Property"
+ value 1)
+ (object Attribute
+ tool "MSVC"
+ name "Get_Set_Property"
+ value 2)
+ (object Attribute
+ tool "MSVC"
+ name "Dialog_Data"
+ value 3)
+ (object Attribute
+ tool "MSVC"
+ name "Field_Data"
+ value 4)
+ (object Attribute
+ tool "MSVC"
+ name "Stock_Property"
+ value 5)))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DeclSpec"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "PointerBase"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "CallType"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "StockPropertyImplementation"
+ value "")))
+ (object Attribute
+ tool "MSVC"
+ name "default__Has"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Type"
+ value ("MSVCAttributeTypeSet" 0))
+ (object Attribute
+ tool "MSVC"
+ name "MSVCAttributeTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Normal"
+ value 0)
+ (object Attribute
+ tool "MSVC"
+ name "Member_Property"
+ value 1)
+ (object Attribute
+ tool "MSVC"
+ name "Get_Set_Property"
+ value 2)
+ (object Attribute
+ tool "MSVC"
+ name "Dialog_Data"
+ value 3)
+ (object Attribute
+ tool "MSVC"
+ name "Field_Data"
+ value 4)
+ (object Attribute
+ tool "MSVC"
+ name "Stock_Property"
+ value 5)))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DeclSpec"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "PointerBase"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "CallType"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "StockPropertyImplementation"
+ value "")))
+ (object Attribute
+ tool "MSVC"
+ name "default__Attribute"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Type"
+ value ("MSVCAttributeTypeSet" 0))
+ (object Attribute
+ tool "MSVC"
+ name "MSVCAttributeTypeSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "Normal"
+ value 0)
+ (object Attribute
+ tool "MSVC"
+ name "Member_Property"
+ value 1)
+ (object Attribute
+ tool "MSVC"
+ name "Get_Set_Property"
+ value 2)
+ (object Attribute
+ tool "MSVC"
+ name "Dialog_Data"
+ value 3)
+ (object Attribute
+ tool "MSVC"
+ name "Field_Data"
+ value 4)
+ (object Attribute
+ tool "MSVC"
+ name "Stock_Property"
+ value 5)))
+ (object Attribute
+ tool "MSVC"
+ name "AFX_DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DISPATCH_MAP_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "DeclSpec"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "PointerBase"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "CallType"
+ value "")
+ (object Attribute
+ tool "MSVC"
+ name "StockPropertyImplementation"
+ value "")))
+ (object Attribute
+ tool "MSVC"
+ name "default__Module-Spec"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "GenerateIncludesGroup"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_INCLUDES_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateInsertLocation"
+ value FALSE)))
+ (object Attribute
+ tool "MSVC"
+ name "default__Module-Body"
+ value (list Attribute_Set
+ (object Attribute
+ tool "MSVC"
+ name "GenerateIncludesGroup"
+ value FALSE)
+ (object Attribute
+ tool "MSVC"
+ name "AFX_INCLUDES_Entries"
+ value (value Text ""))
+ (object Attribute
+ tool "MSVC"
+ name "GenerateInsertLocation"
+ value FALSE)))
+ (object Attribute
+ tool "cg"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "SCC"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "TypeLibImporter"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "propertyId"
+ value "783606378")
+ (object Attribute
+ tool "Visual Basic"
+ name "default__Class"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Visual Basic"
+ name "CreatableSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Visual Basic"
+ name "Private"
+ value 221)
+ (object Attribute
+ tool "Visual Basic"
+ name "PublicNotCreatable"
+ value 213)
+ (object Attribute
+ tool "Visual Basic"
+ name "SingleUse"
+ value 214)
+ (object Attribute
+ tool "Visual Basic"
+ name "GlobalSingleUse"
+ value 215)
+ (object Attribute
+ tool "Visual Basic"
+ name "MultiUse"
+ value 219)
+ (object Attribute
+ tool "Visual Basic"
+ name "GlobalMultiUse"
+ value 220)))
+ (object Attribute
+ tool "Visual Basic"
+ name "OptionBase"
+ value "0")
+ (object Attribute
+ tool "Visual Basic"
+ name "OptionExplicit"
+ value TRUE)
+ (object Attribute
+ tool "Visual Basic"
+ name "OptionCompare"
+ value ("CompareSet" 202))
+ (object Attribute
+ tool "Visual Basic"
+ name "Creatable"
+ value ("CreatableSet" 221))
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateInitialization"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateTermination"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "CollectionClass"
+ value "Collection")
+ (object Attribute
+ tool "Visual Basic"
+ name "CompareSet"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Visual Basic"
+ name "None"
+ value 202)
+ (object Attribute
+ tool "Visual Basic"
+ name "Binary"
+ value 203)
+ (object Attribute
+ tool "Visual Basic"
+ name "Text"
+ value 204)))))
+ (object Attribute
+ tool "Visual Basic"
+ name "default__Operation"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Visual Basic"
+ name "OperationName"
+ value "$operation")
+ (object Attribute
+ tool "Visual Basic"
+ name "LibraryName"
+ value "")
+ (object Attribute
+ tool "Visual Basic"
+ name "AliasName"
+ value "")
+ (object Attribute
+ tool "Visual Basic"
+ name "IsStatic"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "EntryCode"
+ value (value Text ""))
+ (object Attribute
+ tool "Visual Basic"
+ name "ExitCode"
+ value (value Text ""))))
+ (object Attribute
+ tool "Visual Basic"
+ name "default__Attribute"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Visual Basic"
+ name "IsConst"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "New"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "WithEvents"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "Subscript"
+ value "")
+ (object Attribute
+ tool "Visual Basic"
+ name "NameIfUnlabeled"
+ value "the$supplier")
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "Visual Basic"
+ name "DataMemberName"
+ value "$relationship")
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateGetOperation"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateSetOperation"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateLetOperation"
+ value FALSE)))
+ (object Attribute
+ tool "Visual Basic"
+ name "default__Role"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Visual Basic"
+ name "New"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "WithEvents"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "Subscript"
+ value "")
+ (object Attribute
+ tool "Visual Basic"
+ name "NameIfUnlabeled"
+ value "the$supplier")
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateDataMember"
+ value TRUE)
+ (object Attribute
+ tool "Visual Basic"
+ name "DataMemberName"
+ value "$relationship")
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateGetOperation"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateSetOperation"
+ value FALSE)
+ (object Attribute
+ tool "Visual Basic"
+ name "GenerateLetOperation"
+ value FALSE)))
+ (object Attribute
+ tool "Visual Basic"
+ name "default__Inherit"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Visual Basic"
+ name "ImplementsDelegation"
+ value TRUE)))
+ (object Attribute
+ tool "Visual Basic"
+ name "default__Module-Spec"
+ value (list Attribute_Set
+ (object Attribute
+ tool "Visual Basic"
+ name "ProjectFile"
+ value "")))
+ (object Attribute
+ tool "Visual Basic"
+ name "HiddenTool"
+ value FALSE)
+ (object Attribute
+ tool "VisualStudio"
+ name "HiddenTool"
+ value FALSE))
+ quid "4362A29901BD"))
|