<objectNumber>6.0221415</objectNumber>
</ns2:collectionobjects_common>
- <ns3:collectionobjects_naturalhistory
- xmlns:ns3="http://collectionspace.org/services/collectionobject/domain/naturalhistory">
+ <ns3:collectionobjects_testsci
+ xmlns:ns3="http://collectionspace.org/services/collectionobject/domain/testsci">
<fieldLocVerbatim>jlmbsoqjlmbsoq</fieldLocVerbatim>
- </ns3:collectionobjects_naturalhistory>
+ </ns3:collectionobjects_testsci>
</document>
<!-- expected text within a single field in the extension schema part. -->
<test ID="co2advsearch">
<method>GET</method>
- <uri>/cspace-services/collectionobjects?as=collectionobjects_naturalhistory%3AfieldLocVerbatim%3D'jlmbsoqjlmbsoq'</uri>
+ <uri>/cspace-services/collectionobjects?as=collectionobjects_testsci%3AfieldLocVerbatim%3D'jlmbsoqjlmbsoq'</uri>
<response>
<expected level="TEXT" />
<label>abstract-common-list</label>
public class CSpaceResteasyBootstrap extends ResteasyBootstrap {
+ @Override
public void contextInitialized(ServletContextEvent event) {
try {
//
System.out.println(String.format("%tc [INFO] CollectionSpace Services' JAX-RS application started.", new Date()));
} catch (Throwable e) {
e.printStackTrace();
+ throw e;
}
}
<artifactId>jboss-logging</artifactId>
<version>3.1.4.GA</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-catalina</artifactId>
+ <version>7.0.64</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-dbcp</artifactId>
+ <version>7.0.64</version>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<!--
<groupId>jboss</groupId>
--- /dev/null
+package org.collectionspace.authentication;
+
+import static org.apache.catalina.Lifecycle.AFTER_INIT_EVENT;
+import static org.apache.catalina.Lifecycle.AFTER_START_EVENT;
+import static org.apache.catalina.LifecycleState.INITIALIZED;
+import static org.apache.catalina.LifecycleState.NEW;
+import static org.apache.catalina.LifecycleState.STARTED;
+
+import java.util.logging.Level;
+
+import org.apache.catalina.Container;
+import org.apache.catalina.Executor;
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleEvent;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.LifecycleState;
+import org.apache.catalina.Server;
+import org.apache.catalina.Service;
+import org.apache.catalina.connector.Connector;
+
+/**
+ * Checks to see if any of the webapps in the Tomcat container failed during startup. If so,
+ * we ask Tomcat to shutdown.
+ *
+ * @author remillet
+ *
+ */
+public class TomcatShutdownListener implements LifecycleListener {
+
+ java.util.logging.Logger logger = java.util.logging.Logger.getAnonymousLogger();
+
+ @Override
+ public void lifecycleEvent(final LifecycleEvent event) {
+ boolean isInit = AFTER_INIT_EVENT.equals(event.getType());
+ if (isInit || AFTER_START_EVENT.equals(event.getType())) {
+ Server server = (Server) event.getLifecycle();
+ boolean failed = checkServer(isInit, server);
+ if (failed) {
+ triggerShutdown(isInit, server);
+ } else if (!isInit) {
+ logger.log(Level.INFO, "CollectionSpace Startup successful.");
+ }
+ }
+ }
+
+ private boolean checkServer(final boolean isInit, final Server server) {
+ boolean failed = checkState(isInit, server);
+ for (Service service : server.findServices()) {
+ failed |= checkService(isInit, service);
+ }
+ return failed;
+ }
+
+ private boolean checkService(final boolean isInit, final Service service) {
+ boolean failed = checkState(isInit, service);
+ failed |= checkContainer(isInit, service.getContainer());
+ for (Connector connector : service.findConnectors()) {
+ failed |= checkState(isInit, connector);
+ }
+ for (Executor executor : service.findExecutors()) {
+ failed |= checkState(isInit, executor);
+ }
+ return failed;
+ }
+
+ private boolean checkContainer(final boolean isInit, final Container container) {
+ boolean failed = checkState(isInit, container);
+ for (Container child : container.findChildren()) {
+ failed |= checkContainer(isInit, child);
+ }
+ return failed;
+ }
+
+ private boolean checkState(final boolean isInit, final Lifecycle lifecycle) {
+ LifecycleState state = lifecycle.getState();
+ if (isInit ? state != NEW && state != INITIALIZED : state != STARTED) {
+ logger.log(Level.SEVERE, "CollectionSpace Startup Failure\n###\n### - CollectionSpace Startup failure, initiating Tomcat shutdown...\n###");
+ logger.log(Level.SEVERE, String.format("Required CollectionSpace Component {%s} failed to {%s}: state {%s}.", lifecycle.toString(),
+ isInit ? "initialize" : "start", state.toString()));
+ logger.log(Level.SEVERE, "See other Tomcat log files for possible failure reasons and details.\n");
+ return true;
+ }
+ return false;
+ }
+
+ private void triggerShutdown(final boolean isInit, final Server server) {
+ if (isInit) {
+ throw new RuntimeException("One or more required Tomcat components failed to initialize.");
+ }
+ try {
+ server.stop();
+ server.destroy();
+ } catch (LifecycleException e) {
+ e.printStackTrace();
+ }
+ }
+}
--- /dev/null
+package org.collectionspace.services.collectionobject.nuxeo;
+
+import org.collectionspace.services.common.document.InvalidDocumentException;
+
+public class BotGardenCollectionObjectValidatorHandler extends CollectionObjectValidatorHandler {
+
+ @Override
+ protected void handleUpdate() throws InvalidDocumentException {
+ // Disable non-empty objectNumber requirement, so that updates don't need to retrieve the current objectNumber.
+
+ }
+}
\ No newline at end of file
<!-- value in cspace/config/services/tenants/testsci-tenant-bindings-proto.xml -->
<tenant:tenantBinding id="3500">
- <tenant:eventListenerConfigurations id="default" merge:matcher="id">
- <tenant:eventListenerConfig id="UpdateObjectLocationOnMove" merge:matcher="id">
- <tenant:paramList id="default" merge:matcher="id" merge:action="delete"/>
+ <tenant:eventListenerConfigurations id="default" merge:matcher="id">
+ <tenant:eventListenerConfig id="UpdateObjectLocationOnMove" merge:matcher="id">
+ <tenant:paramList id="default" merge:matcher="id" merge:action="delete"/>
</tenant:eventListenerConfig>
<tenant:eventListenerConfig id="UpdateObjectLocationAndCrateOnMove" merge:matcher="id" merge:action="delete"/>
</tenant:eventListenerConfigurations>
+
+ <tenant:properties id="default">
+ <types:item xmlns:types="http://collectionspace.org/services/config/types" id="ptstartingwildcard" merge:matcher="id" merge:action="replace">
+ <types:key>ptStartingWildcard</types:key>
+ <types:value>false</types:value>
+ </types:item>
+ <types:item xmlns:types="http://collectionspace.org/services/config/types" id="maxlistitemsjdbc" merge:matcher="id" merge:action="replace">
+ <types:key>maxListItemsReturnedLimitOnJdbcQueries</types:key>
+ <types:value>425</types:value>
+ </types:item>
+ </tenant:properties>
+
+ <tenant:serviceBindings merge:matcher="id" id="CollectionObjects">
+ <service:validatorHandler xmlns:service="http://collectionspace.org/services/config/service" merge:matcher="tag" merge:action="replace">org.collectionspace.services.collectionobject.nuxeo.BotGardenCollectionObjectValidatorHandler</service:validatorHandler>
+ </tenant:serviceBindings>
+
+ <tenant:serviceBindings merge:matcher="id" id="idgenerators">
+ <service:initHandler xmlns:service="http://collectionspace.org/services/config/service">
+ <service:params>
+ <service:property merge:matcher="skip" merge:action="insert">
+ <service:key>sqlScriptName</service:key>
+ <service:value>load_botgarden_id_generators.sql</service:value>
+ </service:property>
+ <service:property merge:matcher="skip" merge:action="insert">
+ <service:key>sqlScriptName</service:key>
+ <service:value>grant_botgarden_reporters_privileges.sql</service:value>
+ </service:property>
+ </service:params>
+ </service:initHandler>
+ </tenant:serviceBindings>
+
</tenant:tenantBinding>
</tenant:TenantBindingConfig>
TenantBindingType tenantBinding = tenantBindings.get(tenantId);
Role adminRole = AuthorizationCommon.getRole(em, tenantBinding.getId(), ROLE_TENANT_ADMINISTRATOR);
Role readonlyRole = AuthorizationCommon.getRole(em, tenantBinding.getId(), ROLE_TENANT_READER);
+
+ if (adminRole == null || readonlyRole == null) {
+ String msg = String.format("One or more of the required default CollectionSpace administrator roles is missing or was never created. If you're setting up a new instance of CollectionSpace, shutdown the Tomcat server and run the 'ant import' command from the root/top level CollectionSpace 'Services' source directory. Then try restarting Tomcat.");
+ logger.error(msg);
+ throw new RuntimeException("One or more of the required default CollectionSpace administrator roles is missing or was never created.");
+ }
+
for (ServiceBindingType serviceBinding : tenantBinding.getServiceBindings()) {
String prop = ServiceBindingUtils.getPropertyValue(serviceBinding, REFRESH_AUTZ_PROP);
if (prop == null ? true : Boolean.parseBoolean(prop)) {
import org.collectionspace.services.config.RepositoryClientConfigType;
import org.collectionspace.services.config.tenant.RepositoryDomainType;
import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-
+import org.nuxeo.ecm.core.api.CoreInstance;
+import org.nuxeo.ecm.core.api.CoreSession;
import org.nuxeo.ecm.core.api.DocumentModel;
import org.nuxeo.ecm.core.api.DocumentModelList;
+import org.nuxeo.ecm.core.api.SystemPrincipal;
+import org.nuxeo.ecm.core.api.repository.Repository;
+import org.nuxeo.ecm.core.api.repository.RepositoryManager;
import org.nuxeo.osgi.application.FrameworkBootstrap;
-
+import org.nuxeo.runtime.api.Framework;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
fb = new FrameworkBootstrap(NuxeoConnectorEmbedded.class.getClassLoader(),
nuxeoHomeDir);
fb.setHostName("Tomcat");
- fb.setHostVersion("7.0.57"); //FIXME: Should not be hard coded.
+ fb.setHostVersion("7.0.64"); //FIXME: Should not be hard coded.
fb.initialize();
fb.start();
+
+ // Test to see if we can connect to the default repository
+ CoreSession coreSession = null;
+ try {
+ Repository defaultRepo = Framework.getService(RepositoryManager.class).getDefaultRepository();
+ coreSession = CoreInstance.openCoreSession(defaultRepo.getName(), new SystemPrincipal(null));
+ } catch (Throwable t) {
+ logger.error(t.getMessage());
+ throw new RuntimeException("Could not start the Nuxeo EP Framework", t);
+ } finally {
+ if (coreSession != null) {
+ CoreInstance.closeCoreSession(coreSession);
+ }
+ }
}
/**
--- /dev/null
+/*
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright © 2009 Regents of the University of California
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ */
+
+/*
+ * load_botgarden_id_generators.sql
+ *
+ * Loads botgarden-specific data into the "id_generators" table,
+ * used by the ID Service.
+ *
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ */
+
+/*
+ * Note: in the priority column, values range from '1' (highest)
+ * to '9' (lowest).
+ */
+
+/*
+ * NOTE: In the id_generator_state column, for numeric sequence parts
+ * whose first generated value should start at the initial value
+ * (such as '1'), enter '-1' for the <currentValue>
+ *
+ * Otherwise, the first generated value will be the next value
+ * in the sequence after the initial value (e.g. '2', if the
+ * initial value is '1').
+ */
+
+
+-- UC_ACCESSION_NUMBER
+
+INSERT INTO id_generators
+ (csid, displayname, description, priority, last_generated_id, id_generator_state)
+ SELECT
+ 'ed3c8578-cf01-4a05-b7fc-8e49b96273c6',
+ 'UC Accession Number',
+ 'Identifies individual collection objects formally
+acquired by the UC Herbarium. Used for collection objects
+without parts.',
+ '9',
+ '',
+'<org.collectionspace.services.id.SettableIDGenerator>
+ <parts>
+ <org.collectionspace.services.id.StringIDGeneratorPart>
+ <initialValue>UC</initialValue>
+ <currentValue>UC</currentValue>
+ </org.collectionspace.services.id.StringIDGeneratorPart>
+ <org.collectionspace.services.id.NumericIDGeneratorPart>
+ <maxLength>9</maxLength>
+ <initialValue>1</initialValue>
+ <currentValue>-1</currentValue>
+ </org.collectionspace.services.id.NumericIDGeneratorPart>
+ </parts>
+</org.collectionspace.services.id.SettableIDGenerator>'
+WHERE 'ed3c8578-cf01-4a05-b7fc-8e49b96273c6' NOT IN
+ (
+ SELECT csid
+ FROM id_generators
+ );
+
+
+
+-- JEPS_ACCESSION_NUMBER
+
+INSERT INTO id_generators
+ (csid, displayname, description, priority, last_generated_id, id_generator_state)
+ SELECT
+ 'd9eca382-23b7-47aa-8d9b-d7ff88f49e2b',
+ 'JEPS Accession Number',
+ 'Identifies individual collection objects formally
+acquired by the Jepson Herbarium. Used for collection objects
+without parts.',
+ '9',
+ '',
+'<org.collectionspace.services.id.SettableIDGenerator>
+ <parts>
+ <org.collectionspace.services.id.StringIDGeneratorPart>
+ <initialValue>JEPS</initialValue>
+ <currentValue>JEPS</currentValue>
+ </org.collectionspace.services.id.StringIDGeneratorPart>
+ <org.collectionspace.services.id.NumericIDGeneratorPart>
+ <maxLength>9</maxLength>
+ <initialValue>1</initialValue>
+ <currentValue>-1</currentValue>
+ </org.collectionspace.services.id.NumericIDGeneratorPart>
+ </parts>
+</org.collectionspace.services.id.SettableIDGenerator>'
+WHERE 'd9eca382-23b7-47aa-8d9b-d7ff88f49e2b' NOT IN
+ (
+ SELECT csid
+ FROM id_generators
+ );
+
+
+
+-- VOUCHER_NUMBER
+
+INSERT INTO id_generators
+ (csid, displayname, description, priority, last_generated_id, id_generator_state)
+ SELECT
+ '940710aa-3df4-4bd4-8d6f-9bf6a92b35cc',
+ 'Voucher Collection Number',
+ 'Identifies Botanical Garden vouchers.',
+ '9',
+ '',
+'<org.collectionspace.services.id.SettableIDGenerator>
+ <parts>
+ <org.collectionspace.services.id.StringIDGeneratorPart>
+ <initialValue>V</initialValue>
+ <currentValue>V</currentValue>
+ </org.collectionspace.services.id.StringIDGeneratorPart>
+ <org.collectionspace.services.id.YearIDGeneratorPart>
+ <currentValue></currentValue>
+ </org.collectionspace.services.id.YearIDGeneratorPart>
+ <org.collectionspace.services.id.StringIDGeneratorPart>
+ <initialValue>.</initialValue>
+ <currentValue>.</currentValue>
+ </org.collectionspace.services.id.StringIDGeneratorPart>
+ <org.collectionspace.services.id.NumericIDGeneratorPart>
+ <maxLength>6</maxLength>
+ <initialValue>1</initialValue>
+ <currentValue>-1</currentValue>
+ </org.collectionspace.services.id.NumericIDGeneratorPart>
+ </parts>
+</org.collectionspace.services.id.SettableIDGenerator>'
+WHERE '940710aa-3df4-4bd4-8d6f-9bf6a92b35cc' NOT IN
+ (
+ SELECT csid
+ FROM id_generators
+ );
+
+
+-- PROP_NUMBER
+
+INSERT INTO id_generators
+ (csid, displayname, description, priority, last_generated_id, id_generator_state)
+ SELECT
+ '81cf5a56-d43d-49e9-ac11-61cf4b0923d4',
+ 'Propagation Number',
+ 'Identifies activities in which accessions are
+propagated.',
+ '9',
+ '',
+'<org.collectionspace.services.id.SettableIDGenerator>
+ <parts>
+ <org.collectionspace.services.id.NumericIDGeneratorPart>
+ <maxLength>9</maxLength>
+ <initialValue>1</initialValue>
+ <currentValue>-1</currentValue>
+ </org.collectionspace.services.id.NumericIDGeneratorPart>
+ </parts>
+</org.collectionspace.services.id.SettableIDGenerator>'
+WHERE '81cf5a56-d43d-49e9-ac11-61cf4b0923d4' NOT IN
+ (
+ SELECT csid
+ FROM id_generators
+ );
\ No newline at end of file