]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
NOJIRA: Adding support for specifying 'primary' tenant via properties file.
authorRichard Millet <remillet@yahoo.com>
Fri, 4 May 2018 02:37:20 +0000 (19:37 -0700)
committerRichard Millet <remillet@yahoo.com>
Fri, 4 May 2018 02:37:20 +0000 (19:37 -0700)
build.properties
cspace-ui/build.xml
cspace-ui/cspace#template/WEB-INF/web.xml [new file with mode: 0644]
cspace-ui/cspace#template/index.html [new file with mode: 0644]

index f50d2a8a4b4afa1d2a0bd0fd1cf3a798ae3172ab..f537d76b3efd6d5bc6a84a5439a8c8e92ad2d1d9 100644 (file)
@@ -6,20 +6,6 @@ host=127.0.0.1
 # The instance ID is blank by default. If it is added, by convention, 
 # instance IDs should begin with an underscore (_). E.g.: _trs80
 
-#
-# Default tenant ID's for profiles
-#
-cspace.profile.core.default.id=1
-cspace.profile.testsci.default.id=2
-cspace.profile.anthro.default.id=1500
-cspace.profile.publicart.default.id=5000
-cspace.profile.bonsai.default.id=3000
-cspace.profile.botgarden.default.id=3500
-cspace.profile.fcart.default.id=1000
-cspace.profile.herbarium.default.id=4000
-cspace.profile.lhmc.default.id=501
-cspace.profile.materials.default.id=2000
-
 #
 # Release version info
 #
index 70c9fd2131c7cbf93e0e49039905e8ce0f6ec7aa..05df8849e08f379eb89aa1a8add0d23574959823 100644 (file)
@@ -5,10 +5,35 @@
        
        <!-- set global properties for this build -->
        <property name="services.trunk" value=".."/>
-       <!-- enviornment should be declared before reading build.properties -->
+       
+       <!-- Enviornment should be declared before reading build.properties -->
        <property environment="env" />
        <property file="${services.trunk}/build.properties" />
        
+       <!--
+               Properties set in this file will override all corresponding <property> definitions
+               made in this Ant file.
+       -->
+       <property file="${jee.server.cspace}/primary.tenant.properties" />
+       <property name="primary.profile.plugin.enabled" value="${env.CSPACE_PRIMARY_UIPLUGIN}"/>
+
+       <!--
+               #
+               # Default tenant ID's for profiles - You can override these values in the "primary.tenant.properties" file at
+               # the top-level directory of the tomcat deployment location.
+               #
+       -->
+       <property name="cspace.profile.core.default.id" value="1"/>
+       <property name="cspace.profile.testsci.default.id" value="2"/>
+       <property name="cspace.profile.anthro.default.id" value="1500"/>
+       <property name="cspace.profile.publicart.default.id" value="5000"/>
+       <property name="cspace.profile.bonsai.default.id" value="3000"/>
+       <property name="cspace.profile.botgarden.default.id" value="3500"/>
+       <property name="cspace.profile.fcart.default.id" value="1000"/>
+       <property name="cspace.profile.herbarium.default.id" value="4000"/>
+       <property name="cspace.profile.lhmc.default.id" value="501"/>
+       <property name="cspace.profile.materials.default.id" value="2000"/>
+       
        <condition property="osfamily-unix">
                <os family="unix" />
        </condition>
        <!--
                Set all the values for a single/primary tenant deployment
        -->
-       <target name="set_primary" if="${env.CSPACE_PRIMARY_UIPLUGIN}">
+       <target name="set_primary" if="${primary.profile.plugin.enabled}">
                <echo>Setting primary vars</echo>
+               <echo>The value of primary.profile.plugin.name is ${primary.profile.plugin.name}</echo>
                <property name="primary.profile.plugin.name" value="${env.CSPACE_PRIMARY_UIPLUGIN_NAME}" />
