You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2016/05/21 07:10:46 UTC
[45/56] [abbrv] [partial] isis git commit: ISIS-1335: deleting the
mothballed directory.
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/nosql/src/test/java/org/apache/isis/objectstore/nosql/db/mongo/ObjectReaderMongoIntegrationTest.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/nosql/src/test/java/org/apache/isis/objectstore/nosql/db/mongo/ObjectReaderMongoIntegrationTest.java b/mothballed/component/objectstore/nosql/src/test/java/org/apache/isis/objectstore/nosql/db/mongo/ObjectReaderMongoIntegrationTest.java
deleted file mode 100644
index b52206a..0000000
--- a/mothballed/component/objectstore/nosql/src/test/java/org/apache/isis/objectstore/nosql/db/mongo/ObjectReaderMongoIntegrationTest.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.nosql.db.mongo;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.hamcrest.CoreMatchers;
-import org.jmock.Expectations;
-import org.jmock.auto.Mock;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.exceptions.UnexpectedCallException;
-import org.apache.isis.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
-import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
-import org.apache.isis.core.metamodel.spec.ObjectSpecId;
-import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.tck.dom.refs.ParentEntity;
-import org.apache.isis.core.tck.dom.refs.ReferencingEntity;
-import org.apache.isis.core.tck.dom.refs.SimpleEntity;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.objectstore.nosql.ObjectReader;
-import org.apache.isis.objectstore.nosql.db.StateReader;
-import org.apache.isis.objectstore.nosql.encryption.DataEncryption;
-import org.apache.isis.objectstore.nosql.versions.VersionCreator;
-
-public class ObjectReaderMongoIntegrationTest {
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().with(new MongoPersistorMechanismInstaller()).build();
-
- @Rule
- public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_ONLY);
-
- @Mock
- private VersionCreator versionCreator;
-
- @Mock
- private StateReader reader1;
- @Mock
- private StateReader reader2;
-
- private ObjectReader objectReader;
-
- private Map<String, DataEncryption> dataEncrypter;
-
- private OidMarshaller oidMarshaller = new OidMarshaller();
-
- private final RootOidDefault oid3 = RootOidDefault.deString("SMPL:3", oidMarshaller );
- private final RootOidDefault oid4 = RootOidDefault.deString("RFCG:4", oidMarshaller);
- private final RootOidDefault oid5 = RootOidDefault.deString("PRNT:5", oidMarshaller);
-
-
- @Before
- public void setup() {
- objectReader = new ObjectReader();
-
- dataEncrypter = new HashMap<String, DataEncryption>();
- final DataEncryption etcEncryption = new DataEncryption() {
- @Override
- public String getType() {
- return "etc1";
- }
-
- @Override
- public void init(final IsisConfiguration configuration) {
- }
-
- @Override
- public String encrypt(final String plainText) {
- throw new UnexpectedCallException();
- }
-
- @Override
- public String decrypt(final String encryptedText) {
- return encryptedText.substring(3);
- }
- };
- dataEncrypter.put(etcEncryption.getType(), etcEncryption);
- }
-
- @Test
- public void testReadingValues() throws Exception {
- setupObject1();
-
- context.checking(new Expectations() {
- {
- one(reader1).readOid();
- will(returnValue("SMPL:3"));
-
- one(reader1).readEncrytionType();
- will(returnValue("etc1"));
- one(reader1).readVersion();
- will(returnValue("3"));
- one(reader1).readUser();
- will(returnValue("username"));
- one(reader1).readTime();
- will(returnValue("1020"));
- one(versionCreator).version("3", "username", "1020");
- }
- });
-
- final ObjectAdapter readObject = objectReader.load(reader1, versionCreator, dataEncrypter);
- assertEquals(oid3, readObject.getOid());
- assertEquals(ResolveState.RESOLVED, readObject.getResolveState());
-
- final SimpleEntity pojo = (SimpleEntity) readObject.getObject();
- assertEquals("Fred Smith", pojo.getName());
- assertEquals(34, pojo.getSize());
-
- context.assertIsSatisfied();
- }
-
- @Test
- public void testReadingReference() throws Exception {
- context.checking(new Expectations() {
- {
- one(reader2).readOid();
- will(returnValue("RFCG:4"));
-
- one(reader2).readEncrytionType();
- will(returnValue("etc1"));
- one(reader2).readVersion();
- will(returnValue("3"));
- one(reader2).readUser();
- will(returnValue("username"));
- one(reader2).readTime();
- will(returnValue("1020"));
- one(versionCreator).version("3", "username", "1020");
-
- one(reader2).readField("reference");
- will(returnValue("SMPL:3"));
-
- one(reader2).readCollection("aggregatedEntities");
- will(returnValue(new ArrayList<StateReader>()));
-
- one(reader2).readAggregate("aggregatedReference");
- will(returnValue(null));
- }
- });
-
- final ObjectAdapter readObject = objectReader.load(reader2, versionCreator, dataEncrypter);
- assertEquals(oid4, readObject.getOid());
- assertEquals(ResolveState.RESOLVED, readObject.getResolveState());
-
- final ReferencingEntity pojo = (ReferencingEntity) readObject.getObject();
- assertEquals(null, pojo.getAggregatedReference());
- assertThat(pojo.getReference(), CoreMatchers.instanceOf(SimpleEntity.class));
-
- context.assertIsSatisfied();
- }
-
- @Test
- public void testReadingCollection() throws Exception {
- //final ObjectSpecification specification = IsisContext.getSpecificationLoader().loadSpecification(ExamplePojoWithValues.class);
- context.checking(new Expectations() {
- {
- one(reader2).readOid();
- will(returnValue("PRNT:5"));
-
- one(reader2).readEncrytionType();
- will(returnValue("etc1"));
- one(reader2).readVersion();
- will(returnValue("3"));
- one(reader2).readUser();
- will(returnValue("username"));
- one(reader2).readTime();
- will(returnValue("1020"));
- one(versionCreator).version("3", "username", "1020");
-
- one(reader2).readField("name");
- will(returnValue(null));
- one(reader2).readField("children");
- will(returnValue(null));
- one(reader2).readField("heterogeneousCollection");
- will(returnValue(null));
- one(reader2).readField("homogeneousCollection");
- will(returnValue("SMPL:3|SMPL:4|"));
- }
- });
-
- final ObjectAdapter readObject = objectReader.load(reader2, versionCreator, dataEncrypter);
- assertEquals(oid5, readObject.getOid());
- assertEquals(ResolveState.RESOLVED, readObject.getResolveState());
-
- final ParentEntity pojo = (ParentEntity) readObject.getObject();
- final List<SimpleEntity> collection2 = pojo.getHomogeneousCollection();
- assertEquals(2, collection2.size());
-
- assertThat(collection2.get(0), CoreMatchers.instanceOf(SimpleEntity.class));
- assertThat(collection2.get(1), CoreMatchers.instanceOf(SimpleEntity.class));
-
- context.assertIsSatisfied();
- }
-
- @Test
- public void updateObjectsState() throws Exception {
- setupObject1();
- context.checking(new Expectations() {
- {
-
- one(reader1).readEncrytionType();
- will(returnValue("etc1"));
- one(reader1).readVersion();
- will(returnValue("3"));
- one(reader1).readUser();
- will(returnValue("username"));
- one(reader1).readTime();
- will(returnValue("1020"));
- one(versionCreator).version("3", "username", "1020");
- }
- });
-
- final ObjectAdapter readObject = getAdapterManager().adapterFor(RootOidDefault.create(ObjectSpecId.of("SMPL"), ""+4));
-
- objectReader.update(reader1, versionCreator, dataEncrypter, readObject);
-
- final SimpleEntity pojo = (SimpleEntity) readObject.getObject();
- assertEquals("Fred Smith", pojo.getName());
- assertEquals(34, pojo.getSize());
-
- context.assertIsSatisfied();
- }
-
- private void setupObject1() {
- context.checking(new Expectations() {
- {
- one(reader1).readField("date");
- will(returnValue("null"));
-
- one(reader1).readField("name");
- will(returnValue("ENCFred Smith"));
-
- one(reader1).readField("size");
- will(returnValue("ENC34"));
-
- one(reader1).readField("nullable");
- will(returnValue("null"));
- }
- });
- }
-
- protected SpecificationLoader getSpecificationLoader() {
- return IsisContext.getSpecificationLoader();
- }
-
- protected PersistenceSession getPersistenceSession() {
- return IsisContext.getPersistenceSession();
- }
-
- protected AdapterManager getAdapterManager() {
- return getPersistenceSession().getAdapterManager();
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/NOTICE
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/NOTICE b/mothballed/component/objectstore/sql/NOTICE
deleted file mode 100644
index ba21d0c..0000000
--- a/mothballed/component/objectstore/sql/NOTICE
+++ /dev/null
@@ -1,7 +0,0 @@
-Apache Isis
-Copyright 2010-2013 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/pom.xml
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/pom.xml b/mothballed/component/objectstore/sql/pom.xml
deleted file mode 100644
index 2240e6c..0000000
--- a/mothballed/component/objectstore/sql/pom.xml
+++ /dev/null
@@ -1,158 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- you under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis</artifactId>
- <version>1.3.0-SNAPSHOT</version>
- <relativePath>../../../core/pom.xml</relativePath>
- </parent>
-
- <groupId>org.apache.isis.objectstore</groupId>
- <artifactId>isis-objectstore-sql</artifactId>
- <version>1.0.0-SNAPSHOT</version>
-
- <name>Isis SQL ObjectStore</name>
-
- <description>
- Provides JDBC-based persistence.
- </description>
-
- <packaging>pom</packaging>
-
- <properties>
- <isis-objectstore-xml.version>1.0.0-SNAPSHOT</isis-objectstore-xml.version>
-
- <siteBaseDir>.</siteBaseDir>
- <relativeUrl/>
-
- <docbkxGuideTitle>Apache Isis Default Runtime SQL ObjectStore</docbkxGuideTitle>
- <docbkxGuideSubTitle>Configuration and Deployment Guide</docbkxGuideSubTitle>
- <docbkxGuideName>isis-sql-objectstore</docbkxGuideName>
- </properties>
-
- <!-- used in Site generation for relative references. -->
- <url>http://isis.apache.org/${relativeUrl}</url>
-
- <build>
- <pluginManagement>
- <plugins>
- <!-- Apache Release Audit Tool -->
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <version>0.8</version>
- <configuration>
- <excludes>
- <!--
- overriding inherited excludes from oia.core:isis
- with a more specific set for this component
- -->
- <exclude>**/target/**</exclude>
- <exclude>**/target-ide/**</exclude>
-
- <exclude>**/*.project</exclude>
- <exclude>**/.classpath</exclude>
- <exclude>**/.settings/**</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <groupId>com.agilejava.docbkx</groupId>
- <artifactId>docbkx-maven-plugin</artifactId>
- <inherited>false</inherited>
- </plugin>
- </plugins>
- </build>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- <version>${maven-project-info-reports-plugin}</version>
- <inherited>false</inherited>
- <reportSets>
- <reportSet>
- <inherited>false</inherited>
- <reports>
- <report>dependency-management</report>
- <report>plugins</report>
- <report>modules</report>
- <report>summary</report>
- </reports>
- </reportSet>
- </reportSets>
- </plugin>
- </plugins>
- </reporting>
-
-
- <modules>
- <module>sql-impl</module>
- <module>sql-tests-common</module>
- <module>sql-tests-served</module>
- </modules>
-
- <dependencyManagement>
- <dependencies>
-
- <!-- for benefit of application developers, using scope=import -->
- <dependency>
- <groupId>org.apache.isis.objectstore</groupId>
- <artifactId>isis-objectstore-sql-impl</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.objectstore</groupId>
- <artifactId>isis-objectstore-sql-tests-common</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.objectstore</groupId>
- <artifactId>isis-objectstore-sql-tests-common</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.objectstore</groupId>
- <artifactId>isis-objectstore-sql-tests-served</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </dependency>
-
- <!-- Required to support the XML cross-test -->
- <dependency>
- <groupId>org.apache.isis.objectstore</groupId>
- <artifactId>isis-objectstore-xml</artifactId>
- <version>${isis-objectstore-xml.version}</version>
- </dependency>
-
-
- <!-- Test environment -->
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.9.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
- </dependencyManagement>
-
-
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/pom.xml
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/pom.xml b/mothballed/component/objectstore/sql/sql-impl/pom.xml
deleted file mode 100644
index 2c2cc81..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/pom.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- you under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.isis.objectstore</groupId>
- <artifactId>isis-objectstore-sql</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>isis-objectstore-sql-impl</artifactId>
- <name>Isis SQL ObjectStore Implementation</name>
- <description>SQL Objectstire Implementation. Uses jdbc for maximum compatibility.</description>
-
- <properties>
- <siteBaseDir>..</siteBaseDir>
- <relativeUrl>sql-impl/</relativeUrl>
- </properties>
-
- <!-- used in Site generation for relative references. -->
- <url>http://isis.apache.org/${relativeUrl}</url>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- <version>${maven-project-info-reports-plugin}</version>
- <inherited>false</inherited>
- <configuration>
- <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
- </configuration>
- <reportSets>
- <reportSet>
- <inherited>false</inherited>
- <reports>
- <report>dependencies</report>
- <report>dependency-convergence</report>
- <report>plugins</report>
- <report>summary</report>
- </reports>
- </reportSet>
- </reportSets>
- </plugin>
- </plugins>
- </reporting>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-runtime</artifactId>
- </dependency>
-
- <!-- Test dependencies -->
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/sqlos-testing.properties
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/sqlos-testing.properties b/mothballed/component/objectstore/sql/sql-impl/sqlos-testing.properties
deleted file mode 100644
index 29d5a76..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/sqlos-testing.properties
+++ /dev/null
@@ -1,59 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# run with SQL object store
-#isis.object-store=org.apache.isis.persistor.sql.SqlObjectStore
-#isis.persistor.sql.connection=org.apache.isis.persistor.sql.SimpleConnection
-#isis.persistor.sql.database=jdbc:hsqldb:tmp/hsql-db
-#isis.persistor.sql.database=jdbc:hsqldb:hsql://localhost
-#isis.persistor.sql.driver=org.hsqldb.jdbcDriver
-#isis.persistor.sql.user=sa
-#isis.persistor.sql.password=
-
-
-#isis.oidgenerator=org.apache.isis.persistor.sql.SqlOidGenerator
-
-#isis.object-store=org.apache.isis.persistor.sql.SqlObjectStore
-isis.persistor.sql.connector=org.apache.isis.persistor.sql.jdbc.JdbcConnectorFactory
-isis.persistor.sql.automapper=org.apache.isis.persistor.sql.auto.AutoMapperFactory
-
-isis.persistor.sql.jdbc.driver=org.hsqldb.jdbcDriver
-isis.persistor.sql.jdbc.connection=jdbc:hsqldb:tmp/hsql-db
-isis.persistor.sql.jdbc.user=sa
-isis.persistor.sql.jdbc.password=
-
-
-## log4j
-# apache's log4j is used to provide system logging.
-##
-log4j.rootCategory=OFF, Console
-
-# The console appender
-log4j.appender.Console=org.apache.log4j.ConsoleAppender
-log4j.appender.Console.target=System.out
-log4j.appender.Console.layout=org.apache.log4j.PatternLayout
-log4j.appender.Console.layout.ConversionPattern=%-5r [%-20c{1}] %-5p %m -- %l%n
-
-
-log4j.rootCategory=DEBUG, File
-# The file appender
-log4j.appender.File=org.apache.log4j.RollingFileAppender
-log4j.appender.File.file=isis.log
-log4j.appender.File.append=false
-#log4j.appender.File.maxFileSize=500KB
-#log4j.appender.File.maxBackupIndex=1
-log4j.appender.File.layout=org.apache.log4j.PatternLayout
-log4j.appender.File.layout.ConversionPattern=%d [%-20c{1} %-10t %-5p] %m%n
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/AbstractDatabaseConnector.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/AbstractDatabaseConnector.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/AbstractDatabaseConnector.java
deleted file mode 100644
index a993d33..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/AbstractDatabaseConnector.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-public abstract class AbstractDatabaseConnector implements DatabaseConnector {
- private boolean isUsed;
-
- @Override
- public final void setUsed(final boolean isUsed) {
- this.isUsed = isUsed;
- }
-
- @Override
- public final boolean isUsed() {
- return isUsed;
- }
-
- private DatabaseConnectorPool pool;
-
- @Override
- public final void setConnectionPool(final DatabaseConnectorPool pool) {
- this.pool = pool;
- }
-
- @Override
- public final DatabaseConnectorPool getConnectionPool() {
- return pool;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/AbstractFieldMappingFactory.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/AbstractFieldMappingFactory.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/AbstractFieldMappingFactory.java
deleted file mode 100644
index eb3d48b..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/AbstractFieldMappingFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.objectstore.sql.mapping.FieldMappingFactory;
-
-public abstract class AbstractFieldMappingFactory implements FieldMappingFactory {
-
- protected String getTypeOverride(final ObjectSpecification object, final ObjectAssociation field, final String type) {
- // isis.persistor.sql.automapper.default
- final IsisConfiguration configParameters = IsisContext.getConfiguration();
- final String find = object.getShortIdentifier() + "." + field.getId();
- final String property = SqlObjectStore.BASE_NAME + ".automapper.type." + find;
- final String dataType = configParameters.getString(property, type);
- return dataType;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/AbstractMapper.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/AbstractMapper.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/AbstractMapper.java
deleted file mode 100644
index 1ec41d4..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/AbstractMapper.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-import java.util.Date;
-
-import org.apache.isis.core.metamodel.adapter.version.SerialNumberVersion;
-import org.apache.isis.core.metamodel.adapter.version.Version;
-
-
-public abstract class AbstractMapper {
-
- public abstract void createTables(final DatabaseConnector connector);
-
- protected boolean needsTables(final DatabaseConnector connector) {
- return false;
- }
-
- public void startup(final DatabaseConnector connector) {
- if (needsTables(connector)) {
- createTables(connector);
- }
- }
-
- public final void shutdown() {
- }
-
- protected String asSqlName(final String name) {
- return Sql.sqlName(name);
- }
-
- protected Version createVersion(final long versionSequence) {
- return SerialNumberVersion.create(versionSequence, "", new Date());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/CollectionMapper.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/CollectionMapper.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/CollectionMapper.java
deleted file mode 100644
index 9d19bbc..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/CollectionMapper.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-
-public interface CollectionMapper {
-
- public void loadInternalCollection(final DatabaseConnector connector, final ObjectAdapter parent);
-
- public void saveInternalCollection(final DatabaseConnector connector, final ObjectAdapter parent);
-
- void createTables(DatabaseConnector connection);
-
- boolean needsTables(DatabaseConnector connection);
-
- public void debugData(DebugBuilder debug);
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/DatabaseConnector.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/DatabaseConnector.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/DatabaseConnector.java
deleted file mode 100644
index 602a1cb..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/DatabaseConnector.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-
-public interface DatabaseConnector {
- /*
- * @deprecated Results callStoredProcedure(String name, Parameter[]
- * parameters);
- */
- void close();
-
- int count(String sql);
-
- void delete(String sql);
-
- // MultipleResults executeStoredProcedure(String name, Parameter[]
- // parameters);
-
- boolean hasTable(String tableName);
-
- boolean hasColumn(String tableName, String columnName);
-
- void insert(String sql);
-
- void insert(String sql, Object oid);
-
- Results select(String sql);
-
- /**
- * Updates the database using the specified sql statement, and returns the
- * number of rows affected.
- */
- int update(String sql);
-
- void setUsed(boolean isUsed);
-
- boolean isUsed();
-
- void commit();
-
- void rollback();
-
- void setConnectionPool(DatabaseConnectorPool pool);
-
- DatabaseConnectorPool getConnectionPool();
-
- void begin();
-
- void debug(DebugBuilder debug);
-
- SqlMetaData getMetaData();
-
- // Full PreparedStatement support
- public String addToQueryValues(int i);
-
- public String addToQueryValues(String s);
-
- public String addToQueryValues(Object object);
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/DatabaseConnectorFactory.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/DatabaseConnectorFactory.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/DatabaseConnectorFactory.java
deleted file mode 100644
index 1f94c34..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/DatabaseConnectorFactory.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-public interface DatabaseConnectorFactory {
- DatabaseConnector createConnector();
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/DatabaseConnectorPool.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/DatabaseConnectorPool.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/DatabaseConnectorPool.java
deleted file mode 100644
index 89c90c9..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/DatabaseConnectorPool.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-import java.util.Vector;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-
-public class DatabaseConnectorPool {
- private static final Logger LOG = LoggerFactory.getLogger(DatabaseConnectorPool.class);
- private static final int AVERAGE_POOL_SIZE = 5;
-
- private final DatabaseConnectorFactory factory;
- private final Vector<DatabaseConnector> connectorPool;
-
- public DatabaseConnectorPool(final DatabaseConnectorFactory factory) {
- this(factory, AVERAGE_POOL_SIZE);
- }
-
- public DatabaseConnectorPool(final DatabaseConnectorFactory factory, final int size) {
- this.factory = factory;
- connectorPool = new Vector<DatabaseConnector>();
- for (int i = 0; i < size; i++) {
- newConnector();
- }
- LOG.info("Created an intial pool of " + size + " database connections");
-
- final DatabaseConnector connection = acquire();
- Sql.setMetaData(connection.getMetaData());
- release(connection);
- }
-
- private DatabaseConnector newConnector() {
- final DatabaseConnector connector = factory.createConnector();
- connector.setConnectionPool(this);
- connectorPool.addElement(connector);
- return connector;
- }
-
- public DatabaseConnector acquire() {
- DatabaseConnector connector = findFreeConnector();
- if (connector == null) {
- connector = newConnector();
- connector.setUsed(true);
- LOG.info("Added an additional database connection; now contains " + connectorPool.size() + " connections");
- }
- LOG.debug("acquired connection " + connector);
- return connector;
- }
-
- private DatabaseConnector findFreeConnector() {
- for (int i = 0, no = connectorPool.size(); i < no; i++) {
- final DatabaseConnector connector = connectorPool.elementAt(i);
- if (!connector.isUsed()) {
- connector.setUsed(true);
- return connector;
- }
- }
- return null;
- }
-
- public void release(final DatabaseConnector connector) {
- connector.setUsed(false);
- LOG.debug("released connection " + connector);
- }
-
- public void shutdown() {
- for (int i = 0, no = connectorPool.size(); i < no; i++) {
- final DatabaseConnector connector = connectorPool.elementAt(i);
- try {
- connector.close();
- } catch (final SqlObjectStoreException e) {
- LOG.error("Failed to release connectuion", e);
- }
- }
- connectorPool.removeAllElements();
- }
-
- public void debug(final DebugBuilder debug) {
- final DatabaseConnector connection = acquire();
- connection.debug(debug);
- release(connection);
-
- }
-
- public SqlMetaData getMetaData() {
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/Defaults.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/Defaults.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/Defaults.java
deleted file mode 100755
index 1433faf..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/Defaults.java
+++ /dev/null
@@ -1,370 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-import java.util.Calendar;
-
-import org.joda.time.DateTimeZone;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-
-/**
- * Provides objectstore defaults. Most significantly, maintains the object store default TimeZone, and maintains
- * Calendar.
- *
- *
- * @version $Rev$ $Date$
- */
-public class Defaults {
- private static String propertiesBase;
- private static IsisConfiguration isisConfiguration;
-
- /**
- * Initialise the Defaults internals. Called by the PersistorInstaller.
- *
- * @param propertiesBase
- * by default, @link {@link SqlObjectStore#BASE_NAME}
- * @param isisConfiguration
- */
- public static void initialise(final String propertiesBase, final IsisConfiguration isisConfiguration) {
- Defaults.propertiesBase = propertiesBase; // "isis.persistor.sql"
- setTimeZone(DateTimeZone.UTC);
-
- Defaults.isisConfiguration = isisConfiguration;
-
- setTablePrefix(getStringProperty(propertiesBase, isisConfiguration, "tableprefix", "isis_"));
- setPkIdLabel(getStringProperty(propertiesBase, isisConfiguration, "pk_id"));
- setIdColumn(getStringProperty(propertiesBase, isisConfiguration, "id"));
- setMaxInstances(getIntProperty(propertiesBase, isisConfiguration, "maxinstances", 100));
- final String useVersioningProperty = getStringProperty(propertiesBase, isisConfiguration, "versioning", "true");
- final int isTrue = useVersioningProperty.compareToIgnoreCase("true");
- useVersioning(isTrue == 0);
-
- defineDatabaseCommands();
-
- final String BASE_DATATYPE = propertiesBase + ".datatypes.";
- final IsisConfiguration dataTypes = isisConfiguration.getProperties(BASE_DATATYPE);
- populateSqlDataTypes(dataTypes, BASE_DATATYPE);
-
- }
-
- /**
- * Returns a string value by looking up "isis.persistor.sql.default.XXXX"
- *
- * @param propertiesBase
- * @param configParameters
- * @param property
- * @return
- */
- protected static String getStringProperty(final String propertiesBase, final IsisConfiguration configParameters,
- final String property) {
- return configParameters.getString(propertiesBase + ".default." + property, property);
- }
-
- /**
- * Returns a string value by looking up "isis.persistor.sql.default.XXXX", returning the specified default, if no
- * value was found.
- *
- * @param propertiesBase
- * @param configParameters
- * @param property
- * @param defaultValue
- * @return
- */
- protected static String getStringProperty(final String propertiesBase, final IsisConfiguration configParameters,
- final String property, final String defaultValue) {
- return configParameters.getString(propertiesBase + ".default." + property, defaultValue);
- }
-
- /**
- * Returns an integer value by looking up "isis.persistor.sql.default.XXXX", returning the specified default, if no
- * value was found.
- *
- * @param propertiesBase
- * @param configParameters
- * @param property
- * @param defaultValue
- * @return
- */
- protected static int getIntProperty(final String propertiesBase, final IsisConfiguration configParameters,
- final String property, final int defaultValue) {
- return configParameters.getInteger(propertiesBase + ".default." + property, defaultValue);
- }
-
- // {{ Calendar
- private static Calendar calendar;
-
- public static Calendar getCalendar() {
- return calendar;
- }
-
- // }}
-
- // {{ DateTimeZone
- private static DateTimeZone dateTimeZone;
-
- public static DateTimeZone getTimeZone() {
- return dateTimeZone;
- }
-
- public static void setTimeZone(final DateTimeZone timezone) {
- dateTimeZone = timezone;
- calendar = Calendar.getInstance(timezone.toTimeZone());
- }
-
- // }}
-
- // {{ Table prefix, defaults to "isis_"
- private static String tablePrefix;
-
- public static String getTablePrefix() {
- return Defaults.tablePrefix;
- }
-
- public static void setTablePrefix(final String prefix) {
- Defaults.tablePrefix = prefix;
- }
-
- // }}
-
- // {{ Primary Key label, defaults to "pk_id"
- private static String pkIdLabel;
-
- public static void setPkIdLabel(final String pkIdLabel) {
- Defaults.pkIdLabel = pkIdLabel;
- }
-
- public static String getPkIdLabel() {
- return pkIdLabel;
- }
-
- // }}
-
- // {{ Id Column, defaults to "id"
- private static String idColumn;
-
- public static void setIdColumn(final String idColumn) {
- Defaults.idColumn = idColumn;
- }
-
- public static String getIdColumn() {
- return idColumn;
- }
-
- // }}
-
- // {{ MaxInstances
- private static int maxInstances;
-
- public static int getMaxInstances() {
- return maxInstances;
- }
-
- public static void setMaxInstances(final int maxInstances) {
- Defaults.maxInstances = maxInstances;
- }
-
- // }}
-
- // {{ Default data types
- static String TYPE_BOOLEAN;
- static String TYPE_TIMESTAMP;
- static String TYPE_DATETIME;
- static String TYPE_DATE;
- static String TYPE_TIME;
- static String TYPE_SHORT;
- static String TYPE_DOUBLE;
- static String TYPE_FLOAT;
- static String TYPE_LONG;
- static String TYPE_INT;
- static String TYPE_PK;
- static String TYPE_STRING;
- static String TYPE_LONG_STRING;
- static String TYPE_PASSWORD;
- static String PASSWORD_SEED;
- static Integer PASSWORD_ENC_LENGTH;
- static String TYPE_DEFAULT;
- static String TYPE_BLOB;
-
- /**
- * Default SQL data types used to define the fields in the database. By providing this method, we allow the user an
- * opportunity to override these types by specifying alternatives in sql.properties (or which ever). For example,
- * Postgresql does not know about DATETIME, but can use TIMESTAMP instead.
- *
- * @param dataTypes
- * @param baseName
- */
- private static void populateSqlDataTypes(final IsisConfiguration dataTypes, final String baseName) {
- TYPE_BLOB = dataTypes.getString(baseName + "blob", "BLOB");
- TYPE_TIMESTAMP = dataTypes.getString(baseName + "timestamp", "DATETIME");
- TYPE_DATETIME = dataTypes.getString(baseName + "datetime", "DATETIME");
- TYPE_DATE = dataTypes.getString(baseName + "date", "DATE");
- TYPE_TIME = dataTypes.getString(baseName + "time", "TIME");
- TYPE_DOUBLE = dataTypes.getString(baseName + "double", "DOUBLE");
- TYPE_FLOAT = dataTypes.getString(baseName + "float", "FLOAT");
- TYPE_SHORT = dataTypes.getString(baseName + "short", "INT");
- TYPE_LONG = dataTypes.getString(baseName + "long", "BIGINT");
- TYPE_INT = dataTypes.getString(baseName + "int", "INT");
- TYPE_BOOLEAN = dataTypes.getString(baseName + "boolean", "BOOLEAN"); // CHAR(1)
- TYPE_PK = dataTypes.getString(baseName + "primarykey", "INTEGER");
- TYPE_STRING = dataTypes.getString(baseName + "string", "VARCHAR(65)");
- TYPE_LONG_STRING = dataTypes.getString(baseName + "longstring", "VARCHAR(128)");
- TYPE_PASSWORD = dataTypes.getString(baseName + "password", "VARCHAR(128)");
- PASSWORD_ENC_LENGTH = getIntProperty(propertiesBase, isisConfiguration, "password.length", 120);
- PASSWORD_SEED = getStringProperty(propertiesBase, isisConfiguration, "password.seed");
- TYPE_DEFAULT = dataTypes.getString(baseName + "default", "VARCHAR(65)");
-
- }
-
- public static String TYPE_TIMESTAMP() {
- return TYPE_TIMESTAMP;
- }
-
- public static String TYPE_SHORT() {
- return TYPE_SHORT;
- }
-
- public static String TYPE_INT() {
- return TYPE_INT;
- }
-
- public static String TYPE_LONG() {
- return TYPE_LONG;
- }
-
- public static String TYPE_FLOAT() {
- return TYPE_FLOAT;
- }
-
- public static String TYPE_DOUBLE() {
- return TYPE_DOUBLE;
- }
-
- public static String TYPE_BOOLEAN() {
- return TYPE_BOOLEAN;
- }
-
- public static String TYPE_PK() {
- return TYPE_PK;
- }
-
- public static String TYPE_STRING() {
- return TYPE_STRING;
- }
-
- public static String TYPE_LONG_STRING() {
- return TYPE_LONG_STRING;
- }
-
- public static String TYPE_PASSWORD() {
- return TYPE_PASSWORD;
- }
-
- public static String PASSWORD_SEED() {
- return PASSWORD_SEED;
- }
-
- public static Integer PASSWORD_ENC_LENGTH() {
- return PASSWORD_ENC_LENGTH;
- }
-
- public static String TYPE_DEFAULT() {
- return TYPE_DEFAULT;
- }
-
- public static String TYPE_DATE() {
- return TYPE_DATE;
- }
-
- public static String TYPE_DATETIME() {
- return TYPE_DATETIME;
- }
-
- public static String TYPE_TIME() {
- return TYPE_TIME;
- }
-
- public static String TYPE_BLOB() {
- return TYPE_BLOB;
- }
-
- // }}
-
- // {{ Versioning
- private static boolean useVersioning;
-
- public static void useVersioning(final boolean useVersioning) {
- Defaults.useVersioning = useVersioning;
- }
-
- public static boolean useVersioning() {
- return useVersioning;
- }
-
- public static boolean useVersioning(final String shortIdentifier) {
- if (useVersioning() == false) {
- return false;
- }
- final String useVersioningProperty =
- getStringProperty(propertiesBase, isisConfiguration, "versioning." + shortIdentifier, "true");
- return (useVersioningProperty.compareToIgnoreCase("true") == 0);
- }
-
- // }}
-
- // {{ Database commands
-
- private static String START_TRANSACTION;
- private static String ABORT_TRANSACTION;
- private static String COMMIT_TRANSACTION;
-
- private static void defineDatabaseCommands() {
- START_TRANSACTION =
- getStringProperty(propertiesBase, isisConfiguration, "command.beginTransaction", "START TRANSACTION;");
- ABORT_TRANSACTION =
- getStringProperty(propertiesBase, isisConfiguration, "command.abortTransaction", "ROLLBACK;");
- COMMIT_TRANSACTION =
- getStringProperty(propertiesBase, isisConfiguration, "command.commitTransaction", "COMMIT;");
- }
-
- public static String START_TRANSACTION() {
- return START_TRANSACTION;
- }
-
- public static String ABORT_TRANSACTION() {
- return ABORT_TRANSACTION;
- }
-
- public static String COMMIT_TRANSACTION() {
- return COMMIT_TRANSACTION;
- }
- // }}
-
- /**
- * Based on the database engine, return a LIMIT start, count clause.
- *
- * @param startIndex
- * @param rowCount
- */
- public static String getLimitsClause(long startIndex, long rowCount) {
- return String.format("LIMIT %d, %d", startIndex, rowCount);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/FieldMappingFactoryInstaller.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/FieldMappingFactoryInstaller.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/FieldMappingFactoryInstaller.java
deleted file mode 100644
index 99a6158..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/FieldMappingFactoryInstaller.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-public interface FieldMappingFactoryInstaller {
- void load(FieldMappingLookup lookup);
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/FieldMappingLookup.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/FieldMappingLookup.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/FieldMappingLookup.java
deleted file mode 100644
index 32ca76c..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/FieldMappingLookup.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.core.commons.exceptions.NotYetImplementedException;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.objectstore.sql.jdbc.JdbcGeneralValueMapper;
-import org.apache.isis.objectstore.sql.mapping.FieldMapping;
-import org.apache.isis.objectstore.sql.mapping.FieldMappingFactory;
-import org.apache.isis.objectstore.sql.mapping.ObjectReferenceMapping;
-import org.apache.isis.objectstore.sql.mapping.ObjectReferenceMappingFactory;
-
-public class FieldMappingLookup {
- private static final Logger LOG = LoggerFactory.getLogger(FieldMappingLookup.class);
- private final Map<ObjectSpecification, FieldMappingFactory> fieldMappings = new HashMap<ObjectSpecification, FieldMappingFactory>();
- private final Map<ObjectSpecification, ObjectReferenceMappingFactory> referenceMappings = new HashMap<ObjectSpecification, ObjectReferenceMappingFactory>();
- private FieldMappingFactory referenceFieldMappingfactory;
- private ObjectReferenceMappingFactory objectReferenceMappingfactory;
-
- public FieldMapping createMapping(final ObjectSpecification object, final ObjectAssociation field) {
- final ObjectSpecification spec = field.getSpecification();
- FieldMappingFactory factory = fieldMappings.get(spec);
- if (factory != null) {
- return factory.createFieldMapping(object, field);
- } else if (spec.isEncodeable()) {
- factory = new JdbcGeneralValueMapper.Factory(Defaults.TYPE_DEFAULT());
- addFieldMappingFactory(spec, factory);
- return factory.createFieldMapping(object, field);
- } else {// if (true /* TODO test for reference */) {
- factory = referenceFieldMappingfactory;
- addFieldMappingFactory(spec, factory);
- return factory.createFieldMapping(object, field);
- // } else {
- // throw new IsisException("No mapper for " + spec +
- // " (no default mapper)");
- }
- }
-
- public ObjectReferenceMapping createMapping(final ObjectSpecification spec) {
- return createMapping(spec.getShortIdentifier(), spec);
- }
-
- public ObjectReferenceMapping createMapping(final String columnName, final ObjectSpecification spec) {
- ObjectReferenceMappingFactory factory = referenceMappings.get(spec);
- if (factory != null) {
- return factory.createReferenceMapping(columnName, spec);
- } else if (spec.isEncodeable()) {
- // TODO add generic encodeable mapping
- throw new NotYetImplementedException();
- } else {// if (true /* TODO test for reference */) {
- factory = objectReferenceMappingfactory;
- // add(spec, factory);
- return factory.createReferenceMapping(columnName, spec); // TODO:
- // here
- // } else {
- // throw new IsisException("No mapper for " + spec +
- // " (no default mapper)");
- }
- }
-
- public void addFieldMappingFactory(final Class<?> valueType, final FieldMappingFactory mapper) {
- final ObjectSpecification spec = IsisContext.getSpecificationLoader().loadSpecification(valueType);
- addFieldMappingFactory(spec, mapper);
- }
-
- private void addFieldMappingFactory(final ObjectSpecification specification, final FieldMappingFactory mapper) {
- LOG.debug("add mapper " + mapper + " for " + specification);
- fieldMappings.put(specification, mapper);
- }
-
- public void addReferenceMappingFactory(final ObjectSpecification specification, final ObjectReferenceMappingFactory mapper) {
- LOG.debug("add mapper " + mapper + " for " + specification);
- referenceMappings.put(specification, mapper);
- }
-
- public void init() {
- // fieldMappingFactory.load(this);
- }
-
- public IdMapping createIdMapping() {
- // TODO inject and use external factory
- final IdMapping idMapping = new IdMapping();
- idMapping.init();
- return idMapping;
- }
-
- public VersionMapping createVersionMapping() {
- // TODO inject and use external factory
- final VersionMapping versionMapping = new VersionMapping();
- versionMapping.init();
- return versionMapping;
- }
-
- public void setReferenceFieldMappingFactory(final FieldMappingFactory referenceMappingfactory) {
- this.referenceFieldMappingfactory = referenceMappingfactory;
- }
-
- public void setObjectReferenceMappingfactory(final ObjectReferenceMappingFactory objectReferenceMappingfactory) {
- this.objectReferenceMappingfactory = objectReferenceMappingfactory;
- }
-
- public TitleMapping createTitleMapping() {
- // TODO inject and use external factory
- return new TitleMapping();
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/IdMapping.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/IdMapping.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/IdMapping.java
deleted file mode 100644
index 544da36..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/IdMapping.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-
-public class IdMapping extends IdMappingAbstract {
-
- public void init() {
- String idColumn = null;
- // idColumn = configParameters.getString(parameterBase + "id");
- if (idColumn == null) {
- idColumn = Defaults.getPkIdLabel();
- }
- setColumn(idColumn);
- }
-
- public void appendUpdateValues(final StringBuffer sql, final ObjectAdapter object) {
- }
-
- public void initializeField(final ObjectAdapter object, final Results rs) {
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/IdMappingAbstract.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/IdMappingAbstract.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/IdMappingAbstract.java
deleted file mode 100644
index 8d6a2a4..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/IdMappingAbstract.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
-import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
-import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-
-public class IdMappingAbstract {
- private String column;
-
- protected void setColumn(final String column) {
- this.column = Sql.identifier(column);
- }
-
- protected String getColumn() {
- return column;
- }
-
- public void appendWhereClause(final DatabaseConnector connector, final StringBuffer sql, final RootOid oid) {
- sql.append(column);
- sql.append(" = ");
- appendObjectId(connector, sql, oid);
- }
-
- public void appendObjectId(final DatabaseConnector connector, final StringBuffer sql, final RootOid oid) {
- sql.append("?");
- connector.addToQueryValues(primaryKey(oid));
- }
-
- public void appendCreateColumnDefinitions(final StringBuffer sql) {
- sql.append(column);
- sql.append(" ");
- sql.append(Defaults.TYPE_PK() + " NOT NULL PRIMARY KEY");
- }
-
- public void appendColumnDefinitions(final StringBuffer sql) {
- sql.append(column);
- sql.append(" ");
- sql.append(Defaults.TYPE_PK());
- }
-
- public void appendColumnNames(final StringBuffer sql) {
- sql.append(column);
- }
-
- public void appendInsertValues(final DatabaseConnector connector, final StringBuffer sql, final ObjectAdapter object) {
- if (object == null) {
- sql.append("NULL");
- } else {
- appendObjectId(connector, sql, (RootOid) object.getOid());
- // sql.append(connector.addToQueryValues(primaryKeyAsObject(object.getOid())));
- }
- }
-
- public String primaryKey(final RootOid oid) {
- return oid.getIdentifier();
- }
-
- public TypedOid recreateOid(final Results rs, final ObjectSpecification specification) {
- final Object object = rs.getObject(column);
- if (object == null) {
- return null;
- }
- final int id = ((Integer) object).intValue();
- return new RootOidDefault(specification.getSpecId(), "" + id, Oid.State.PERSISTENT);
- }
-
- protected ObjectAdapter getAdapter(final ObjectSpecification spec, final Oid oid) {
- final ObjectAdapter adapter = getAdapterManager().getAdapterFor(oid);
- if (adapter != null) {
- return adapter;
- }
- // REVIEW: where the oid is a TypedOid, the following two lines could be replaced by
- // getPersistenceSession().recreatePersistentAdapter(oid)
- // is preferable, since then reuses the PojoRecreator impl defined within SqlPersistorInstaller
- final Object recreatedPojo = spec.createObject();
- return getPersistenceSession().mapRecreatedPojo(oid, recreatedPojo);
- }
-
- protected AdapterManager getAdapterManager() {
- return getPersistenceSession().getAdapterManager();
- }
-
- protected PersistenceSession getPersistenceSession() {
- return IsisContext.getPersistenceSession();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/MappingLookup.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/MappingLookup.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/MappingLookup.java
deleted file mode 100644
index 92a0af2..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/MappingLookup.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-public class MappingLookup {
- // private ObjectMappingLookup classMappingLookup;
- // private FieldMappingLookup fieldMappingLookup;
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/MultipleResults.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/MultipleResults.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/MultipleResults.java
deleted file mode 100644
index 35dafe4..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/MultipleResults.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-public interface MultipleResults {
- Results nextResults();
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/ObjectMapping.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/ObjectMapping.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/ObjectMapping.java
deleted file mode 100644
index 64034e5..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/ObjectMapping.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-import java.util.Vector;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.persistence.query.PersistenceQueryFindByPattern;
-
-public interface ObjectMapping {
- void createObject(DatabaseConnector connector, ObjectAdapter object);
-
- void destroyObject(DatabaseConnector connector, ObjectAdapter object);
-
- Vector<ObjectAdapter> getInstances(DatabaseConnector connector, ObjectSpecification spec, long startIndex, long rowCount);
-
- Vector<ObjectAdapter> getInstances(DatabaseConnector connector, ObjectSpecification spec, String title, long startIndex, long rowCount);
-
- Vector<ObjectAdapter> getInstances(DatabaseConnector connector, ObjectSpecification spec, PersistenceQueryFindByPattern query);
-
- ObjectAdapter getObject(DatabaseConnector connector, TypedOid typedOid);
-
- boolean hasInstances(DatabaseConnector connector, ObjectSpecification cls);
-
- void resolve(DatabaseConnector connector, ObjectAdapter object);
-
- void resolveCollection(DatabaseConnector connector, ObjectAdapter object, ObjectAssociation field);
-
- void save(DatabaseConnector connector, ObjectAdapter object);
-
- void shutdown();
-
- void startup(DatabaseConnector connection, ObjectMappingLookup objectMapperLookup);
-
- boolean saveCollection(DatabaseConnector connection, ObjectAdapter parent, String fieldName);
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/ObjectMappingFactory.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/ObjectMappingFactory.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/ObjectMappingFactory.java
deleted file mode 100644
index 0a5976b..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/ObjectMappingFactory.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-public interface ObjectMappingFactory {
- ObjectMapping createMapper(String className, String propertiesBase, FieldMappingLookup fieldMapperLookup, ObjectMappingLookup objectMapperLookup);
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/ObjectMappingLookup.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/ObjectMappingLookup.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/ObjectMappingLookup.java
deleted file mode 100644
index 3535b5f..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/ObjectMappingLookup.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.debug.DebuggableWithTitle;
-import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.core.commons.factory.InstanceCreationException;
-import org.apache.isis.core.commons.factory.InstanceUtil;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.runtime.persistence.ObjectPersistenceException;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-
-public class ObjectMappingLookup implements DebuggableWithTitle {
- private static final Logger LOG = LoggerFactory.getLogger(ObjectMappingLookup.class);
- private DatabaseConnectorPool connectionPool;
- private final Map<ObjectSpecification, ObjectMapping> mappings = new HashMap<ObjectSpecification, ObjectMapping>();
- private ObjectMappingFactory objectMappingFactory;
- private FieldMappingLookup fieldMappingLookup;
-
- public ObjectMapping getMapping(final ObjectSpecification spec, final DatabaseConnector connection) {
- String fullName = spec.getFullIdentifier();
- ObjectMapping mapping = mappings.get(spec);
- if (mapping == null) {
- final String propertiesBase = SqlObjectStore.BASE_NAME + ".automapper.default";
- mapping = objectMappingFactory.createMapper(fullName, propertiesBase, fieldMappingLookup, this);
- add(spec, mapping, connection);
- }
- LOG.debug(" mapper for " + spec.getSingularName() + " -> " + mapping);
- if (mapping == null) {
- throw new IsisException("No mapper for " + spec + " (no default mapper)");
- }
- return mapping;
- }
-
- public ObjectMapping getMapping(final ObjectAdapter object, final DatabaseConnector connection) {
- return getMapping(object.getSpecification(), connection);
- }
-
- public void setConnectionPool(final DatabaseConnectorPool connectionPool) {
- this.connectionPool = connectionPool;
- }
-
- // / ???
- public void setObjectMappingFactory(final ObjectMappingFactory mapperFactory) {
- this.objectMappingFactory = mapperFactory;
- }
-
- public void setValueMappingLookup(final FieldMappingLookup fieldMappingLookup) {
- this.fieldMappingLookup = fieldMappingLookup;
- }
-
- private void add(final String className, final ObjectMapping mapper) {
- final ObjectSpecification spec = IsisContext.getSpecificationLoader().loadSpecification(className);
- if (spec.getProperties(Contributed.EXCLUDED).size() == 0) {
- throw new SqlObjectStoreException(spec.getFullIdentifier() + " has no fields to persist: " + spec);
- }
- add(spec, mapper, null);
- }
-
- public void add(final ObjectSpecification specification, final ObjectMapping mapper, DatabaseConnector connection) {
- LOG.debug("add mapper " + mapper + " for " + specification);
- if (connection == null) {
- connection = connectionPool.acquire();
- }
- mapper.startup(connection, this);
- connectionPool.release(connection);
- mappings.put(specification, mapper);
- }
-
- public void init() {
- fieldMappingLookup.init();
-
- final String prefix = SqlObjectStore.BASE_NAME + ".mapper.";
- final IsisConfiguration subset = IsisContext.getConfiguration().createSubset(prefix);
- for (final String className : subset) {
- final String value = subset.getString(className);
-
- if (value.startsWith("auto.")) {
- final String propertiesBase = SqlObjectStore.BASE_NAME + ".automapper." + value.substring(5) + ".";
- add(className, objectMappingFactory.createMapper(className, propertiesBase, fieldMappingLookup, this));
- } else if (value.trim().equals("auto")) {
- final String propertiesBase = SqlObjectStore.BASE_NAME + ".automapper.default";
- add(className, objectMappingFactory.createMapper(className, propertiesBase, fieldMappingLookup, this));
- } else {
- LOG.debug("mapper " + className + "=" + value);
-
- try {
- add(className, InstanceUtil.createInstance(value, ObjectMapping.class));
- } catch (final ObjectPersistenceException ex) {
- throw new InstanceCreationException("Failed to set up mapper for " + className, ex);
- }
- }
- }
- }
-
- public void shutdown() {
- for (final ObjectMapping mapping : mappings.values()) {
- try {
- mapping.shutdown();
- } catch (final ObjectPersistenceException ex) {
- LOG.error("Shutdown mapper " + mapping, ex);
- }
- }
- }
-
- @Override
- public void debugData(final DebugBuilder debug) {
- debug.appendln("field mapping lookup", fieldMappingLookup);
- debug.appendln("object mapping factory", objectMappingFactory);
- debug.appendTitle("Mappings");
- int i = 1;
- for (final ObjectSpecification specification : mappings.keySet()) {
- debug.appendln(i++ + ". " + specification.getShortIdentifier());
- final ObjectMapping mapper = mappings.get(specification);
- debug.indent();
- debug.append(mapper);
- debug.unindent();
- }
- }
-
- @Override
- public String debugTitle() {
- return "Object Mapping Lookup";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a43dbdd9/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/Parameter.java
----------------------------------------------------------------------
diff --git a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/Parameter.java b/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/Parameter.java
deleted file mode 100644
index aa192ff..0000000
--- a/mothballed/component/objectstore/sql/sql-impl/src/main/java/org/apache/isis/objectstore/sql/Parameter.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.objectstore.sql;
-
-import org.apache.isis.core.runtime.persistence.ObjectPersistenceException;
-
-public interface Parameter {
- void setupParameter(int parameter, StoredProcedure procedure) throws ObjectPersistenceException;
-
- // String getRestoreString();
-
- void retrieve(int parameter, StoredProcedure procedure) throws ObjectPersistenceException;
-}