From fe377d977a8e8f40133d02b344b80647fe7a42e1 Mon Sep 17 00:00:00 2001 From: singletonc Date: Wed, 20 Nov 2024 18:40:24 -0500 Subject: [PATCH] [PPP-5411] [PPP-5420] Update Pentaho User Console community release help about page to display enterprise license text and perform limited smoke test - Limit to one LICENSE.TXT file at the root of the project - Copy license text file to root of product artifact as well as GWT accessible location - No additional error handling, if license text is missing in @Source annotation, the project will not compile, it will tell you the file is missing - AboutCommand now gets the license text from HTTP request to the server instead of compiling it into GWT, this way it can be easily overridden in EE - Chained version and license request callbacks while caching the results to prevent additional calls --- LICENSE.txt => LICENSE.TXT | 0 .../pentaho-server/src/assembly/assembly.xml | 8 ++ user-console/LICENSE.txt | 63 ------------- user-console/pom.xml | 12 +++ .../mantle/client/commands/AboutCommand.java | 92 +++++++++++++------ .../org/pentaho/mantle/public/license.txt | 63 ------------- 6 files changed, 85 insertions(+), 153 deletions(-) rename LICENSE.txt => LICENSE.TXT (100%) delete mode 100644 user-console/LICENSE.txt delete mode 100644 user-console/src/main/resources/org/pentaho/mantle/public/license.txt diff --git a/LICENSE.txt b/LICENSE.TXT similarity index 100% rename from LICENSE.txt rename to LICENSE.TXT diff --git a/assemblies/pentaho-server/src/assembly/assembly.xml b/assemblies/pentaho-server/src/assembly/assembly.xml index 13d669f3457..50a5639adc5 100644 --- a/assemblies/pentaho-server/src/assembly/assembly.xml +++ b/assemblies/pentaho-server/src/assembly/assembly.xml @@ -78,6 +78,14 @@ ${project.build.directory}/pentaho-solutions/system/dialects/hsqldb pentaho-solutions/system + + + ${project.basedir}/../.. + + LICENSE.TXT + + . + diff --git a/user-console/LICENSE.txt b/user-console/LICENSE.txt deleted file mode 100644 index 7d2847eb745..00000000000 --- a/user-console/LICENSE.txt +++ /dev/null @@ -1,63 +0,0 @@ -Pentaho Developer Edition 10.3 Copyright 2024 Hitachi Vantara, LLC; licensed under the -Business Source License 1.1 (BSL). This project may include third party components that -are individually licensed per the terms indicated by their respective copyright owners -included in text file or in the source code. - -License text copyright (c) 2020 MariaDB Corporation Ab, All Rights Reserved. -"Business Source License" is a trademark of MariaDB Corporation Ab. - -Parameters - -Licensor: Hitachi Vantara, LLC. -Licensed Work: Pentaho Developer Edition 10.3. The Licensed Work is (c) 2024 - Hitachi Vantara, LLC. -Additional Use Grant: None -Change Date: Four years from the date the Licensed Work is published. -Change License: Apache 2.0 - -For information about alternative licensing arrangements for the Licensed Work, -please contact support@pentaho.com. - -Notice - -Business Source License 1.1 - -Terms - -The Licensor hereby grants you the right to copy, modify, create derivative -works, redistribute, and make non-production use of the Licensed Work. The -Licensor may make an Additional Use Grant, above, permitting limited production use. - -Effective on the Change Date, or the fourth anniversary of the first publicly -available distribution of a specific version of the Licensed Work under this -License, whichever comes first, the Licensor hereby grants you rights under -the terms of the Change License, and the rights granted in the paragraph -above terminate. - -If your use of the Licensed Work does not comply with the requirements -currently in effect as described in this License, you must purchase a -commercial license from the Licensor, its affiliated entities, or authorized -resellers, or you must refrain from using the Licensed Work. - -All copies of the original and modified Licensed Work, and derivative works -of the Licensed Work, are subject to this License. This License applies -separately for each version of the Licensed Work and the Change Date may vary -for each version of the Licensed Work released by Licensor. - -You must conspicuously display this License on each original or modified copy -of the Licensed Work. If you receive the Licensed Work in original or -modified form from a third party, the terms and conditions set forth in this -License apply to your use of that work. - -Any use of the Licensed Work in violation of this License will automatically -terminate your rights under this License for the current and all other -versions of the Licensed Work. - -This License does not grant you any right in any trademark or logo of -Licensor or its affiliates (provided that you may use a trademark or logo of -Licensor as expressly required by this License). - -TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE. \ No newline at end of file diff --git a/user-console/pom.xml b/user-console/pom.xml index cfbd1cde8b2..0fefd4b65ae 100644 --- a/user-console/pom.xml +++ b/user-console/pom.xml @@ -428,6 +428,18 @@ maven-antrun-plugin + + copy-license-file + generate-resources + + run + + + + + + + copy-jquery-files generate-resources diff --git a/user-console/src/main/java/org/pentaho/mantle/client/commands/AboutCommand.java b/user-console/src/main/java/org/pentaho/mantle/client/commands/AboutCommand.java index 1f150d29b4a..aa5965bcf89 100644 --- a/user-console/src/main/java/org/pentaho/mantle/client/commands/AboutCommand.java +++ b/user-console/src/main/java/org/pentaho/mantle/client/commands/AboutCommand.java @@ -27,18 +27,17 @@ import org.pentaho.gwt.widgets.client.utils.string.StringUtils; import org.pentaho.mantle.client.MantleApplication; import org.pentaho.mantle.client.messages.Messages; -import com.google.gwt.core.client.GWT; -import com.google.gwt.resources.client.ClientBundle; -import com.google.gwt.resources.client.TextResource; import java.util.Date; public class AboutCommand extends AbstractCommand { + private static final String LICENSE_FILE_URL = GWT.getHostPageBaseURL() + "mantle/LICENSE.TXT"; - interface MyTextResource extends ClientBundle { - @Source("org/pentaho/mantle/public/license.txt") - TextResource myText(); - } + private static final String LICENSE_READ_ERROR = + "Error reading license file from server URL: \"" + LICENSE_FILE_URL + "\""; + + private String versionText; + private String licenseText; public AboutCommand() { } @@ -47,9 +46,33 @@ protected void performOperation() { performOperation( true ); } + /** + * Begins callback chain for About window values then opens the window: + * -> retrieve version (if not set) + * -> retrieve license text (if not set nor error) + * -> show the window + */ protected void performOperation( boolean feedback ) { - if ( StringUtils.isEmpty( MantleApplication.mantleRevisionOverride ) == false ) { - showAboutDialog( MantleApplication.mantleRevisionOverride ); + retrieveVersionValue(); + } + + + //Setters are here to be accessible in RequestCallbacks + private void setVersionText( String text ) { + versionText = text; + } + + private void setLicenseFileText( String text ) { + licenseText = text.replace( "\t", " " ); + licenseText = "
" + licenseText + "
"; + } + + private void retrieveVersionValue() { + if ( versionText != null && !versionText.isEmpty() ) { + retrieveLicenseFileText(); + } else if ( StringUtils.isEmpty( MantleApplication.mantleRevisionOverride ) == false ) { + setVersionText( MantleApplication.mantleRevisionOverride ); + retrieveLicenseFileText(); } else { final String url = GWT.getHostPageBaseURL() + "api/version/show"; //$NON-NLS-1$ RequestBuilder requestBuilder = new RequestBuilder( RequestBuilder.GET, url ); @@ -59,43 +82,58 @@ protected void performOperation( boolean feedback ) { requestBuilder.sendRequest( null, new RequestCallback() { public void onError( Request request, Throwable exception ) { - // showError(exception); } public void onResponseReceived( Request request, Response response ) { - showAboutDialog( response.getText() ); + setVersionText( response.getText() ); + retrieveLicenseFileText(); } } ); } catch ( RequestException e ) { Window.alert( e.getMessage() ); - // showError(e); } } } - public String readTextFile() { - MyTextResource resource = GWT.create(MyTextResource.class); - String text = resource.myText().getText(); - text = text.replace("\t", " "); - text = "
" + text + "
"; - return text; + private void retrieveLicenseFileText() { + //if we already have a license text value that isn't the ERROR value, don't bother getting the value again. + if ( licenseText != null && !licenseText.isEmpty() && licenseText != LICENSE_READ_ERROR ) { + showAboutDialog(); + } else { + RequestBuilder licenseFileRequest = new RequestBuilder( RequestBuilder.GET, LICENSE_FILE_URL ); + licenseFileRequest.setHeader( "If-Modified-Since", "01 Jan 1970 00:00:00 GMT" ); + licenseFileRequest.setHeader( "accept", "text/plain" ); + + try { + licenseFileRequest.sendRequest( null, new RequestCallback() { + + public void onError( Request request, Throwable exception ) { + setLicenseFileText( LICENSE_READ_ERROR ); + showAboutDialog(); + } + + public void onResponseReceived( Request request, Response response ) { + setLicenseFileText( response.getText() ); + showAboutDialog(); + } + } ); + } catch ( RequestException e ) { + Window.alert( e.getMessage() ); + } + } } - private void showAboutDialog( String version ) { - @SuppressWarnings( "deprecation" ) - String licenseInfo = Messages.getString( "licenseInfo", "" + ( ( new Date() ).getYear() + 1900 ) ); + private void showAboutDialog() { String releaseLabel = Messages.getString( "release" ); PromptDialogBox dialogBox = - new PromptDialogBox( null, Messages.getString( "ok" ), null, false, true ); //$NON-NLS-1$ - + new PromptDialogBox( null, Messages.getString( "ok" ), null, false, true ); //$NON-NLS-1$ VerticalPanel aboutContent = new VerticalPanel(); - aboutContent.setBorderWidth(0); - String licenseText = readTextFile(); + aboutContent.setBorderWidth( 0 ); aboutContent.setStyleName( "about-splash" ); - aboutContent.add( new Label( releaseLabel + " " + version ) ); + aboutContent.add( new Label( releaseLabel + " " + versionText ) ); aboutContent.add( new HTML( licenseText ) ); dialogBox.setContent( aboutContent ); - dialogBox.setPixelSize(700, 400); + dialogBox.setPixelSize( 700, 400 ); dialogBox.center(); } } \ No newline at end of file diff --git a/user-console/src/main/resources/org/pentaho/mantle/public/license.txt b/user-console/src/main/resources/org/pentaho/mantle/public/license.txt deleted file mode 100644 index 0a022258b0e..00000000000 --- a/user-console/src/main/resources/org/pentaho/mantle/public/license.txt +++ /dev/null @@ -1,63 +0,0 @@ -Pentaho Developer Edition 10.3 Copyright 2024 Hitachi Vantara, LLC; licensed under the -Business Source License 1.1 (BSL). This project may include third party components that -are individually licensed per the terms indicated by their respective copyright owners -included in text file or in the source code. - -License text copyright (c) 2020 MariaDB Corporation Ab, All Rights Reserved. -"Business Source License" is a trademark of MariaDB Corporation Ab. - -Parameters - -Licensor: Hitachi Vantara, LLC. -Licensed Work: Pentaho Developer Edition 10.3. The Licensed Work is (c) 2024 - Hitachi Vantara, LLC. -Additional Use Grant: None -Change Date: Four years from the date the Licensed Work is published. -Change License: Apache 2.0 - -For information about alternative licensing arrangements for the Licensed Work, -please contact support@pentaho.com. - -Notice - -Business Source License 1.1 - -Terms - -The Licensor hereby grants you the right to copy, modify, create derivative -works, redistribute, and make non-production use of the Licensed Work. The -Licensor may make an Additional Use Grant, above, permitting limited production use. - -Effective on the Change Date, or the fourth anniversary of the first publicly -available distribution of a specific version of the Licensed Work under this -License, whichever comes first, the Licensor hereby grants you rights under -the terms of the Change License, and the rights granted in the paragraph -above terminate. - -If your use of the Licensed Work does not comply with the requirements -currently in effect as described in this License, you must purchase a -commercial license from the Licensor, its affiliated entities, or authorized -resellers, or you must refrain from using the Licensed Work. - -All copies of the original and modified Licensed Work, and derivative works -of the Licensed Work, are subject to this License. This License applies -separately for each version of the Licensed Work and the Change Date may vary -for each version of the Licensed Work released by Licensor. - -You must conspicuously display this License on each original or modified copy -of the Licensed Work. If you receive the Licensed Work in original or -modified form from a third party, the terms and conditions set forth in this -License apply to your use of that work. - -Any use of the Licensed Work in violation of this License will automatically -terminate your rights under this License for the current and all other -versions of the Licensed Work. - -This License does not grant you any right in any trademark or logo of -Licensor or its affiliates (provided that you may use a trademark or logo of -Licensor as expressly required by this License). - -TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE. \ No newline at end of file