+               <!--
+               <condition property="primary.profile.plugin.name" value="${env.CSPACE_PRIMARY_UIPLUGIN_NAME}">
+                  <not>
+                         <isset property="primary.profile.plugin.name"/>
+                  </not>
+               </condition>
+               -->
+               <echo>The value of primary.profile.plugin.name is ${primary.profile.plugin.name}</echo>
+
+               
                <property name="primary.profile.plugin.version" value="${env.CSPACE_PRIMARY_UIPLUGIN_VERSION}" />
                <property name="primary.profile.plugin.package" value="${env.CSPACE_PRIMARY_UIPLUGIN_PACKAGE}" /> 
                <property name="primary.profile.plugin.dir" value="${env.CSPACE_PRIMARY_UIPLUGIN_DIR}" />
-               <property name="primary.profile.plugin.js" value="${primary.profile.plugin.name}@${primary.profile.plugin.version}.min.js" />
                <property name="primary.profile.plugin.basename" value="${env.CSPACE_PRIMARY_UIPLUGIN_BASENAME}" />             
                <property name="primary.profile.plugin.tenantid" value="${env.CSPACE_PRIMARY_UIPLUGIN_TENANTID}" />
                <property name="primary.profile.plugin.message.title" value="${env.CSPACE_PRIMARY_UIPLUGIN_TITLE_MESSAGE}" />
+               <!-- Derived from the other props -->
+               <property name="primary.profile.plugin.js" value="${primary.profile.plugin.name}@${primary.profile.plugin.version}.min.js" />
                
                <!-- Set the logo URL value     base on the env var CSPACE_PRIMARY_UIPLUGIN_LOGO value.
                        #
                </condition>
                <condition property="primary.profile.plugin.logo" value="'${env.CSPACE_PRIMARY_UIPLUGIN_LOGO}'">
                        <matches pattern="^(?!\s*$).+" string="${env.CSPACE_PRIMARY_UIPLUGIN_LOGO}"/>
-               </condition>            
+               </condition>
+               
+               <!-- Test to see if "core" tenant is being asked for, since we'll need to do something special for it. -->
+               <condition property="is.primary.core" value="true">
+                       <matches pattern="^cspaceUI$" string="${primary.profile.plugin.name}"/>
+               </condition>
        </target>
 
        <!--
-               Primary tenant
+               Since "core" is a special tenant, we need to do a special check
+       -->
+       <target name="deploy_core_as_generic" if="${is.primary.core}">
+               <antcall target="deploy_core" />
+       </target>
+       
+       <!--
+               Since "core" is a special tenant, we need to do a special check
+       -->
+       <target name="deploy_other_as_generic" unless="${is.primary.core}">
+               <antcall target="deploy_primary" />     
+       </target>
+       
+       <target name="deploy_generic" depends="set_primary">
+               <antcall target="deploy_core_as_generic" />
+               <antcall target="deploy_other_as_generic" />
+       </target>
+       
+       <!--
+               Primary tenant - Use the props to decide what tenant plugin to deploy
        -->
-       <target name="download_primary" depends="set_primary" if="${env.CSPACE_PRIMARY_UIPLUGIN}">
+       <target name="download_primary" if="${primary.profile.plugin.enabled}">         
                <!-- Default primary tenant -->
+               <echo>-o ${primary.profile.plugin.js} --fail --insecure --remote-name --location https://unpkg.com/${primary.profile.plugin.package}@${primary.profile.plugin.version}/dist/${primary.profile.plugin.name}.min.js</echo>
                <exec executable="curl"  failonerror="true">
                        <arg line="-o ${primary.profile.plugin.js} --fail --insecure --remote-name --location https://unpkg.com/${primary.profile.plugin.package}@${primary.profile.plugin.version}/dist/${primary.profile.plugin.name}.min.js"/>
                </exec>
-               </target>
+       </target>
 
