diff --git a/rtd_phosphonetx/.classpath b/rtd_phosphonetx/.classpath index 66d17f9b5b77cfb4ee1278b34ae3d5a9ce993098..605f3fd7c87f711e4ccce4d71bb026910ee1e47d 100644 --- a/rtd_phosphonetx/.classpath +++ b/rtd_phosphonetx/.classpath @@ -22,5 +22,7 @@ <attribute name="javadoc_location" value="jar:platform:/resource/libraries/ext-gwt/gxt-api.zip!/"/> </attributes> </classpathentry> + <classpathentry kind="lib" path="/libraries/restrictionchecker/restrictions.jar"/> + <classpathentry kind="lib" path="/libraries/spring/spring.jar" sourcepath="/libraries/spring/src.jar"/> <classpathentry kind="output" path="targets/classes"/> </classpath> diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/PhosphoNetXServer.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/PhosphoNetXServer.java new file mode 100644 index 0000000000000000000000000000000000000000..96e5fb1c2dc2a302cbbfe3b00fe9be5975ef96e7 --- /dev/null +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/PhosphoNetXServer.java @@ -0,0 +1,62 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * 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 ch.systemsx.cisd.openbis.plugin.phosphonetx.server; + +import org.springframework.stereotype.Component; + +import ch.rinn.restrictions.Private; +import ch.systemsx.cisd.authentication.ISessionManager; +import ch.systemsx.cisd.openbis.generic.server.AbstractServer; +import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; +import ch.systemsx.cisd.openbis.generic.server.plugin.IDataSetTypeSlaveServerPlugin; +import ch.systemsx.cisd.openbis.generic.server.plugin.ISampleTypeSlaveServerPlugin; +import ch.systemsx.cisd.openbis.generic.shared.dto.Session; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.IPhosphoNetXServer; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.ResourceNames; + +/** + * @author Franz-Josef Elmer + */ +@Component(ResourceNames.PHOSPHONETX_PLUGIN_SERVER) +public class PhosphoNetXServer extends AbstractServer<IPhosphoNetXServer> implements + IPhosphoNetXServer +{ + public PhosphoNetXServer() + { + super(); + } + + @Private + PhosphoNetXServer(ISessionManager<Session> sessionManager, IDAOFactory daoFactory, + ISampleTypeSlaveServerPlugin sampleTypeSlaveServerPlugin, + IDataSetTypeSlaveServerPlugin dataSetTypeSlaveServerPlugin) + { + super(sessionManager, daoFactory, sampleTypeSlaveServerPlugin, dataSetTypeSlaveServerPlugin); + } + + @Override + protected Class<IPhosphoNetXServer> getProxyInterface() + { + return IPhosphoNetXServer.class; + } + + public IPhosphoNetXServer createLogger(boolean invocationSuccessful) + { + return new PhosphoNetXServerLogger(getSessionManager(), invocationSuccessful); + } + +} diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/PhosphoNetXServerLogger.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/PhosphoNetXServerLogger.java new file mode 100644 index 0000000000000000000000000000000000000000..c6e8456d40074e3b7063e7865787328a078b47d4 --- /dev/null +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/PhosphoNetXServerLogger.java @@ -0,0 +1,66 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * 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 ch.systemsx.cisd.openbis.plugin.phosphonetx.server; + +import java.util.List; + +import ch.systemsx.cisd.authentication.ISessionManager; +import ch.systemsx.cisd.common.exceptions.UserFailureException; +import ch.systemsx.cisd.openbis.generic.server.AbstractServerLogger; +import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; +import ch.systemsx.cisd.openbis.generic.shared.dto.AttachmentPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.SampleGenerationDTO; +import ch.systemsx.cisd.openbis.generic.shared.dto.Session; +import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.shared.IPhosphoNetXServer; + +/** + * + * + * @author Franz-Josef Elmer + */ +public class PhosphoNetXServerLogger extends AbstractServerLogger implements IPhosphoNetXServer +{ + PhosphoNetXServerLogger(final ISessionManager<Session> sessionManager, + final boolean invocationSuccessful) + { + super(sessionManager, invocationSuccessful); + } + + public SampleGenerationDTO getSampleInfo(String sessionToken, SampleIdentifier sampleIdentifier) + throws UserFailureException + { + logAccess(sessionToken, "get_sample_info", "CODE(%s)", sampleIdentifier); + return null; + } + + public SampleGenerationDTO getSampleInfo(String sessionToken, TechId sampleId) + throws UserFailureException + { + logAccess(sessionToken, "get_sample_info", "ID(%s)", sampleId); + return null; + } + + public void registerSample(String sessionToken, NewSample newSample, + List<AttachmentPE> attachments) + { + logTracking(sessionToken, "register_sample", "SAMPLE_TYPE(%s) SAMPLE(%s) ATTACHMENTS(%s)", + newSample.getSampleType(), newSample.getIdentifier(), attachments.size()); + } + +} diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/dataaccess/IPhosphoNetXDAOFactory.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/dataaccess/IPhosphoNetXDAOFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..f7f64dea17689fbba63603c59c18d00c86fe5263 --- /dev/null +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/dataaccess/IPhosphoNetXDAOFactory.java @@ -0,0 +1,27 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * 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 ch.systemsx.cisd.openbis.plugin.phosphonetx.server.dataaccess; + +/** + * + * + * @author Franz-Josef Elmer + */ +public interface IPhosphoNetXDAOFactory +{ + +} diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/dataaccess/db/PhosphoNetXDAOFactory.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/dataaccess/db/PhosphoNetXDAOFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..2bdb0da0e792b1742b7787e6fa4d8b039f204b17 --- /dev/null +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/server/dataaccess/db/PhosphoNetXDAOFactory.java @@ -0,0 +1,65 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * 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 ch.systemsx.cisd.openbis.plugin.phosphonetx.server.dataaccess.db; + +import java.sql.Connection; +import java.sql.SQLException; + +import net.lemnik.eodsql.QueryTool; + +import org.apache.log4j.Logger; + +import ch.systemsx.cisd.base.exceptions.CheckedExceptionTunnel; +import ch.systemsx.cisd.common.logging.LogCategory; +import ch.systemsx.cisd.common.logging.LogFactory; +import ch.systemsx.cisd.dbmigration.DBMigrationEngine; +import ch.systemsx.cisd.dbmigration.DatabaseConfigurationContext; +import ch.systemsx.cisd.openbis.plugin.phosphonetx.server.dataaccess.IPhosphoNetXDAOFactory; +import ch.systemsx.cisd.phosphonetx.db.IProtDAO; + +/** + * + * + * @author Franz-Josef Elmer + */ +public class PhosphoNetXDAOFactory implements IPhosphoNetXDAOFactory +{ + /** Current version of the database. */ + public static final String DATABASE_VERSION = "001"; + + private static final Logger operationLog = + LogFactory.getLogger(LogCategory.OPERATION, PhosphoNetXDAOFactory.class); + + public PhosphoNetXDAOFactory(DatabaseConfigurationContext context) + { + DBMigrationEngine.createOrMigrateDatabaseAndGetScriptProvider(context, DATABASE_VERSION); + Connection connection = null; + try + { + connection = context.getDataSource().getConnection(); + } catch (SQLException ex) + { + throw CheckedExceptionTunnel.wrapIfNecessary(ex); + } + QueryTool.getQuery(connection, IProtDAO.class); + if (operationLog.isInfoEnabled()) + { + operationLog.info("DAO factory for PhosphoNetX created."); + } + } + +} diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/IPhosphoNetXServer.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/IPhosphoNetXServer.java new file mode 100644 index 0000000000000000000000000000000000000000..e72021c36f86393203d6ec0ae44981fbe61a5352 --- /dev/null +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/IPhosphoNetXServer.java @@ -0,0 +1,29 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * 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 ch.systemsx.cisd.openbis.plugin.phosphonetx.shared; + +import ch.systemsx.cisd.openbis.generic.shared.IServer; + +/** + * + * + * @author Franz-Josef Elmer + */ +public interface IPhosphoNetXServer extends IServer +{ + +} diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/ResourceNames.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/ResourceNames.java new file mode 100644 index 0000000000000000000000000000000000000000..e12af898d9c5ec7c2585122ba8ca5e8ec6360a3a --- /dev/null +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/phosphonetx/shared/ResourceNames.java @@ -0,0 +1,36 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * 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 ch.systemsx.cisd.openbis.plugin.phosphonetx.shared; + +/** + * + * + * @author Franz-Josef Elmer + */ +public class ResourceNames +{ + private ResourceNames() + { + } + + public final static String PHOSPHONETX_PLUGIN_SERVICE = "phosphonetx-plugin-service"; + + public final static String PHOSPHONETX_PLUGIN_SERVER = "phosphonetx-plugin-server"; + + public final static String PHOSPHONETX_DAO_FACTORY = "phosphonetx-dao-factory"; + +} diff --git a/rtd_phosphonetx/source/java/phosphonetx-applicationContext.xml b/rtd_phosphonetx/source/java/phosphonetx-applicationContext.xml index c056a6b647bd71e3bf44d5bffd3ac6d793b7070a..c68cbeee9d45bd8739f1ea846a5f62ff6a0493e1 100644 --- a/rtd_phosphonetx/source/java/phosphonetx-applicationContext.xml +++ b/rtd_phosphonetx/source/java/phosphonetx-applicationContext.xml @@ -29,6 +29,8 @@ <property name="databaseInstance" value="${phosphonetx.database-instance}" /> </bean> - <bean id="phosphonetx-data-source" factory-bean="phosphonetx-db-configuration-context" factory-method="getDataSource" /> - + <bean id="phosphonetx-dao-factory" + class="ch.systemsx.cisd.openbis.plugin.phosphonetx.server.dataaccess.db.PhosphoNetXDAOFactory"> + <constructor-arg ref="phosphonetx-db-configuration-context"/> + </bean> </beans> \ No newline at end of file