-       <target name="deploy_primary" depends="download_primary" if="${env.CSPACE_PRIMARY_UIPLUGIN}" description="deploy cspace ui to ${jee.server.cspace}">
+       <target name="deploy_primary" depends="download_primary" if="${primary.profile.plugin.enabled}" description="deploy cspace ui to ${jee.server.cspace}">
                <filter token="UI_VERSION" value="${cspace.ui.version}" />                              
                <filter token="PLUGIN_VERSION" value="${primary.profile.plugin.version}" />
+               <filter token="PLUGIN_NAME" value="${primary.profile.plugin.name}" />
                <filter token="PLUGIN_BASENAME" value="${primary.profile.plugin.basename}" />
                <filter token="TENANT_ID" value="${primary.profile.plugin.tenantid}" />
                <filter token="MESSAGE_TITLE" value="${primary.profile.plugin.message.title}" />
                <filter token="LOGO" value="${primary.profile.plugin.logo}" />
                
                <copy todir="${jee.deploy.cspace}/${primary.profile.plugin.dir}" filtering="true" overwrite="true">
-                       <fileset dir="${primary.profile.plugin.dir}"/>
+                       <fileset dir="cspace#template"/>
                </copy>
                <move file="${primary.profile.plugin.js}" todir="${jee.deploy.cspace.ui.shared}"></move>
        </target>                
                
-       <target name="undeploy_primary" if="${env.CSPACE_PRIMARY_UIPLUGIN}" depends="set_primary" description="undeploy collectionspace ui components from ${jee.server.cspace}">                                
+       <target name="undeploy_primary" if="${primary.profile.plugin.enabled}" depends="set_primary" description="undeploy collectionspace ui components from ${jee.server.cspace}">                             
                <delete dir="${jee.deploy.cspace}/${primary.profile.plugin.dir}" />
                <delete file="${jee.deploy.cspace.ui.shared}/${primary.profile.plugin.js}" />
        </target>                
        </target>
                
        <target name="deploy_core" depends="download_core" unless="${env.CSPACE_CORE_CREATE_DISABLED_OPT}">
+               <property name="cspace.profile.core.default.id" value="${cspace.ui.tenantid}" />
+               <condition property="cspace.profile.core.default.id" value="1234">
+                  <not>  
+                         <isset property="cspace.profile.core.default.id"/>
+                  </not>
+               </condition>            
+               
                <!-- Core UI Webapp-->
                <filter token="UI_VERSION" value="${cspace.ui.version}" />
                <filter token="PLUGIN_BASENAME" value="${cspace.ui.basename}" />
-               <filter token="TENANT_ID" value="${cspace.ui.tenantid}" />
+               <filter token="TENANT_ID" value="${cspace.profile.core.default.id}" />
                <filter token="MESSAGE_TITLE" value="${cspace.ui.message.title}" />
                <filter token="LOGO" value="${cspace.ui.logo}" />
                
        <!--
                Public Art Tenant
        -->
-       
        <property name="publicart.profile.plugin.tenantid" value="${cspace.profile.publicart.default.id}" />
        <property name="publicart.profile.plugin.message.title" value="Default Public Art Profile Tenant" />
        <property name="publicart.profile.plugin.version" value="latest" />
        <!-- Use a value of "undefined" to use the default logo -->
        <property name="publicart.profile.plugin.logo" value="undefined" />
 
-       
        <target name="download_publicart" unless="${env.CSPACE_PUBLICART_CREATE_DISABLED_OPT}">
                <!-- Public Art Profile -->
                <exec executable="curl"  failonerror="true">
        <!--
                Anthropology Tenant
        -->
-       
        <property name="anthro.profile.plugin.tenantid" value="${cspace.profile.anthro.default.id}" />
-       <property name="anthro.profile.plugin.message.title" value="Default Anthropology Profile Tenant" />
+       <property name="anthro.profile.plugin.message.title" value="Default Anthropology Profile" />
        <property name="anthro.profile.plugin.logo" value="undefined" />
        <property name="anthro.profile.plugin.version" value="latest" />
        <property name="anthro.profile.plugin.name" value="cspaceUIPluginProfileAnthro" />
        <property name="anthro.profile.plugin.js" value="${anthro.profile.plugin.name}@${anthro.profile.plugin.version}.min.js" />
        <property name="anthro.profile.plugin.basename" value="/cspace/anthro" />
        
-       
        <target name="download_anthro" unless="${env.CSPACE_ANTHRO_CREATE_DISABLED_OPT}">
                <!-- Anthropology Profile -->
                <exec executable="curl"  failonerror="true">
                <delete file="${jee.deploy.cspace.ui.shared}/${anthro.profile.plugin.js}" />
        </target>
 
-       <!-- General deploy target -->
-               
-       <target name="deploy_others" unless="${env.CSPACE_PRIMARY_UIPLUGIN}">
+       <!--
+               General deploy target 
+       -->             
+       <target name="deploy_others" unless="${primary.profile.plugin.enabled}">
                <antcall target="deploy_common" />
                <antcall target="deploy_core" />                
                <antcall target="deploy_publicart" />
                <antcall target="deploy_anthro" />
        </target>
                
-       <target name="deploy" depends="deploy_common, deploy_primary, deploy_others" description="deploy cspace ui to ${jee.server.cspace}">                            
+       <target name="deploy" depends="deploy_common, deploy_generic, deploy_others" description="deploy cspace ui to ${jee.server.cspace}">                            
                <!-- Trigger dependencies -->
        </target>
                
diff --git a/cspace-ui/cspace#template/WEB-INF/web.xml b/cspace-ui/cspace#template/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..b476587
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="3.0" metadata-complete="true">
+        <filter>
+                <filter-name>FallbackResourceFilter</filter-name>
+                <filter-class>org.collectionspace.services.common.filter.FallbackResourceFilter</filter-class>
+        </filter>
+        <filter-mapping>
+                <filter-name>FallbackResourceFilter</filter-name>
+                <url-pattern>/*</url-pattern>
+        </filter-mapping>
+        <filter>
+                <filter-name>ExpiresFilter</filter-name>
+                <filter-class>org.apache.catalina.filters.ExpiresFilter</filter-class>
+                <init-param>
+                        <param-name>ExpiresDefault</param-name>
+                        <param-value>access plus 12 hours</param-value>
+                </init-param>
+        </filter>
+        <filter-mapping>
+                <filter-name>ExpiresFilter</filter-name>
+                <url-pattern>/*</url-pattern>
+        </filter-mapping>
+</web-app>
\ No newline at end of file
diff --git a/cspace-ui/cspace#template/index.html b/cspace-ui/cspace#template/index.html
new file mode 100644 (file)
index 0000000..d87b070
--- /dev/null
@@ -0,0 +1,27 @@
+<html>
+       <head>
+               <meta charset="UTF-8" />
+       </head>
+       <body>
+               <!-- The template -->
+               <div id="cspace"></div>
+               <script src="/cspace-ui/cspaceUI@@UI_VERSION@.min.js"></script>
+               <script src="/cspace-ui/@PLUGIN_NAME@@@PLUGIN_VERSION@.min.js"></script>
+               <script>
+                       cspaceUI({
+                               tenantid: '@TENANT_ID@',
+                               // No quotes for logo value.  Use "undefined" (no quotes) for default logo
+                               logo: @LOGO@,
+                               messages: {
+                               // Override the login page title
+                                       'about.title': '@MESSAGE_TITLE@',
+                               },
+                               basename: '@PLUGIN_BASENAME@',
+                               prettyUrls: true,
+                               plugins: [
+                                       @PLUGIN_NAME@(),
+                               ],
+                       });
+               </script>
+       </body>
+</html>