From 13d96455db8f828dcd81fe762c5d43e2854a08e9 Mon Sep 17 00:00:00 2001 From: Gaurav Gupta Date: Mon, 19 Dec 2022 15:14:00 +0530 Subject: [PATCH 1/6] FISH-6776 Payara Server tools for Eclipse IDE --- .../.classpath | 0 .../.project | 2 +- .../org.eclipse.core.resources.prefs | 0 .../.settings/org.eclipse.m2e.core.prefs | 0 .../META-INF/MANIFEST.MF | 4 +- .../build.properties | 0 .../icons/payara-micro.png | Bin .../plugin.properties | 0 .../plugin.xml | 22 +- .../pom.xml | 2 +- .../eclipse/tools}/micro/BuildTool.java | 2 +- .../eclipse/tools}/micro/GradleBuildTool.java | 8 +- .../eclipse/tools}/micro/MavenBuildTool.java | 8 +- .../payara/eclipse/tools}/micro/Messages.java | 4 +- .../eclipse/tools}/micro/Messages.properties | 0 .../eclipse/tools}/micro/MicroConstants.java | 2 +- .../tools}/micro/MicroLaunchDelegate.java | 14 +- .../tools}/micro/MicroRuntimeProcess.java | 16 +- .../micro/MicroRuntimeProcessFactory.java | 2 +- .../tools}/micro/PayaraMicroPlugin.java | 2 +- .../ui/MicroLaunchConfigurationTabGroup.java | 2 +- .../tools}/micro/ui/MicroProjectTab.java | 32 +- .../tools}/micro/ui/wizards/Messages.java | 2 +- .../micro/ui/wizards/Messages.properties | 0 .../micro/ui/wizards/MicroProjectWizard.java | 2 +- .../ui/wizards/MicroProjectWizardPage.java | 2 +- .../ui/wizards/MicroSettingsWizardPage.java | 8 +- .../.classpath | 17 + .../fish.payara.eclipse.tools.server/.project | 34 + .../org.eclipse.core.resources.prefs | 0 .../.settings/org.eclipse.m2e.core.prefs | 0 .../META-INF/MANIFEST.MF | 60 + .../build.properties | 7 + .../icons/GlassFishLogo.png | Bin 0 -> 3908 bytes .../icons/Javaicon.gif | Bin 0 -> 1094 bytes .../icons/obj16/appclient_module.gif | Bin 0 -> 604 bytes .../icons/obj16/create.png | Bin 0 -> 604 bytes .../icons/obj16/create@2x.png | Bin 0 -> 1426 bytes .../icons/obj16/ear.gif | Bin 0 -> 600 bytes .../icons/obj16/ejb_module.gif | Bin 0 -> 1021 bytes .../icons/obj16/folder_open.gif | Bin 0 -> 324 bytes .../icons/obj16/folder_open.png | Bin 0 -> 508 bytes .../icons/obj16/folder_open@2x.png | Bin 0 -> 851 bytes .../icons/obj16/glassfishserver.gif | Bin 0 -> 29310 bytes .../icons/obj16/glassfishserver_1.gif | Bin 0 -> 29310 bytes .../icons/obj16/java_jar.gif | Bin 0 -> 594 bytes .../icons/obj16/logfile.png | Bin 0 -> 770 bytes .../icons/obj16/logfile@2x.png | Bin 0 -> 1016 bytes .../icons/obj16/payara-blue.png | Bin 0 -> 1794 bytes .../icons/obj16/payara-blue@2x.png | Bin 0 -> 2530 bytes .../icons/obj16/payara-blue@2x_1.png | Bin 0 -> 2530 bytes .../icons/obj16/payara-blue_1.png | Bin 0 -> 1794 bytes .../icons/obj16/registration.png | Bin 0 -> 642 bytes .../icons/obj16/resources.gif | Bin 0 -> 588 bytes .../icons/obj16/web_module.gif | Bin 0 -> 588 bytes .../icons/obj16/webservice.png | Bin 0 -> 782 bytes .../icons/payara-blue.png | Bin 0 -> 1794 bytes .../icons/payara-yellow.png | Bin 0 -> 1757 bytes .../icons/wizard75x66.png | Bin 0 -> 7118 bytes .../icons/wizard75x66@2x.png | Bin 0 -> 12897 bytes .../plugin.properties | 76 + .../plugin.xml | 1230 +++++++++++++++ .../fish.payara.eclipse.tools.server/pom.xml | 34 + .../payara/eclipse/tools/server/Messages.java | 104 ++ .../eclipse/tools/server/Messages.properties | 79 + .../eclipse/tools/server/PayaraRuntime.java | 275 ++++ .../eclipse/tools/server/PayaraServer.java | 896 +++++++++++ .../tools/server/PayaraServerPlugin.java | 219 +++ .../eclipse/tools/server/ServerStatus.java | 27 + .../payara/eclipse/tools/server/Status.java | 423 +++++ .../server/archives/AssembleModules.java | 500 ++++++ .../EclipseToPayaraArchiveConverter.java | 181 +++ .../server/archives/ExportJavaEEArchive.java | 74 + .../deploying/PayaraServerBehaviour.java | 961 ++++++++++++ .../events/RuntimeLifecycleListener.java | 73 + .../events/ServerLifecycleListener.java | 235 +++ .../exceptions/HttpPortUpdateException.java | 44 + .../exceptions/PayaraLaunchException.java | 56 + .../server/exceptions/UniqueNameNotFound.java | 25 + .../GlassfishEjbFacetInstallDelegate.java | 41 + .../GlassfishEjbFacetUninstallDelegate.java | 34 + .../GlassfishWebFacetInstallDelegate.java | 48 + .../GlassfishWebFacetUninstallDelegate.java | 34 + .../IGlassfishDeploymentDescriptor.java | 28 + .../IGlassfishEjbDeploymentDescriptor.java | 25 + .../IGlassfishWebDeploymentDescriptor.java | 28 + ...AbstractGlassfishDeploymentDescriptor.java | 47 + .../GlassfishDeploymentDescriptorFactory.java | 53 + .../internal/GlassfishDescriptorType.java | 70 + .../GlassfishEjbDeploymentDescriptor.java | 54 + .../GlassfishWebDeploymentDescriptor.java | 126 ++ .../AbstractPayaraSelectionHandler.java | 79 + .../handlers/OpenDomainHomeHandler.java | 41 + .../handlers/OpenServerHomeHandler.java | 41 + .../server/handlers/PayaraStateTester.java | 50 + .../server/handlers/PayaraVersionTester.java | 37 + .../tools/server/handlers/ShowURLHandler.java | 55 + .../handlers/ViewAdminConsoleHandler.java | 52 + .../tools/server/handlers/ViewLogHandler.java | 63 + .../internal/ContainersRefresherThread.java | 83 + .../ContainsRuntimeComponentType.java | 116 ++ .../tools/server/internal/InstallJAXRS.java | 36 + .../tools/server/internal/Library.java | 51 + .../tools/server/internal/ManifestUtil.java | 163 ++ .../internal/PayaraClasspathProvider.java | 69 + .../server/internal/PayaraRuntimeBridge.java | 179 +++ .../server/internal/PayaraStateResolver.java | 96 ++ .../internal/RuntimeComponentProvider.java | 44 + ...ntimeComponentProvidersExtensionPoint.java | 115 ++ .../server/internal/ServerStateListener.java | 25 + .../server/internal/ServerStatusMonitor.java | 117 ++ .../server/internal/SystemLibraries.java | 148 ++ .../internal/SystemLibrariesContainer.java | 390 +++++ .../SystemLibrariesContainer.properties | 1 + .../internal/SystemLibrariesSetting.java | 204 +++ .../tools/server/log/AbstractLogFilter.java | 106 ++ .../server/log/AbstractPayaraConsole.java | 43 + .../eclipse/tools/server/log/ILogFilter.java | 39 + .../tools/server/log/IPayaraConsole.java | 47 + .../tools/server/log/LevelResolver.java | 77 + .../tools/server/log/LogFormatterSimple.java | 55 + .../eclipse/tools/server/log/LogReader.java | 85 + .../eclipse/tools/server/log/LogRecord.java | 116 ++ .../eclipse/tools/server/log/NoOpFilter.java | 32 + .../tools/server/log/PatternLogFilterV4.java | 82 + .../tools/server/log/PayaraConsole.java | 171 +++ .../server/log/PayaraConsoleManager.java | 137 ++ .../server/log/PayaraStartupConsole.java | 33 + .../tools/server/log/StateLogFilterV3.java | 230 +++ .../eclipse/tools/server/log/V3LogFilter.java | 273 ++++ .../preferences/PreferenceConstants.java | 32 + .../preferences/PreferenceInitializer.java | 47 + .../sapphire/PayaraServerConfigServices.java | 182 +++ .../server/sdk/ExceptionMessages.properties | 12 + .../tools/server/sdk/GlassFishStatus.java | 524 +++++++ .../server/sdk/GlassFishStatusListener.java | 82 + .../server/sdk/GlassFishToolsConfig.java | 71 + .../tools/server/sdk/LogMessages.properties | 21 + .../tools/server/sdk/PayaraIdeException.java | 167 ++ .../eclipse/tools/server/sdk/TaskEvent.java | 221 +++ .../eclipse/tools/server/sdk/TaskState.java | 127 ++ .../tools/server/sdk/TaskStateListener.java | 44 + .../tools/server/sdk/admin/ActionReport.java | 42 + .../tools/server/sdk/admin/AdminFactory.java | 149 ++ .../server/sdk/admin/AdminFactoryHttp.java | 99 ++ .../server/sdk/admin/AdminFactoryRest.java | 100 ++ .../tools/server/sdk/admin/Command.java | 86 ++ .../server/sdk/admin/CommandAddResources.java | 127 ++ .../sdk/admin/CommandChangeAdminPassword.java | 66 + .../sdk/admin/CommandCreateAdminObject.java | 103 ++ .../sdk/admin/CommandCreateCluster.java | 54 + .../sdk/admin/CommandCreateConnector.java | 109 ++ .../CommandCreateConnectorConnectionPool.java | 100 ++ .../sdk/admin/CommandCreateInstance.java | 64 + .../CommandCreateJDBCConnectionPool.java | 245 +++ .../sdk/admin/CommandCreateJDBCResource.java | 177 +++ .../sdk/admin/CommandDeleteCluster.java | 54 + .../sdk/admin/CommandDeleteInstance.java | 54 + .../sdk/admin/CommandDeleteResource.java | 79 + .../tools/server/sdk/admin/CommandDeploy.java | 129 ++ .../server/sdk/admin/CommandDisable.java | 55 + .../tools/server/sdk/admin/CommandEnable.java | 55 + .../server/sdk/admin/CommandException.java | 140 ++ .../server/sdk/admin/CommandFetchLogData.java | 81 + .../server/sdk/admin/CommandGetProperty.java | 132 ++ .../tools/server/sdk/admin/CommandJava.java | 67 + .../sdk/admin/CommandJavaClassPath.java | 71 + .../sdk/admin/CommandListComponents.java | 90 ++ .../sdk/admin/CommandListResources.java | 117 ++ .../sdk/admin/CommandListWebServices.java | 49 + .../server/sdk/admin/CommandLocation.java | 105 ++ .../server/sdk/admin/CommandRedeploy.java | 101 ++ .../server/sdk/admin/CommandRestartDAS.java | 97 ++ .../sdk/admin/CommandRestoreDomain.java | 63 + .../server/sdk/admin/CommandSetProperty.java | 197 +++ .../server/sdk/admin/CommandStartCluster.java | 89 ++ .../server/sdk/admin/CommandStartDAS.java | 81 + .../sdk/admin/CommandStartInstance.java | 89 ++ .../server/sdk/admin/CommandStopCluster.java | 89 ++ .../server/sdk/admin/CommandStopDAS.java | 85 + .../server/sdk/admin/CommandStopInstance.java | 84 + .../tools/server/sdk/admin/CommandTarget.java | 55 + .../server/sdk/admin/CommandTargetName.java | 56 + .../server/sdk/admin/CommandUndeploy.java | 64 + .../server/sdk/admin/CommandVersion.java | 141 ++ .../sdk/admin/ExceptionMessages.properties | 60 + .../server/sdk/admin/LogMessages.properties | 126 ++ .../tools/server/sdk/admin/MessagePart.java | 47 + .../tools/server/sdk/admin/PasswordFile.java | 377 +++++ .../server/sdk/admin/ProcessIOContent.java | 438 ++++++ .../server/sdk/admin/ProcessIOParser.java | 436 ++++++ .../server/sdk/admin/ProcessIOResult.java | 43 + .../tools/server/sdk/admin/Result.java | 106 ++ .../tools/server/sdk/admin/ResultList.java | 66 + .../tools/server/sdk/admin/ResultLog.java | 68 + .../tools/server/sdk/admin/ResultMap.java | 68 + .../tools/server/sdk/admin/ResultProcess.java | 66 + .../tools/server/sdk/admin/ResultString.java | 66 + .../tools/server/sdk/admin/Runner.java | 965 ++++++++++++ .../tools/server/sdk/admin/RunnerAsadmin.java | 328 ++++ .../RunnerAsadminChangeAdminPassword.java | 124 ++ .../sdk/admin/RunnerAsadminRestoreDomain.java | 134 ++ .../tools/server/sdk/admin/RunnerHttp.java | 546 +++++++ .../sdk/admin/RunnerHttpAddResources.java | 70 + .../server/sdk/admin/RunnerHttpClass.java | 47 + .../admin/RunnerHttpCreateAdminObject.java | 147 ++ .../sdk/admin/RunnerHttpCreateConnector.java | 125 ++ ...nnerHttpCreateConnectorConnectionPool.java | 135 ++ .../sdk/admin/RunnerHttpCreateInstance.java | 145 ++ .../RunnerHttpCreateJDBCConnectionPool.java | 137 ++ .../admin/RunnerHttpCreateJDBCResource.java | 136 ++ .../sdk/admin/RunnerHttpDeleteInstance.java | 79 + .../sdk/admin/RunnerHttpDeleteResource.java | 74 + .../server/sdk/admin/RunnerHttpDeploy.java | 320 ++++ .../sdk/admin/RunnerHttpEnableDisable.java | 106 ++ .../sdk/admin/RunnerHttpGetProperty.java | 134 ++ .../sdk/admin/RunnerHttpListComponents.java | 113 ++ .../sdk/admin/RunnerHttpListResources.java | 122 ++ .../sdk/admin/RunnerHttpListWebServices.java | 108 ++ .../server/sdk/admin/RunnerHttpLocation.java | 76 + .../server/sdk/admin/RunnerHttpRedeploy.java | 187 +++ .../sdk/admin/RunnerHttpRestartDAS.java | 92 ++ .../sdk/admin/RunnerHttpSetProperty.java | 58 + .../server/sdk/admin/RunnerHttpTarget.java | 94 ++ .../server/sdk/admin/RunnerHttpUndeploy.java | 106 ++ .../tools/server/sdk/admin/RunnerJava.java | 321 ++++ .../tools/server/sdk/admin/RunnerLocal.java | 256 ++++ .../tools/server/sdk/admin/RunnerRest.java | 314 ++++ .../sdk/admin/RunnerRestAddResources.java | 59 + .../server/sdk/admin/RunnerRestClass.java | 46 + .../sdk/admin/RunnerRestCreateCluster.java | 69 + .../sdk/admin/RunnerRestCreateConnector.java | 68 + .../admin/RunnerRestCreateConnectorPool.java | 67 + .../sdk/admin/RunnerRestCreateInstance.java | 63 + .../RunnerRestCreateJDBCConnectionPool.java | 67 + .../admin/RunnerRestCreateJDBCResource.java | 67 + .../sdk/admin/RunnerRestDeleteCluster.java | 54 + .../sdk/admin/RunnerRestDeleteInstance.java | 58 + .../sdk/admin/RunnerRestDeleteResource.java | 55 + .../server/sdk/admin/RunnerRestDeploy.java | 207 +++ .../server/sdk/admin/RunnerRestDisable.java | 62 + .../server/sdk/admin/RunnerRestEnable.java | 62 + .../sdk/admin/RunnerRestFetchLogData.java | 234 +++ .../sdk/admin/RunnerRestGetProperty.java | 139 ++ .../server/sdk/admin/RunnerRestList.java | 83 + .../sdk/admin/RunnerRestListApplications.java | 47 + .../sdk/admin/RunnerRestListResources.java | 47 + .../sdk/admin/RunnerRestListWebServices.java | 47 + .../server/sdk/admin/RunnerRestLocation.java | 77 + .../sdk/admin/RunnerRestSetProperty.java | 64 + .../sdk/admin/RunnerRestStartCluster.java | 54 + .../sdk/admin/RunnerRestStartInstance.java | 58 + .../sdk/admin/RunnerRestStopCluster.java | 54 + .../server/sdk/admin/RunnerRestStopDAS.java | 62 + .../sdk/admin/RunnerRestStopInstance.java | 58 + .../server/sdk/admin/RunnerRestUndeploy.java | 61 + .../tools/server/sdk/admin/ServerAdmin.java | 192 +++ .../tools/server/sdk/admin/ValueLog.java | 128 ++ .../tools/server/sdk/admin/ValueProcess.java | 120 ++ .../server/sdk/admin/cloud/CloudTasks.java | 60 + .../server/sdk/admin/cloud/CommandCloud.java | 71 + .../sdk/admin/cloud/CommandCloudDeploy.java | 68 + .../sdk/admin/cloud/RunnerHttpCloud.java | 83 + .../sdk/admin/cloud/RunnerRestCloud.java | 77 + .../admin/cloud/RunnerRestCloudDeploy.java | 130 ++ .../sdk/admin/response/ActionReport.java | 61 + .../sdk/admin/response/MessagePart.java | 64 + .../admin/response/ResponseContentType.java | 41 + .../sdk/admin/response/ResponseParser.java | 40 + .../admin/response/ResponseParserFactory.java | 57 + .../sdk/admin/response/RestActionReport.java | 80 + .../admin/response/RestResponseParser.java | 34 + .../admin/response/RestXMLResponseParser.java | 216 +++ .../tools/server/sdk/data/DataException.java | 131 ++ .../sdk/data/ExceptionMessages.properties | 8 + .../sdk/data/GlassFishAdminInterface.java | 112 ++ .../server/sdk/data/GlassFishConfig.java | 67 + .../server/sdk/data/GlassFishContainer.java | 164 ++ .../sdk/data/GlassFishJavaEEConfig.java | 103 ++ .../sdk/data/GlassFishJavaSEConfig.java | 84 + .../server/sdk/data/GlassFishLibrary.java | 177 +++ .../sdk/data/GlassFishServerStatus.java | 54 + .../server/sdk/data/GlassFishStatusCheck.java | 130 ++ .../sdk/data/GlassFishStatusCheckResult.java | 137 ++ .../server/sdk/data/GlassFishStatusTask.java | 57 + .../tools/server/sdk/data/IdeContext.java | 45 + .../server/sdk/data/LogMessages.properties | 7 + .../tools/server/sdk/data/StartupArgs.java | 39 + .../server/sdk/data/StartupArgsEntity.java | 165 ++ .../tools/server/sdk/data/ToolConfig.java | 41 + .../tools/server/sdk/data/ToolsConfig.java | 41 + .../sdk/data/cloud/GlassFishAccount.java | 81 + .../data/cloud/GlassFishAccountEntity.java | 243 +++ .../server/sdk/data/cloud/GlassFishCloud.java | 71 + .../sdk/data/cloud/GlassFishCloudEntity.java | 179 +++ .../tools/server/sdk/logging/Logger.java | 392 +++++ .../sdk/server/ExceptionMessages.properties | 20 + .../tools/server/sdk/server/FetchLog.java | 140 ++ .../server/sdk/server/FetchLogEvent.java | 66 + .../sdk/server/FetchLogEventListener.java | 37 + .../server/sdk/server/FetchLogException.java | 76 + .../server/sdk/server/FetchLogLocal.java | 216 +++ .../server/sdk/server/FetchLogPiped.java | 411 +++++ .../server/sdk/server/FetchLogRemote.java | 166 ++ .../server/sdk/server/FetchLogSimple.java | 68 + .../eclipse/tools/server/sdk/server/JDK.java | 366 +++++ .../tools/server/sdk/server/JpaSupport.java | 144 ++ .../server/sdk/server/LogMessages.properties | 48 + .../tools/server/sdk/server/ServerStatus.java | 1199 +++++++++++++++ .../tools/server/sdk/server/ServerTasks.java | 494 ++++++ .../server/sdk/server/config/AsadminTool.java | 70 + .../sdk/server/config/ConfigBuilder.java | 299 ++++ .../server/config/ConfigBuilderProvider.java | 116 ++ .../server/sdk/server/config/ConfigUtils.java | 252 +++ .../server/sdk/server/config/FileSet.java | 128 ++ .../server/config/GlassFishConfigManager.java | 43 + .../server/config/GlassFishConfigXMLImpl.java | 143 ++ .../sdk/server/config/GlassFishTool.java | 64 + .../server/sdk/server/config/GlassFishV3.xml | 79 + .../server/sdk/server/config/GlassFishV4.xml | 78 + .../sdk/server/config/JavaEEProfile.java | 305 ++++ .../server/sdk/server/config/JavaEESet.java | 198 +++ .../sdk/server/config/JavaSEPlatform.java | 159 ++ .../server/sdk/server/config/JavaSESet.java | 94 ++ .../server/sdk/server/config/JavaSet.java | 64 + .../server/sdk/server/config/LibraryNode.java | 66 + .../server/sdk/server/config/ModuleType.java | 134 ++ .../server/config/ServerConfigException.java | 101 ++ .../tools/server/sdk/server/config/Tools.java | 67 + .../sdk/server/parser/AbstractReader.java | 73 + .../sdk/server/parser/ConfigReader.java | 77 + .../server/parser/ConfigReaderClasspath.java | 54 + .../sdk/server/parser/ConfigReaderJava.java | 106 ++ .../sdk/server/parser/ConfigReaderJavaEE.java | 184 +++ .../sdk/server/parser/ConfigReaderJavaSE.java | 156 ++ .../server/parser/ConfigReaderJavadocs.java | 104 ++ .../sdk/server/parser/ConfigReaderServer.java | 185 +++ .../server/parser/ConfigReaderSources.java | 52 + .../sdk/server/parser/ConfigReaderTools.java | 173 +++ .../sdk/server/parser/FilesetReader.java | 109 ++ .../server/sdk/server/parser/HttpData.java | 55 + .../sdk/server/parser/HttpListenerReader.java | 109 ++ .../sdk/server/parser/JavaEEModuleReader.java | 162 ++ .../parser/JavaEEProfileCheckReader.java | 218 +++ .../server/parser/JavaEEProfileReader.java | 181 +++ .../server/parser/JavaSEPlatformReader.java | 112 ++ .../sdk/server/parser/JmxConnectorReader.java | 93 ++ .../sdk/server/parser/JvmConfigReader.java | 286 ++++ .../server/sdk/server/parser/LinkReader.java | 85 + .../sdk/server/parser/LogMessages.properties | 41 + .../sdk/server/parser/LookupReader.java | 85 + .../server/parser/NetworkListenerReader.java | 120 ++ .../server/sdk/server/parser/PathReader.java | 106 ++ .../sdk/server/parser/ResourcesReader.java | 126 ++ .../server/parser/TargetConfigNameReader.java | 71 + .../sdk/server/parser/TargetConfigReader.java | 67 + .../sdk/server/parser/ToolsAsadminReader.java | 109 ++ .../server/sdk/server/parser/TreeParser.java | 460 ++++++ .../server/sdk/server/parser/XMLReader.java | 39 + .../server/sdk/server/state/AbstractTask.java | 118 ++ .../sdk/server/state/AdminPortTask.java | 248 +++ .../server/state/ExceptionMessages.properties | 25 + .../server/state/GlassFishStatusEntity.java | 114 ++ .../sdk/server/state/LogMessages.properties | 49 + .../server/sdk/server/state/RunnerTask.java | 158 ++ .../server/state/ServerStateException.java | 88 ++ .../server/sdk/server/state/StatusJob.java | 1365 +++++++++++++++++ .../sdk/server/state/StatusJobState.java | 230 +++ .../server/sdk/server/state/StatusResult.java | 92 ++ .../server/state/StatusResultLocations.java | 82 + .../sdk/server/state/StatusResultVersion.java | 80 + .../sdk/server/state/StatusScheduler.java | 784 ++++++++++ .../server/sdk/utils/CyclicStringBuffer.java | 183 +++ .../sdk/utils/ExceptionMessages.properties | 15 + .../eclipse/tools/server/sdk/utils/Jar.java | 134 ++ .../tools/server/sdk/utils/JarException.java | 118 ++ .../tools/server/sdk/utils/JavaUtils.java | 441 ++++++ .../server/sdk/utils/JavaVersionDetector.java | 29 + .../tools/server/sdk/utils/LinkedList.java | 666 ++++++++ .../server/sdk/utils/LogMessages.properties | 16 + .../tools/server/sdk/utils/NetUtils.java | 453 ++++++ .../tools/server/sdk/utils/OsUtils.java | 424 +++++ .../tools/server/sdk/utils/ServerUtils.java | 879 +++++++++++ .../server/sdk/utils/StringPrefixTree.java | 566 +++++++ .../eclipse/tools/server/sdk/utils/Utils.java | 197 +++ .../tools/server/serverview/AppDesc.java | 55 + .../tools/server/serverview/ResourceDesc.java | 52 + .../tools/server/serverview/WSDesc.java | 49 + .../starting/AdminCredentialsDialog.java | 132 ++ .../starting/PayaraServerLaunchDelegate.java | 419 +++++ .../tools/server/starting/PayaraStartJob.java | 209 +++ .../server/starting/StartupArgsImpl.java | 88 ++ .../tools/server/ui/PayaraToolsUIPlugin.java | 109 ++ .../LaunchConfigurationTabGroup.java | 81 + .../ui/editorsections/ServerSection.java | 127 ++ .../server/ui/internal/JAXRSActionPanels.java | 41 + .../PayaraRuntimeComponentLabelProvider.java | 48 + ...raRuntimeComponentLabelProvider.properties | 1 + ...aRuntimeComponentLabelProviderFactory.java | 42 + .../PayaraRuntimeLocatorDelegate.java | 146 ++ .../PayaraRuntimeLocatorDelegate.sdef | 21 + .../eclipse/tools/server/ui/log/LogStyle.java | 109 ++ .../server/ui/log/PayaraConsoleTracker.java | 58 + .../ui/log/PayaraLogPageParticipant.java | 54 + .../preferences/GlassFishPreferencePage.java | 84 + .../ui/properties/ClasspathContainerPage.java | 130 ++ .../ui/properties/ServerPropertyPage.java | 383 +++++ .../SystemLibrariesVariantBlock.java | 186 +++ .../tools/server/ui/resources/DriverMaps.java | 363 +++++ .../tools/server/ui/resources/JDBCInfo.java | 84 + .../tools/server/ui/resources/JMSInfo.java | 81 + .../tools/server/ui/resources/MailInfo.java | 88 ++ .../tools/server/ui/resources/UrlData.java | 261 ++++ .../wizards/JDBCResourceWizardPage.java | 333 ++++ .../ui/resources/wizards/JDBCWizard.java | 258 ++++ .../wizards/JMSResourceWizardPage.java | 267 ++++ .../ui/resources/wizards/JMSWizard.java | 224 +++ .../wizards/MailResourceWizardPage.java | 256 ++++ .../ui/resources/wizards/MailWizard.java | 207 +++ .../server/ui/resources/wizards/Messages.java | 68 + .../ui/resources/wizards/Messages.properties | 40 + .../ui/resources/wizards/ResourceWizard.java | 147 ++ .../AddGenericResourceClassOperation.java | 119 ++ .../AddGenericResourceDataModelProvider.java | 262 ++++ .../AddGenericResourceTemplateModel.java | 238 +++ .../wizards/AddGenericResourceWizard.java | 111 ++ .../wizards/AddGenericResourceWizardPage.java | 336 ++++ .../wizards/ContainerResourceTemplate.java | 367 +++++ .../rest/wizards/GenericResourceTemplate.java | 394 +++++ .../server/ui/rest/wizards/Messages.java | 61 + .../ui/rest/wizards/Messages.properties | 33 + .../ui/serverview/GenericActionProvider.java | 120 ++ .../ServerModuleActionProvider.java | 110 ++ .../serverview/ServerViewActionProvider.java | 138 ++ .../ServerViewDynamicNodeProvider.java | 125 ++ .../serverview/ServerViewLabelProvider.java | 96 ++ .../GotoModuleProjectInExplorerAction.java | 96 ++ .../actions/OpenInBrowserAction.java | 94 ++ .../OpenModuleInFileBrowserAction.java | 86 ++ .../actions/TestWebServiceAction.java | 90 ++ .../ui/serverview/actions/UndeployAction.java | 159 ++ .../actions/UnregisterResourceAction.java | 154 ++ .../actions/WSDLInfoWebServiceAction.java | 89 ++ .../dynamicnodes/ApplicationNode.java | 132 ++ .../DeployedApplicationsNode.java | 122 ++ .../dynamicnodes/DeployedWebServicesNode.java | 120 ++ .../ui/serverview/dynamicnodes/NodeTypes.java | 90 ++ .../dynamicnodes/ResourcesNode.java | 193 +++ .../ui/serverview/dynamicnodes/TreeNode.java | 105 ++ .../dynamicnodes/WebServiceNode.java | 83 + .../serverview/dynamicnodes/package-info.java | 24 + .../server/ui/serverview/package-info.java | 7 + .../server/ui/wizards/CreatePayaraDomain.java | 292 ++++ .../ui/wizards/GlassfishWizardResources.java | 56 + .../GlassfishWizardResources.properties | 25 + .../NewPayaraRuntimeWizardFragment.java | 435 ++++++ .../NewPayaraServerWizardFragment.java | 526 +++++++ .../tools/server/ui/wizards/SWTUtil.java | 52 + .../TestRemotePayaraConnectionAction.java | 127 ++ .../tools/server/utils/EqualsFactory.java | 179 +++ .../eclipse/tools/server/utils/Filter.java | 31 + .../tools/server/utils/HashCodeFactory.java | 90 ++ .../tools/server/utils/IsPayaraUtil.java | 77 + .../eclipse/tools/server/utils/JdkFilter.java | 46 + .../eclipse/tools/server/utils/JdtUtil.java | 401 +++++ .../eclipse/tools/server/utils/Jobs.java | 53 + .../tools/server/utils/ListFactory.java | 284 ++++ .../eclipse/tools/server/utils/MiscUtil.java | 234 +++ .../tools/server/utils/ModuleUtil.java | 101 ++ .../tools/server/utils/NamingUtils.java | 59 + .../tools/server/utils/NodesUtils.java | 165 ++ .../utils/PartialCompletionException.java | 43 + .../server/utils/PayaraLocationUtils.java | 303 ++++ .../tools/server/utils/PluginUtil.java | 328 ++++ .../tools/server/utils/ResourceUtils.java | 437 ++++++ .../server/utils/ServerStatusHelper.java | 207 +++ .../tools/server/utils/SetFactory.java | 247 +++ .../tools/server/utils/SortedSetFactory.java | 603 ++++++++ .../tools/server/utils/StreamGobbler.java | 67 + .../eclipse/tools/server/utils/URIHelper.java | 61 + .../eclipse/tools/server/utils/Utils.java | 447 ++++++ .../eclipse/tools/server/utils/Version.java | 213 +++ .../tools/server/utils/VersionConstraint.java | 572 +++++++ .../tools/server/utils/WizardUtil.java | 78 + .../eclipse/tools/server/utils/WtpUtil.java | 70 + bundles/pom.xml | 3 +- .../.polyglot.build.properties | 0 .../.project | 2 +- .../org.eclipse.core.resources.prefs | 2 + .../.settings/org.eclipse.m2e.core.prefs | 4 + .../build.properties | 0 .../feature.xml | 4 +- .../.project | 23 + .../org.eclipse.core.resources.prefs | 2 + .../.settings/org.eclipse.m2e.core.prefs | 4 + .../build.properties | 1 + .../feature.xml | 111 ++ features/pom.xml | 3 +- .../fish.payara.eclipse.20229.target | 12 + .../fish.payara.eclipse.update/category.xml | 5 +- 500 files changed, 63189 insertions(+), 74 deletions(-) rename bundles/{fish.payara.eclipse.micro => fish.payara.eclipse.tools.micro}/.classpath (100%) rename bundles/{fish.payara.eclipse.micro => fish.payara.eclipse.tools.micro}/.project (94%) rename bundles/{fish.payara.eclipse.micro => fish.payara.eclipse.tools.micro}/.settings/org.eclipse.core.resources.prefs (100%) rename bundles/{fish.payara.eclipse.micro => fish.payara.eclipse.tools.micro}/.settings/org.eclipse.m2e.core.prefs (100%) rename bundles/{fish.payara.eclipse.micro => fish.payara.eclipse.tools.micro}/META-INF/MANIFEST.MF (81%) rename bundles/{fish.payara.eclipse.micro => fish.payara.eclipse.tools.micro}/build.properties (100%) rename bundles/{fish.payara.eclipse.micro => fish.payara.eclipse.tools.micro}/icons/payara-micro.png (100%) rename bundles/{fish.payara.eclipse.micro => fish.payara.eclipse.tools.micro}/plugin.properties (100%) rename bundles/{fish.payara.eclipse.micro => fish.payara.eclipse.tools.micro}/plugin.xml (64%) rename bundles/{fish.payara.eclipse.micro => fish.payara.eclipse.tools.micro}/pom.xml (93%) rename bundles/{fish.payara.eclipse.micro/src/fish/payara/eclipse => fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools}/micro/BuildTool.java (97%) rename bundles/{fish.payara.eclipse.micro/src/fish/payara/eclipse => fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools}/micro/GradleBuildTool.java (92%) rename bundles/{fish.payara.eclipse.micro/src/fish/payara/eclipse => fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools}/micro/MavenBuildTool.java (93%) rename bundles/{fish.payara.eclipse.micro/src/fish/payara/eclipse => fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools}/micro/Messages.java (96%) rename bundles/{fish.payara.eclipse.micro/src/fish/payara/eclipse => fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools}/micro/Messages.properties (100%) rename bundles/{fish.payara.eclipse.micro/src/fish/payara/eclipse => fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools}/micro/MicroConstants.java (96%) rename bundles/{fish.payara.eclipse.micro/src/fish/payara/eclipse => fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools}/micro/MicroLaunchDelegate.java (89%) rename bundles/{fish.payara.eclipse.micro/src/fish/payara/eclipse => fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools}/micro/MicroRuntimeProcess.java (92%) rename bundles/{fish.payara.eclipse.micro/src/fish/payara/eclipse => fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools}/micro/MicroRuntimeProcessFactory.java (94%) rename bundles/{fish.payara.eclipse.micro/src/fish/payara/eclipse => fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools}/micro/PayaraMicroPlugin.java (92%) rename bundles/{fish.payara.eclipse.micro/src/fish/payara/eclipse => fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools}/micro/ui/MicroLaunchConfigurationTabGroup.java (96%) rename bundles/{fish.payara.eclipse.micro/src/fish/payara/eclipse => fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools}/micro/ui/MicroProjectTab.java (88%) rename bundles/{fish.payara.eclipse.micro/src/fish/payara/eclipse => fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools}/micro/ui/wizards/Messages.java (97%) rename bundles/{fish.payara.eclipse.micro/src/fish/payara/eclipse => fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools}/micro/ui/wizards/Messages.properties (100%) rename bundles/{fish.payara.eclipse.micro/src/fish/payara/eclipse => fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools}/micro/ui/wizards/MicroProjectWizard.java (99%) rename bundles/{fish.payara.eclipse.micro/src/fish/payara/eclipse => fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools}/micro/ui/wizards/MicroProjectWizardPage.java (99%) rename bundles/{fish.payara.eclipse.micro/src/fish/payara/eclipse => fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools}/micro/ui/wizards/MicroSettingsWizardPage.java (93%) create mode 100644 bundles/fish.payara.eclipse.tools.server/.classpath create mode 100644 bundles/fish.payara.eclipse.tools.server/.project rename {features/fish.payara.eclipse.micro.feature => bundles/fish.payara.eclipse.tools.server}/.settings/org.eclipse.core.resources.prefs (100%) rename {features/fish.payara.eclipse.micro.feature => bundles/fish.payara.eclipse.tools.server}/.settings/org.eclipse.m2e.core.prefs (100%) create mode 100644 bundles/fish.payara.eclipse.tools.server/META-INF/MANIFEST.MF create mode 100644 bundles/fish.payara.eclipse.tools.server/build.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/GlassFishLogo.png create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/Javaicon.gif create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/appclient_module.gif create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/create.png create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/create@2x.png create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/ear.gif create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/ejb_module.gif create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/folder_open.gif create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/folder_open.png create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/folder_open@2x.png create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/glassfishserver.gif create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/glassfishserver_1.gif create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/java_jar.gif create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/logfile.png create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/logfile@2x.png create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/payara-blue.png create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/payara-blue@2x.png create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/payara-blue@2x_1.png create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/payara-blue_1.png create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/registration.png create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/resources.gif create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/web_module.gif create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/obj16/webservice.png create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/payara-blue.png create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/payara-yellow.png create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/wizard75x66.png create mode 100644 bundles/fish.payara.eclipse.tools.server/icons/wizard75x66@2x.png create mode 100644 bundles/fish.payara.eclipse.tools.server/plugin.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/plugin.xml create mode 100644 bundles/fish.payara.eclipse.tools.server/pom.xml create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/Messages.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/Messages.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraRuntime.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraServer.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraServerPlugin.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ServerStatus.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/Status.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/AssembleModules.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/EclipseToPayaraArchiveConverter.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/ExportJavaEEArchive.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/deploying/PayaraServerBehaviour.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/events/RuntimeLifecycleListener.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/events/ServerLifecycleListener.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/HttpPortUpdateException.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/PayaraLaunchException.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/UniqueNameNotFound.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishEjbFacetInstallDelegate.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishEjbFacetUninstallDelegate.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishWebFacetInstallDelegate.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishWebFacetUninstallDelegate.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishDeploymentDescriptor.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishEjbDeploymentDescriptor.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishWebDeploymentDescriptor.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/AbstractGlassfishDeploymentDescriptor.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishDeploymentDescriptorFactory.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishDescriptorType.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishEjbDeploymentDescriptor.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishWebDeploymentDescriptor.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/AbstractPayaraSelectionHandler.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/OpenDomainHomeHandler.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/OpenServerHomeHandler.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/PayaraStateTester.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/PayaraVersionTester.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ShowURLHandler.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ViewAdminConsoleHandler.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ViewLogHandler.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ContainersRefresherThread.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ContainsRuntimeComponentType.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/InstallJAXRS.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/Library.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ManifestUtil.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraClasspathProvider.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraRuntimeBridge.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraStateResolver.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/RuntimeComponentProvider.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/RuntimeComponentProvidersExtensionPoint.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ServerStateListener.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ServerStatusMonitor.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibraries.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesContainer.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesContainer.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesSetting.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/AbstractLogFilter.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/AbstractPayaraConsole.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/ILogFilter.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/IPayaraConsole.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LevelResolver.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogFormatterSimple.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogRecord.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/NoOpFilter.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PatternLogFilterV4.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraConsole.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraConsoleManager.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraStartupConsole.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/StateLogFilterV3.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/V3LogFilter.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/preferences/PreferenceConstants.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/preferences/PreferenceInitializer.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sapphire/PayaraServerConfigServices.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/ExceptionMessages.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishStatus.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishStatusListener.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishToolsConfig.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/LogMessages.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/PayaraIdeException.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskEvent.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskState.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskStateListener.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ActionReport.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactory.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactoryHttp.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactoryRest.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Command.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandAddResources.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandChangeAdminPassword.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateAdminObject.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateCluster.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateConnector.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateConnectorConnectionPool.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateInstance.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateJDBCConnectionPool.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateJDBCResource.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteCluster.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteInstance.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteResource.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeploy.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDisable.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandEnable.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandException.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandFetchLogData.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandGetProperty.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandJava.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandJavaClassPath.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListComponents.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListResources.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListWebServices.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandLocation.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRedeploy.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRestartDAS.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRestoreDomain.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandSetProperty.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartCluster.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartDAS.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartInstance.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopCluster.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopDAS.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopInstance.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandTarget.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandTargetName.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandUndeploy.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandVersion.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ExceptionMessages.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/LogMessages.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/MessagePart.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/PasswordFile.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOContent.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOParser.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOResult.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Result.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultList.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultLog.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultMap.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultProcess.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultString.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Runner.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadmin.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadminChangeAdminPassword.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadminRestoreDomain.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttp.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpAddResources.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpClass.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateAdminObject.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateConnector.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateConnectorConnectionPool.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateInstance.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateJDBCConnectionPool.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateJDBCResource.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeleteInstance.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeleteResource.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeploy.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpEnableDisable.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpGetProperty.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListComponents.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListResources.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListWebServices.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpLocation.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpRedeploy.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpRestartDAS.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpSetProperty.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpTarget.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpUndeploy.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerJava.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerLocal.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRest.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestAddResources.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestClass.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateCluster.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateConnector.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateConnectorPool.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateInstance.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateJDBCConnectionPool.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateJDBCResource.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteCluster.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteInstance.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteResource.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeploy.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDisable.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestEnable.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestFetchLogData.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestGetProperty.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestList.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListApplications.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListResources.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListWebServices.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestLocation.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestSetProperty.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStartCluster.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStartInstance.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopCluster.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopDAS.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopInstance.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestUndeploy.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ServerAdmin.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ValueLog.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ValueProcess.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CloudTasks.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CommandCloud.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CommandCloudDeploy.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerHttpCloud.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerRestCloud.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerRestCloudDeploy.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ActionReport.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/MessagePart.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseContentType.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseParser.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseParserFactory.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestActionReport.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestResponseParser.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestXMLResponseParser.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/DataException.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ExceptionMessages.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishAdminInterface.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishConfig.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishContainer.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishJavaEEConfig.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishJavaSEConfig.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishLibrary.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishServerStatus.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusCheck.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusCheckResult.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusTask.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/IdeContext.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/LogMessages.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/StartupArgs.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/StartupArgsEntity.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ToolConfig.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ToolsConfig.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishAccount.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishAccountEntity.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishCloud.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishCloudEntity.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/logging/Logger.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ExceptionMessages.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLog.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogEvent.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogEventListener.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogException.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogLocal.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogPiped.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogRemote.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogSimple.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/JDK.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/JpaSupport.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/LogMessages.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ServerStatus.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ServerTasks.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/AsadminTool.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigBuilder.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigBuilderProvider.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigUtils.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/FileSet.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishConfigManager.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishConfigXMLImpl.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishTool.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishV3.xml create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishV4.xml create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaEEProfile.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaEESet.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSEPlatform.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSESet.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSet.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/LibraryNode.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ModuleType.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ServerConfigException.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/Tools.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/AbstractReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderClasspath.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJava.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavaEE.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavaSE.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavadocs.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderServer.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderSources.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderTools.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/FilesetReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/HttpData.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/HttpListenerReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEModuleReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEProfileCheckReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEProfileReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaSEPlatformReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JmxConnectorReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JvmConfigReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LinkReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LogMessages.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LookupReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/NetworkListenerReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/PathReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ResourcesReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TargetConfigNameReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TargetConfigReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ToolsAsadminReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TreeParser.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/XMLReader.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/AbstractTask.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/AdminPortTask.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/ExceptionMessages.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/GlassFishStatusEntity.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/LogMessages.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/RunnerTask.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/ServerStateException.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusJob.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusJobState.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResult.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResultLocations.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResultVersion.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusScheduler.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/CyclicStringBuffer.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/ExceptionMessages.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/Jar.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JarException.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JavaUtils.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JavaVersionDetector.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/LinkedList.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/LogMessages.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/NetUtils.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/OsUtils.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/ServerUtils.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/StringPrefixTree.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/Utils.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/AppDesc.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/ResourceDesc.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/WSDesc.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/AdminCredentialsDialog.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/PayaraServerLaunchDelegate.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/PayaraStartJob.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/StartupArgsImpl.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/PayaraToolsUIPlugin.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/editorsections/LaunchConfigurationTabGroup.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/editorsections/ServerSection.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/JAXRSActionPanels.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProvider.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProvider.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProviderFactory.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeLocatorDelegate.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeLocatorDelegate.sdef create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/LogStyle.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/PayaraConsoleTracker.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/PayaraLogPageParticipant.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/preferences/GlassFishPreferencePage.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/ClasspathContainerPage.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/ServerPropertyPage.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/SystemLibrariesVariantBlock.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/DriverMaps.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/JDBCInfo.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/JMSInfo.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/MailInfo.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/UrlData.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JDBCResourceWizardPage.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JDBCWizard.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JMSResourceWizardPage.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JMSWizard.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/MailResourceWizardPage.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/MailWizard.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/Messages.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/Messages.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/ResourceWizard.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceClassOperation.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceDataModelProvider.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceTemplateModel.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceWizard.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceWizardPage.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/ContainerResourceTemplate.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/GenericResourceTemplate.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/Messages.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/Messages.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/GenericActionProvider.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerModuleActionProvider.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewActionProvider.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewDynamicNodeProvider.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewLabelProvider.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/GotoModuleProjectInExplorerAction.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/OpenInBrowserAction.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/OpenModuleInFileBrowserAction.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/TestWebServiceAction.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/UndeployAction.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/UnregisterResourceAction.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/WSDLInfoWebServiceAction.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/ApplicationNode.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/DeployedApplicationsNode.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/DeployedWebServicesNode.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/NodeTypes.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/ResourcesNode.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/TreeNode.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/WebServiceNode.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/package-info.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/package-info.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/CreatePayaraDomain.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/GlassfishWizardResources.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/GlassfishWizardResources.properties create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraRuntimeWizardFragment.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraServerWizardFragment.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/SWTUtil.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/actions/TestRemotePayaraConnectionAction.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/EqualsFactory.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/Filter.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/HashCodeFactory.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/IsPayaraUtil.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/JdkFilter.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/JdtUtil.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/Jobs.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/ListFactory.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/MiscUtil.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/ModuleUtil.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/NamingUtils.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/NodesUtils.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/PartialCompletionException.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/PayaraLocationUtils.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/PluginUtil.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/ResourceUtils.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/ServerStatusHelper.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/SetFactory.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/SortedSetFactory.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/StreamGobbler.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/URIHelper.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/Utils.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/Version.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/VersionConstraint.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/WizardUtil.java create mode 100644 bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/WtpUtil.java delete mode 100644 features/fish.payara.eclipse.micro.feature/.polyglot.build.properties rename features/{fish.payara.eclipse.micro.feature => fish.payara.eclipse.tools.micro.feature}/.project (90%) create mode 100644 features/fish.payara.eclipse.tools.micro.feature/.settings/org.eclipse.core.resources.prefs create mode 100644 features/fish.payara.eclipse.tools.micro.feature/.settings/org.eclipse.m2e.core.prefs rename features/{fish.payara.eclipse.micro.feature => fish.payara.eclipse.tools.micro.feature}/build.properties (100%) rename features/{fish.payara.eclipse.micro.feature => fish.payara.eclipse.tools.micro.feature}/feature.xml (99%) create mode 100644 features/fish.payara.eclipse.tools.server.feature/.project create mode 100644 features/fish.payara.eclipse.tools.server.feature/.settings/org.eclipse.core.resources.prefs create mode 100644 features/fish.payara.eclipse.tools.server.feature/.settings/org.eclipse.m2e.core.prefs create mode 100644 features/fish.payara.eclipse.tools.server.feature/build.properties create mode 100644 features/fish.payara.eclipse.tools.server.feature/feature.xml diff --git a/bundles/fish.payara.eclipse.micro/.classpath b/bundles/fish.payara.eclipse.tools.micro/.classpath similarity index 100% rename from bundles/fish.payara.eclipse.micro/.classpath rename to bundles/fish.payara.eclipse.tools.micro/.classpath diff --git a/bundles/fish.payara.eclipse.micro/.project b/bundles/fish.payara.eclipse.tools.micro/.project similarity index 94% rename from bundles/fish.payara.eclipse.micro/.project rename to bundles/fish.payara.eclipse.tools.micro/.project index 8b637d7b..e42a879f 100644 --- a/bundles/fish.payara.eclipse.micro/.project +++ b/bundles/fish.payara.eclipse.tools.micro/.project @@ -1,6 +1,6 @@ - fish.payara.eclipse.micro + fish.payara.eclipse.tools.micro diff --git a/bundles/fish.payara.eclipse.micro/.settings/org.eclipse.core.resources.prefs b/bundles/fish.payara.eclipse.tools.micro/.settings/org.eclipse.core.resources.prefs similarity index 100% rename from bundles/fish.payara.eclipse.micro/.settings/org.eclipse.core.resources.prefs rename to bundles/fish.payara.eclipse.tools.micro/.settings/org.eclipse.core.resources.prefs diff --git a/bundles/fish.payara.eclipse.micro/.settings/org.eclipse.m2e.core.prefs b/bundles/fish.payara.eclipse.tools.micro/.settings/org.eclipse.m2e.core.prefs similarity index 100% rename from bundles/fish.payara.eclipse.micro/.settings/org.eclipse.m2e.core.prefs rename to bundles/fish.payara.eclipse.tools.micro/.settings/org.eclipse.m2e.core.prefs diff --git a/bundles/fish.payara.eclipse.micro/META-INF/MANIFEST.MF b/bundles/fish.payara.eclipse.tools.micro/META-INF/MANIFEST.MF similarity index 81% rename from bundles/fish.payara.eclipse.micro/META-INF/MANIFEST.MF rename to bundles/fish.payara.eclipse.tools.micro/META-INF/MANIFEST.MF index 0922573c..5dc4794d 100644 --- a/bundles/fish.payara.eclipse.micro/META-INF/MANIFEST.MF +++ b/bundles/fish.payara.eclipse.tools.micro/META-INF/MANIFEST.MF @@ -1,11 +1,11 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Payara Micro Tools -Bundle-SymbolicName: fish.payara.eclipse.micro;singleton:=true +Bundle-SymbolicName: fish.payara.eclipse.tools.micro;singleton:=true Bundle-Version: 2.0.0.qualifier Bundle-ClassPath: . Bundle-Localization: plugin -Bundle-Activator: fish.payara.eclipse.micro.PayaraMicroPlugin +Bundle-Activator: fish.payara.eclipse.tools.micro.PayaraMicroPlugin Bundle-Vendor: Payara Require-Bundle: org.eclipse.ui, org.eclipse.swt, diff --git a/bundles/fish.payara.eclipse.micro/build.properties b/bundles/fish.payara.eclipse.tools.micro/build.properties similarity index 100% rename from bundles/fish.payara.eclipse.micro/build.properties rename to bundles/fish.payara.eclipse.tools.micro/build.properties diff --git a/bundles/fish.payara.eclipse.micro/icons/payara-micro.png b/bundles/fish.payara.eclipse.tools.micro/icons/payara-micro.png similarity index 100% rename from bundles/fish.payara.eclipse.micro/icons/payara-micro.png rename to bundles/fish.payara.eclipse.tools.micro/icons/payara-micro.png diff --git a/bundles/fish.payara.eclipse.micro/plugin.properties b/bundles/fish.payara.eclipse.tools.micro/plugin.properties similarity index 100% rename from bundles/fish.payara.eclipse.micro/plugin.properties rename to bundles/fish.payara.eclipse.tools.micro/plugin.properties diff --git a/bundles/fish.payara.eclipse.micro/plugin.xml b/bundles/fish.payara.eclipse.tools.micro/plugin.xml similarity index 64% rename from bundles/fish.payara.eclipse.micro/plugin.xml rename to bundles/fish.payara.eclipse.tools.micro/plugin.xml index ba496fb2..1b9a62d4 100644 --- a/bundles/fish.payara.eclipse.micro/plugin.xml +++ b/bundles/fish.payara.eclipse.tools.micro/plugin.xml @@ -4,16 +4,16 @@ + class="fish.payara.eclipse.tools.micro.MicroRuntimeProcessFactory" + id="fish.payara.eclipse.tools.micro.processFactory"> @@ -26,9 +26,9 @@ @@ -40,18 +40,18 @@ + class="fish.payara.eclipse.tools.micro.ui.MicroLaunchConfigurationTabGroup" + id="fish.payara.eclipse.tools.micro.ui.launchConfigurationTabGroup" + type="fish.payara.eclipse.tools.micro.launchConfigurationType"> + id="fish.payara.eclipse.tools.micro.ui.launchConfigurationTypeImage"> diff --git a/bundles/fish.payara.eclipse.micro/pom.xml b/bundles/fish.payara.eclipse.tools.micro/pom.xml similarity index 93% rename from bundles/fish.payara.eclipse.micro/pom.xml rename to bundles/fish.payara.eclipse.tools.micro/pom.xml index 2e275c48..2d4475d7 100644 --- a/bundles/fish.payara.eclipse.micro/pom.xml +++ b/bundles/fish.payara.eclipse.tools.micro/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - fish.payara.eclipse.micro + fish.payara.eclipse.tools.micro eclipse-plugin Payara Micro Eclipse Tools diff --git a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/BuildTool.java b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/BuildTool.java similarity index 97% rename from bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/BuildTool.java rename to bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/BuildTool.java index ba1ede7b..2823d068 100644 --- a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/BuildTool.java +++ b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/BuildTool.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v20.html * SPDX-License-Identifier: EPL-2.0 */ -package fish.payara.eclipse.micro; +package fish.payara.eclipse.tools.micro; import java.io.FileNotFoundException; import java.util.List; diff --git a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/GradleBuildTool.java b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/GradleBuildTool.java similarity index 92% rename from bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/GradleBuildTool.java rename to bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/GradleBuildTool.java index 2340510e..ee5c65a0 100644 --- a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/GradleBuildTool.java +++ b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/GradleBuildTool.java @@ -7,11 +7,11 @@ * http://www.eclipse.org/legal/epl-v20.html * SPDX-License-Identifier: EPL-2.0 */ -package fish.payara.eclipse.micro; +package fish.payara.eclipse.tools.micro; -import static fish.payara.eclipse.micro.MicroConstants.EXPLODED_WAR_BUILD_ARTIFACT; -import static fish.payara.eclipse.micro.MicroConstants.UBER_JAR_BUILD_ARTIFACT; -import static fish.payara.eclipse.micro.MicroConstants.WAR_BUILD_ARTIFACT; +import static fish.payara.eclipse.tools.micro.MicroConstants.EXPLODED_WAR_BUILD_ARTIFACT; +import static fish.payara.eclipse.tools.micro.MicroConstants.UBER_JAR_BUILD_ARTIFACT; +import static fish.payara.eclipse.tools.micro.MicroConstants.WAR_BUILD_ARTIFACT; import java.io.File; import java.io.FileNotFoundException; diff --git a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/MavenBuildTool.java b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/MavenBuildTool.java similarity index 93% rename from bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/MavenBuildTool.java rename to bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/MavenBuildTool.java index 86cc9737..9f255e77 100644 --- a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/MavenBuildTool.java +++ b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/MavenBuildTool.java @@ -7,11 +7,11 @@ * http://www.eclipse.org/legal/epl-v20.html * SPDX-License-Identifier: EPL-2.0 */ -package fish.payara.eclipse.micro; +package fish.payara.eclipse.tools.micro; -import static fish.payara.eclipse.micro.MicroConstants.EXPLODED_WAR_BUILD_ARTIFACT; -import static fish.payara.eclipse.micro.MicroConstants.UBER_JAR_BUILD_ARTIFACT; -import static fish.payara.eclipse.micro.MicroConstants.WAR_BUILD_ARTIFACT; +import static fish.payara.eclipse.tools.micro.MicroConstants.EXPLODED_WAR_BUILD_ARTIFACT; +import static fish.payara.eclipse.tools.micro.MicroConstants.UBER_JAR_BUILD_ARTIFACT; +import static fish.payara.eclipse.tools.micro.MicroConstants.WAR_BUILD_ARTIFACT; import java.io.File; import java.io.FileNotFoundException; diff --git a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/Messages.java b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/Messages.java similarity index 96% rename from bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/Messages.java rename to bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/Messages.java index f84f2e3e..2c6c43c5 100644 --- a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/Messages.java +++ b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/Messages.java @@ -16,14 +16,14 @@ * SPDX-License-Identifier: EPL-2.0 ******************************************************************************/ -package fish.payara.eclipse.micro; +package fish.payara.eclipse.tools.micro; import org.eclipse.osgi.util.NLS; public class Messages extends NLS { static { - initializeMessages("fish.payara.eclipse.micro.Messages", Messages.class); + initializeMessages("fish.payara.eclipse.tools.micro.Messages", Messages.class); } public static String serverHome; diff --git a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/Messages.properties b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/Messages.properties similarity index 100% rename from bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/Messages.properties rename to bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/Messages.properties diff --git a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/MicroConstants.java b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/MicroConstants.java similarity index 96% rename from bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/MicroConstants.java rename to bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/MicroConstants.java index 93e2e488..cc2009a9 100644 --- a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/MicroConstants.java +++ b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/MicroConstants.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v20.html * SPDX-License-Identifier: EPL-2.0 */ -package fish.payara.eclipse.micro; +package fish.payara.eclipse.tools.micro; public interface MicroConstants { diff --git a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/MicroLaunchDelegate.java b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/MicroLaunchDelegate.java similarity index 89% rename from bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/MicroLaunchDelegate.java rename to bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/MicroLaunchDelegate.java index d65d8a92..2a2fa10f 100644 --- a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/MicroLaunchDelegate.java +++ b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/MicroLaunchDelegate.java @@ -7,14 +7,14 @@ * http://www.eclipse.org/legal/epl-v20.html * SPDX-License-Identifier: EPL-2.0 */ -package fish.payara.eclipse.micro; +package fish.payara.eclipse.tools.micro; -import static fish.payara.eclipse.micro.MicroConstants.ATTR_DEBUG_PORT; -import static fish.payara.eclipse.micro.MicroConstants.ATTR_HOST_NAME; -import static fish.payara.eclipse.micro.MicroConstants.ATTR_PORT; -import static fish.payara.eclipse.micro.MicroConstants.DEFAULT_DEBUG_PORT; -import static fish.payara.eclipse.micro.MicroConstants.DEFAULT_HOST; -import static fish.payara.eclipse.micro.MicroConstants.PLUGIN_ID; +import static fish.payara.eclipse.tools.micro.MicroConstants.ATTR_DEBUG_PORT; +import static fish.payara.eclipse.tools.micro.MicroConstants.ATTR_HOST_NAME; +import static fish.payara.eclipse.tools.micro.MicroConstants.ATTR_PORT; +import static fish.payara.eclipse.tools.micro.MicroConstants.DEFAULT_DEBUG_PORT; +import static fish.payara.eclipse.tools.micro.MicroConstants.DEFAULT_HOST; +import static fish.payara.eclipse.tools.micro.MicroConstants.PLUGIN_ID; import static org.eclipse.core.runtime.IStatus.ERROR; import static org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants.ATTR_ALLOW_TERMINATE; import static org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP; diff --git a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/MicroRuntimeProcess.java b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/MicroRuntimeProcess.java similarity index 92% rename from bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/MicroRuntimeProcess.java rename to bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/MicroRuntimeProcess.java index bd2e195d..4de0e554 100644 --- a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/MicroRuntimeProcess.java +++ b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/MicroRuntimeProcess.java @@ -7,14 +7,14 @@ * http://www.eclipse.org/legal/epl-v20.html * SPDX-License-Identifier: EPL-2.0 */ -package fish.payara.eclipse.micro; - -import static fish.payara.eclipse.micro.Messages.errorInInitializingMicroWatcher; -import static fish.payara.eclipse.micro.Messages.errorInReloadingMicro; -import static fish.payara.eclipse.micro.Messages.errorInTerminatingMicro; -import static fish.payara.eclipse.micro.MicroConstants.ATTR_RELOAD_ARTIFACT; -import static fish.payara.eclipse.micro.MicroConstants.HOT_DEPLOY_ARTIFACT; -import static fish.payara.eclipse.micro.MicroConstants.PROJECT_NAME_ATTR; +package fish.payara.eclipse.tools.micro; + +import static fish.payara.eclipse.tools.micro.Messages.errorInInitializingMicroWatcher; +import static fish.payara.eclipse.tools.micro.Messages.errorInReloadingMicro; +import static fish.payara.eclipse.tools.micro.Messages.errorInTerminatingMicro; +import static fish.payara.eclipse.tools.micro.MicroConstants.ATTR_RELOAD_ARTIFACT; +import static fish.payara.eclipse.tools.micro.MicroConstants.HOT_DEPLOY_ARTIFACT; +import static fish.payara.eclipse.tools.micro.MicroConstants.PROJECT_NAME_ATTR; import java.io.File; import java.io.IOException; diff --git a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/MicroRuntimeProcessFactory.java b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/MicroRuntimeProcessFactory.java similarity index 94% rename from bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/MicroRuntimeProcessFactory.java rename to bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/MicroRuntimeProcessFactory.java index adfeb5d0..9497d41e 100644 --- a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/MicroRuntimeProcessFactory.java +++ b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/MicroRuntimeProcessFactory.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v20.html * SPDX-License-Identifier: EPL-2.0 */ -package fish.payara.eclipse.micro; +package fish.payara.eclipse.tools.micro; import java.util.Map; diff --git a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/PayaraMicroPlugin.java b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/PayaraMicroPlugin.java similarity index 92% rename from bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/PayaraMicroPlugin.java rename to bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/PayaraMicroPlugin.java index ecec57d0..7af252b2 100644 --- a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/PayaraMicroPlugin.java +++ b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/PayaraMicroPlugin.java @@ -2,7 +2,7 @@ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template */ -package fish.payara.eclipse.micro; +package fish.payara.eclipse.tools.micro; import org.eclipse.ui.plugin.AbstractUIPlugin; diff --git a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/MicroLaunchConfigurationTabGroup.java b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/MicroLaunchConfigurationTabGroup.java similarity index 96% rename from bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/MicroLaunchConfigurationTabGroup.java rename to bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/MicroLaunchConfigurationTabGroup.java index 6f368607..b53afdc8 100644 --- a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/MicroLaunchConfigurationTabGroup.java +++ b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/MicroLaunchConfigurationTabGroup.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v20.html * SPDX-License-Identifier: EPL-2.0 */ -package fish.payara.eclipse.micro.ui; +package fish.payara.eclipse.tools.micro.ui; import java.util.ArrayList; import java.util.List; diff --git a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/MicroProjectTab.java b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/MicroProjectTab.java similarity index 88% rename from bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/MicroProjectTab.java rename to bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/MicroProjectTab.java index fc549512..975d221e 100644 --- a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/MicroProjectTab.java +++ b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/MicroProjectTab.java @@ -7,20 +7,20 @@ * http://www.eclipse.org/legal/epl-v20.html * SPDX-License-Identifier: EPL-2.0 */ -package fish.payara.eclipse.micro.ui; +package fish.payara.eclipse.tools.micro.ui; -import static fish.payara.eclipse.micro.MicroConstants.ATTR_BUILD_ARTIFACT; -import static fish.payara.eclipse.micro.MicroConstants.ATTR_CONTEXT_PATH; -import static fish.payara.eclipse.micro.MicroConstants.ATTR_DEBUG_PORT; -import static fish.payara.eclipse.micro.MicroConstants.ATTR_MICRO_VERSION; -import static fish.payara.eclipse.micro.MicroConstants.ATTR_RELOAD_ARTIFACT; -import static fish.payara.eclipse.micro.MicroConstants.AUTO_DEPLOY_ARTIFACT; -import static fish.payara.eclipse.micro.MicroConstants.DEFAULT_DEBUG_PORT; -import static fish.payara.eclipse.micro.MicroConstants.EXPLODED_WAR_BUILD_ARTIFACT; -import static fish.payara.eclipse.micro.MicroConstants.HOT_DEPLOY_ARTIFACT; -import static fish.payara.eclipse.micro.MicroConstants.JAVA_HOME_ENV_VAR; -import static fish.payara.eclipse.micro.MicroConstants.UBER_JAR_BUILD_ARTIFACT; -import static fish.payara.eclipse.micro.MicroConstants.WAR_BUILD_ARTIFACT; +import static fish.payara.eclipse.tools.micro.MicroConstants.ATTR_BUILD_ARTIFACT; +import static fish.payara.eclipse.tools.micro.MicroConstants.ATTR_CONTEXT_PATH; +import static fish.payara.eclipse.tools.micro.MicroConstants.ATTR_DEBUG_PORT; +import static fish.payara.eclipse.tools.micro.MicroConstants.ATTR_MICRO_VERSION; +import static fish.payara.eclipse.tools.micro.MicroConstants.ATTR_RELOAD_ARTIFACT; +import static fish.payara.eclipse.tools.micro.MicroConstants.AUTO_DEPLOY_ARTIFACT; +import static fish.payara.eclipse.tools.micro.MicroConstants.DEFAULT_DEBUG_PORT; +import static fish.payara.eclipse.tools.micro.MicroConstants.EXPLODED_WAR_BUILD_ARTIFACT; +import static fish.payara.eclipse.tools.micro.MicroConstants.HOT_DEPLOY_ARTIFACT; +import static fish.payara.eclipse.tools.micro.MicroConstants.JAVA_HOME_ENV_VAR; +import static fish.payara.eclipse.tools.micro.MicroConstants.UBER_JAR_BUILD_ARTIFACT; +import static fish.payara.eclipse.tools.micro.MicroConstants.WAR_BUILD_ARTIFACT; import static org.eclipse.core.externaltools.internal.IExternalToolConstants.ATTR_BUILD_SCOPE; import static org.eclipse.core.externaltools.internal.IExternalToolConstants.ATTR_LOCATION; import static org.eclipse.core.externaltools.internal.IExternalToolConstants.ATTR_TOOL_ARGUMENTS; @@ -61,8 +61,8 @@ import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Text; -import fish.payara.eclipse.micro.BuildTool; -import fish.payara.eclipse.micro.ui.wizards.Messages; +import fish.payara.eclipse.tools.micro.BuildTool; +import fish.payara.eclipse.tools.micro.ui.wizards.Messages; public class MicroProjectTab extends AbstractJavaMainTab { @@ -197,7 +197,7 @@ public void setDefaults(ILaunchConfigurationWorkingCopy config) { } else { config.setAttribute(ATTR_PROJECT_NAME, EMPTY_STRING); } - config.setAttribute(DebugPlugin.ATTR_PROCESS_FACTORY_ID, "fish.payara.eclipse.micro.processFactory"); + config.setAttribute(DebugPlugin.ATTR_PROCESS_FACTORY_ID, "fish.payara.eclipse.tools.micro.processFactory"); } @Override diff --git a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/wizards/Messages.java b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/Messages.java similarity index 97% rename from bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/wizards/Messages.java rename to bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/Messages.java index 3c5d05af..39b63a7b 100644 --- a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/wizards/Messages.java +++ b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/Messages.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v20.html * SPDX-License-Identifier: EPL-2.0 */ -package fish.payara.eclipse.micro.ui.wizards; +package fish.payara.eclipse.tools.micro.ui.wizards; public class Messages extends org.eclipse.osgi.util.NLS { diff --git a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/wizards/Messages.properties b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/Messages.properties similarity index 100% rename from bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/wizards/Messages.properties rename to bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/Messages.properties diff --git a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/wizards/MicroProjectWizard.java b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/MicroProjectWizard.java similarity index 99% rename from bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/wizards/MicroProjectWizard.java rename to bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/MicroProjectWizard.java index 236bc7cd..4e9d033c 100644 --- a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/wizards/MicroProjectWizard.java +++ b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/MicroProjectWizard.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v20.html * SPDX-License-Identifier: EPL-2.0 */ -package fish.payara.eclipse.micro.ui.wizards; +package fish.payara.eclipse.tools.micro.ui.wizards; import static java.lang.Boolean.FALSE; import static java.lang.Boolean.TRUE; diff --git a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/wizards/MicroProjectWizardPage.java b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/MicroProjectWizardPage.java similarity index 99% rename from bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/wizards/MicroProjectWizardPage.java rename to bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/MicroProjectWizardPage.java index a3240683..a62f4da9 100644 --- a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/wizards/MicroProjectWizardPage.java +++ b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/MicroProjectWizardPage.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v20.html * SPDX-License-Identifier: EPL-2.0 */ -package fish.payara.eclipse.micro.ui.wizards; +package fish.payara.eclipse.tools.micro.ui.wizards; import java.util.regex.Pattern; diff --git a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/wizards/MicroSettingsWizardPage.java b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/MicroSettingsWizardPage.java similarity index 93% rename from bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/wizards/MicroSettingsWizardPage.java rename to bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/MicroSettingsWizardPage.java index 290a3606..80de6dfd 100644 --- a/bundles/fish.payara.eclipse.micro/src/fish/payara/eclipse/micro/ui/wizards/MicroSettingsWizardPage.java +++ b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/MicroSettingsWizardPage.java @@ -7,11 +7,11 @@ * http://www.eclipse.org/legal/epl-v20.html * SPDX-License-Identifier: EPL-2.0 */ -package fish.payara.eclipse.micro.ui.wizards; +package fish.payara.eclipse.tools.micro.ui.wizards; -import static fish.payara.eclipse.micro.ui.wizards.MicroProjectWizard.ARCHETYPE_AUTOBIND_HTTP; -import static fish.payara.eclipse.micro.ui.wizards.MicroProjectWizard.ARCHETYPE_CONTEXT_ROOT; -import static fish.payara.eclipse.micro.ui.wizards.MicroProjectWizard.ARCHETYPE_MICRO_VERSION; +import static fish.payara.eclipse.tools.micro.ui.wizards.MicroProjectWizard.ARCHETYPE_AUTOBIND_HTTP; +import static fish.payara.eclipse.tools.micro.ui.wizards.MicroProjectWizard.ARCHETYPE_CONTEXT_ROOT; +import static fish.payara.eclipse.tools.micro.ui.wizards.MicroProjectWizard.ARCHETYPE_MICRO_VERSION; import static java.nio.charset.StandardCharsets.UTF_8; import java.io.UnsupportedEncodingException; diff --git a/bundles/fish.payara.eclipse.tools.server/.classpath b/bundles/fish.payara.eclipse.tools.server/.classpath new file mode 100644 index 00000000..d9925b3f --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/.classpath @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/bundles/fish.payara.eclipse.tools.server/.project b/bundles/fish.payara.eclipse.tools.server/.project new file mode 100644 index 00000000..839d14ac --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/.project @@ -0,0 +1,34 @@ + + + fish.payara.eclipse.tools.server + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/features/fish.payara.eclipse.micro.feature/.settings/org.eclipse.core.resources.prefs b/bundles/fish.payara.eclipse.tools.server/.settings/org.eclipse.core.resources.prefs similarity index 100% rename from features/fish.payara.eclipse.micro.feature/.settings/org.eclipse.core.resources.prefs rename to bundles/fish.payara.eclipse.tools.server/.settings/org.eclipse.core.resources.prefs diff --git a/features/fish.payara.eclipse.micro.feature/.settings/org.eclipse.m2e.core.prefs b/bundles/fish.payara.eclipse.tools.server/.settings/org.eclipse.m2e.core.prefs similarity index 100% rename from features/fish.payara.eclipse.micro.feature/.settings/org.eclipse.m2e.core.prefs rename to bundles/fish.payara.eclipse.tools.server/.settings/org.eclipse.m2e.core.prefs diff --git a/bundles/fish.payara.eclipse.tools.server/META-INF/MANIFEST.MF b/bundles/fish.payara.eclipse.tools.server/META-INF/MANIFEST.MF new file mode 100644 index 00000000..83a3d846 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/META-INF/MANIFEST.MF @@ -0,0 +1,60 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Payara Server Tools +Bundle-SymbolicName: fish.payara.eclipse.tools.server;singleton:=true +Bundle-Version: 2.0.0.qualifier +Bundle-ClassPath: . +Bundle-Localization: plugin +Bundle-Activator: fish.payara.eclipse.tools.server.PayaraServerPlugin +Bundle-Vendor: Payara +Require-Bundle: + org.eclipse.emf.codegen, + org.eclipse.jst.server.core, + org.eclipse.jst.j2ee, + org.eclipse.jst.server.core, + org.eclipse.jst.servlet.ui, + org.eclipse.jst.j2ee.ejb, + org.eclipse.jst.common.project.facet.core, + org.eclipse.jst.common.project.facet.ui, + org.eclipse.jst.j2ee, + org.eclipse.jst.j2ee.core, + org.eclipse.jst.j2ee.ejb, + org.eclipse.jst.j2ee.web, + org.eclipse.jst.j2ee.ui, + org.eclipse.jst.jee.ui, + org.eclipse.jst.server.generic.core, + org.eclipse.wst.server.core, + org.eclipse.wst.server.ui, + org.eclipse.wst.common.project.facet.core, + org.eclipse.wst.common.project.facet.ui, + org.eclipse.wst.common.frameworks.ui, + org.eclipse.ui.console, + org.eclipse.ui, + org.eclipse.ui.ide, + org.eclipse.ui.forms, + org.eclipse.ui.navigator, + org.eclipse.ui.workbench.texteditor, + org.eclipse.text, + org.eclipse.swt, + org.eclipse.jem.util, + com.sun.jna, + com.sun.jna.platform, + org.apache.ant, + org.eclipse.m2e.core, + org.eclipse.m2e.core.ui, + org.eclipse.m2e.archetype.common, + org.eclipse.debug.core, + org.eclipse.debug.ui, + org.eclipse.core.expressions, + org.eclipse.core.externaltools, + org.eclipse.core.runtime, + org.eclipse.jdt.core, + org.eclipse.jdt.debug, + org.eclipse.jdt.debug.ui, + org.eclipse.jdt.ui, + org.eclipse.jdt.launching, + org.eclipse.datatools.connectivity, + org.eclipse.datatools.connectivity.ui +Bundle-RequiredExecutionEnvironment: JavaSE-17 +Bundle-ActivationPolicy: lazy +Import-Package: org.eclipse.ui.navigator.resources diff --git a/bundles/fish.payara.eclipse.tools.server/build.properties b/bundles/fish.payara.eclipse.tools.server/build.properties new file mode 100644 index 00000000..d24082bd --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/build.properties @@ -0,0 +1,7 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.properties,\ + plugin.xml,\ + icons/ diff --git a/bundles/fish.payara.eclipse.tools.server/icons/GlassFishLogo.png b/bundles/fish.payara.eclipse.tools.server/icons/GlassFishLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..5d7c5fd63a813ee9e443530618b316fd7e74ca9c GIT binary patch literal 3908 zcmV-K54-S*P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z000DUNkljF@K*MawPg|z&(9*^hp zxpU_i6+wu;j#aoY?Er&iK&42x&^`&s}Npci<%P%~UES7dN-u&lnm{`vJ5 zj%D%#(!0AssA~$*P9Owy<>Q19`iT=KE=Qx$7dDa{KxEUH^vIe@xEJ^d*qwji@p#4~ zkx1tB>C^R!qA)!@O>1i_O-)S<3=EVEAWb$*w=X>upb_{Q*qr}OFc=)3nwqMwtgPG& zpzAt;K!9j8N;n+m*s)`TLZQ+D?oObjV?_bB17GC!9>D1A>>Tdz?{8KVWjS_YVuE-) z&hg{NIePRchG8%?G*mJG(m$+U+i9|yBe7<~~bUK}K ze0*FMi(T#a!=FjxtJh@e<|V1?x-47)E8x!+Tl)O@^O25@j>ckdp=lZe0|NvC0gfCw z!tn4g)z#G{wm%zEDPzf5v+@|u&CS)FJbCiN$;nC1oH-33O@hQ!tA}`CtR90Vc5Mzk6{mB9q_V#a=mX;RR12CTv7!t0; zi+B30Wh;xD_Z0=`0|LNIzFaO|ym+9hs_IHO9KKd6!1X)-NvzfUfZMjBArir+uQs2KD_v6cz!rJ`TTIs`Fzgj z?0@drUAwC?hzuf05D-IzF+vz&24fZq6$U(l0w$mcgPXU_eu^^8EKW{)mgAAY)r$t# zlGQ~52o=gP=l7pL#3RI6$*`3SP_YO=JUy-Z+vyK3$8MQ?040QGEKe`~G5B4(3UYA{ zCuz*t+`bb(s@XUVgn10ha?tIM4366n9)!qq!KqTOY2sA0w&R6%f zbPh8NlVoTfWBa%UA*eOa8SUQYUq-)b)5d+SAQj;d!y}$SJO>&5Uv>s?I^)c58e;-* z@dT~6lKqng->J`R&e;St|L)25D3u`Fnjr>yhg*=tnws&{$$KN@9YIc$Gax&wVw236#S0J~)?3Xj4XRPo zbj8U7Xk{E*?(OgGTedyo@`TvqfEEPLe4Kv8mw$AmY|tflm=dao3im^1>T= z+hr*d`r}$})31c&_|t}6>kkmyk3M!^^*{|-uw%_(*+`){HBCemH3tvBp@nM#BOtC+^Hq&t_ZBI$7 z#6uN7pChnKlNpbv@&-@EZfm>q>Svl_TuS+lAtuZTDDQN`k>U5nlUHOU)8iu zT3@w#m3-?5J16q$8c&N}dHtS)557}S(Ymu{)86Xbf~K5I^RWw?H(Wkac`>K$z-(5= e3l{N9r61+A7VRlbmsHVNGOaIt?;9c!@#Mc)reO8} literal 0 HcmV?d00001 diff --git a/bundles/fish.payara.eclipse.tools.server/icons/obj16/appclient_module.gif b/bundles/fish.payara.eclipse.tools.server/icons/obj16/appclient_module.gif new file mode 100644 index 0000000000000000000000000000000000000000..4423578f1958106fb3a11c24130bd983ade05781 GIT binary patch literal 604 zcmZ?wbhEHb6krfwc*ekR!^!{ktc5>*{`vOf&)4t2KYaQ9`P=W0UxAEY?>_zb{_{^_ z!^*s_4J~tauh?^K;pWr(&ON^N_{+WLpWl7{_4UV}FW-MxPTf&HX;aVABMs9xpSk_^ z^21L@F5JKS;@jO9Umv~x_Vn%dCvU#J|MKh2$M2uM{l0Mj!^H<5uRr;EK|>2 zrjfHuBX^lz;Y$6&Rpu3IEh^SJ)@}4|-R9l8HKb=}XwS~LNqbVK9Y~#iAZym4_g{a- zPTI5g%#DvO6?Xs`>oZl+p*MC;z#)HElLF`OCXXCO*5m^8bY` z8GRU%$Cn2v+&I$l?(5s@|1a$<`3&O2ZEkR2Ik_Qa`lHJ$etdm{tq(X-NXI=FYT^=b!<&^5=hPNxgIZH+}`&8=jR9iKfXBm|HFeF z{~w;6@pso;uL}&@XE@%!b9xp~@;(@Ud3E~#hljhs_{Ndm-#cf!U)eU>Q|9REw4={& zZT$EC;nx2*4>$eYvnce`_PHMF4D%ZlI1Vh0nRnypgzrDzUjk~}^8dxf$^Xx7EBU!= zuKz)hW|&vD&k4Tx?D~rTJLU$j#0Y~OGrT-bZ7%%*GT`)Pp*n9m*-~TN$g8GrgFKkOqx_zYi&!rt%waa=OL~y2oRb37ebL%u- zH8e25;~AJH1a2N~eFX~K^INmu?VswvgEt{HBp{r3bah<$=}p;hzI?a~j-A){cK<)W zt@!b=RWTj}QzS5oj$S>~^$!$vApH5oDRA_G@WtJ=KljY{-Hz7)P(bZl8awg&;ofhs z*m-__!v9knbAIfeAGmXUgMk21d1J#wC##d2%f5pQII$t`)8`R{HwC8)j_j%v% z`<^Gq$LIes$1uq0DuX<7{7vJHNL-PzAg1|^3Fu@|FLctKU_fZT-o|P)v?Yf8=y9DS z(m_0XoxDLFP0`C^vAfEzoQA7$T(8L^pCp*8e!*I6&tW>`vm;&;xFw6}ury{v&pj#B z4D^a65^uVflC$E?8Ijxn&VYcBO7=C7i#?l0+ z&7j*(8RWm!qv30hu&sa-* zin5et(=ND^E7OAFRs66XoE1VkyE1ScWnKfI#al zj?*@1hF33I-57YJfW9`V8*N%96tXrriTOTCPN=k)9SEfyveT^P!1(Z!Dal_aFoBLn z5mX3wJ6y5pA!dXZuuPKdze>raNy>7f$NIX|c=G!$^qPfWHF4l^V;YnRW5$Zp!fKJE zb^fl(QD&e~ksN>%*y4D2TYv}P>|g#h1$}K2*CLZ)F{VR}WIsm45+J%T(anmg?k3QoX9CKm*sf?Dcs1#SFith3pU!%HC{$-d;A1 zK=++YxRw>=P_RPHa>m*@H9^6qagD0e&Oggffh;jZK5q>`SfL3BlWd>d!lx!46m!Cz zXv$`lr)#J$p#Nknh|8NOD37sjDEG{oF~JWjNnWWS!raVPX2m$h2b*04D#ZKnDgs-H zMLnC>?oqvL7ZA6D_?`3fYCZ3`@1WN*%wYH|ktJ^GHffTfrS=cVJ@vj_@axL89;N#V z&0i;tbTnMq2@SH{2Z{gEjxP60{q`OIH*&(P6DwlHXV*H=^azli58}^hUIm}lwACj< zXJZa%WgmCVN4DodV&w?;7zubM-t%b3T1i}d?WLWL(V-4pC-k60;+gJ}#f_eYJ4=-imDM zxVbiYnsPpA&WB0?)sCCk=|$O&$wQU4$*)ql!&t`OhIN|qXO(Vio6ErL_`C;74*A0c zCst;J9#C>Zdaq?r?53*UVQi>tPVX4#(txS*EGRQ5SZP|&aB*tz`2`T5h+NK>vH{v} z=YZ`+3y#()7TxP01;^5Que~71O<=i4P^2AK6j%mO2?@5fjhk z9rDEWcqgvA2|R1&Ls5FTU6DfOFZvCbX~>g;E+DKej*-5`f4w7#Tt`UyTls==c}G%k zOGD`iXsJsC@tF^Xy>`F_%l41HG|?%4ET6g6k^9@~lmE%LB=`7=(afVHc-EQ<51+mL^8L4F{t?aG16sKUG_!YUW^B>Q*rJ)TRx4$V zR^k%v#3fpBbG75}DsNBN{pJxhS1-#Rng+Kl%Ll?T^QAzP_{S39>O|M$ZQf1WSi*rm7uh`JSj z-)){&sXwt)e?qB2N4`OQhCxZ9QFe@ZRK;cZGyUgh$Sd?3~u5 z#A})5%B!@XNkv=F&D+XcTV(+kr-_AirZuy!KFc%?Zf#RV1y(s3NeMBLE_PLQ9btP1 zM<-`nJJBvSLnFM_}@$*+~7nhfh`ze*e1&11& zCAIeGJW_mma=Hq?0t*KN;~{ZxWu*pBB?qR4exWljY~ z@=2R|mL6%CzWL1Ux0fD#y8Q6dkqh_lzW8?c#n;DgzCU{X?djX^Pu_fc^YMG*j7^O* zHeR^@;nKrT7ax4Qc>mpvr(do=`F!))m&b3uz5e*)*!7pMKYoAr`NzkvKR z?>~OdSh@4kgExE6-1zwQ$LDW9u0MRfrx>vccvbANXz z>CMF{Z;x01{qt*ioA>h0fK@%g4>lK1$hPdwv}jE*YK%4PNi(ku)jqYLAlFm1&{w_C zSM$l@#CwZUlkDYE92E*Y)%ubwuFpugIVWXip-+~p#>51hDam#@o_bd&#qRA&Ue_3Z zyd|VGzT9z7 zHswXE%!yi_8a6$`XJ$;`w2+`_fdRjM{rdm^Kf@@XZwM&>!@ zI0ZjlT)g0*oE?jn$c<*UK3S`VKMI$U7dpv1wy;P}D)eybW)fAfFg(G^#Hzq*w4&i* zE02h(mH|U#Lj#Af){GSl1&t1j-OM~85)&UiGOkDn5Juiz@d1Q5%SSK_TJaF#Nh@KJ4cxG zQ480R8H~-X?8=ST_IMT@_m?wkQCjn0;^AYxQemea+-!F7pJU9VtdlXp(YcK+@&L!L XVwS$yQ@Czdyu9?xEbk5@BZD;nmNZ~E literal 0 HcmV?d00001 diff --git a/bundles/fish.payara.eclipse.tools.server/icons/obj16/folder_open.gif b/bundles/fish.payara.eclipse.tools.server/icons/obj16/folder_open.gif new file mode 100644 index 0000000000000000000000000000000000000000..21322e0aaf5788039bfb789a8b2baab157bcac42 GIT binary patch literal 324 zcmZ?wbhEHb6krfwxXQrr=fjTwUr+yhx$*yp{g028{C~Ob)BP3yAI<%Lr}xd}IsY$| z{JT*4|62Xi6BBng811Mv+}~`nzr|#CgYofh^P`<+`~2r2P% raLBZEcF8!&@<{PaoHR+wSx%B`=B%0AlCIJV7B2E#vUJ%JM+R#E_+M?1 literal 0 HcmV?d00001 diff --git a/bundles/fish.payara.eclipse.tools.server/icons/obj16/folder_open.png b/bundles/fish.payara.eclipse.tools.server/icons/obj16/folder_open.png new file mode 100644 index 0000000000000000000000000000000000000000..88ad5b9dcc2f4c50c385f609ab7f413979c2657a GIT binary patch literal 508 zcmVr@aB2G@B0$c&~R}|d2!RS z`SP~D5x50|@ocQs9q`V3T`%otP%ddEJ@*lb(Hnd9?H;(cwc+nZF*$~lyo$n>46^(X zsqh_a2JG4&3UALV{MA@ZK;mf^v`-=EU*>R}i$njsfWu4-#k9=U7OEJ%H36$nIzhiL z)y3$o35a_-K)=rZ^2N6mL4-8=C*>o9fIs`2U!~i&5Tz}n87qV$xMOnOoO~1VZ*KehK&*(E$m(# z$jTsS(#xkYNQRW%*98~3zTXp{uo!n8?uu-r3EQ)Zi8Ip@DORlz`%!%aWj^#7h yyMw5!O%@!jjWu6ExZ89|=(jZe7wb8ff9N-5GK_X&=RIKn0000_|t!NK@TZ{)x(*r9uK+zmZywOX2IylqXbRXz6Au#EcAhTL?F*4H!qpl5KdW$iA zPXc{w6h`XK;Fa#QNtUh)J!ct4^*N_;=j0oo3XnZa!ii{Up83%H?;)l%1O>qZc7%T#LS8b<; zQFBK`)!Jc4_rBh0L9a%qB8V>@=4vPpbMdw|&~(ln6dB7iGxp1&NjS)g@5kH=1vin> zB@-&+>C5d@Fe>i&RMul$7%xMI?6~9NG#bwC1Vx6kV0@Xz75C%E9^(x|pA1BoZ>NAM zw3}EFQ_Oo)V)cEz1Ra^j*w|e^Eh|o=KFST0p(h^AalZV{FZp8bSrW)dHltv2c%!*? zt}uDlDUz|PFbyiumJ(pyxhmAz)!{u*8@U5&PK#upIl1wI7v`VFfefZ`q)fWaPzIC9 z$auqYD^q_4+NDPe8YN*|t^iD&~@<+ys7$Q`lL@{VE;4Y(k+r?X-F0 df5Cqhe*pj>{pBE{9@qc?002ovPDHLkV1k+?i0A+S literal 0 HcmV?d00001 diff --git a/bundles/fish.payara.eclipse.tools.server/icons/obj16/glassfishserver.gif b/bundles/fish.payara.eclipse.tools.server/icons/obj16/glassfishserver.gif new file mode 100644 index 0000000000000000000000000000000000000000..c1763ce5593745b9cef42f1a06f2dea3546045f5 GIT binary patch literal 29310 zcmbrlcUV);voH>#qS92PcTfqAA+b@^DZ@RrO@gyUo?f&N`?*|pzUOwdVQZx3_ z2ibf1zW1;r(|K>>0dldkb$rjQ?&x9X3-WOCmsk z9hsPPJ%mf9Qct2~TXRmxT#RDBNFh?gi9j`GqOk;>sUoqyS@EqTH1 zZ8l*#>6qKxmZtg`)8?6v$Ga>?>wT5erpDznzo&PV@t}7r#|2!!4?%n7emb|?w;0xMa5`$_&X$Md z9lZB{A>ZPwJ!;i=lHgMV)V4U&|AR_6Lk73ba!!aWR_hCMZTP>Svh=p)T%Zv4bKrwt z=EM3+&UAGv`@un%Ii@eTfpXpn0{*V#{~5s}e7kd#g6!y9NMb?CK`T=+dddRE{f*EQjQ_RY^V zOPr2lZJtg?HvIiu-`N+>hbmvnH3-4l8)oucq6?=iM01S(#S~&|-Ewo8rn6*Ny3y`n zj^3?1b#ixl8heWw%InftWOr3XODfwlEkrs;A?$i1ibV~M38b*X&z4iteew_SEqN=F ziUa7jxJcHD3zS3QQx1ygv{^8F1@CMK zDvH-;-s#iy^+r88xQoQ*yxJ-ieW1nwtJ@P>lP zHf%{wZZ_bEBL7*{&X0)?U2O zQ?5(VnV-0D;DXuCBClE|RQ z_S_SSOzway1{=@0#y@db_TTHu{|~tzUC3fD=#4yFod_zUk%E*{QWGL3?n(PRE+XKl zeIDUiFP)0O@7J;p?7Zme`qi~g9^X&>fEDUAJ`p?J#0PUk3l%F}YG6MvKcQ5ey~k!r=UpRVis<|n@W1FELK zu`2;h|H80Qy~LOelU9s;aM_Mu#PF%I)>AHXy6H%?up=?s9HUG{D|Mte_UYI>cQ2ID zIUwyVMtQgdJ9ha<2lwEgPG+pmIUTy_a&~MlS;xTjtuFyoVGJMawL~F2i>7V8X8_eD!~J*%vNO&(trL zhlrQutC#oxQxg0o`Gbs%UEam%t-fFOzJ;0Rg8H{U`?cAmO*4tq;8`XE7ngl~iJsJz z{D)CV)-SDZJoq-S^d=U9NoY2Fjk z|7uC$v-~+4G{5h4ATTO|pNH?kbyEa}l#f$zG&E zwpnd=6znZB55>k_w-Z>YhiJ$`moMe7rEqw)xK&8IoSE3=Ewvw3MP^sws@MGJ%>1Lu zf9se5A4wH?7p}UP0_7N7WQtXOR6pyt&ZNjtl6-M2YnC^@)C|4I|{YYwz=U*%@f9BEA~02WRj4oIqkj@CjF5D zSjHCTsZJU7?mWe2mU90>dV4{jIIjrU!mnTF%sqWQ@(r8cweM)>>kl}rSkq1UxYD7r z>A3H1Mn{r{%M|7ns8)}XpskOtYAGm+AYyUQ$W{H#e8Xwa$qrM=jqZkT;?AS2s!8W$ ziRh(8KBHPso00|A?l(q};nl;OW2Zb}kTYhF{A;rJ>K}WSq~320N=Uu74P-8|Q4qSG z@LuBMROojzrO4twF;vaL8{8sDrU()y0ZXX4@~T_nzYGjC3SS=YQZmD(v; zDF$xN*XjAt3z9rVS`dCEnF4Cs-1rtF^8)H zpgJj@RNms*VUvAa#AU3D7Vx;j;=x9l6qMAv{^dwERQl6K-(u1V1@ACEX+^bCtS5fG zOYM%|p#2Dqz>6HJb@{d2o0c(T(q(ECixlSd<6qwMv&K4)49N_5yqOx&rktCMia#Dx zlzMudqg#y2XZNA>(}<`dtoU}rv+c1@LHuT>{8G`8_V;*GMuIn31~Nz6@7;Ro@w325 zqV93Tx8AXu*;n>gzi?ge5K9^FL&x1(IhR2jnr}AB%HGZTG5hXeQZ%DV_1UX?G!eY| z;({@S!){X&Zcm&PXvS9jKVH{J63Xp;3YD1nW2?dY?$e}+wjfSyLghg!JSt|*+%y9k z_^tE-js26Uu<#Qu7G~CN@`U!{g7*!;j(`RSF{`_z-bsVR%*8OvOtsmMUa6)M7O8O) zT7oZyUm|J#T!V7XWJM)6@Md3##r5CL#hbWKFvU$8ewoxbdU0Tw&J0(gbmt>HNSy(#;)?~G@=uo?hkoU9Kb3({sLlCvJ@(e@4!@^YWVZB zeVE|xJW5EGr(MjcXL&2-Nt`oR4Y0n?*2?!%%mVd%@m}VToSiAoWFyM?Tmex72L~K0mY=@4;sYuqCF~>lT!o#8~oX)ICv*zBsMbz8mm6 zMYBfZ+EEa@=Sd}#JR;YVS4%8bh`Er*_>0ZGGLVchP{!^L&pd6nC%Rm0NebHPF)X6{ z$HAUcyXCg&^&hViKJbO>Uj6nV&g(ko1G?z2g1N_MKVAUiuSmU78n#Z14}DNTkFY*} z^ohql#;rP1HRShjdyO;O>PvcOS?*qK!@j8)gv6_-w7-jPV(WRJcf`9D1^!;0wyTr0~)MGa(7MbAE(#BsNQ7jN>~Wct0nw0yNSOLW5Pd+ z5_t~rTz>k%$l9$F`ffHX?D?#IiN59w$$JGalJ97I)Ep1gK0f)|%JDZ)Lzclj#v`kr zbd$e6te5e({7@)}lhl8YnGaGn(0HRFlf1(29)&cS?rAssP4ePVVASD;tZfH79~Wsx z3k4F9?9~tK5GuQ~;>H@rOkkC`pjo-+|98VZdyqo*;d-=)G2`!kGVg%wOswx!)6;?! z_UAGdA5pAI52g(aLO#xmD=Ybm2rB7W%HgsZa12M}Yf&H4blC4FV)a-gzDESQp=mov zWO-w+`v=?(?)O`Zo0Y-qlt->ecG9U6ZxQJtT+!MlGOF*jen;;x>OH>aCU%mQZmv8o zqej%4XGAMh_r14MdO_hC%q*h7oZn>$LA@94%(8T-&sYiexbS325TTgRmDyc9jj51| zCTG2N#6o#Q8YmNLv4qR;pH29XMdaItgcWNF;ji8**-}aMt^tI6iiyp#ybCu z^RYAfnK zUX^BOy9VGu@xqn%_Q~fgIvuh>gSW{%13ys?_wMO7d=d&E6%On2N8UWMi5bZ1UFoGG6UWzOK8L$S{bK7-^oridBtj3e}1JUGCQeN@451DMy)&1g|?3vm<#Q z8N{4Nq*=RAZ@Y3V$Bt;cZo{_X1&x}#IJC=tO%=SHty)jE=$QI2fS?P%){&ci#g6zr zy)Q$@(_NH5v)_LA7Drju$YZnKx>FNoS@5q{TX#Pq%d zD?vSKNYPn~686(i`Jm;Y$wT)RAu2q;!hO7xHTKJ4)c=D{Grwb*<}3CH;ec!V$A7V3cwl|411V6KfnH9l zlh8t_eh3BUO?%P#$WF4OA{=t7{|H+Z4SMHTYg9J14S({c;JN{xAY_bT-1|V+8E=YW zRAC@GX)u{%gY_rmkh< zc|aoO1y-T;&cA9*z4^-n9+XQ=e4yv;z8$apsCFG8*gvc}Y(G&Wx)X4Fx%g$Ed7pP3q zza#4s-o+8e(4b;UJpg=at*lfkC{W9jJXe)u!cuw`G2;|>*U-fWudwMS>lm9}r=D6j zbai2APQhq<9Td6zzV1LFzao1hh+h^kQG4Y{@BdbU{h;B-~43MX9Rgw4z zingA6!}q1Z%oLf$iL>wNI6bbI+~IjpHC(*oSy5;#soWUK|0wH;JEy^0tqP8oSkrqY z7q4r9^`_nB{Z2HVhVoTCPUU4W>ubRrgJ<4EZu9=W9rnnBeie$bScKt)o3((i2sWLAl|w{5J+d}mO8BK>06gw~Pf zzWGy7%!j8-(T&2tH+H|jHllQVSrJDK7t>E!^w6->(a}e3#2QqqHTP|+OM@+5R*$Cg zqLwv^v+{3@*$vlBB-A=bR6TtBIb zPIoXZUfsFjx=k|{U3bUX;XGOD6XljNSFs@9Y)#UX7+Y8O9pVcW<(aAz)1R@f#FnWQ z$KvaqCyuUovzuI73qOCYIgJlpO@p$QHM4{?%GmxHkCyQN@MPrm0Pu@c{r+B|sd>R! zqG1VK5Qr~lIz%k+mB02JRnPpI+7dKc!p*y zEkP{s)x!Zr=7YJm2Zwq4MH%apS1mK9mIjWtR`R^=iR|(0T{%xBbGth4@46met4{rK zbE%F<7hD`?B-JA%`QGv)F6^$DI1& zQW-n9z$stf6q#zhUM(tg7@|9x3*$S#8BeogAu7dQs;UzkqAgcT+i6hT1)7}IZ?q47 zdoct=N1W4>R7-jxi*ec5h%^2r!8H70WtCcWZJrv0mQi%6su<8#SdsqsDW#i{SQ~nc zZ2l3|gVCd+x*eAG(JjS{gO$o+i%IXsRfYg$6i2|qns9>GJa&!V9`wQa7$)6Z_w4?k z9ngK6JEe05@2U6@d(WVa-=7+#G_sE-{*4~U5U6{264xo_ul+;YE%lLkZv&v$D?t4| z{&)Wnn1ZMT%Rcwan_RvC__0Ujze{flp{l4<3-Rh@s#4&sO%J97p!k+o1(#N%a6C0< z8WoHcUJmkW2?0E<5)&TetrW!mc4e)18?8^awoVmG?$GX_xVXQDqV%MOu=VlZ>(e>g zb;O<}|MJmT@8=n9)tZhm>N=y3m3EBB#nU=NfsC=ponSeU_pQ!IbK9)-ISq$<< zNb_pXP<9QvSKWx!^it*)>uo#9Isftg5`*;mQL`WRR(IVHIH2*xjdh zZg|VNd<_{@D+Cc)G0>1{wcd{Ukp>y#g&AIUjZPaGyQ@RwHCirVkOz^;8wnjg@*$Si zo@mQ+{e@U954A@9kPiJ(n(F%xt2vQBI(sgQ8lWp0|6s;d$h5qOTOT&|H>y72ukx%% zRahgUa-uh6I zk*kVGC$}gpcMr{Biy{Z8Hs!V7HcM8#-g{@`R>w|_m*`m0QhLR`>GpT(pUqMq>}FaR z!^Y&CQXA|(WIeF0oGEdEHaDp4$8Ef17`NW z8kWY8VseWg#q1B!>mU$0EO}Q{HO4~7R52?zZJwbkN5@S65yGW3H*b9#8iU#g{ic?b zy-?GRYMl~20}?8D-4}eEVOFmiO$%qXp`YgexZf@c<>V7`I?|`gV2xjuoy}4PIOQY}Q9 z62Pm;oUh@&$G*sl_9r;%H`u)R0)3Tc z_uy7F8gn$2B^LQ7*k_aLC){ejaPQCGfes2(db-9mS=m%NDE#z`dn{7P!#AvkL$zk# zn%_}&(SrKx`8NBDiXaVN4dHg$^}>yZC!bpp%^xgUYB;d@L9OhBQilFk)rp&7c;Wb; z=4mx?G+jm-9G*5AnnS2D_SF|-MH(e6oFu(Qx>mC7_l;mc^EPrl z&mm|yY6qEapNV`JlFondm8C>&*%N5*&lCVJ3gs}{wt)3IRHpFl4g#8t<4B}zz6I>!E*Vj`jwRuBw- z?(32g75%g({1GgN>mm5*+sB&b?6z7n^i2JMEjMRDYU?Kxe2TdlV}D0JH@j!tGy#{E zJx@(7uDNSqXnkt(RpXCs6UhA@>R5{tNEyiN>(A&-cYv4Qf@xJrnyPVxL)owbEYG+V)=m~{?xKEe&3gftJFV$_xr}@sg z!%|-G@c7XfNiN&bZWh{+)@2qhm*+Qd1E~FJATSx9WFiU+JvKbzfGGWt5-^%)P%~S2 zS7%4Cpga&wRds*~L?Qd0$Tzb!IE#1q38Q;YW0U{lmo*lSd~0CiwG^ensv$XAwQYHS zQ>Ea~;zRCN=#Z*scux`c8@cI^+`eXUi)THqzxKu0)*y(J#QNk)@DN>T-S0oYrmr>q zW>5rVLEIR`ncCRD0x?0FHDCO9xp<-RyLuiBDym14q}%|Pi`^^k<;rj91I$6yDHv! z#=w0K7Jm4qlE{=&;lYqakGs?t2&JBM*h~`#1wW`50XH^&ZLr zX2wx&nlDsAnfenCg`#swkLtMFVZ*SGX>PQEKCgE=lPoigQ1Mu~5;jx)5RQZ37%pKE z@AxuVb^0d8Z@rApR?j3FiYuoNqJu5MX};xm&;u^G4~+_@{gmujjTu{1@~d)>T0c!E z@BIa|!}gMUs2mVa_W|#pwyw(U);wm8SC65IQ{Orb#+sjVh%c92JA5eQqt!}cS~USK zS@ks){%L{(&B1B)zM2Dj*%R8rkicu};P|rTgR;W9j@TETZl_O7jpJ*apQ7qRzGsqK zCH_!7e2bc$BVMhm=c}3BPA<2{7oEzva#_gjaVQAL2<6pvBwJ#?rmfvtFo3FuAaprKqTj{ywB{=mDY#e`AS(kh&C3Ef~(MRNQ!cZu0Ot*6#+xL(yQebM9~ zVRja$dzSn!NJdlPAi+RF1}1eMeomc7BSK@I6Y|IVe#-(?{+$L=RnUD`{SLe5eA)i% zQk%e^%S~#YB66GWj-+v}2}F*(mnH?v_(A| z*f}i$o%fs$_M6WUi;x|a&kW(?$nA6u4_dUx2w+vjJI($za3Vk=Yt*bJXqP)xZj)y( zCB6sFIQKHSE#F{3U~Xahc@uJ!@i_QXSF5OA$tiPZS-|M|Z@B#(I8W=juT@lFM8ADbi?l{pzJ z=dN-xo>o||Mun3C9y=rKR}I?6AN2j5q^ET7n_t?4>t*6{j(adpmvI++xI*RlAJ9@l zdEQviXzQHWgJken)5LwA?||>TAKxEqJm3snl9+=-v{&MP_O9*av{h|my zFRMx$E0!^?LfPg$pO)k2K9iSuLVKiytE|5G?s|56)xIOb}mXSL}uP& zx@im|Z;t(l^Z}+zwi!hD3bP&dgcU}%&k#0_kXOvWerMlqQFiPwrhrTaWgtJnZfaBt zBi)RO$g0!KL>?j?JkBkqE~JYxN4CcV2;p>GAyHgYD6CN_c;tH-hwQivO3=V$--9d40T78vlicJ3$4Csq?4IGN^BM8rbI|2XXK0yJbG$874$sMbcI!M z*S_Vew$1H>orfvvfLp~7w%E9=JqNmpi3aqQPqfs}CRnsfJ*tlDuWPs^fo$2XmjSuX zY(*RFlm_i@$`^z_!!BH3wc&byPoh+|Er4W(Y2yND--VhtHxwxS86Ut^7aC98DtG%yZndA z|9iR&u1;w=Oc~vyT=^LPDdDG&{!~uE*ix~Mw*B3l`!fEq=`3rr12MOrvBu=Qi@n*G zejcO3W^^sT{M~&)1NyhTc5TWE6bjc zH9R9`>zYae=B|$#Z(^4=|A|CxTgS44>)s86aHgpTkA~+>Yvwv=M!5)_vEO11jSMOr zUi1yu#yS;wI}dIJ=n<_BD_$1RiikW`cvU6lCAU;_5&|2q1cA8PlqSUePPTI=0l_n# z9(d!!F=-9jcykl459kT>lCaaGwdyF*TU56yrl+Ph0>J#0^-aa+yPsYaOLNBe? zT~bz8SSSly=Pjwj^RwfL=LTqXZ*T7kPchk|UBjth77^M`qq`y@0eSw?H_rCuPKHMS z9f#4{i?ZT-#HBqb6u~s@t2v@Q8V?9hNUw}=wILFWrH|uNQtapF=e6V-U9#j96!2w@f*CIswF=%eL;irJaXF2^ z(O>}Jus0x(KS%Z+Z6w&`!-s%s>2`k0*2fvzTLJ$l(Em2AOk>#!lNQAjf0WRWk=?5Q zuhk1SYWd%``9J9{S8q;i;(`pdy8a7RO&-DfvA+`TC8@u8;hK=;dvZYaV$h_LW5G`{ zcX~JS*NwYB$r3KGp3D*N|LgM8>;RL93y1yjTqKTG0fV@}wADH6(P}rSv(l=Q_!~3d z0VEj7{-*B6g|JrQ==AqT|AZ)Tvj+vvW)pYfH=u1crQB)2KCgQO$sZ%|Y zaB~WEf~F2L(vYjC}tRzt9mD?Lo@r`HTdg?^adIpTi zM*q_lr4G3WC9)wKMRDZZAgPR~hxI+A-uA!ruS$ivVe<`-2_wdX@Bp%HTxza&_n4;+ zmJgO>V6mt4!U~iA$N$_Uso$rCXW{E<%%+t~k0UkdjrSVSvyRJR)HvIPtH=t76Erbd z7Nomy*|LE7KTfMDbD8H3h!7v#&HT@~^iyN*hbL=P!HP&HAkjk;)Y1i~`L0uo)MgFk z1mB&7Zl(>V9ljiB!o__6!~#p9g8==CF^?w zkULoQ8@@9c5DZsR?#CJD{ei&KQ3AqvvW>|>(!+M6L;&>cBCDplEgIdsz=XJ1-nowc zx^T0lw}sh<*q71?-P_R19?C$!A!fs{-9#UxnHIoICAa_}Oz=J1->jc<8J|uh1S@C^ z*lcQjPVE#A{?b=vW`=XzyhhRnh%D0KqO70*7h*mQC=1RvMx zbVO6NGl0AC-9R94au>fcb90-v|1)Co4_f${<=%;t6%a6j`d+CH$j+}V$~V@;ZVFT!F76D%+hg}89FED8>7I5gcl zr)%+lp1YTJ0!22SJl+1XLqZr2f(uASK1b++B0UZ^!F^s_wT&2reb~ojC3&`&ikgHl zMI8o(tTbCa5QScQ3_*k4%s&nfHv2=WE^9=`26yB|{UVrVRw16Jc&nZ3jj{j|N9n7P z#mc8kt>*h??d$$Q%X3$lyAh{7u`)SR(53S{AlU}4b9ks)J8%Q=AM+wcjbOG~agyx# zgNRV7OIkm_lE=2N*vE7pu)$h7cz(qyEC=7ubdERIC$3WkDO3oOtb;=1dxsFx9e@74 zs9ig*x!Ti0-Sp=ma6Ni@H;-2Z|i5<`6^Z}C&Lbxa3DyklT?tjgi$WAH8lTq zIx4eu#@c|p_!~cH31ww(g223Xs0#&=^`YE%SzWu94i14M`=_*Oy=ev)abmv_8!eE%01P1C$2j=wi^ve9*{0fdqEFFne5ipC@`jMEwC zt3Xar4Axj`N6xGF6(?9;2y&g~gf<`pG&$ThG&)o9RF&&mNV2k-Y)If};M^eGZs3p# zm#L8oP865e>0c-t&KxjuI&T-%=ga0rev@Zom`%4m*fru;+B;e$?6e! z&&8|C#s%4}sTm9ql8DTb^ z7KODnKm2GdFLs?HQElH->BjmW(!=br)g-wPuDrtG$+>(>a_8@kbiJ;Kr>wG-wIxis zM*Yx`MsxXl3jiOYYh2oX>lq?R%5KD?06tFWJTb7=5Anek5%VpZF$UCn(s~bfg5-s; z`p_K>H2z5tVAg)0tBy2=X?O(a_lQfw7==J3prBq|;XB2A_>3PMN7D9KGi}+{; zBCf1qzLwXyv8Xk4w0s-xp=C@;ulJMyuT?*U7oZR=aWD6fjf^caDRD6ZN^42R%4^@+ zXd$o5aIXoh*7+;*?&!E2l&{}cDx@_=Fu8N@pvh`TD=0NS(FelBy}T%nh?~}Fle+D6 z!!FNGSfW4c@Zu>pPd4p@1E6IYr`GZ-`Z4Z2hP8YBlA}^=- zQX%bd0Z#lOjPxQqZs|$#*Hu|&>)!#k5><(DH_caZx`Z|3A+6msPeFklODz)6JY)?a z5u7EpA3Rmt*|>Tr*vz@;YN6MP^H}DvWE;WMeuxZ-;B7nzfbv&~E+DcMlq4X!a+5Im^a}x7|gg z?&mgSuuoS)`ShR$0Yckd1|)#|0f8Rt8HZT3%?#o6IbP9i%!+)TgOGkCVuC1T6Y`Op z^tY2opUVsf7l!PRmV&|?YlONJm&0|5vf%ucr9Z)`fzSGK`Mj=I?xe%~4ieU<%RS?b z2RofAWAw|o4EM9}qSJ_0@0W_8U1|+N=aEA6bgQ-iDZl1Ky9^~qxAEMfMr!dxnSD+M z3aFjFcQqhKv{Goc-7GLJ1J2RnakQk0)~PUoxfh14Zkx5T2gdtHx8+x$M*UfD+FTn5 zQ0XjMMz^99m*po9d=EdDR)6f5O)H}h81xJ<>P*4CsK`D+o)|{H_md=%egAa9z0&z0 z|MD{d*nb=?KQ1$sblp+g(NDG}NbXb-AgzdZ(RNq{fLAXI7`L zFMLu9lVSUCY>vfSRN2N=3)Xhag5e6_ep{fD+XqBxz#fuo(+Td~Tn7r|%%tbYDy=Z@raVlF@GOItIOU8&^@CfKR}?srE% zQ9TU~bO1gU`kT}b|HtMIIk+W<^VG2$NAc;TKqXD`_!Kb`xK`@dxeGV4`r%_4g*Wa@&|lzwS24V3J>JvjePHD5Et0ej2!8z`K291J5~j4+hp!G`uTq#bZh zTj&UJ7gVfo=!;|zFbp0SSql>#Qz{M#RWS7MX;D@h;sIb73~~tA1n4lFg>)#+)YMDd zR=D6hJ=iE9rV@fV*8ViiDiYPrxG#qo5>bYJJs)^3Ga_`f_T@VYLJ(DwI$LvBew}8&esbC-)cdqk?l-PI3 zBM>Y~aoQJY+cM@MfgQB!SG|ZN9o7`%<4O zaPLCyUz^RI0%NGHduX7w0daSZA#cV#J^pVAq++{i&E=4%w6CEQ_z3bF#bsa~(1%bVxw|P&IG@?GRNC5w)fR-kK(}c`^ zu$Hc!h4~8Ln6Os8b4s__Jxl8q(aV)uKZz+q;IvI9BE37HLl|lOU zOcl7ruF1R=|4n z|HHk+GQ^HzNYKzuQoy$&1(68U0A|D~9=;@2SpJu8-sZS6Qd;4FA%_X$Fo(vf?!?CG=dk?C7h{ zcX$BZ6lTD#iPV!w{PJN|ZT5Y5B*>o5&P8w+uA<>)yQ8lK~AIqG{T1 zd=ARI@At^=MO<4Cn?WCa84{k;c-3NL0xNnhw@=z0f=b#V)WI-@zx0q5y{|0n}7HCmD=ID$)>l0JDgTBK*p!j zhuB2&y#?eS3svmp`kx&Jw!OyweH{PTGRIw=L)5qz=Ofc1GE)MiUxi5q?+-MsUD11m z1ta6BLtG!MI~Y(dYdoPXLYzOe!i9Uf1{npv1@ik@+U%i|AFJ;Z!W;Ur3{~CZe3p7}i|OBu46l=xx_9|iI~Q|o}1%9;gAbMm;=d#rj$ zw}QCJYu1b%uJ=P2kAllOX!}9i0jZMA$K&ZVE?VnU+okJ127M5sg=MQ_oo)-=@@A6} zhss$iUmeCTZZD;D=St$%2l$Xz&nc3f%AG2uXb^;d2zgUKq|-8|!#R|_n!F=Wu=vPw_D4;pWhJum*nM8n<*uTC zkk$$6+^4tH4*zw*oRID@5S80(KI0*AYrBd@sBxQX&(pWmZ* z!^wk`l`gVU2GVz~zcrtVBM5P-RwrLqd~}#GSQ?bxsd4m@L$677Xp_Ro0{e}@FHT&f zHsi4VJDseRTHaW7$r?>N!I0qIPb5DD53LLOOguysuYVs(42B{*%``Tz9%DIti?j0% z`dhAWETGo|h1bGB=yvu+eGXe#s?~7rAp{mSL_C++oZ^soe9NEb`v?y4y@+hgNS3=k zb-ksizaI!IZ%EcB>it-!^c+Dhe~4e&Z8>~k8fz9}HC$=CGgHy{>$pZJCwt}?-8|xJ zF-MaAPa&VTe&1uZfG#?5&h2Z)cqeoS*%fJ9l-@mr%zQc|2dP-bBdQMM6*b=cs0Cz` z?f4)os~KnH6)=ow|4)tFAjbInx(DKHh`KL|a`1vz2Zrkm}*kgP_;_~D68R$z?!=?vV8yNWc2WXN6tGt zFml(t)UjpT`Y9xICQHDJCH`t{6Q(^i0BKO@> zQhu&mObg{EBhIP$AQDs$ko(0xJzPN;RPCp&Z$9vy8>9qR;PZy}lmL@jKG01$l?LKT zu$o-s0K}@)m0c)soajyJRzy~wbnY&Ce6P*IxQ`}xjMQ2vDUpV4$Ag)L+RyROP1Ydo zw(!%nl~b`ZQmZ(g_>YNt5bjK9jI#UKh_1lK0p-FgU@gZDQ8~Hqj9{3@lEZrIfYSCv za*MQ%Yv!`JSE1*ygOE|Ps(dFs(hZyu))A>;!w}LZxPF79M_3`3*0-=tgb*+3J`$Wt zx1I|Y@cHe1=+@VBC`xkwAqo(K~l2eQoRBIfX za#AkyOq6n|E5`x5tp=U`&Xpz*ExYRr0Bgxl_{pLC*p6DRDSSf)DL2q9*wpqw+bb9% zi?D_lEBs3A=hJ* zGw2rh{Ml(*OZ=6*x9*=S^zmRAiK3NA3s2cm$m%{k2bY`iLlyC0ds3WPPy`7>cZ%_> z3OIO$5MKXHUvy%RV-heIcJh0v4A&f07HC*Y2E-hs5w{68ysgG##L zj^^%PkyD)nmA8*-F4b1*=39_=&=5Ghz+1!p&<74Ot&`~+cH}G^i z;)3&bYO;o<9y zQ-X)U8K(Wf904vDKqPr(zcp!s`l6#o0z{sl6et!i8U;-bhPW$Q{pcX`|J|X}x_FG3 znA{hcalf8+zZJ)utW8{hEGV%4P+FfC3++Sz}xUrDsUWF{lN5>Cx|_l<@}mMu0< z%7%z|J^2m^0p$+lx^jq@1{(w~*HViAjR@Ra@(vv$?n;xph(|MQXS}w6zcR|zo?JPE#K8raK^pYKF2dP#0RO=;dg>Qd@Ij_JPK z|L}9qx1EuUjQq-fySUkB|68~Af6`sLxRB~w#kA1X{p1k~y z)&IX|(e80Kbf0DGiCg^!ycNB8*6Hb(k^U%p-v%BZDO9|76~aIoU8rvyb5W&&)@%c z=oLni@OGK65)Cir0Fo+>UUG5GV4Z2XIqfzG0*8uGGv|Qt(R9!b0_*y5zxw^z9x@Bv z9wf~i%YaqNBmnvo&<5Wg49k}u-i`lRj*k~Tb~&rh)dh=guWQED&tdFOUeAQ#0|Ez* z6((&*cBFP}GhDIq+m-V}q=K5)9TeYOaDjoCr~CH_e{feF#|!panboDMW)$Uk{Wq1 zJhuZ`yhrMX>I@3!PFUv}N%Sh&v^W$i?#{!dI4#AYIK|!lp~c;bYl}m1m*Vh%0uOh1xWmI9Z}~Qx{gTaY@@=wz z?8ziExtW~YIl1R|=H$%%%{?!CRF^2ww(Id{h9A-_Q6|R8y}%vFlRlFNj>y;I>?aevPe365*NyMy01cvcb4|F)gg*q) zT{GW4t-%|4@+-|>Ky8$wH-X6>?6;RJ0l=Q9aj|CYd+rWvvgTcw2*h;AdD{%~hu<&v zo)^lTkOmC0yQFnsau~~78i5z{})1R5-`1So7wwVNf(=*q3C)Iz|prKi4Z=l=Ag zG}Ad?Tgj6k3Gr{{~b3uOGdF(8AVt;J3FCnrJQrXfF7qF8Kd3 zsP7EHYAK_I|Gg#HH!!GBHeB>|WZRjpdfAFU7&K9c^YdFL)(6(IiCl>DD(y_z?G zwe^H~;VxN`jWBwUE=lnN$-CE{K1ufj;k)R#*x1-OwyYq{r=Mqed4~^k@VO{`w?heS zKQKle$9V_GmwiZpKpw(!V-ouiSpHjN@c@#u(cd?A2pi#n1J`Dhn<1F^h|QSf(|I5I zyw*~d>cjdjC;i=?FJ+t%(sI_MSm#}Mo4f7RiQjH|=SprdA97uow$-u%pcsS&t6$hk zOyZDh1w&fh40Bi3L7B$V_S`JbG6dIYvv_!{b9O7tXYxL3bV9f378)`WCc-2mvl8m4 zT#WXWe60ye4y-R{$Bv0!XDbS%39f(Z?&GpH5ydor16?riX5M13)@C$>E2acsKNi;X zSr)cX2Dv1()dU8H8nAE_^P2;s1=toITmSaq+35k5ViUAsp)um7w6~Bl3{pEw#0IX-)9f!s+#Kc}1#+>L%1LA^wSfgn>i4Ol|ZB z7MYz08HQbsT5qRAi0~rbGX&{lxkrfhUw@v8h$RNmnR9}WoJz`8Bl#^;a54)B>$jF1 zgQAW(m#Q`LkVMBl3#a>cn-r_e+j)$cR^14Ru`!AY!g0CrzgIgf#OZTlcx;CPcW!)t zw|avX_;Y+W%`N~XMW3iIHt!6{#onn?s4}S2GYjqtY>JeVh-2jbK7##=LDQ2ehV}y$ zahfa96IBY_1ahX3Re`!kBM;K%y19(QnV-6d+)*q$IL7V>pDREZyc}eK$ zm!13YgLAGrqBsI9$ouVk!dNW$G7N*-NbHk)e__j4>zwRw{z`0OyRB&foATGVnzlyM zP7DSbrZX_aC;=FmE}>q}q}UeeZvcLUo|6qiuzVirGnatiR!B9qz$f|33k;BBBF*^ys?ZK$Zvh6uuBe8h!8s0L47f?UyyRZBg zZ`2U{o3IZAA+>fIcS1RGEr||S_ZYTP>RFd_;K%jg$~+2*z?bBRz17Xdh@^JZLuuj1 zrfrM}tc4OJA?@l)WeQxG0nb0SX2*CcSO1IaR`|PiVX{YeRhFWdVimA^64QUr5^PP|MR_^4L+5spT+;al&dj&lA9^Se z+9QVxl2+~}oMC*}j^ppfUB0F24y8O`JbHqf?heS7IJ|Ea9b=#3oLuuibq9m^t1kOC z;fk9S9>1b5kB%cV60oc`%So_L!C=!9vb2b31AWqWA`)W5s*<0Ig|CrdNLAY({<##G6=Wi!@k6&cuCDshW(zbhUHssW@e%-C^^UTYkJGW3Dce(0e_wf``|+Zoz( zI!F!Jf?2cNLAG{*p_ZxU3LQPJB;&&m)YCh%iyY*H;y2^Ue^$?q(f>-W>8uUcs}dqV zaqR^sBJVt%9_)55Ue|bnTsGA7i?AfRiav2y|r7UTo?TkK) zQUUIJ0O_YAEWHy4=6)R|=dF;@`m5ketXBUno($Fl*rp**%N@<>I!mJcs!+>TG|S8Im^h%;=Z%|?A)teVMW#~7;fwvt%@vaxj%kF&V37iE8$(<~ zCw(Og;Gh%q;SHi2HN^%7vI)O9QNyVo#jvy%J-Z#9i-HFGv?bvS9mJ}-550ejVc{1$ zD210w@MwB>Vnk?8RXFQi2^m7#x-sXo-g$y17vEOflR;ur;% zeTq3hLcuYoi}AmX78Um;2Q3#{X?~Kfw;Gue_(OL6Ua@xIuI@rC`c^zUT~aHbB*F!` zVQBV<)UQeDe&K!(Rs6b@bv_O8HWQS8_Q{Du);b9_i;-(;X>aH0(@h++A{EX{oROWe z*!07x2;tfuIRYao(1EXIIsfWf_qgPglLSBdx4_7ZYW;Gb1^ML-59gXY9(^?zi3@yb zw?c=}Fg%DAgC)-3*JU2g*$vBgw_lcuJDhkmSfcL#7;GBP3+yZ`U+;XQVb8W;B;5Ka z-pnxAJ7%SqEY@S33|wsaW+ISVu`%LrL)kiU{Dyb2P$D>thvuC|JN}~!94v@N42o~W zg3aSTv#Ggt+jhujiAy*Ac>ab}aT?N?CR2WOhw?pMJDCMh>o74vQswUk>TFF|3_O|= zsb#p_!Ay*YNM12T%cZV?VxUdFi)wG@9;!>x{ylCtzTsBgp-MptwuawwGaDe%{PBJF zIFSeTpw*j25lYFiN-f1K4&a{Bl!~OY zu*cQ0Am!ZAPx~v{y;CP7BJH1sf!(=3V56R5*1qvOu?HxZG?#F6ZuyTc4q5D?DL6`3 zac>a>aRA8cRNLw&%zCakOBR;Hn4nR4)G<<=y)2B`$C*-iy6fLX#dLh?@jla&;o+6S zgHj2yA$$b3!nD>}UU&?-?1?^lOq<;0*ia4Ptc%OV$)cb$c?h5tI1;&YEGi2 zO>!+3e-(EV?vBH&J~5Bm069$A5nucM%MWiA{}JG_o~xl#nh^7x^thp!Bd*l4U%4tK zedQ>4*H{{L^Bz7mw~)XToOB+W70w)hwdsV>a4KSSP*uJnP%dv{?^PesDH%KKJLD(O zu3?e|z(#Dwkvk@zT_c;eX)L=poGy@;1_vx-_!#0$N)fOrN}$k1%K@2RN0vhrxe8}sSX;t7U_b3k z!tfKEV@LYDW^-|7LQ1?M?;g@wua`BB?eB|nb0K0CO-|om735^o#-nQ+azEUum?La&T0(O7CRl`(=*&Do47Uma2InuE&Xtzz@F%KQ+qzcZjn7>Ey7!&<@kH3=qZZZdNW#;Q0eqK@wDUtzqEUhlj+lJh+ zlc&TqKIy}6;_D=V3FnCqBdhQO%EAs3zFcMhngsf9xTFE3rulXRT58+y0;Y^WC2iV% zyDJ^U;1HGA9DVSuY$l4Da#~;M8|Xx#_6{m`@lVho6t*V%C);|0@LVO(l-X#ncAZw* z*7JaQ#_DSLmb$p7?Z&X>T6*tIK(dsFB2=req<{c*3JGD}`WTvd_Fk3x468y+FcMom zrbT4rbj$$iAmDN8c^AJnEXo_d-y}ZreC9=YSnd_;NOka33%`F%$UrG6;dNGinNlq( zX)Xm;RQg?WAh=`I&=n$IJGy7T2M}!@$60*8tTUUC5oo*?uN#xYXna>dRZTUI8_pJ7 zNx2skS=wykkIo$dPf8ODVz1aSq5pRLA6=mrSLNaO1WtaKnG z%5RWX7@qN_JNWU@8VSRw6d4 z(OkR%6N0C0QfM5f8fEzAl3rZ5b2pQFmu?4=B0M*J5~4TnW(Waw6Vq8oyX|+%I(=&QP97G7e&N_{UdiH>WJSSM&8CB^_svE6!STJ`(S};?p4o`A#`>R5*GvtW5yz-T^s_YN(i4v1 zXEfYDve%2>6xzgZLUT`iP`RL=5fW8sM|^N6HIX&&Ci3u4>9r*P)id(dn&u1RBQf!e zBIXUoY&I(qSIG?v>5kqjxy}z_@>LL}fAqg?gF;bsC*u>$Y(GMNCpim z!n~9ynn9t-E7A4Bx5e_v5cM!;CU8b7ErbX&EO<-Zh~V6Gn>~6`X(@Kpe){>a4L>n- z@no6xpRL=)pmS_kEBXe57~?y4KVCp=F?yB18Y+vkAc0xd98%EP&LLpVwB-A)EK!q= zJ$g_w31VT_MU-wvK2op#vV^F|eJ)Fhof9$(z0TIi)YoX|Toba94Pbi{0L%i6Bnr5pb6@rAN`D;t^^8ppVXM zT5Yi}xgo*ii<$QpH4LnRUsc;!wSq)?9NGM}X>hEtg=@2fP^EgJT-r@A8{^*a!X z{O7CC&Qa`J)S;52y7P&3O+Rrv8^NqzQq{fMUN2qE2j^!)&-2NYDRoYGGsoY%<;ynA zn>aPzmPtirt&36nAIj-;IWClVSE*Fd#yYDgjW!{j++OYvR67M&Hj-#aB*$ceZOLqM19T@t^w4@Lhc5rK!ZctB&^5MrVnh?Q#C5pEtctY32%JM_864b zBczV(Rwqaaw07-jc|9J5HkU(uh&GM^L?(GUe-FD@fKp~Mv$u!0>JPN8zCB^4MJ4>7 z>n9x-GKw3c20F3btqipUp}O*RR5*d1%BLip`$lJ0d)cOwJyp(-nW&gg&M zr9D$eb1r@ySD}l0YhmJpO?@7eZ^y=WhNUo(4x2HPm0;@waX8r#(!pd!Bm4!^4LFD? znq(JbPD!PH<`eAFM}HsQKeUHG*G7Z#3zZhCrb({Qx3AZ!WqVw@j9AynEafoLuF_2^ z+1U%SfMr_b)avBdH!N&JJr7AasnJ)F*fdt3+GKm{9De%<$Jed^X!gzFRwK#&^ zYZ(0Leafxk2#Sz2iJi?6r1Dc=JiUGi`?trhAx`C4s^g|K!meZlq#qE7&gR?SBI~nv z+FaY&Tv20E17uP@v|v0Lr(e1cCO~_HEtr#pNHo^Mjh36Ui@{z7ghhy6_GE`3(WY37 zv^mENaKw$%lyc=koW%pS;`_4oFlO1u+VI-fH90;jP0*;G?>w6@BRqt3;=a3h|1+8F z?1G;~fKZY1?sh_Nk~^}Mre0HPKh}<#&2fC;NmsF}8g(rC0yhabHV$|z0Vm70uu4He zgfI#;20cG_8OsF`e@b_VA$@1OK62NVv{F7Cy4D7hy`re&SZ7>l0H{Yer%;!W!fU z-6aS#3lGzhD4lYP(j|^k-Jj`sOM$@3>={0{K@R>lLDbpU78E!|bVe5-Fnr~>4PCp9 z!_=w|xtlV0#oc1aW(%Fy-B_2tat&KEqR73GWQHOu^r$2<98+`k)q{&rqb& z0RI=4rN(u;>5CJ@rN;@g8aEL{t9B;N>F3a1T*{r!MoHQiBZfBMsxLiQeDG6=+weEu zj36BvOJA`#4JCyuJeicxnkTLb$pgOA;in!fe(R<*Z@78<>6adbo7E@n zcQ^F4T65$wGD84&3-4iyR}vwWZ?QumLglx|hZfduU$y~wssaIQ*hnV1*(o&C>4u?p zOI0ZA_j&g2Q(^YCZUr$S4s<-=9sU+GL`y>>bi*s`@toCNKX20w6{ofs&3{4m8eYnR zaVLkbiq1--5sXdQ=BZ6y?9G_xdbuM3mp#Wo)YEHR5N`@)*jlWyVA0B*$OV4*_&RW4 zz_{JRtqPRwBHbqRu`lkxCRo8cmby;w<#lxq{7696z*E1^)YiSijt5Cvy6KcM0R|71 zF{Jr6XzEk$GC3LC^g6r;XdknmL`1t7O~@h@-ma{K{$c#7=pVf{z1erbAF7fR4Hx4Z z1)g6Sn!PD|dbLypL53{A$V%1ktH8(5&%0ugIZG>+S#ex!1+O->=~l z>9r?p1SRWBQ%>6q`low0v?yLn;s~th`F_`-wh!~tBM)?b=#~yX{7yD z*+?DeLtn(MPPT?MpY;2#rBJCzHw~KTurN;WHmLIj?XqIR2Xq-SbDQsf{``^4NwO$} z+-M~w+L-y91|Gqf%V}jl(6hPP(y9gV5afBrl&vl$E*<2OfN%=&N*;#>) zy^xoe@X8~Sw$ERWqct;dM%o^H9OCtr@id$Td+rx-$x+hT={ye7V6-;j$6MvuEQ0lj zOE&!26tO;_mvk^`_0d%4eAXnAkqPsY9hYNibWyErtM@^|QxI0FA*W)>>cprl_Lc|o zlnb7Iy5VxH0_$E{lP*@!iGJx93121x!3WLA5Ep`+u(tT_w$a#ABzom-EsiTrnUoH+ zuM4Zz!=o=i`5lUZlA`~JrC6tfuSZLeO)7=fqP@;@ZVmV z$0Tyy5FAGI^VrC0ZW1e3BCTxXKIQLEmyqcX_zEQ?Q$+tR=GK1ZCaer2PN$Jk#nxWf z@G^z;*7V<}wxpmA`*l*hMXb-Jq7oHd2$V0lQ$FJroVLq;n?B(ohVFdVWHA=McM!!Y zQxWtoy97N8J5Fm0FA1vZ+cuN{=@BGnaYUF6M*p>sayLg~FNch)KuPX1Y2OtoLO78G zSBhIdO?INLmp&1bGK`PSHWWy(xHy2xmu?+RI)CMHh;TfM9 z{EtJYrqj;d5Wjc~*<1GACYxnT1xU3X@1K(7P5yb|-hq*G^-B3sk19W;jAfF){ny^< zZaaf^H9T!WqM{`3nukGvSEQk3ef>0iZK7h?nC*5HeRKr;YopU> zsr8->Ac<^AdryK-$+@Yvdq;+_t|PMcgYi!WxI1D=#G4NLsJe6ph%Xv3s0Dd@8lT!m ziXBp8zMB(1lXY8vxk?OshLOtIJ1F#*n~Eo3k=meNk@QzcE12wigg1iq9Q98stL63F zXl}F*o9KvrRmmC0MaI_@99t1V9;Y0)vbxdlfusDoj&CWl`wH)nazxhyn&&DRbkzY} zfjo>4Yl{?Tt!VPDwzfqCWJQ$WLQy$bK2l>tyQClMb?`9=3LA-{gMZE9D<#enWI|C= zggM*FJwnY`ZbS4N?a4%rvE8;haocEw8qoQBdq3S~O9aBd{|WgSk~n>xsU((YmwSra z-;5KrRI+1S^cn1(Z4h&S*0A7)8(gg*OWL|c(!0YPfxsG_K_^$-)~M*X5Furfvt=k> zho%3}we*f*c7i-6d2kl64(I#Ugi=-Il?$da@mmrsq@W;d!>7AhsU^FiHIYd@ntlp!~QtT%(gKTvI?|Uif)~YF;=G-6kvq`oIznq{ev%VjAPay7vp81;56gMLC?Z?G=ua}+N;i!eIH^FadD{ZWn zAsjqLCu?nhNXE3EUQ%0HQGdGS2L`*3o4X0LEvrK-(HLO47NBu^B=W}Z_aQOMFD@?` zs&0%Bfh^q|FA{dfDJl}Z)9!Fy=F;jc1>vMBKXY)%#6s2ZYdqLr6D=;PKBVwmzjzFG z457=ILPtC`YocspLFp2Er3{%|y^ORpx!`UlrhNYCd~g7T1VAgfxo_6w>613}bb%qx z#3e3o-y3DDy2Zcl@7N6b89p*n6r$Ek0x4xXt*!@V+oU3wvaH-vvAf3EDuC+}Jukd^ zAd0y(Qgl&>2)&J*N)=NCPv<3I( znX5MN?XSL6~w*Mvw&RJtujhCUM^|D$2*_@g;m zTbIat?-j2w|B}f(uj&j2n5B)Db=}_LBjWz*zD18P|!nT(a7IN0%?^+l7ik*;1Z!8hXrV z*pBJ>PWInAdn&^c1L08fCmw<8ZEf5jY*hg(w)P)ao#O~hIiw{7;i!2s(+ih;_us{2 zp^hjG=Y{n5-p?7+jW~+F{E%)ugWs49Cci*^EeGU(G~IvpIYfJ^jmwx!Tz)Hv^gft* z-VVf3HABa7Lm&aa)sXYpwnv(c@*x^mOfy2^I8MLs-BYrDV=4Wixh24cEweQG1@p`(`-qRIC zrTg>Z<$RbvgNkJ8Nn*QsT>jY!kRS>o-kZ`1eDnze_?I8)*45MUZu7qYWt#=h4@CCS?RHOOyh10-dRA-9QC^ zJh)xsx)c3mK#jXi5ofaS zu;pgE81Ld`^g%wdIDi6PMBL$1i30{dv6+!E%^%dMMNYkl&pEZ-E!@m;v0>g;48z+y zwgc0LRAZ=sgHM=xXkA35scQF`OtNqyCvO-Qvpz#)ebXYu zD|n`N>xZHls?8TOo`)B)5742H=DnT!=#F;K##9q1I5F*_avIu0?xB0l$eQ*B#y@myRD$Y~8yPm}TxQFJ z=~^q?)G04JQpFM|g1vJ<)SjOqtl+SElH$#iT>8Kca6?UZHC3SV@zib%aW)mz!ox$V zguK@M27y0GX(pud4H-!v+fp#$fH?X=v=c{+l~b-|OUt;fKPeW0PRTBN&DFKE2(-fu z8pet&65UQs$0JD`HG`e#NpsEOias6h1pj>g!>)?dg}L<_GH--@ip`s+2(mWHU5LW` zSLxB$`RN{brjxKD?VB9vGho`$Gh?_NCos$BsgkL$5mO^(q^gN;fhCifZ=kkP6Xt@b z-TKs+yG9aNd|lRNcbJ33u*+LF3?3aVH)3ULN--J2_x#?a@vAzvuw@+jR9Z(hR$q}1TBRPwz5_MpwaMj;6KJK3vbdcn(M;b3`R+dxkALc-*hoz{ zWmGKP*ZxJWu-QRjK=2g0W$ubTFj*GzL+mj*rjQEU6G-(E%@?p7PL_9SQ&cx4TKjxu z@BGSi^oJo?cTS%~)V)R%5JprFg;L_?UHfF6+i|lFHF^m2QyNtMnpil9z}}L*%`)ff z8Tz?=J-znPA}mdso;F||ZYeSBX6j&5*akmR;59dfQ0-?3c?e&3Hl>kow?=J*g0v5P zA|s_mt+43y62FTt$d+S?k8M+g_VFd1{$MPOPhJQ6cgw(1W_ddXq1o0(i-FHCIXc$1 zs5YOKbhU9)lIXal_~ogBT=`JJgnrLktH)Bi8He_^`ChGGE~d89*W3lfD9<_7`U+^` z44+DFuPe1m-G`rWGfn-mhrU-#OiDz5;mFo;di{68J2nke+o{*NKjH^zX+dycL;KX= zXKfuY>KVv#WQ0dLv+qU=@VY;M>gGg;>>p%ODP+jkmDtf5@`LX7X@@XPVwce{G5~wbrTH)QE3vaEa@JRDwp5L0HI>ByOqHfS~^7G|4?{ zI+ow3zahWe3>Us!ZQuBA-zt|jye01cMJ<${T!*o*#`O<;@Vo!0>tSAKsHT^SFLy*o$*| z+aF!Wd!?oCK`9*@jZSDV-)*vfUisI_<~N^*P|G=;y8RWQ@Tr4UOblmn0==ZB*NKKI ze|sHrFc)d5=KNr+4u2u(TzZIC_r!A1YNjbB@=`>U=Y3iW*${VvC5S$M3$#nt0wH_J zY=BN1Qa$?1cHY?)+R9}T`9DRwfPTf#y+sLC{>lcz+5~-kb<`JcyRFp#%|!1$?Y2WA z)SsNHE6?l5gZ*0};<;EQ^L5U!?y-Gw$d5#HswrddM`@Dr1SskHva)w&`9H}EgT$*T zrL68bJ!vD7FTcyS^Agdr5+Lx$8D*C@qZ~+EUBMa)D_-RA&VheY3Whh?I{l!Ski~7` zhaFrH&u6N}j6EsCgA_f(pBp~n!xa|_w$Sd0!{OWcqJGsg$@kl_?sK8dVV=mcLEXsZ;c)`p2I%rV#AUt0=Pi!Vli zS=2V}U)Dey+A7*k*e8@_!o6yJ=(ZmBFeH;73GdmZ!IC)oDjglT&(_>l^R8e#(*(|F zm9;x>>wL+nvoses=4FcTpia}7U8jgm$UD07^wN!}^euDb%46|?xZ}2!`)IOc^r;1X z1O$Z#?Xj9XjOlb=rPccX|34%ShNG=zzsvGsDTBV!u3;+4N_`QEGk=D|0m%FaMA|Cv z_@hEzrEh3xU&GLFHNfyH_Mkrfv+<-Cbi`9#%@`3`*u$u6BM2U2(&76zI0bkbhd_EP zrb)2XBKG|J&!B@baKKhW*1L5Dh=#WehdtcttO;nyD}hwD0iqiTJ=kpLZLL1tT(Fmy z{6i=yiBvqiCw%dxd3~|bW?=MKo!7Vvo=Q*m@#Dxn93F(qs$4k<2=s4BOHXQ>>KkhR ze!J{J^sYugh^I41Z@l;692=QPkQABe90c!a6PgN|f4+!Nh4jN%t%D4^VIx~-qo>q8 zuzT(Px5UIAaX_F9WcA@1=~dvbQg-8k2MkRPT<7jRwVZdp@&P=@#{%&&_WoX!P0AI;KRQEAc+IhkaU!QpVwx9^Ty zBV%K;#Z`p^eYN%z{f}@k?_PdFG0%I^JYFs?uGS7e_W;=4X=zhh+DCHMaRy|W0iV9U zJ^gpOE>s}{vQ2>0*0LaL|`rjpq4ZYwjq;dcZ5JN$~ZDuCob-s4{a&uUG zbaVJ`DRJ)={)q?rMl$0FV7sBTKjjXr@DW;v=L-hnn- literal 0 HcmV?d00001 diff --git a/bundles/fish.payara.eclipse.tools.server/icons/obj16/glassfishserver_1.gif b/bundles/fish.payara.eclipse.tools.server/icons/obj16/glassfishserver_1.gif new file mode 100644 index 0000000000000000000000000000000000000000..c1763ce5593745b9cef42f1a06f2dea3546045f5 GIT binary patch literal 29310 zcmbrlcUV);voH>#qS92PcTfqAA+b@^DZ@RrO@gyUo?f&N`?*|pzUOwdVQZx3_ z2ibf1zW1;r(|K>>0dldkb$rjQ?&x9X3-WOCmsk z9hsPPJ%mf9Qct2~TXRmxT#RDBNFh?gi9j`GqOk;>sUoqyS@EqTH1 zZ8l*#>6qKxmZtg`)8?6v$Ga>?>wT5erpDznzo&PV@t}7r#|2!!4?%n7emb|?w;0xMa5`$_&X$Md z9lZB{A>ZPwJ!;i=lHgMV)V4U&|AR_6Lk73ba!!aWR_hCMZTP>Svh=p)T%Zv4bKrwt z=EM3+&UAGv`@un%Ii@eTfpXpn0{*V#{~5s}e7kd#g6!y9NMb?CK`T=+dddRE{f*EQjQ_RY^V zOPr2lZJtg?HvIiu-`N+>hbmvnH3-4l8)oucq6?=iM01S(#S~&|-Ewo8rn6*Ny3y`n zj^3?1b#ixl8heWw%InftWOr3XODfwlEkrs;A?$i1ibV~M38b*X&z4iteew_SEqN=F ziUa7jxJcHD3zS3QQx1ygv{^8F1@CMK zDvH-;-s#iy^+r88xQoQ*yxJ-ieW1nwtJ@P>lP zHf%{wZZ_bEBL7*{&X0)?U2O zQ?5(VnV-0D;DXuCBClE|RQ z_S_SSOzway1{=@0#y@db_TTHu{|~tzUC3fD=#4yFod_zUk%E*{QWGL3?n(PRE+XKl zeIDUiFP)0O@7J;p?7Zme`qi~g9^X&>fEDUAJ`p?J#0PUk3l%F}YG6MvKcQ5ey~k!r=UpRVis<|n@W1FELK zu`2;h|H80Qy~LOelU9s;aM_Mu#PF%I)>AHXy6H%?up=?s9HUG{D|Mte_UYI>cQ2ID zIUwyVMtQgdJ9ha<2lwEgPG+pmIUTy_a&~MlS;xTjtuFyoVGJMawL~F2i>7V8X8_eD!~J*%vNO&(trL zhlrQutC#oxQxg0o`Gbs%UEam%t-fFOzJ;0Rg8H{U`?cAmO*4tq;8`XE7ngl~iJsJz z{D)CV)-SDZJoq-S^d=U9NoY2Fjk z|7uC$v-~+4G{5h4ATTO|pNH?kbyEa}l#f$zG&E zwpnd=6znZB55>k_w-Z>YhiJ$`moMe7rEqw)xK&8IoSE3=Ewvw3MP^sws@MGJ%>1Lu zf9se5A4wH?7p}UP0_7N7WQtXOR6pyt&ZNjtl6-M2YnC^@)C|4I|{YYwz=U*%@f9BEA~02WRj4oIqkj@CjF5D zSjHCTsZJU7?mWe2mU90>dV4{jIIjrU!mnTF%sqWQ@(r8cweM)>>kl}rSkq1UxYD7r z>A3H1Mn{r{%M|7ns8)}XpskOtYAGm+AYyUQ$W{H#e8Xwa$qrM=jqZkT;?AS2s!8W$ ziRh(8KBHPso00|A?l(q};nl;OW2Zb}kTYhF{A;rJ>K}WSq~320N=Uu74P-8|Q4qSG z@LuBMROojzrO4twF;vaL8{8sDrU()y0ZXX4@~T_nzYGjC3SS=YQZmD(v; zDF$xN*XjAt3z9rVS`dCEnF4Cs-1rtF^8)H zpgJj@RNms*VUvAa#AU3D7Vx;j;=x9l6qMAv{^dwERQl6K-(u1V1@ACEX+^bCtS5fG zOYM%|p#2Dqz>6HJb@{d2o0c(T(q(ECixlSd<6qwMv&K4)49N_5yqOx&rktCMia#Dx zlzMudqg#y2XZNA>(}<`dtoU}rv+c1@LHuT>{8G`8_V;*GMuIn31~Nz6@7;Ro@w325 zqV93Tx8AXu*;n>gzi?ge5K9^FL&x1(IhR2jnr}AB%HGZTG5hXeQZ%DV_1UX?G!eY| z;({@S!){X&Zcm&PXvS9jKVH{J63Xp;3YD1nW2?dY?$e}+wjfSyLghg!JSt|*+%y9k z_^tE-js26Uu<#Qu7G~CN@`U!{g7*!;j(`RSF{`_z-bsVR%*8OvOtsmMUa6)M7O8O) zT7oZyUm|J#T!V7XWJM)6@Md3##r5CL#hbWKFvU$8ewoxbdU0Tw&J0(gbmt>HNSy(#;)?~G@=uo?hkoU9Kb3({sLlCvJ@(e@4!@^YWVZB zeVE|xJW5EGr(MjcXL&2-Nt`oR4Y0n?*2?!%%mVd%@m}VToSiAoWFyM?Tmex72L~K0mY=@4;sYuqCF~>lT!o#8~oX)ICv*zBsMbz8mm6 zMYBfZ+EEa@=Sd}#JR;YVS4%8bh`Er*_>0ZGGLVchP{!^L&pd6nC%Rm0NebHPF)X6{ z$HAUcyXCg&^&hViKJbO>Uj6nV&g(ko1G?z2g1N_MKVAUiuSmU78n#Z14}DNTkFY*} z^ohql#;rP1HRShjdyO;O>PvcOS?*qK!@j8)gv6_-w7-jPV(WRJcf`9D1^!;0wyTr0~)MGa(7MbAE(#BsNQ7jN>~Wct0nw0yNSOLW5Pd+ z5_t~rTz>k%$l9$F`ffHX?D?#IiN59w$$JGalJ97I)Ep1gK0f)|%JDZ)Lzclj#v`kr zbd$e6te5e({7@)}lhl8YnGaGn(0HRFlf1(29)&cS?rAssP4ePVVASD;tZfH79~Wsx z3k4F9?9~tK5GuQ~;>H@rOkkC`pjo-+|98VZdyqo*;d-=)G2`!kGVg%wOswx!)6;?! z_UAGdA5pAI52g(aLO#xmD=Ybm2rB7W%HgsZa12M}Yf&H4blC4FV)a-gzDESQp=mov zWO-w+`v=?(?)O`Zo0Y-qlt->ecG9U6ZxQJtT+!MlGOF*jen;;x>OH>aCU%mQZmv8o zqej%4XGAMh_r14MdO_hC%q*h7oZn>$LA@94%(8T-&sYiexbS325TTgRmDyc9jj51| zCTG2N#6o#Q8YmNLv4qR;pH29XMdaItgcWNF;ji8**-}aMt^tI6iiyp#ybCu z^RYAfnK zUX^BOy9VGu@xqn%_Q~fgIvuh>gSW{%13ys?_wMO7d=d&E6%On2N8UWMi5bZ1UFoGG6UWzOK8L$S{bK7-^oridBtj3e}1JUGCQeN@451DMy)&1g|?3vm<#Q z8N{4Nq*=RAZ@Y3V$Bt;cZo{_X1&x}#IJC=tO%=SHty)jE=$QI2fS?P%){&ci#g6zr zy)Q$@(_NH5v)_LA7Drju$YZnKx>FNoS@5q{TX#Pq%d zD?vSKNYPn~686(i`Jm;Y$wT)RAu2q;!hO7xHTKJ4)c=D{Grwb*<}3CH;ec!V$A7V3cwl|411V6KfnH9l zlh8t_eh3BUO?%P#$WF4OA{=t7{|H+Z4SMHTYg9J14S({c;JN{xAY_bT-1|V+8E=YW zRAC@GX)u{%gY_rmkh< zc|aoO1y-T;&cA9*z4^-n9+XQ=e4yv;z8$apsCFG8*gvc}Y(G&Wx)X4Fx%g$Ed7pP3q zza#4s-o+8e(4b;UJpg=at*lfkC{W9jJXe)u!cuw`G2;|>*U-fWudwMS>lm9}r=D6j zbai2APQhq<9Td6zzV1LFzao1hh+h^kQG4Y{@BdbU{h;B-~43MX9Rgw4z zingA6!}q1Z%oLf$iL>wNI6bbI+~IjpHC(*oSy5;#soWUK|0wH;JEy^0tqP8oSkrqY z7q4r9^`_nB{Z2HVhVoTCPUU4W>ubRrgJ<4EZu9=W9rnnBeie$bScKt)o3((i2sWLAl|w{5J+d}mO8BK>06gw~Pf zzWGy7%!j8-(T&2tH+H|jHllQVSrJDK7t>E!^w6->(a}e3#2QqqHTP|+OM@+5R*$Cg zqLwv^v+{3@*$vlBB-A=bR6TtBIb zPIoXZUfsFjx=k|{U3bUX;XGOD6XljNSFs@9Y)#UX7+Y8O9pVcW<(aAz)1R@f#FnWQ z$KvaqCyuUovzuI73qOCYIgJlpO@p$QHM4{?%GmxHkCyQN@MPrm0Pu@c{r+B|sd>R! zqG1VK5Qr~lIz%k+mB02JRnPpI+7dKc!p*y zEkP{s)x!Zr=7YJm2Zwq4MH%apS1mK9mIjWtR`R^=iR|(0T{%xBbGth4@46met4{rK zbE%F<7hD`?B-JA%`QGv)F6^$DI1& zQW-n9z$stf6q#zhUM(tg7@|9x3*$S#8BeogAu7dQs;UzkqAgcT+i6hT1)7}IZ?q47 zdoct=N1W4>R7-jxi*ec5h%^2r!8H70WtCcWZJrv0mQi%6su<8#SdsqsDW#i{SQ~nc zZ2l3|gVCd+x*eAG(JjS{gO$o+i%IXsRfYg$6i2|qns9>GJa&!V9`wQa7$)6Z_w4?k z9ngK6JEe05@2U6@d(WVa-=7+#G_sE-{*4~U5U6{264xo_ul+;YE%lLkZv&v$D?t4| z{&)Wnn1ZMT%Rcwan_RvC__0Ujze{flp{l4<3-Rh@s#4&sO%J97p!k+o1(#N%a6C0< z8WoHcUJmkW2?0E<5)&TetrW!mc4e)18?8^awoVmG?$GX_xVXQDqV%MOu=VlZ>(e>g zb;O<}|MJmT@8=n9)tZhm>N=y3m3EBB#nU=NfsC=ponSeU_pQ!IbK9)-ISq$<< zNb_pXP<9QvSKWx!^it*)>uo#9Isftg5`*;mQL`WRR(IVHIH2*xjdh zZg|VNd<_{@D+Cc)G0>1{wcd{Ukp>y#g&AIUjZPaGyQ@RwHCirVkOz^;8wnjg@*$Si zo@mQ+{e@U954A@9kPiJ(n(F%xt2vQBI(sgQ8lWp0|6s;d$h5qOTOT&|H>y72ukx%% zRahgUa-uh6I zk*kVGC$}gpcMr{Biy{Z8Hs!V7HcM8#-g{@`R>w|_m*`m0QhLR`>GpT(pUqMq>}FaR z!^Y&CQXA|(WIeF0oGEdEHaDp4$8Ef17`NW z8kWY8VseWg#q1B!>mU$0EO}Q{HO4~7R52?zZJwbkN5@S65yGW3H*b9#8iU#g{ic?b zy-?GRYMl~20}?8D-4}eEVOFmiO$%qXp`YgexZf@c<>V7`I?|`gV2xjuoy}4PIOQY}Q9 z62Pm;oUh@&$G*sl_9r;%H`u)R0)3Tc z_uy7F8gn$2B^LQ7*k_aLC){ejaPQCGfes2(db-9mS=m%NDE#z`dn{7P!#AvkL$zk# zn%_}&(SrKx`8NBDiXaVN4dHg$^}>yZC!bpp%^xgUYB;d@L9OhBQilFk)rp&7c;Wb; z=4mx?G+jm-9G*5AnnS2D_SF|-MH(e6oFu(Qx>mC7_l;mc^EPrl z&mm|yY6qEapNV`JlFondm8C>&*%N5*&lCVJ3gs}{wt)3IRHpFl4g#8t<4B}zz6I>!E*Vj`jwRuBw- z?(32g75%g({1GgN>mm5*+sB&b?6z7n^i2JMEjMRDYU?Kxe2TdlV}D0JH@j!tGy#{E zJx@(7uDNSqXnkt(RpXCs6UhA@>R5{tNEyiN>(A&-cYv4Qf@xJrnyPVxL)owbEYG+V)=m~{?xKEe&3gftJFV$_xr}@sg z!%|-G@c7XfNiN&bZWh{+)@2qhm*+Qd1E~FJATSx9WFiU+JvKbzfGGWt5-^%)P%~S2 zS7%4Cpga&wRds*~L?Qd0$Tzb!IE#1q38Q;YW0U{lmo*lSd~0CiwG^ensv$XAwQYHS zQ>Ea~;zRCN=#Z*scux`c8@cI^+`eXUi)THqzxKu0)*y(J#QNk)@DN>T-S0oYrmr>q zW>5rVLEIR`ncCRD0x?0FHDCO9xp<-RyLuiBDym14q}%|Pi`^^k<;rj91I$6yDHv! z#=w0K7Jm4qlE{=&;lYqakGs?t2&JBM*h~`#1wW`50XH^&ZLr zX2wx&nlDsAnfenCg`#swkLtMFVZ*SGX>PQEKCgE=lPoigQ1Mu~5;jx)5RQZ37%pKE z@AxuVb^0d8Z@rApR?j3FiYuoNqJu5MX};xm&;u^G4~+_@{gmujjTu{1@~d)>T0c!E z@BIa|!}gMUs2mVa_W|#pwyw(U);wm8SC65IQ{Orb#+sjVh%c92JA5eQqt!}cS~USK zS@ks){%L{(&B1B)zM2Dj*%R8rkicu};P|rTgR;W9j@TETZl_O7jpJ*apQ7qRzGsqK zCH_!7e2bc$BVMhm=c}3BPA<2{7oEzva#_gjaVQAL2<6pvBwJ#?rmfvtFo3FuAaprKqTj{ywB{=mDY#e`AS(kh&C3Ef~(MRNQ!cZu0Ot*6#+xL(yQebM9~ zVRja$dzSn!NJdlPAi+RF1}1eMeomc7BSK@I6Y|IVe#-(?{+$L=RnUD`{SLe5eA)i% zQk%e^%S~#YB66GWj-+v}2}F*(mnH?v_(A| z*f}i$o%fs$_M6WUi;x|a&kW(?$nA6u4_dUx2w+vjJI($za3Vk=Yt*bJXqP)xZj)y( zCB6sFIQKHSE#F{3U~Xahc@uJ!@i_QXSF5OA$tiPZS-|M|Z@B#(I8W=juT@lFM8ADbi?l{pzJ z=dN-xo>o||Mun3C9y=rKR}I?6AN2j5q^ET7n_t?4>t*6{j(adpmvI++xI*RlAJ9@l zdEQviXzQHWgJken)5LwA?||>TAKxEqJm3snl9+=-v{&MP_O9*av{h|my zFRMx$E0!^?LfPg$pO)k2K9iSuLVKiytE|5G?s|56)xIOb}mXSL}uP& zx@im|Z;t(l^Z}+zwi!hD3bP&dgcU}%&k#0_kXOvWerMlqQFiPwrhrTaWgtJnZfaBt zBi)RO$g0!KL>?j?JkBkqE~JYxN4CcV2;p>GAyHgYD6CN_c;tH-hwQivO3=V$--9d40T78vlicJ3$4Csq?4IGN^BM8rbI|2XXK0yJbG$874$sMbcI!M z*S_Vew$1H>orfvvfLp~7w%E9=JqNmpi3aqQPqfs}CRnsfJ*tlDuWPs^fo$2XmjSuX zY(*RFlm_i@$`^z_!!BH3wc&byPoh+|Er4W(Y2yND--VhtHxwxS86Ut^7aC98DtG%yZndA z|9iR&u1;w=Oc~vyT=^LPDdDG&{!~uE*ix~Mw*B3l`!fEq=`3rr12MOrvBu=Qi@n*G zejcO3W^^sT{M~&)1NyhTc5TWE6bjc zH9R9`>zYae=B|$#Z(^4=|A|CxTgS44>)s86aHgpTkA~+>Yvwv=M!5)_vEO11jSMOr zUi1yu#yS;wI}dIJ=n<_BD_$1RiikW`cvU6lCAU;_5&|2q1cA8PlqSUePPTI=0l_n# z9(d!!F=-9jcykl459kT>lCaaGwdyF*TU56yrl+Ph0>J#0^-aa+yPsYaOLNBe? zT~bz8SSSly=Pjwj^RwfL=LTqXZ*T7kPchk|UBjth77^M`qq`y@0eSw?H_rCuPKHMS z9f#4{i?ZT-#HBqb6u~s@t2v@Q8V?9hNUw}=wILFWrH|uNQtapF=e6V-U9#j96!2w@f*CIswF=%eL;irJaXF2^ z(O>}Jus0x(KS%Z+Z6w&`!-s%s>2`k0*2fvzTLJ$l(Em2AOk>#!lNQAjf0WRWk=?5Q zuhk1SYWd%``9J9{S8q;i;(`pdy8a7RO&-DfvA+`TC8@u8;hK=;dvZYaV$h_LW5G`{ zcX~JS*NwYB$r3KGp3D*N|LgM8>;RL93y1yjTqKTG0fV@}wADH6(P}rSv(l=Q_!~3d z0VEj7{-*B6g|JrQ==AqT|AZ)Tvj+vvW)pYfH=u1crQB)2KCgQO$sZ%|Y zaB~WEf~F2L(vYjC}tRzt9mD?Lo@r`HTdg?^adIpTi zM*q_lr4G3WC9)wKMRDZZAgPR~hxI+A-uA!ruS$ivVe<`-2_wdX@Bp%HTxza&_n4;+ zmJgO>V6mt4!U~iA$N$_Uso$rCXW{E<%%+t~k0UkdjrSVSvyRJR)HvIPtH=t76Erbd z7Nomy*|LE7KTfMDbD8H3h!7v#&HT@~^iyN*hbL=P!HP&HAkjk;)Y1i~`L0uo)MgFk z1mB&7Zl(>V9ljiB!o__6!~#p9g8==CF^?w zkULoQ8@@9c5DZsR?#CJD{ei&KQ3AqvvW>|>(!+M6L;&>cBCDplEgIdsz=XJ1-nowc zx^T0lw}sh<*q71?-P_R19?C$!A!fs{-9#UxnHIoICAa_}Oz=J1->jc<8J|uh1S@C^ z*lcQjPVE#A{?b=vW`=XzyhhRnh%D0KqO70*7h*mQC=1RvMx zbVO6NGl0AC-9R94au>fcb90-v|1)Co4_f${<=%;t6%a6j`d+CH$j+}V$~V@;ZVFT!F76D%+hg}89FED8>7I5gcl zr)%+lp1YTJ0!22SJl+1XLqZr2f(uASK1b++B0UZ^!F^s_wT&2reb~ojC3&`&ikgHl zMI8o(tTbCa5QScQ3_*k4%s&nfHv2=WE^9=`26yB|{UVrVRw16Jc&nZ3jj{j|N9n7P z#mc8kt>*h??d$$Q%X3$lyAh{7u`)SR(53S{AlU}4b9ks)J8%Q=AM+wcjbOG~agyx# zgNRV7OIkm_lE=2N*vE7pu)$h7cz(qyEC=7ubdERIC$3WkDO3oOtb;=1dxsFx9e@74 zs9ig*x!Ti0-Sp=ma6Ni@H;-2Z|i5<`6^Z}C&Lbxa3DyklT?tjgi$WAH8lTq zIx4eu#@c|p_!~cH31ww(g223Xs0#&=^`YE%SzWu94i14M`=_*Oy=ev)abmv_8!eE%01P1C$2j=wi^ve9*{0fdqEFFne5ipC@`jMEwC zt3Xar4Axj`N6xGF6(?9;2y&g~gf<`pG&$ThG&)o9RF&&mNV2k-Y)If};M^eGZs3p# zm#L8oP865e>0c-t&KxjuI&T-%=ga0rev@Zom`%4m*fru;+B;e$?6e! z&&8|C#s%4}sTm9ql8DTb^ z7KODnKm2GdFLs?HQElH->BjmW(!=br)g-wPuDrtG$+>(>a_8@kbiJ;Kr>wG-wIxis zM*Yx`MsxXl3jiOYYh2oX>lq?R%5KD?06tFWJTb7=5Anek5%VpZF$UCn(s~bfg5-s; z`p_K>H2z5tVAg)0tBy2=X?O(a_lQfw7==J3prBq|;XB2A_>3PMN7D9KGi}+{; zBCf1qzLwXyv8Xk4w0s-xp=C@;ulJMyuT?*U7oZR=aWD6fjf^caDRD6ZN^42R%4^@+ zXd$o5aIXoh*7+;*?&!E2l&{}cDx@_=Fu8N@pvh`TD=0NS(FelBy}T%nh?~}Fle+D6 z!!FNGSfW4c@Zu>pPd4p@1E6IYr`GZ-`Z4Z2hP8YBlA}^=- zQX%bd0Z#lOjPxQqZs|$#*Hu|&>)!#k5><(DH_caZx`Z|3A+6msPeFklODz)6JY)?a z5u7EpA3Rmt*|>Tr*vz@;YN6MP^H}DvWE;WMeuxZ-;B7nzfbv&~E+DcMlq4X!a+5Im^a}x7|gg z?&mgSuuoS)`ShR$0Yckd1|)#|0f8Rt8HZT3%?#o6IbP9i%!+)TgOGkCVuC1T6Y`Op z^tY2opUVsf7l!PRmV&|?YlONJm&0|5vf%ucr9Z)`fzSGK`Mj=I?xe%~4ieU<%RS?b z2RofAWAw|o4EM9}qSJ_0@0W_8U1|+N=aEA6bgQ-iDZl1Ky9^~qxAEMfMr!dxnSD+M z3aFjFcQqhKv{Goc-7GLJ1J2RnakQk0)~PUoxfh14Zkx5T2gdtHx8+x$M*UfD+FTn5 zQ0XjMMz^99m*po9d=EdDR)6f5O)H}h81xJ<>P*4CsK`D+o)|{H_md=%egAa9z0&z0 z|MD{d*nb=?KQ1$sblp+g(NDG}NbXb-AgzdZ(RNq{fLAXI7`L zFMLu9lVSUCY>vfSRN2N=3)Xhag5e6_ep{fD+XqBxz#fuo(+Td~Tn7r|%%tbYDy=Z@raVlF@GOItIOU8&^@CfKR}?srE% zQ9TU~bO1gU`kT}b|HtMIIk+W<^VG2$NAc;TKqXD`_!Kb`xK`@dxeGV4`r%_4g*Wa@&|lzwS24V3J>JvjePHD5Et0ej2!8z`K291J5~j4+hp!G`uTq#bZh zTj&UJ7gVfo=!;|zFbp0SSql>#Qz{M#RWS7MX;D@h;sIb73~~tA1n4lFg>)#+)YMDd zR=D6hJ=iE9rV@fV*8ViiDiYPrxG#qo5>bYJJs)^3Ga_`f_T@VYLJ(DwI$LvBew}8&esbC-)cdqk?l-PI3 zBM>Y~aoQJY+cM@MfgQB!SG|ZN9o7`%<4O zaPLCyUz^RI0%NGHduX7w0daSZA#cV#J^pVAq++{i&E=4%w6CEQ_z3bF#bsa~(1%bVxw|P&IG@?GRNC5w)fR-kK(}c`^ zu$Hc!h4~8Ln6Os8b4s__Jxl8q(aV)uKZz+q;IvI9BE37HLl|lOU zOcl7ruF1R=|4n z|HHk+GQ^HzNYKzuQoy$&1(68U0A|D~9=;@2SpJu8-sZS6Qd;4FA%_X$Fo(vf?!?CG=dk?C7h{ zcX$BZ6lTD#iPV!w{PJN|ZT5Y5B*>o5&P8w+uA<>)yQ8lK~AIqG{T1 zd=ARI@At^=MO<4Cn?WCa84{k;c-3NL0xNnhw@=z0f=b#V)WI-@zx0q5y{|0n}7HCmD=ID$)>l0JDgTBK*p!j zhuB2&y#?eS3svmp`kx&Jw!OyweH{PTGRIw=L)5qz=Ofc1GE)MiUxi5q?+-MsUD11m z1ta6BLtG!MI~Y(dYdoPXLYzOe!i9Uf1{npv1@ik@+U%i|AFJ;Z!W;Ur3{~CZe3p7}i|OBu46l=xx_9|iI~Q|o}1%9;gAbMm;=d#rj$ zw}QCJYu1b%uJ=P2kAllOX!}9i0jZMA$K&ZVE?VnU+okJ127M5sg=MQ_oo)-=@@A6} zhss$iUmeCTZZD;D=St$%2l$Xz&nc3f%AG2uXb^;d2zgUKq|-8|!#R|_n!F=Wu=vPw_D4;pWhJum*nM8n<*uTC zkk$$6+^4tH4*zw*oRID@5S80(KI0*AYrBd@sBxQX&(pWmZ* z!^wk`l`gVU2GVz~zcrtVBM5P-RwrLqd~}#GSQ?bxsd4m@L$677Xp_Ro0{e}@FHT&f zHsi4VJDseRTHaW7$r?>N!I0qIPb5DD53LLOOguysuYVs(42B{*%``Tz9%DIti?j0% z`dhAWETGo|h1bGB=yvu+eGXe#s?~7rAp{mSL_C++oZ^soe9NEb`v?y4y@+hgNS3=k zb-ksizaI!IZ%EcB>it-!^c+Dhe~4e&Z8>~k8fz9}HC$=CGgHy{>$pZJCwt}?-8|xJ zF-MaAPa&VTe&1uZfG#?5&h2Z)cqeoS*%fJ9l-@mr%zQc|2dP-bBdQMM6*b=cs0Cz` z?f4)os~KnH6)=ow|4)tFAjbInx(DKHh`KL|a`1vz2Zrkm}*kgP_;_~D68R$z?!=?vV8yNWc2WXN6tGt zFml(t)UjpT`Y9xICQHDJCH`t{6Q(^i0BKO@> zQhu&mObg{EBhIP$AQDs$ko(0xJzPN;RPCp&Z$9vy8>9qR;PZy}lmL@jKG01$l?LKT zu$o-s0K}@)m0c)soajyJRzy~wbnY&Ce6P*IxQ`}xjMQ2vDUpV4$Ag)L+RyROP1Ydo zw(!%nl~b`ZQmZ(g_>YNt5bjK9jI#UKh_1lK0p-FgU@gZDQ8~Hqj9{3@lEZrIfYSCv za*MQ%Yv!`JSE1*ygOE|Ps(dFs(hZyu))A>;!w}LZxPF79M_3`3*0-=tgb*+3J`$Wt zx1I|Y@cHe1=+@VBC`xkwAqo(K~l2eQoRBIfX za#AkyOq6n|E5`x5tp=U`&Xpz*ExYRr0Bgxl_{pLC*p6DRDSSf)DL2q9*wpqw+bb9% zi?D_lEBs3A=hJ* zGw2rh{Ml(*OZ=6*x9*=S^zmRAiK3NA3s2cm$m%{k2bY`iLlyC0ds3WPPy`7>cZ%_> z3OIO$5MKXHUvy%RV-heIcJh0v4A&f07HC*Y2E-hs5w{68ysgG##L zj^^%PkyD)nmA8*-F4b1*=39_=&=5Ghz+1!p&<74Ot&`~+cH}G^i z;)3&bYO;o<9y zQ-X)U8K(Wf904vDKqPr(zcp!s`l6#o0z{sl6et!i8U;-bhPW$Q{pcX`|J|X}x_FG3 znA{hcalf8+zZJ)utW8{hEGV%4P+FfC3++Sz}xUrDsUWF{lN5>Cx|_l<@}mMu0< z%7%z|J^2m^0p$+lx^jq@1{(w~*HViAjR@Ra@(vv$?n;xph(|MQXS}w6zcR|zo?JPE#K8raK^pYKF2dP#0RO=;dg>Qd@Ij_JPK z|L}9qx1EuUjQq-fySUkB|68~Af6`sLxRB~w#kA1X{p1k~y z)&IX|(e80Kbf0DGiCg^!ycNB8*6Hb(k^U%p-v%BZDO9|76~aIoU8rvyb5W&&)@%c z=oLni@OGK65)Cir0Fo+>UUG5GV4Z2XIqfzG0*8uGGv|Qt(R9!b0_*y5zxw^z9x@Bv z9wf~i%YaqNBmnvo&<5Wg49k}u-i`lRj*k~Tb~&rh)dh=guWQED&tdFOUeAQ#0|Ez* z6((&*cBFP}GhDIq+m-V}q=K5)9TeYOaDjoCr~CH_e{feF#|!panboDMW)$Uk{Wq1 zJhuZ`yhrMX>I@3!PFUv}N%Sh&v^W$i?#{!dI4#AYIK|!lp~c;bYl}m1m*Vh%0uOh1xWmI9Z}~Qx{gTaY@@=wz z?8ziExtW~YIl1R|=H$%%%{?!CRF^2ww(Id{h9A-_Q6|R8y}%vFlRlFNj>y;I>?aevPe365*NyMy01cvcb4|F)gg*q) zT{GW4t-%|4@+-|>Ky8$wH-X6>?6;RJ0l=Q9aj|CYd+rWvvgTcw2*h;AdD{%~hu<&v zo)^lTkOmC0yQFnsau~~78i5z{})1R5-`1So7wwVNf(=*q3C)Iz|prKi4Z=l=Ag zG}Ad?Tgj6k3Gr{{~b3uOGdF(8AVt;J3FCnrJQrXfF7qF8Kd3 zsP7EHYAK_I|Gg#HH!!GBHeB>|WZRjpdfAFU7&K9c^YdFL)(6(IiCl>DD(y_z?G zwe^H~;VxN`jWBwUE=lnN$-CE{K1ufj;k)R#*x1-OwyYq{r=Mqed4~^k@VO{`w?heS zKQKle$9V_GmwiZpKpw(!V-ouiSpHjN@c@#u(cd?A2pi#n1J`Dhn<1F^h|QSf(|I5I zyw*~d>cjdjC;i=?FJ+t%(sI_MSm#}Mo4f7RiQjH|=SprdA97uow$-u%pcsS&t6$hk zOyZDh1w&fh40Bi3L7B$V_S`JbG6dIYvv_!{b9O7tXYxL3bV9f378)`WCc-2mvl8m4 zT#WXWe60ye4y-R{$Bv0!XDbS%39f(Z?&GpH5ydor16?riX5M13)@C$>E2acsKNi;X zSr)cX2Dv1()dU8H8nAE_^P2;s1=toITmSaq+35k5ViUAsp)um7w6~Bl3{pEw#0IX-)9f!s+#Kc}1#+>L%1LA^wSfgn>i4Ol|ZB z7MYz08HQbsT5qRAi0~rbGX&{lxkrfhUw@v8h$RNmnR9}WoJz`8Bl#^;a54)B>$jF1 zgQAW(m#Q`LkVMBl3#a>cn-r_e+j)$cR^14Ru`!AY!g0CrzgIgf#OZTlcx;CPcW!)t zw|avX_;Y+W%`N~XMW3iIHt!6{#onn?s4}S2GYjqtY>JeVh-2jbK7##=LDQ2ehV}y$ zahfa96IBY_1ahX3Re`!kBM;K%y19(QnV-6d+)*q$IL7V>pDREZyc}eK$ zm!13YgLAGrqBsI9$ouVk!dNW$G7N*-NbHk)e__j4>zwRw{z`0OyRB&foATGVnzlyM zP7DSbrZX_aC;=FmE}>q}q}UeeZvcLUo|6qiuzVirGnatiR!B9qz$f|33k;BBBF*^ys?ZK$Zvh6uuBe8h!8s0L47f?UyyRZBg zZ`2U{o3IZAA+>fIcS1RGEr||S_ZYTP>RFd_;K%jg$~+2*z?bBRz17Xdh@^JZLuuj1 zrfrM}tc4OJA?@l)WeQxG0nb0SX2*CcSO1IaR`|PiVX{YeRhFWdVimA^64QUr5^PP|MR_^4L+5spT+;al&dj&lA9^Se z+9QVxl2+~}oMC*}j^ppfUB0F24y8O`JbHqf?heS7IJ|Ea9b=#3oLuuibq9m^t1kOC z;fk9S9>1b5kB%cV60oc`%So_L!C=!9vb2b31AWqWA`)W5s*<0Ig|CrdNLAY({<##G6=Wi!@k6&cuCDshW(zbhUHssW@e%-C^^UTYkJGW3Dce(0e_wf``|+Zoz( zI!F!Jf?2cNLAG{*p_ZxU3LQPJB;&&m)YCh%iyY*H;y2^Ue^$?q(f>-W>8uUcs}dqV zaqR^sBJVt%9_)55Ue|bnTsGA7i?AfRiav2y|r7UTo?TkK) zQUUIJ0O_YAEWHy4=6)R|=dF;@`m5ketXBUno($Fl*rp**%N@<>I!mJcs!+>TG|S8Im^h%;=Z%|?A)teVMW#~7;fwvt%@vaxj%kF&V37iE8$(<~ zCw(Og;Gh%q;SHi2HN^%7vI)O9QNyVo#jvy%J-Z#9i-HFGv?bvS9mJ}-550ejVc{1$ zD210w@MwB>Vnk?8RXFQi2^m7#x-sXo-g$y17vEOflR;ur;% zeTq3hLcuYoi}AmX78Um;2Q3#{X?~Kfw;Gue_(OL6Ua@xIuI@rC`c^zUT~aHbB*F!` zVQBV<)UQeDe&K!(Rs6b@bv_O8HWQS8_Q{Du);b9_i;-(;X>aH0(@h++A{EX{oROWe z*!07x2;tfuIRYao(1EXIIsfWf_qgPglLSBdx4_7ZYW;Gb1^ML-59gXY9(^?zi3@yb zw?c=}Fg%DAgC)-3*JU2g*$vBgw_lcuJDhkmSfcL#7;GBP3+yZ`U+;XQVb8W;B;5Ka z-pnxAJ7%SqEY@S33|wsaW+ISVu`%LrL)kiU{Dyb2P$D>thvuC|JN}~!94v@N42o~W zg3aSTv#Ggt+jhujiAy*Ac>ab}aT?N?CR2WOhw?pMJDCMh>o74vQswUk>TFF|3_O|= zsb#p_!Ay*YNM12T%cZV?VxUdFi)wG@9;!>x{ylCtzTsBgp-MptwuawwGaDe%{PBJF zIFSeTpw*j25lYFiN-f1K4&a{Bl!~OY zu*cQ0Am!ZAPx~v{y;CP7BJH1sf!(=3V56R5*1qvOu?HxZG?#F6ZuyTc4q5D?DL6`3 zac>a>aRA8cRNLw&%zCakOBR;Hn4nR4)G<<=y)2B`$C*-iy6fLX#dLh?@jla&;o+6S zgHj2yA$$b3!nD>}UU&?-?1?^lOq<;0*ia4Ptc%OV$)cb$c?h5tI1;&YEGi2 zO>!+3e-(EV?vBH&J~5Bm069$A5nucM%MWiA{}JG_o~xl#nh^7x^thp!Bd*l4U%4tK zedQ>4*H{{L^Bz7mw~)XToOB+W70w)hwdsV>a4KSSP*uJnP%dv{?^PesDH%KKJLD(O zu3?e|z(#Dwkvk@zT_c;eX)L=poGy@;1_vx-_!#0$N)fOrN}$k1%K@2RN0vhrxe8}sSX;t7U_b3k z!tfKEV@LYDW^-|7LQ1?M?;g@wua`BB?eB|nb0K0CO-|om735^o#-nQ+azEUum?La&T0(O7CRl`(=*&Do47Uma2InuE&Xtzz@F%KQ+qzcZjn7>Ey7!&<@kH3=qZZZdNW#;Q0eqK@wDUtzqEUhlj+lJh+ zlc&TqKIy}6;_D=V3FnCqBdhQO%EAs3zFcMhngsf9xTFE3rulXRT58+y0;Y^WC2iV% zyDJ^U;1HGA9DVSuY$l4Da#~;M8|Xx#_6{m`@lVho6t*V%C);|0@LVO(l-X#ncAZw* z*7JaQ#_DSLmb$p7?Z&X>T6*tIK(dsFB2=req<{c*3JGD}`WTvd_Fk3x468y+FcMom zrbT4rbj$$iAmDN8c^AJnEXo_d-y}ZreC9=YSnd_;NOka33%`F%$UrG6;dNGinNlq( zX)Xm;RQg?WAh=`I&=n$IJGy7T2M}!@$60*8tTUUC5oo*?uN#xYXna>dRZTUI8_pJ7 zNx2skS=wykkIo$dPf8ODVz1aSq5pRLA6=mrSLNaO1WtaKnG z%5RWX7@qN_JNWU@8VSRw6d4 z(OkR%6N0C0QfM5f8fEzAl3rZ5b2pQFmu?4=B0M*J5~4TnW(Waw6Vq8oyX|+%I(=&QP97G7e&N_{UdiH>WJSSM&8CB^_svE6!STJ`(S};?p4o`A#`>R5*GvtW5yz-T^s_YN(i4v1 zXEfYDve%2>6xzgZLUT`iP`RL=5fW8sM|^N6HIX&&Ci3u4>9r*P)id(dn&u1RBQf!e zBIXUoY&I(qSIG?v>5kqjxy}z_@>LL}fAqg?gF;bsC*u>$Y(GMNCpim z!n~9ynn9t-E7A4Bx5e_v5cM!;CU8b7ErbX&EO<-Zh~V6Gn>~6`X(@Kpe){>a4L>n- z@no6xpRL=)pmS_kEBXe57~?y4KVCp=F?yB18Y+vkAc0xd98%EP&LLpVwB-A)EK!q= zJ$g_w31VT_MU-wvK2op#vV^F|eJ)Fhof9$(z0TIi)YoX|Toba94Pbi{0L%i6Bnr5pb6@rAN`D;t^^8ppVXM zT5Yi}xgo*ii<$QpH4LnRUsc;!wSq)?9NGM}X>hEtg=@2fP^EgJT-r@A8{^*a!X z{O7CC&Qa`J)S;52y7P&3O+Rrv8^NqzQq{fMUN2qE2j^!)&-2NYDRoYGGsoY%<;ynA zn>aPzmPtirt&36nAIj-;IWClVSE*Fd#yYDgjW!{j++OYvR67M&Hj-#aB*$ceZOLqM19T@t^w4@Lhc5rK!ZctB&^5MrVnh?Q#C5pEtctY32%JM_864b zBczV(Rwqaaw07-jc|9J5HkU(uh&GM^L?(GUe-FD@fKp~Mv$u!0>JPN8zCB^4MJ4>7 z>n9x-GKw3c20F3btqipUp}O*RR5*d1%BLip`$lJ0d)cOwJyp(-nW&gg&M zr9D$eb1r@ySD}l0YhmJpO?@7eZ^y=WhNUo(4x2HPm0;@waX8r#(!pd!Bm4!^4LFD? znq(JbPD!PH<`eAFM}HsQKeUHG*G7Z#3zZhCrb({Qx3AZ!WqVw@j9AynEafoLuF_2^ z+1U%SfMr_b)avBdH!N&JJr7AasnJ)F*fdt3+GKm{9De%<$Jed^X!gzFRwK#&^ zYZ(0Leafxk2#Sz2iJi?6r1Dc=JiUGi`?trhAx`C4s^g|K!meZlq#qE7&gR?SBI~nv z+FaY&Tv20E17uP@v|v0Lr(e1cCO~_HEtr#pNHo^Mjh36Ui@{z7ghhy6_GE`3(WY37 zv^mENaKw$%lyc=koW%pS;`_4oFlO1u+VI-fH90;jP0*;G?>w6@BRqt3;=a3h|1+8F z?1G;~fKZY1?sh_Nk~^}Mre0HPKh}<#&2fC;NmsF}8g(rC0yhabHV$|z0Vm70uu4He zgfI#;20cG_8OsF`e@b_VA$@1OK62NVv{F7Cy4D7hy`re&SZ7>l0H{Yer%;!W!fU z-6aS#3lGzhD4lYP(j|^k-Jj`sOM$@3>={0{K@R>lLDbpU78E!|bVe5-Fnr~>4PCp9 z!_=w|xtlV0#oc1aW(%Fy-B_2tat&KEqR73GWQHOu^r$2<98+`k)q{&rqb& z0RI=4rN(u;>5CJ@rN;@g8aEL{t9B;N>F3a1T*{r!MoHQiBZfBMsxLiQeDG6=+weEu zj36BvOJA`#4JCyuJeicxnkTLb$pgOA;in!fe(R<*Z@78<>6adbo7E@n zcQ^F4T65$wGD84&3-4iyR}vwWZ?QumLglx|hZfduU$y~wssaIQ*hnV1*(o&C>4u?p zOI0ZA_j&g2Q(^YCZUr$S4s<-=9sU+GL`y>>bi*s`@toCNKX20w6{ofs&3{4m8eYnR zaVLkbiq1--5sXdQ=BZ6y?9G_xdbuM3mp#Wo)YEHR5N`@)*jlWyVA0B*$OV4*_&RW4 zz_{JRtqPRwBHbqRu`lkxCRo8cmby;w<#lxq{7696z*E1^)YiSijt5Cvy6KcM0R|71 zF{Jr6XzEk$GC3LC^g6r;XdknmL`1t7O~@h@-ma{K{$c#7=pVf{z1erbAF7fR4Hx4Z z1)g6Sn!PD|dbLypL53{A$V%1ktH8(5&%0ugIZG>+S#ex!1+O->=~l z>9r?p1SRWBQ%>6q`low0v?yLn;s~th`F_`-wh!~tBM)?b=#~yX{7yD z*+?DeLtn(MPPT?MpY;2#rBJCzHw~KTurN;WHmLIj?XqIR2Xq-SbDQsf{``^4NwO$} z+-M~w+L-y91|Gqf%V}jl(6hPP(y9gV5afBrl&vl$E*<2OfN%=&N*;#>) zy^xoe@X8~Sw$ERWqct;dM%o^H9OCtr@id$Td+rx-$x+hT={ye7V6-;j$6MvuEQ0lj zOE&!26tO;_mvk^`_0d%4eAXnAkqPsY9hYNibWyErtM@^|QxI0FA*W)>>cprl_Lc|o zlnb7Iy5VxH0_$E{lP*@!iGJx93121x!3WLA5Ep`+u(tT_w$a#ABzom-EsiTrnUoH+ zuM4Zz!=o=i`5lUZlA`~JrC6tfuSZLeO)7=fqP@;@ZVmV z$0Tyy5FAGI^VrC0ZW1e3BCTxXKIQLEmyqcX_zEQ?Q$+tR=GK1ZCaer2PN$Jk#nxWf z@G^z;*7V<}wxpmA`*l*hMXb-Jq7oHd2$V0lQ$FJroVLq;n?B(ohVFdVWHA=McM!!Y zQxWtoy97N8J5Fm0FA1vZ+cuN{=@BGnaYUF6M*p>sayLg~FNch)KuPX1Y2OtoLO78G zSBhIdO?INLmp&1bGK`PSHWWy(xHy2xmu?+RI)CMHh;TfM9 z{EtJYrqj;d5Wjc~*<1GACYxnT1xU3X@1K(7P5yb|-hq*G^-B3sk19W;jAfF){ny^< zZaaf^H9T!WqM{`3nukGvSEQk3ef>0iZK7h?nC*5HeRKr;YopU> zsr8->Ac<^AdryK-$+@Yvdq;+_t|PMcgYi!WxI1D=#G4NLsJe6ph%Xv3s0Dd@8lT!m ziXBp8zMB(1lXY8vxk?OshLOtIJ1F#*n~Eo3k=meNk@QzcE12wigg1iq9Q98stL63F zXl}F*o9KvrRmmC0MaI_@99t1V9;Y0)vbxdlfusDoj&CWl`wH)nazxhyn&&DRbkzY} zfjo>4Yl{?Tt!VPDwzfqCWJQ$WLQy$bK2l>tyQClMb?`9=3LA-{gMZE9D<#enWI|C= zggM*FJwnY`ZbS4N?a4%rvE8;haocEw8qoQBdq3S~O9aBd{|WgSk~n>xsU((YmwSra z-;5KrRI+1S^cn1(Z4h&S*0A7)8(gg*OWL|c(!0YPfxsG_K_^$-)~M*X5Furfvt=k> zho%3}we*f*c7i-6d2kl64(I#Ugi=-Il?$da@mmrsq@W;d!>7AhsU^FiHIYd@ntlp!~QtT%(gKTvI?|Uif)~YF;=G-6kvq`oIznq{ev%VjAPay7vp81;56gMLC?Z?G=ua}+N;i!eIH^FadD{ZWn zAsjqLCu?nhNXE3EUQ%0HQGdGS2L`*3o4X0LEvrK-(HLO47NBu^B=W}Z_aQOMFD@?` zs&0%Bfh^q|FA{dfDJl}Z)9!Fy=F;jc1>vMBKXY)%#6s2ZYdqLr6D=;PKBVwmzjzFG z457=ILPtC`YocspLFp2Er3{%|y^ORpx!`UlrhNYCd~g7T1VAgfxo_6w>613}bb%qx z#3e3o-y3DDy2Zcl@7N6b89p*n6r$Ek0x4xXt*!@V+oU3wvaH-vvAf3EDuC+}Jukd^ zAd0y(Qgl&>2)&J*N)=NCPv<3I( znX5MN?XSL6~w*Mvw&RJtujhCUM^|D$2*_@g;m zTbIat?-j2w|B}f(uj&j2n5B)Db=}_LBjWz*zD18P|!nT(a7IN0%?^+l7ik*;1Z!8hXrV z*pBJ>PWInAdn&^c1L08fCmw<8ZEf5jY*hg(w)P)ao#O~hIiw{7;i!2s(+ih;_us{2 zp^hjG=Y{n5-p?7+jW~+F{E%)ugWs49Cci*^EeGU(G~IvpIYfJ^jmwx!Tz)Hv^gft* z-VVf3HABa7Lm&aa)sXYpwnv(c@*x^mOfy2^I8MLs-BYrDV=4Wixh24cEweQG1@p`(`-qRIC zrTg>Z<$RbvgNkJ8Nn*QsT>jY!kRS>o-kZ`1eDnze_?I8)*45MUZu7qYWt#=h4@CCS?RHOOyh10-dRA-9QC^ zJh)xsx)c3mK#jXi5ofaS zu;pgE81Ld`^g%wdIDi6PMBL$1i30{dv6+!E%^%dMMNYkl&pEZ-E!@m;v0>g;48z+y zwgc0LRAZ=sgHM=xXkA35scQF`OtNqyCvO-Qvpz#)ebXYu zD|n`N>xZHls?8TOo`)B)5742H=DnT!=#F;K##9q1I5F*_avIu0?xB0l$eQ*B#y@myRD$Y~8yPm}TxQFJ z=~^q?)G04JQpFM|g1vJ<)SjOqtl+SElH$#iT>8Kca6?UZHC3SV@zib%aW)mz!ox$V zguK@M27y0GX(pud4H-!v+fp#$fH?X=v=c{+l~b-|OUt;fKPeW0PRTBN&DFKE2(-fu z8pet&65UQs$0JD`HG`e#NpsEOias6h1pj>g!>)?dg}L<_GH--@ip`s+2(mWHU5LW` zSLxB$`RN{brjxKD?VB9vGho`$Gh?_NCos$BsgkL$5mO^(q^gN;fhCifZ=kkP6Xt@b z-TKs+yG9aNd|lRNcbJ33u*+LF3?3aVH)3ULN--J2_x#?a@vAzvuw@+jR9Z(hR$q}1TBRPwz5_MpwaMj;6KJK3vbdcn(M;b3`R+dxkALc-*hoz{ zWmGKP*ZxJWu-QRjK=2g0W$ubTFj*GzL+mj*rjQEU6G-(E%@?p7PL_9SQ&cx4TKjxu z@BGSi^oJo?cTS%~)V)R%5JprFg;L_?UHfF6+i|lFHF^m2QyNtMnpil9z}}L*%`)ff z8Tz?=J-znPA}mdso;F||ZYeSBX6j&5*akmR;59dfQ0-?3c?e&3Hl>kow?=J*g0v5P zA|s_mt+43y62FTt$d+S?k8M+g_VFd1{$MPOPhJQ6cgw(1W_ddXq1o0(i-FHCIXc$1 zs5YOKbhU9)lIXal_~ogBT=`JJgnrLktH)Bi8He_^`ChGGE~d89*W3lfD9<_7`U+^` z44+DFuPe1m-G`rWGfn-mhrU-#OiDz5;mFo;di{68J2nke+o{*NKjH^zX+dycL;KX= zXKfuY>KVv#WQ0dLv+qU=@VY;M>gGg;>>p%ODP+jkmDtf5@`LX7X@@XPVwce{G5~wbrTH)QE3vaEa@JRDwp5L0HI>ByOqHfS~^7G|4?{ zI+ow3zahWe3>Us!ZQuBA-zt|jye01cMJ<${T!*o*#`O<;@Vo!0>tSAKsHT^SFLy*o$*| z+aF!Wd!?oCK`9*@jZSDV-)*vfUisI_<~N^*P|G=;y8RWQ@Tr4UOblmn0==ZB*NKKI ze|sHrFc)d5=KNr+4u2u(TzZIC_r!A1YNjbB@=`>U=Y3iW*${VvC5S$M3$#nt0wH_J zY=BN1Qa$?1cHY?)+R9}T`9DRwfPTf#y+sLC{>lcz+5~-kb<`JcyRFp#%|!1$?Y2WA z)SsNHE6?l5gZ*0};<;EQ^L5U!?y-Gw$d5#HswrddM`@Dr1SskHva)w&`9H}EgT$*T zrL68bJ!vD7FTcyS^Agdr5+Lx$8D*C@qZ~+EUBMa)D_-RA&VheY3Whh?I{l!Ski~7` zhaFrH&u6N}j6EsCgA_f(pBp~n!xa|_w$Sd0!{OWcqJGsg$@kl_?sK8dVV=mcLEXsZ;c)`p2I%rV#AUt0=Pi!Vli zS=2V}U)Dey+A7*k*e8@_!o6yJ=(ZmBFeH;73GdmZ!IC)oDjglT&(_>l^R8e#(*(|F zm9;x>>wL+nvoses=4FcTpia}7U8jgm$UD07^wN!}^euDb%46|?xZ}2!`)IOc^r;1X z1O$Z#?Xj9XjOlb=rPccX|34%ShNG=zzsvGsDTBV!u3;+4N_`QEGk=D|0m%FaMA|Cv z_@hEzrEh3xU&GLFHNfyH_Mkrfv+<-Cbi`9#%@`3`*u$u6BM2U2(&76zI0bkbhd_EP zrb)2XBKG|J&!B@baKKhW*1L5Dh=#WehdtcttO;nyD}hwD0iqiTJ=kpLZLL1tT(Fmy z{6i=yiBvqiCw%dxd3~|bW?=MKo!7Vvo=Q*m@#Dxn93F(qs$4k<2=s4BOHXQ>>KkhR ze!J{J^sYugh^I41Z@l;692=QPkQABe90c!a6PgN|f4+!Nh4jN%t%D4^VIx~-qo>q8 zuzT(Px5UIAaX_F9WcA@1=~dvbQg-8k2MkRPT<7jRwVZdp@&P=@#{%&&_WoX!P0AI;KRQEAc+IhkaU!QpVwx9^Ty zBV%K;#Z`p^eYN%z{f}@k?_PdFG0%I^JYFs?uGS7e_W;=4X=zhh+DCHMaRy|W0iV9U zJ^gpOE>s}{vQ2>0*0LaL|`rjpq4ZYwjq;dcZ5JN$~ZDuCob-s4{a&uUG zbaVJ`DRJ)={)q?rMl$0FV7sBTKjjXr@DW;v=L-hnn- literal 0 HcmV?d00001 diff --git a/bundles/fish.payara.eclipse.tools.server/icons/obj16/java_jar.gif b/bundles/fish.payara.eclipse.tools.server/icons/obj16/java_jar.gif new file mode 100644 index 0000000000000000000000000000000000000000..6059f865c8b50c331208d16291c71ea9740d6906 GIT binary patch literal 594 zcmb7>+fPz)0DylgX6kZyLCwpWm_}uj%2Lx-S<7&3U929uN?2N!K2bWgg?f0)pa&m% zaJtN(oCx~Q~fVZ>fxFGk-1j}>*(yF33FQaOh+PD29A4g}+m@~SBQ@tfp*$q#3-cr`eEGS)>ZRQz7m9Mh2peNK znqi-feX!tUFv6I=+QT$YQY_8KzY~5N;p5{1BR~d1j^_=ZKXE+g3poQJ96}7jAdD}; zjb%vBL4FyMV=$l-7@I)bHmFr}I1_y?L3O#PE+5rxNA(4$z7W+HSq$x#`3}se#*E#Q zJ>YdWnCJm-dPP%DlA*9M-3umr65&6S#*Xl~ITkh^z9Co~=JpD=t9NDs#$@pR6n2S(%1xkspvGmgP!n~5 L7m5ZA0Cj%=v!p$j literal 0 HcmV?d00001 diff --git a/bundles/fish.payara.eclipse.tools.server/icons/obj16/logfile.png b/bundles/fish.payara.eclipse.tools.server/icons/obj16/logfile.png new file mode 100644 index 0000000000000000000000000000000000000000..d0f8b9b0efa7b5792a7154e9ca771ad2fec41ea9 GIT binary patch literal 770 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|6p}rHd>I(3 z)EF2VS{N990fib~Fff!FFfhDIU|_JC!N4G1FlSew4NzZXW=KRygs+cPa(=E}VoH8e zs$NBI0Z<16gH44MkeQoWlBiITo0C^;Rbi_HR$&EXgM{^!6u?SKvTc;E0x+ORZW&xbe1>vxEUt+ze+ z;qP(%w)giNC4By;tkB_2*|Bf$r~SnV?5i{t7CY!g6o0x`FZ%n-e}(3PhjX)6|5x1I zl_DNh`;@-@!@%G{4{M660&|`5zkUB-K5ev#-7gtE;pqcC2F|=F1I{TE9<((D si%$4pBDC}8*Rv;!O3t2O1AfjnEKjFOT9D}DX)@^Za$W4-*MbbUihOG|wNBYh(y zU7!lx;>x^|#0uTKVr7USFmqf|i<65o3raHc^AtelCMM;Vme?vOfh>Xph&xL%(-1c0 z6+^uR^q@XSM&D4+Kp$>4P^%3{)XKjoGZknv$b36P8?Z_gF{nK@`XI}Z90TzwSQO}0 zJ1!f2c(B=V`5aP@WME)Y^mK6yiQs%2c2?UZP{ckzP2;Rigr}xXYVt`plcfPBovr^H z)~G2SI^^ax>Czu|u|*El}GN zARuGDd+{j?4Th!DxfdTbna3Ez!k~Ncs!L|){%;>_7!Pg=GSKBd=JqTxKU=bY(S{vt z3p$>joWjpAYwqsy+4~o*S$q7TfzN^(3*)or&fQ{|70b_G=HOZ>u&zvPjvj~mvpP@l zCyyQC^C!;`YgLQqWD(Lzsx&gZ$ExMHb`J9tYc7VnMGs1fk3Doq|G#Dmb5N?-$H`nj z%X7;(-!yg>9DY=AfR%w~W%yrziwO_fuRW8?DQ*a2=6GN3^k(1o`9B|=|7K%)@ApyF zeRiiU8FY*cbal4}H0j@Cjo6U~)XT8n^P+Kp2;U2<*79_L^lPO|liylg{<^)rdDpgu zVUco6j!ek?vP#*c^wXq$D~|kW6{>i4;AUF^o8jf@Gp~4_$aiW_IHSeFaKmkT)uDSr zGoM#@eEvP__3rRVGwh=*{^?HG$G*YggC_G4_sKKcneXOrxc1BAjo8t@oT-G@yGywpI;gI0~ literal 0 HcmV?d00001 diff --git a/bundles/fish.payara.eclipse.tools.server/icons/obj16/payara-blue.png b/bundles/fish.payara.eclipse.tools.server/icons/obj16/payara-blue.png new file mode 100644 index 0000000000000000000000000000000000000000..e7b14f24ea47a43d3633954ab9071383f4be2c16 GIT binary patch literal 1794 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWuD@%nF$y5hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP zs8ErclUHn2VXFi-*9yo63F|8k)?~Nk)^qzp{u!tfu*UNrK_W*v7w8h ztC=}WuSMv>2~2MaLa!@My`Y4UTL84#CABECEH%ZgC_h&L>|v`++-`BgX&zK> z3U0SJqWpsed0vuRA64I@N{tuskpUf zN~Di)ph%m4`m(uV5;@s70}o8#*s9yApj611deP;v*!GM?YA%J&o!q~kd|P0+XNQVg zVQ0sz9cl|2I|RZzx^x4=a;3T&rs$O{ENPo|%{tk{t>(g!-v&ER-l<9ddA`1)(ShOL zam5?w`6c>~GjBf1w)XAa3zu)J|4uSeKO1`T{+HQj9IE#UsE9B%CM(Pq;!2j2no+1< z@>QysV-ioo{>ha(vd0}SFTTIvvh=e$Gl|548$1&H&W-!_KNM#95%^)rJ=Ghdg>#S~obx$*k@;T6Z3RZg-q&gXYj;r#XQ;F{p;TKA{N>eNr0 zy3TB^ZbXRlAHH3mUSytp+a9{KgX6JX{GO{%gQVNr7SAaNock?T1>khqa z`uWo`|NK-j@xrMa{(fA%LZZ#_cY3o??pd+5*IyrIbbWsA2+IO?h86NLxjB_gj1AY> zd8bYnd!DkybOR6H5rfAo@?@sHu?h+Q{wH*uR_Zi8Z`0KuW8KT!!fsEqQuX;}>ZEk7 z(&kG?fXbY#Qj5tsV%a%Pf4(rDZI~2ws zDRmn-qIQ4P(sW&`rG0N-h>(}$<7Gz=v|r=2o%mzN zHoJMul0APNzrHv1ZV)M8Hh5UZ{e-hnUs**cxg;lLgWGjcVI>v&)Kyar+BQ9pYX9|Y zp=8Gt&#&JEtqVR$v$0KPKXXm;jqGs)kxBf$xw1P=^JhJo?d2bK!~L$|#fc9$*pw@3 zq^mIrJzjpwzU7fo*2|09fBD$+k8Wy;R+*o_`}>!h`<{JU_vTqzuDjQ&RkfvY-?+;d z43|iW3h~6V`Ffb#Pw8Ipa>`~QW$l(o*>ye+lTUl~Dtb?mw~x`7+Ep(lbk|YFtMO#g zTpq8U-giEpJ{C3xIi0VzNQxKLXGrCl1m2k*X`%DqW% z_r&A>GJ6-yH1J$GL3*M{>iP3N`z1xqt{S&35&eJI?$O`%N5AV8KfO literal 0 HcmV?d00001 diff --git a/bundles/fish.payara.eclipse.tools.server/icons/obj16/payara-blue@2x.png b/bundles/fish.payara.eclipse.tools.server/icons/obj16/payara-blue@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..ad30befe4d61ba011e4c62ab2a1ba01fa0fce90e GIT binary patch literal 2530 zcmY*b2UL^E8vTLLB5esh3Nf;ZuB3pA5L)O>I!Z#3CLjg~ng|4Gf+CR6mfnl33J4kz zmLN@!9(iQ~8grdMwR(OFI+3gao+#dmt~5JMfSk%nX6Lp`&c>0_J1xU=08fCjlV#4gl2_}1ms|J%! z{3Y@q9b;dT&y9c(asV+HcBt#+O}t6gg~Jbx{%L=mlN{jpU#DQw-(_(NL>}%S(Fhds zA8l@`&LN7iy%FHcbw1SBL+gBF{vYptti=E}cUBMKQf{fu8pmrAEwU&~IUN<6yAxY#2$RJT)AOQ)L!}Y)26v5xvv@0 zdsmwhquDS%(%@iC@)ORog%U`+r^mac$i=dG1xLB)l;LfAAa?zk2MsC(O-7q4Cx0$3 zRET0j0E5B|%ND=o@wcR#d(S~$7H&=uh*a?oA%}nDLi(9YD+r=gl9D7k%tC0P_qy`D zk&@Xxf}>gVkg7i)Xeqg?IltzkxVaGO`j}mWicgPQ=b)N4^}ASc>-%Q64mg$X40e}T zYh-&XXLjM``B?+H*cv>KV)vnk(Okc%__M%TJr8p$r)1wF0xI^v^F|(Rj8DLwRrFF7i()7%(x-EcfV6#C3EAqmLY{4_DKqy(=f1Zl zC*)0LQ^LMJlQ|W1l2#YXJf?xlrF?N-F33&5{qf*>wCJLuNf{O*{>Ho_kH0`OqE16= z`zh18M#00%df@T(pyH`<)A2T1IKx4w0;gF}+@;VB*#6(z&_j#usy`wW`sHLKlQDDSV+!giJLA<)0n zml2(vM>}k0`f=d$CC{j9D`kH2kKbnLj?C`rp6sLB71wEvJd&p9(KcEHq<4??{Vr0z zyw-72!@sD|&@K(=E+yG-?hb6yW0qaEmzD{ty*1+zvhIQ~U&27G3e+9Ae+k`t5V4h0 z*f``=^P4k$Q&-l_)iy?u9LZnREcPLg(Jq7d{!G|-!}#wGrPRS_ z;dpJY*4Bok(N{LELV~|TG+Ckdap)yk#!oK{!u2a7#fJkqSyPBpC8gPIZAG-S%r<$T zU%!gyXq=`6{A9co#>(UT?dean2{Y`orPtaB;=u3%*mL|mgKC9eFwKcW{t0WV(u>|q zkrMH-rj+R`*}=@LeoESNBMc8hi^SV1213}o)$~QYYJ?@l#avBNkxzwRZ#N)lzEAva zPhdpBy%RhB*n;-@s88b$y^Q9SnYBm**ehD;1)tOj71YBWn12Z~f3R?CdbDAvIQPRX z!8&Vp&gY98z8(tB7I5W>xq;lDcq4mj&!)O*CKasTc32}n%pL(Rj+JzLox0gp)xrL= z<#NQ#cemJEKZpMI0n;tkxOdJSFST{ts>DO=$A^QssX^fhvRdV9aO+3wj$I*%1IJIp zWF_WZQp|)Y>xqC?Tz*OUX;_iT5hl7kGazl3r34qEaPl$3It%mhI0DZom1R=xJE*|f z&qBUo{`mB@;3D7+8nC0P#`QBG5~+kT&LstwupJclxK%K(C2Kaef-z~9Vm}?w_;7>m zdS<<<@a|kqrW|@K)iZWbGB$bVt80rWkYLa@hB+sX@IwT580&X5 zzu9Q#r5m9Fk2|UBrIx-dUIazj1K9BbD0-%7yRt{}5nj~oIWc&Hk;|-CshO-~%*kNB zG=7|C#it!?cfOGSC8vbx-tS^UoT6$Px*oiViuT=CbOv*L3(wY0Pq}37X@WP5 z?tb2%QfnNVN|Ugamup5OSP3tpV=1umnk(4)pdXm(DNj0e_aihH#6l_yS>2_NUeQn^ ze3vJ$8yywMYi+h!K8r)-yOf8qx_YNhis^|*L+7ezuI!Z#3CLjg~ng|4Gf+CR6mfnl33J4kz zmLN@!9(iQ~8grdMwR(OFI+3gao+#dmt~5JMfSk%nX6Lp`&c>0_J1xU=08fCjlV#4gl2_}1ms|J%! z{3Y@q9b;dT&y9c(asV+HcBt#+O}t6gg~Jbx{%L=mlN{jpU#DQw-(_(NL>}%S(Fhds zA8l@`&LN7iy%FHcbw1SBL+gBF{vYptti=E}cUBMKQf{fu8pmrAEwU&~IUN<6yAxY#2$RJT)AOQ)L!}Y)26v5xvv@0 zdsmwhquDS%(%@iC@)ORog%U`+r^mac$i=dG1xLB)l;LfAAa?zk2MsC(O-7q4Cx0$3 zRET0j0E5B|%ND=o@wcR#d(S~$7H&=uh*a?oA%}nDLi(9YD+r=gl9D7k%tC0P_qy`D zk&@Xxf}>gVkg7i)Xeqg?IltzkxVaGO`j}mWicgPQ=b)N4^}ASc>-%Q64mg$X40e}T zYh-&XXLjM``B?+H*cv>KV)vnk(Okc%__M%TJr8p$r)1wF0xI^v^F|(Rj8DLwRrFF7i()7%(x-EcfV6#C3EAqmLY{4_DKqy(=f1Zl zC*)0LQ^LMJlQ|W1l2#YXJf?xlrF?N-F33&5{qf*>wCJLuNf{O*{>Ho_kH0`OqE16= z`zh18M#00%df@T(pyH`<)A2T1IKx4w0;gF}+@;VB*#6(z&_j#usy`wW`sHLKlQDDSV+!giJLA<)0n zml2(vM>}k0`f=d$CC{j9D`kH2kKbnLj?C`rp6sLB71wEvJd&p9(KcEHq<4??{Vr0z zyw-72!@sD|&@K(=E+yG-?hb6yW0qaEmzD{ty*1+zvhIQ~U&27G3e+9Ae+k`t5V4h0 z*f``=^P4k$Q&-l_)iy?u9LZnREcPLg(Jq7d{!G|-!}#wGrPRS_ z;dpJY*4Bok(N{LELV~|TG+Ckdap)yk#!oK{!u2a7#fJkqSyPBpC8gPIZAG-S%r<$T zU%!gyXq=`6{A9co#>(UT?dean2{Y`orPtaB;=u3%*mL|mgKC9eFwKcW{t0WV(u>|q zkrMH-rj+R`*}=@LeoESNBMc8hi^SV1213}o)$~QYYJ?@l#avBNkxzwRZ#N)lzEAva zPhdpBy%RhB*n;-@s88b$y^Q9SnYBm**ehD;1)tOj71YBWn12Z~f3R?CdbDAvIQPRX z!8&Vp&gY98z8(tB7I5W>xq;lDcq4mj&!)O*CKasTc32}n%pL(Rj+JzLox0gp)xrL= z<#NQ#cemJEKZpMI0n;tkxOdJSFST{ts>DO=$A^QssX^fhvRdV9aO+3wj$I*%1IJIp zWF_WZQp|)Y>xqC?Tz*OUX;_iT5hl7kGazl3r34qEaPl$3It%mhI0DZom1R=xJE*|f z&qBUo{`mB@;3D7+8nC0P#`QBG5~+kT&LstwupJclxK%K(C2Kaef-z~9Vm}?w_;7>m zdS<<<@a|kqrW|@K)iZWbGB$bVt80rWkYLa@hB+sX@IwT580&X5 zzu9Q#r5m9Fk2|UBrIx-dUIazj1K9BbD0-%7yRt{}5nj~oIWc&Hk;|-CshO-~%*kNB zG=7|C#it!?cfOGSC8vbx-tS^UoT6$Px*oiViuT=CbOv*L3(wY0Pq}37X@WP5 z?tb2%QfnNVN|Ugamup5OSP3tpV=1umnk(4)pdXm(DNj0e_aihH#6l_yS>2_NUeQn^ ze3vJ$8yywMYi+h!K8r)-yOf8qx_YNhis^|*L+7ezul3^w)^1&PVosU-?Y zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP zs8ErclUHn2VXFi-*9yo63F|8k)?~Nk)^qzp{u!tfu*UNrK_W*v7w8h ztC=}WuSMv>2~2MaLa!@My`Y4UTL84#CABECEH%ZgC_h&L>|v`++-`BgX&zK> z3U0SJqWpsed0vuRA64I@N{tuskpUf zN~Di)ph%m4`m(uV5;@s70}o8#*s9yApj611deP;v*!GM?YA%J&o!q~kd|P0+XNQVg zVQ0sz9cl|2I|RZzx^x4=a;3T&rs$O{ENPo|%{tk{t>(g!-v&ER-l<9ddA`1)(ShOL zam5?w`6c>~GjBf1w)XAa3zu)J|4uSeKO1`T{+HQj9IE#UsE9B%CM(Pq;!2j2no+1< z@>QysV-ioo{>ha(vd0}SFTTIvvh=e$Gl|548$1&H&W-!_KNM#95%^)rJ=Ghdg>#S~obx$*k@;T6Z3RZg-q&gXYj;r#XQ;F{p;TKA{N>eNr0 zy3TB^ZbXRlAHH3mUSytp+a9{KgX6JX{GO{%gQVNr7SAaNock?T1>khqa z`uWo`|NK-j@xrMa{(fA%LZZ#_cY3o??pd+5*IyrIbbWsA2+IO?h86NLxjB_gj1AY> zd8bYnd!DkybOR6H5rfAo@?@sHu?h+Q{wH*uR_Zi8Z`0KuW8KT!!fsEqQuX;}>ZEk7 z(&kG?fXbY#Qj5tsV%a%Pf4(rDZI~2ws zDRmn-qIQ4P(sW&`rG0N-h>(}$<7Gz=v|r=2o%mzN zHoJMul0APNzrHv1ZV)M8Hh5UZ{e-hnUs**cxg;lLgWGjcVI>v&)Kyar+BQ9pYX9|Y zp=8Gt&#&JEtqVR$v$0KPKXXm;jqGs)kxBf$xw1P=^JhJo?d2bK!~L$|#fc9$*pw@3 zq^mIrJzjpwzU7fo*2|09fBD$+k8Wy;R+*o_`}>!h`<{JU_vTqzuDjQ&RkfvY-?+;d z43|iW3h~6V`Ffb#Pw8Ipa>`~QW$l(o*>ye+lTUl~Dtb?mw~x`7+Ep(lbk|YFtMO#g zTpq8U-giEpJ{C3xIi0VzNQxKLXGrCl1m2k*X`%DqW% z_r&A>GJ6-yH1J$GL3*M{>iP3N`z1xqt{S&35&eJI?$O`%N5AV8KfO literal 0 HcmV?d00001 diff --git a/bundles/fish.payara.eclipse.tools.server/icons/obj16/registration.png b/bundles/fish.payara.eclipse.tools.server/icons/obj16/registration.png new file mode 100644 index 0000000000000000000000000000000000000000..9267b10aec5f6b877767a9711bd9a365bc27d3c6 GIT binary patch literal 642 zcmV-|0)737P)z^Q>-8KIssI20AY({UO#lFTB>(_`g8%^ZB>(_~(EtE# zUjP8;Yybc}ivR!{ScB&WcmMza_(?=TRCwBylTT|CQ5400FY_jU%#1NrnOYh(B|@_( zr67ocE<~%Fx^PwW6Z8v67lPSHUAS=5jUU2A0xq<5FNoNPO;bx00)-fBLS`B>olKsK zm}+8L>Vvy@_j1mA_ndnLFvou!rBv?ky9C&_RrV<0F;mhk^~m7@8Nr zT)x!I9!9YEB+G}q4S-MmmGd!kt5*vEXj%JDG zCXkvK`uh5Ih}oNGc(7amz&bZZq?o#KWCAT}u<^CVpK22=YA`?$Kx%=Z1m|NvXtYN5 zMRXhozp<6?)1dc*VR5`&B%;1!Sr(RM5%jC=onmgQ&xLA34Rzu6y(R2j8^b(?+iC$2 z3Wu@nUFvmrqq+G!Edhc$1a++s{CIhVPHcvYGbTIV$~bndI}c`@$>{{^C417Ge)LQN z=n{012}@OdTkLMWvU+yNoPB_ItXfS$@ePzDN0 cskgrd0OPi;eRn?7Gynhq07*qoM6N<$f=#p)fdBvi literal 0 HcmV?d00001 diff --git a/bundles/fish.payara.eclipse.tools.server/icons/obj16/resources.gif b/bundles/fish.payara.eclipse.tools.server/icons/obj16/resources.gif new file mode 100644 index 0000000000000000000000000000000000000000..dd2516055bf49bc8ae03b6506d17e31036429604 GIT binary patch literal 588 zcmZ?wbhEHb6krfwc*ekR_{`OLOV_-4|LOV5*N%Y+0m-GI8I|435A>}%+_U^ZQS;=k zc^fOcW){@%%+P>GxeP6rt(3=mRpTBw|X= zzH?Q4rm4m+vaQ-2`~O<}|Fe<*PelGdmGJ*;#{Ub&|F6{jzuxix!=?Wpum1mZ^Z(~N z|G(V(IEUf&42H*(8E*A5oNr|~Qpd2PjA3m)!=iMCnTZS&V;KJb|IaWKfZ|UUMg|5C z1|5)NL2<&szOupA)}y7htq+JaS)%2gg&{q><6Onf_Fi_X~@>Ne=fRWk5{jZ`f1M@bH!VUp0Q4Zl%4uJxl g9ijrt>jW+quyl7zMD}EGEL!Z|&+9D5#lm0>0LuTZy8r+H literal 0 HcmV?d00001 diff --git a/bundles/fish.payara.eclipse.tools.server/icons/obj16/web_module.gif b/bundles/fish.payara.eclipse.tools.server/icons/obj16/web_module.gif new file mode 100644 index 0000000000000000000000000000000000000000..bf20f70173e51d85e2930f23f36dbb7e9b1ef238 GIT binary patch literal 588 zcmZ?wbhEHb6krfwc*el6V8Igm`2F_r^W*FHFFWx3-KQUA6Spkfe0tBBhnF9Gy!ZU` z<2OG(ef?QEbw~N6EsZm`^(;NoGHc7qz1Pm%d4J)-=SvSipT7C}%A?QM9)G^|?Caw< z-ygmH_Twn!aN9xqBZjKl*&<#ne+iAUVQlR;Q70c-~Yb;`2FGYx1YcL{Ql$T;!Ot*U4DG={+qRXPOjN; zX#d$8AHV+i@a6lbuirm>{jqMx9{c(GKmGk5zkh!{5Y3-|=jqe$KYt!RbIQIRYW)8D zKymy1_kr?2Rr9xQ?EC!j&i`LmK7Y9L=hy4q>neYKzVYYn&Rx^hcF)wz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;gh@m}RCwBA`v3nw10@(BfLIvNfOgm>Mj#a}DZ)PW z{iokNzyJRG_vPEKC!FkTwLtNuS6BJ{M^+CIK#U+$&@|T@sPomk+X^#S=!!FZ{`HYz z)%NEMyAFN$@#_ymCs4i-*${vLLU%zl5G&8BHDh3AVq;)oW?}gDn~xzSScE}d`8UUu zIj1Ta|NpxKRI>!80U&@t1~38fKPcb7AzM4-^UtpgZ+?7bc>jxy;pNMd3}0B37`}+| zGl;0ZXM1~#-yf)M8B7mA0HGMb$IB8TEcT6I-KC2RUzmg#{t4SKy!@-m@aWNXhUbs> zGrZ${!@$fCXbsf^^2UFF0D>6+2A@9vdA{xmhvePIry0Ke`N!~`VIKpFxB~;Th%>{Z z`^Ol*zI)3c1yKsp^B2Sb2p}e81AyS@fjjIBuSG){?!JG@@aW}vhP#*g89u()&mgYf z!obb!09FIl0}5~kfB<4b3&f3o?>=GR6fayv+t0xE<#!`U4G^$B0cGKmf5^yTtJS&BtF1j6i7+es-6Qfr%Nye*N+XL$K3vh6|T@8UA13 z1lskN0fZU;Lz0bg+J8oX0Ac}Y1_78uB$a+KJh{yVW`F(ihv6?UDH|F6ha{E%|1ewt z5I~HP{`*n=1a~MS!_xKkj8y@~{~;D&dbNGyIYxj0!Wjm{0)PMm0B`mt;8~K$7XSbN M07*qoM6N<$f<6dep#T5? literal 0 HcmV?d00001 diff --git a/bundles/fish.payara.eclipse.tools.server/icons/payara-blue.png b/bundles/fish.payara.eclipse.tools.server/icons/payara-blue.png new file mode 100644 index 0000000000000000000000000000000000000000..e7b14f24ea47a43d3633954ab9071383f4be2c16 GIT binary patch literal 1794 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWuD@%nF$y5hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP zs8ErclUHn2VXFi-*9yo63F|8k)?~Nk)^qzp{u!tfu*UNrK_W*v7w8h ztC=}WuSMv>2~2MaLa!@My`Y4UTL84#CABECEH%ZgC_h&L>|v`++-`BgX&zK> z3U0SJqWpsed0vuRA64I@N{tuskpUf zN~Di)ph%m4`m(uV5;@s70}o8#*s9yApj611deP;v*!GM?YA%J&o!q~kd|P0+XNQVg zVQ0sz9cl|2I|RZzx^x4=a;3T&rs$O{ENPo|%{tk{t>(g!-v&ER-l<9ddA`1)(ShOL zam5?w`6c>~GjBf1w)XAa3zu)J|4uSeKO1`T{+HQj9IE#UsE9B%CM(Pq;!2j2no+1< z@>QysV-ioo{>ha(vd0}SFTTIvvh=e$Gl|548$1&H&W-!_KNM#95%^)rJ=Ghdg>#S~obx$*k@;T6Z3RZg-q&gXYj;r#XQ;F{p;TKA{N>eNr0 zy3TB^ZbXRlAHH3mUSytp+a9{KgX6JX{GO{%gQVNr7SAaNock?T1>khqa z`uWo`|NK-j@xrMa{(fA%LZZ#_cY3o??pd+5*IyrIbbWsA2+IO?h86NLxjB_gj1AY> zd8bYnd!DkybOR6H5rfAo@?@sHu?h+Q{wH*uR_Zi8Z`0KuW8KT!!fsEqQuX;}>ZEk7 z(&kG?fXbY#Qj5tsV%a%Pf4(rDZI~2ws zDRmn-qIQ4P(sW&`rG0N-h>(}$<7Gz=v|r=2o%mzN zHoJMul0APNzrHv1ZV)M8Hh5UZ{e-hnUs**cxg;lLgWGjcVI>v&)Kyar+BQ9pYX9|Y zp=8Gt&#&JEtqVR$v$0KPKXXm;jqGs)kxBf$xw1P=^JhJo?d2bK!~L$|#fc9$*pw@3 zq^mIrJzjpwzU7fo*2|09fBD$+k8Wy;R+*o_`}>!h`<{JU_vTqzuDjQ&RkfvY-?+;d z43|iW3h~6V`Ffb#Pw8Ipa>`~QW$l(o*>ye+lTUl~Dtb?mw~x`7+Ep(lbk|YFtMO#g zTpq8U-giEpJ{C3xIi0VzNQxKLXGrCl1m2k*X`%DqW% z_r&A>GJ6-yH1J$GL3*M{>iP3N`z1xqt{S&35&eJI?$O`%N5AV8KfO literal 0 HcmV?d00001 diff --git a/bundles/fish.payara.eclipse.tools.server/icons/payara-yellow.png b/bundles/fish.payara.eclipse.tools.server/icons/payara-yellow.png new file mode 100644 index 0000000000000000000000000000000000000000..46e912bfaa4960e9f5021189f9d1256123a183ed GIT binary patch literal 1757 zcmaJ?X;2eq7>);uAQlmCkTtQ20yzmG!Ehy{1PF3uAj2J!C0QWZkSrv@L8=u|ltU4a zf;!+qZN+-PAR>y2$WcYBh#X>-GANcq(Q+u-4FdK@>CWta$2`yTKJWXz-|Rjg@9&HZ z))-(g7$dGb+YcR0bg%vb^c!$5BM=={BW?o3AC5xQLM4cC5yO!nz?BIlpdTm{YvUTg ztr*Na0OAV}0ndvef@OH24ujXo6et^m+3KWG2t_d<0z`rmNY2C#R$a#ekeG=Lr1FS7 z1q+ly?ukm!Khc{nN{kWF#aJgtV5^3K3dlf22xw%nauq|v#7^om(7A4#fCVNYNDLGE z#gu^O1F&Ev2vG4v8xhft2-uPEB#JGKMzaRUL=ureBojzv8xoB{Av1_XVCuo5(UjsS zh98?V6$@Q4u~Gz4FbD*-T8&pz@UT)sAkpb`od%g~gCcBHS~()r*vM75X$3Z@5-A}C z0>N@Xrznhs;}Iqnb^0X*nPNs(u9_+nS}=k}s34H=L|sbLKpyY^p)%PFT7~$5U;X~4 zu!^r$fCN8K1;;Bz=)pzdbfFXsmJ$>qu#ykMvC~!bk-`Y9lEMmrT&Zqsdp4PF$D!M@*c{q4mko>J zWuP3H=8C^^$+L2GjUZE?k=dXUN&v+iB`gCb6J|iOdLeOU)tlmqXZJ#!l}kX)5Ol}- zuVbFxLVHIyooQNhG1K;-9PM=_+SGIRZkvPN6@M<La7uUQT~@G@bJ4t8zuhWS?Xc)w43);=R@`1$LL+$9gpV0L zKXvIogz=bISll@@l69f1de|9qu#{p_mI}J`PM$SvuLa%=G`;69coI&Dc@aTg)h+BU zvK6FeJa(z~c}VS{-4gVr(|xgF%M60hRV0XKGl=A{V--?jEz zQ8IgjB;mVbS+I80zdF9}NY_uE(XHNV57^a*nw7k2^?qH}U!$Pqu(F*t)?=ZzqP+Fk zoFfI_M|wMFUM=^eHWP@OzKOnj)lkuqu!H`|h}xXq^ddtW|IqxQ={cje9M7debPOKgn3SN+HG z!6ZHIP}mE8?jcL|9xr6Xr9R;Lt|y|3*LOzi2I05nsbQzaD>ezVuYMqurdKw2#Y*!x zq&%Sf-1~PcPIA7zMZNZSTaLg%ujkjB=Xv8qP#W&t>%VSXMkJK}I z?XkRL4Vhk#vPMrAEZT6zxMHR80{NRJKfvE9BbjO?Kd?AP4}Vm#LGPodXd3U zi)?QPmHX*S4j;nziP9o%7XcPSJtGPn$`#f!U?;>D$Cu|jcoclYA%4wv_w^PTVB zXRSO*c6Rp8FDrjU!c~=J&{0TG0002GoUEk!Tdwey#E}r*{y?!0)NdJ#v$~8ppkkD4 z|E)r4BCDwUtyUCG4HdD7jg;0_u{||LOi#6QZ_s zad8k}Wp#IVXL09bv3IgyW#{MTXJzAH<=|j`V=y~=+PN5eFxxrP{9EMz=}4M6n>blH zxLDcSQU0TA46%205u&F4$LPP`zsKofW&Z!2?417-)?0wA|Fp2Ov#_!LSNp9i_#ae2 z#mUO-&G{dFVRrDpnEwa+j}MsjAM^h;n14t5FZ3-`VH7ayf2U0tMX{4!2LK@6l#>+G z@PHZ7mvbl8a;xx^gkcz_6vd%rRL7H&r)3_fZd{6JT3S(l$S~kf2RSDg#sRa}#+#0u z623({SIaA7M#gx_dxb5hy_e6GjnCx+bc6A&hi^sIHUSuMk_)FPCE_^;Esw2@UAHGq zY)U?Q$5SdgP^w=`N!*)X5>GsjK2E6;{=7H*-6j+-Y@+o$4Kkg%U(l;trpAgr&P%ntAag@!gcsRa= zRI#>_=k|nF>-M(b#B#59oi1wzjI71yKEdrjpO#(8--*uPWw|xA*gOv_Tmf%nd-lguZ98 ztc8_9LD3oq_i|IVN)wra2Y-~Oul0#@+m)(9Xc-j-w0C;@&xR8WQP-u^r<(wgg)Ba~ zaw89($vJ))N)O1#Y7%(I;Y3*>#GPhp&0AHl!kl-`XScoOaFY+U^4xsE)k+nu_fbtE zuYL~)4=eHV+->$KgvVwYJ`SF*>*^w>4*?4~y8E zcD(^bo@t7 z1(?^Qd+3_GQyTY0IAuz-aY&Wl!Nf4?RGu5m4EEPTA`cMEi&j2tfDi6G!Byp!$n#<2 zpfi8g_F!{+153{zyW-5PleI_ijl=zkVnN+~ycIDacx)d|R&S@RNCM(Z%?b^=nlFz( zx^LiO7cn1tsW3NyRd^+%Ltp@I7V2aWcju59R(Uj z)EWf|IGvC-C2Q+w^6CWhG(-M$H|m#V2w6yjq#`B>CyY**{XF;CkeyIO4==}ZqvF7m zL8axvB6r%u%4teGe(De2LB&Q9CFBwoMdg;$w$!Ga6nyOEE+;Cq-9zB}Gu!@1AB=&RlZqjYq+Rd>&u&g-NEFBvCvEml{ zj2|(Z3vHJCCt-CbnpsGJX2Eg)NO);oVKuc!?7BeN-pial?dZ<-uI|T8ZD}X|5295{ z&mAjkml){0N&>f*%LAljUG>_ryrkvw)f$Z6rVF$8dHx5IBFg%h@3!idqZLQ4>8rUz zwi_o?>QQHpK&-XVFrt@K%Qugdnb^bI?Yxb__&x1ik2wKd7^enUI(y;!L6p$(JRy-| z2jMdgd>?Bk(OHt?5Oq##oXi!*CUjT`r3Y8oH#dE)dNLa_(O^t+zYh?TjM+0xJ`K1n@YKqp%ZB|+roVSKz*+gX4gS=^pnz%#ucmbCt#=hAE^cVy*b4Nt#%*jT+ zr^e#OQGd2Z+7i#Rabe?@rXw^3 zOUbZTDKO>AaTv1_>vj2j0`bGjDq%>MuNP}TlW5^m9-m|LuOp@y}81Y=-dzY96 zTL$bHpqm(=g2Q#NBsI6#XeD^5lznd(nX)1XbqJ@hH{lOz)|A7PimWE9#Ih7XQ7-g9 zb&R1ocB^P<@W*A>G~LrlF7yj2R?eLZ^v0j{rkHSnRmL~hf|q{Z|M9DbWJ+@6f;&7h z6-D#$A`U~yh`KEmncOE&1G)}aD6e*Ratot&RHAH=|7)K^3eb2oe3aowhrlb=M;emp z-a~d6jOrX0?9oOfmsu=!-ngZb%Ak3VTHx)8Ax6tVWCnI@NFUa9C76l~*^eMMO@dQW z&kC_!0zG?IuRIT%b+m~*%ndnaOSW#oPA(!1GZa@TBqYy0>=V_?hKMQ_TG!Dg(~5xL z)8bLtU;b4#|CHWnImz~wbqO3xSKPdv0eCTCbhMTLIpVuzh*crgg?PIgc~>48PMyzZ z1bDvM0oA|6B)B;?e6v*EfjKF4pa{?q$2blVDp!xI5VkHQ9H2++6AbS6_NGcKCo#FO z#v=-tHPny=#qB|xDNNwX;5(lQ^XgZZV6lYA>hnx1j7Y7RDxpwM+yl{}I)5{GXM!}2 z2!ok&!ZwMN(Z{{!9UN2r-dj+6slOv3UncH*F+8$ioL|_e`$8E=x?cyli6fY)Nb5VC zo=}J$8ry5q$vzO~L~YwLbp%~uS-_zKdg`DGY{*f;@Vj=0&l2iGGsL)t(>Lu-VR$E)}+{)pH!G^O-L^WyLx|bxG(r zB3Bw+RK`WIuJTkZ>~v<$XRV$kC1Z46#dZh)Z;}?%Oy?Pl6Z2|r>F~DC8uh#L`0_Mp zZf;ava4(KAbb)u0hxi!hc1Ff$j<$$=2$BK|Id-2#jVCbc^xq~73Q{pcWN3Uo(fJGx z@dwz9Q%MOomXSE_IO<_Mee;ec}($3rMO0Fd6I2vcb!BcoKnGm(eT(3^5CppKmsg zLT?L4KQq#b>wF{po6OP>{N9PD;_fR)(IOXWmQpTWLMx!ZXGsPvkJv@JYi#N+W|J6Z z2!ei+Whxywu5AjTrTZIOOEaOtO`&3s@SFqIAfHIJ67>NOIhtZ=08O3axS8KQZP4|d z$8B(TTm&PCj}Kz5*Z3l3Pm1mr)PUjHyFrbk?8A+r8NU{ILZEYl;Zf{Jtl0MA3bF8ATaEJAb}4S$?vq!7_%{c=*7oh6Xh3K#j06l z&U(h8LyE(D_m}l~X-eoLVX|5W93cyN`s=0<(9&Shb#31^ z1GO2WbhAGd%AR_yfiY3z$;9mfSaki(m||gV9UJ`!WtM^F^VHPIki{J$_>Z2MZMf)? zuU?R&O+qae-)ih=lRT30z$uK%uzRyDCx46h;P!epGKN^GDzd{=O2RN6oD89h$qEeM z7Tnw>6^)!LRVqvi^)R6i7I%+`_5r2Pz*oV5&4IF`pssUiz7&RgJRjVN`hY#gluru1 z63{l4UlK#2`d-k~QtGZITyorQI!0A$<2yd|N%i^o><#bFE9V*T@Sg*upAU`}6kZ=& z6oA{cMrZH5R?!J2N?cOZo~!e53Sq9Z*>o_k0^W6u^BEv@4#PQUb1*R0#;9^y#s^;W z6VFJQqv0f!E*S+tUAPjEPINtxz%VZZD8ZYqLPYOf3Xt))$d8E==<&vWmkh{M0_X-I?()2NV)tLzgq(cbb{^9s3fthVcLRC6ljv#}eh!wx zc6D5fuaL<%|1lr zr{x&stAp$i)~_1sCiYS-CbBJjn@h#e0zj7b=25&Xfm#9kQ%VNwzYcTmu4{@|D>36LF6=zC1dP9Vqkv1sHrXINbFAl0Y_>u;1I1F_*`;lOK;n*J?($V z_?csYuT;z4h13|J;Fqiif^zdNOLp@fvwxOq=`>Eqd=)Tr5Iomx;XY#`f*+c+6-!D) zg!7?6rRge?+sU!%YRxJt%|H_-awN~{94h;3ERrO?gWN$@fq7B{H~zuisg@&Nu<>*& zp|qQ9K#PrYo0nvh4fWy7)M`+>+amzf^>BM)m9dmn8>!L_|cO zOWK2Dt8SU!ih*v?-u)X#RqF4V(KL(XP9HSvv?% z;iX22BA(7q9`&(RsM0UQG$(?A>(ayJ8n@t0xZjodjDHNilvp*tb7wfT{CsmEg%2m3=DdfLB!EJe?1=mZ7)0E;&~>6dbIwM$UgGkZhu^;XGX`1aNuGG}4X=7? zPteoVO*#>3$vDiTaD?UqSpd8t7^=|5H^Rh=_`->|e(q@eQLrC}Knt*oS zY?*vCuGLsn$5rPz1lp1s*e{tbE%=1 zn8M2pe+$LH?=%xiVEnK&w$?|+Xf!voNo8I3sF=t|L4U>DW8?&a5k3k#AjO%&GnBDo zO$$Eyef~>ZybPE%B+LW}75d&I-j*J9jyvberUY;I1oZ5xSPcFi^it{yGnr|MNgOrj z!;^04L$0Opr_KYCf@0jZ>-vJ$v$+-P((gOP_vw<5ZL~EhrH<&%itOKgUBT_S^j_k? zy`S89WX{8flReB{Qyj6p;f^*Z5M-Hmv(T4HK$(!`B1DyHa;o}KYkZ5;_cU#S*avsG z$lZH?{VGe=Cmq)lr?y+GLIUDI`x`nb-BxGW-4K5HL z^s~JLbpJvW`~FpoG>cpgE22u)h5y?qp5sfo zpgZ+vUgt0GuWuGUMns0-`gE67wk{zOFlmv1S%t%bHVq3Q#oT>W@$6#nfjZ}H(h>>d zNIw@ZZ3SwU301fa@*-(~RQF{x_KVJ4RqYRbes^9!O!lxu$Bi^;JKAajZYHI45>GMF zV!%>%$Wj9aNcZ&B^hMQqq-mRnjs2^P?S~oPKsLX|$dPARfnL;O z)j8%(1pzei#}zAMln=(n&5Q#F>Z%hqU^BXS;Q`3AY{~N%8`;T@Q*M{GR=zZ1UvS*0 z2CEt&R}fxW=pMVJjRzWZi*a4YaWVzcfiuX`JyMQ=CDgo_>TO=l z1`pm#w-iXTyIHLA_epux45YTCN)ytP=*0OfjDJT7)W6hd-2GH#(&=YHh;NWw5x4&) zNu{GOS6fuXA>nR5nrVn`*-B1)S1)utcW7V#>N$Z}`;{jcDb=AUm1iN(nd^@v&c+Ro zx=A)sVX8O=Q()t}C%4LaG^VG}@awe$BPO52&W441Q)=|yRhpL74>JK-v3to!1?1z6 z*0XJX!Ot>BoC4tD0&(FU>1~I;1{2)$qw#S(oL10eX#eZC5ji}q_MA&Vv5g;M)Jj9t z3mKj}-UD@&;FLw-Nla`M0XF*Q%kE)&ksROmYa5~`>B}O9ZKF0Jk*0v{ldFpPQyXIi z4`MQgB6<0qA|~d1mCDOwS!fNpZK`=bG@X6kI8LKb)c;xFPQIj^^RJ0VOlTI$N*0;m z<;cN3&&;;P?>+zEO3vHr zkLXG35dC?i<#U{5e9-_A{*$SvQUTrRRrO~N?u-;WOUcWn@||g)xe_(9gWO%sC9~>h zo~qzn3Z{kt^&oB64kP@7SMFA`7FjD2)RGBdpRnWW--`%w{f=qB@9U7{%9p1;fI$;T zCjpIRrm}D*9NFz$bZ$NjKF#sAX*c*j(zSf*4~+q!;;Yzp(KE*O)pQy9oo*uDs#wUB zI$Y2PPRAGw#Ef+`)@=2%6g3rGKKhvM5=JhJs{31h!XLFZ-+^#)uHR-dvqqNMl)gBX z6a4&?E)T-t4GHZfiPxS^d=mDux|buS#mP8~Lx}MI@vV^h!)0pgi-=)ri}&vEyoXx5 zO{b)RJ4GnkpU2YC*yPnj3v9#po44spqVZH`rDm8*u8IN$d%?}+!k-OdcI4Bm%uBa_ z@shj8DQ92utq@0-=9 z=i#Xtvj%8wilFmtr$Xt6qQi26bFGyU>wZk2jj)c-e3s(#%j8uLYpdVJh4eV^Y4p7K z2hkDuG==Kk*ksBs`=+|;!;Or%Z5Te$04KW2M~&&AFSQfa!KyJob3^oX4LnyH9UpHZ zgsh>fKbq1<2vIFm&#F#u1+o!&X1(7lX#xvz_gPso+RjG4?|TVc&jteaaI`f<@V zb%~*EAzUcg%gv{jD9{>_V#vd|-`p=-Xhk*F{&7RKy<6EL63;7MKuNK zCK_Vr>S$(#qWj$^zIiDVemI6*)wBuw0@2Rmk;Bk1rP<;1Y1me{?4bV>naTR1;6z@cBDjct26PP$I|btDPJ(I}{KU-pLg<#3{#}-g5pr#1^Hqnn zZ=NbhtGB+kjMsregt&Yw+E5+Dl5+KFn&c$$Wu;PIR`nz-QZlGSSxMwFNPfWPCdR)N)x zy?kq1+=ovmEk^BlQ>fHIbbO|fsG{TXdFdQ9gTpS}air=5$T2c4ZW>3@^_e>@_l&c;rb4lb7Vc0~W-H8iq!b>Sr;`H#^5 zrvL7zi>2BBuVm-^KVkg~kl{aX7?|i88UC01pDWLQP%e2VOVfYK|KaCj;`uMj{|EaY z9Ug}Ni2q-m`R_>o3;h==A1n{U{|*};tjqv~CI|>)q@;+TiU;VW544NUis#Y!wXA&~ zJmX0W5dawipcYX?sffB{BiRCMAEO&zza^K$H(y|1YmA;H?=*LpN4-9JsY*giMdMbK z;HFPFMAa^!1}a_zYk(9yb9MJLZ2xc&NCIVKNh20OeKxq+>b&mJ{(A2H{(81gExB4; zbn6vOGA1;qT&l2~8XtRI(Qj84j2~~K$$g1rV_mNYR*hUMnR=#*Szc{_T=4Ucml=j0 ziVE5n#DJl-I;X36;U$@twYbt3{FPB;0z(eytTl-g?_<~Dgt!!56k7FFq zv=qr$bulBMDuok$iW|h*sbp!)EW{|J-rVuYxAONfDkti^LQ5=Ei%+=W>etsbs0bRZ z;Xgq{EqjHPlT-`KeMObKIQ?i^4MN0YEuvR=h^*K(7rQdbqMsUlTelWBaB3bsDBOcd zd%R77TLqRCAq6KKvr#|Z*AexZ!y7V*(1a(kAK|6`GKB+ewzsD!9~RIHd86jAc1j14 z2(d9rFvz3txtUQaR8Vk|J#uM>U-SZwvEP#QKb4pI`d&K+4Zrm?W7#V*j)uaTAJ7XUXl)3CFFxMpWp^(o7Tf*66N)gNFvKq!Zu?5@?xEpmWC084}l|yXO^Fp6*jFpWSFxLl3rn z!Y*e=U&^`3QOJ1|c%?>c4E8>=CgxOz_^04wTu-2&=($TM zpreF{?I8uJfta>xZ0$Bs`6j9R8mIM%-;`Tq8$sf zk7GXf|Hei{!nSU z(rmnmo}cs$yUG_#j8)Bg(*A7uZzZk@Q4Aq~JKwL|zv={|mJk1W5*VeL44JIGy!Q~} z|B-5Jiw$=mzXlB5B@xTczb_y4JLb%s>!H-qB|f02JM?`hXOo4d_r zrXCfQjW6X?Jxgwhli~iS_`BL7!iJgWto|o#SGIipB{c&1t~c>@#*8 zy)5xT7vZrpE?p)TFzEDiY!9|@vSSY8Z2J2$2%2*c!aA{8gI88LE>94v3?o-`kQT@i z#s5xAJ+VS6o`W~9%r$ayKgtoW^?~4mq`Me{+AL*ks{jdjX!@;u5isMRdg)rj<=9K1}es`#q#BsG@3hJTAK1Ne(4wU03+; z+=EIL@{262SD2`1B;7}rm-)9~vqDiemgVVBfGIh2`wA7)>v8Duajds9 z;NKApEvh5xZW%eHnELfq7|v2Gg@!F@)kW*uA^cYMfdhSU(k+6&3Ml9$f9y2?A6 z2Xz&2m5e7MEBo4K6YsSV>x*LN%=4e#E_H}7KtZbK>KKdw1v$VK>v%?=IX|ze$zSa2 zm0013_8|{@@?Un}Co12i#}WDWE0=YFT`=N37-r?yS{o}(^j7t-$X-lL3Qns7X+Rx!q$wS!tW zPkt|px%}pfnFc;x9Zgp#lj}}@a7&tguol}5DgZwkz9N+ZBBAaPF)5B2s8zK^2!=CB z$hBaK=zikmUL4P6`&3&v+)N1X3>&;=X!IXpL%GQ848^0WA5uk)L-a$XvMx!nMK|3o z^BRS)tx3*33}R1jHHjrT5^MRhv)As0l8SFY1~h1E0At;l!CzM;Qd!wIbr0cW{6G=m zhZ0yyB}Ds%8*Endem?TN*Kfb8j_hdf1x$&xivV9IFxL_7N=y&Y{15D_Qdk)lMvanZ zqRm-Ye>e@lSfHdP_LCte&8c8^5&ibB2}3~pcK?2_lpaWrjyh~}3`m7a z@L@fP;bnY%#EHh79a?l)dhys+4^Uz3o8(n;#OFVCYSZ`J=|kI=Z^@0?PXM10J*+Gb zx>02k-Ga4Rg4!9RA+wh>Va)(w;#9l}X2&C(V~8!3GXpJY>FOIwNX0jgEs|UMaDvpD z(z2DQJl+{$0>}`|!HIff3Kk)FcIyTj;H@E8bR;dQLohZQvei}B=q7J94?SrKs7x)% zIe2-`!n{f(RFe`!zEi4!_n9ZT1&KrbVAi|MkrQ;BY_oc;;TYy?TB``Whz`6NoMX&h zLjJ#1@~jAtfYc{RY}J8EX{e#g;nInC5~?z4`M9E)#1B>jo?vFU9A8Ca;Lk^F5_bJp zmU?>RSoPR8bap~uM#Hd|qSx0p?aw}$bGYDOvxH;RZ*}x2(pH=rFhy_pBd*ufBPm~n zO;1H8@HWta07g^@3@~9NWwf+irBp`<^)?S!N}uG{>1?l&gZp1FJ1A02=&^B@rU>eiKbqqO83 z%+yyGUYRYPR&Gn?ALzD^3Sw=GU&J|^0o$@D;3k`s8#@6NcO8VSwj0jvMQzM!al2Iv zkxR=XAsC1JK?;k8b-{*P5}ctRHdSDvki-1j?Y7_J1q1V4L>Q-cZ-TTk0Uf7hXp=5` zhQ`qRzcy}II7ebsRmCr=A|of(Gh4544x_(PIBqB!Wrt;CzqVq+D~o%6WA^=NknAWSPq|{srnskU{tEcL+&OSK zxJ+uuIQ<0trxF1%2(abgR_^kW@QfPqm11Z~gOPS+y17)t`}u4Y8=OM<48X<3P%-ZG zW4kSt4I+>7Pw-cMj!(Zr-L{pRjFv1UOlysfQWcvxZFeCqGfgCAy8C|Wq$VMlE47yo z%5Sp2d`)v9gb_R9_>2j!9Nqh<2v!(|IA&F2noPjJ_*tM)^{YzR9JR{NMa(X>0+VS= zFmq(V5a*(tCc?DEfUcg`S5DiflrngUA#b0B>HWkYAQLdl87%Q0mL;HK)d}Q|`fbu9 z^aT7~khef#?n7P$-ZMrFeXWkCI3^7))}IPUFFUmS*MIv*`p%khPFl|D;$I)pf6KyQ zmniyP?x zM<^Sj)+G%ZsRG^=#;cEz^c=rNHjRXT26l7Sp%<$cVn1^KN4i0X;X}wT*%dE_AMl~2 zP9ys@YpK+>8_%9yZ*lv!sM@4~5T_IfU1+kdJNfR8i@W_r-D)VC?N9>oJyBiyeZNcz zW1*5Z0zaf*Q1wX&No(9IBgI~-Kn9uVZ}8}|w(BLAR6zTMr+B+lr@h@bzkTT`m$f9e zEQ1mDZUfzoBS~l)r?8M&3OINnT#LSIK^T~dEi)YuA=w30n$a72+#No_KM?oLLD`f0 z;g4v8eM|e?d8ZY%vdeys{5FUb2lyeP$`1c&W<=&1Q?MBbN;6BRA~6yn+)wi&-MJhK zB#Aee8a*M)1{|jig^8-+L>8P8)hF#7jr_){DXTyXpA8^nwyGGRsxTstetx8Oay1~@ zo_`PA>d^0Ut8x@S2hYa5j|PxzKrKVmSN+Q8E1-@GT1WmO&lHhxW6H@jpgNpYiR1+s z_@OM9ED5w!dqfzDZ19vQuhoiCzEak>@0;2eQXN7RGxG;woDi~f)dd-@J=x&upW*C? zgQOG|!jC>m1%81m&DgnR8A0+@tl)Jg*L2MN=p@J?d*zW{Pz^C69-Q=mX7NA`7fVAk zmq$l(BvPkDT@U6^Zx^G51z6ue`)thQ@ZaX2MV1^d zh|(hJhm9Ea`g71(HPP1Lf@P7|2<}M}gLi9E?YbrcIHW%rT>R6X%r>C!0?;l$Fskl) zz(fYr<@}(Ue~cgm=c_b)^2)7QX}Pb+&>ISd@u_(myZs8H?W=(D^66ykCDva%?u2*_TbiY z>UR#7j3;@dFp6LO=(TnD&_J?CMb0S)X41-z28sjsr2b~}et+(zMUT1v9tZWQ(JT}G zAY}%TbH>;(o1!UNXnftZI?5%Fr4Mx2b`lo|}_u8N@7 z>qaGc)o$NMp{SMVZ@)pD6&U1(%+nT!^i!uge*b^cmm&$PT zXs&sww082_0Ha7_9)SwQfWvp-oWr!8vz}d<-DyRY^(_#^ydCxjyVh(J{w@L*Fszy} zc8bF&c%J1Xw2erhEjcvRqpLTQQC-Qrlfm|Fzzptq_WZjHM}7NLySNd4&V%>>Cru+eN5Y+Czv{6h-2E3X?XSxse*#A8X#%J}_F zvuvsgGJtwX9K}Q`hI;Tsq_wa>o8X=23=xrdHrIQ{`Bd>j^I+j8!a~nDltN3D&QTZW zZ0zl=@9d2Mh5iNY`J90#%ob~5Pl;G-bcIB3-HzJ|(@>^os8R9v4lM8%1*fkH8oPg$ z;_g>z3AKo6BU-O*7175{eHh;l0-TG#sELKD)QdcG9x8;0VTgNQ4RFv3%gCb*D=u7v z46qk9er41Z-t}!AZ@*+M2g5sy_(<+h(_>krFov^a)oM2SLEqAZ0SFR{#EJLk=>8g* zQwI%cS`s)3;fDfuA6|U0(@DmZHr*Jl8E`x^Lh7{}s*YQSE`-N8HDUYhObQNFa4ImP zO(L+XzsGR_UL0b^AH&1R5g`%=(RAVH%Q+0B_!I#)FKlLGP*A_0!fE66vr3p{kj z;*3bbjX^tu^y%;|i5qy&UCq|-y!%PxB|--osufPBGN{w{yN3m3rmFW-!jNX(Q-Qe! ztR67-BJV~7VC>5|8YcWJh19>31LOm{ zuXD7^Rp&EzP_!negM+tu*}Fh|ob8Q5JH3MEEYqC*qk`pS1KhkORHW_MPb< zXaeu%_S>4i59T%fkG6XK4a5Wbd7agDQPZbo52{`>@q{AD$^H@ZD8>k*$u1kBhmy{ysI@ss!U#8uqAtZbILaMt$$S`dK{(&dHRAh}k5gc&a}&#?!1RCz9;k6zEZq zPh*aSvB%Z8!>a<~{wk}=$kDEW@p8;d*tE=l*u#Ob!Hq+pF3`7`o2ES}C4Y6fGoG_+ zXe+r9GzV5+9wayo?-Z#8brqwDKd@aQs@W4iBiB@rf0J2`Onc)TeU=cV)D)E=3`~aI zA_!3DAodihq`(kmE>gC8zaM4urgF`6cKKct$0pNQ6SQi< z1@SNlps|-`H)~*6!9Kwkp_MR6Ge=5yjYc=-n>Rv&m_ z8D=UI2S{m9oXspQHGQ0s5`O7CXL)mS(lIQidyLVjX{RHri>i&Dp(igHGnH@)L+&n@`~|{oEQW^N?E`X+yAd z4j*A}W2ifR-ZlL`4uvWn+JmJ(t#-$D$W7ItgaYp!j`irCXe%f>58H=MRy&TeuzlEZ zM(5}C(j%YE;FwCw`8e%Ep6J{uh%pUDV@d-Ra+iUjDQL9Uz*Mq71c779jHYBZzuj*7 z-1K)t)OT>f`0XBRtA^A0wmL|7-^ZjC?(h3?EI&?+SP?WLug}0(B9U$RLPc-M;?mX_ zMhl?@h>{P4Q6bkab5C)T-!?p0Ie4yqC57Ub@1%7z65i&5FCwXH19AdlkT5qs-@WKy-;lto3r`v0{TKZZS1PJNxT` z7$S`1_u+EC7u9=}RWw=-uv%r%XttR(=O+i zl`n#{eziz_IQ<{frA%`Un&4X9P@@Rc!F}h}I>%{HQ2H|Jrw3xh0+UDf^9Pv8q2>aO z-x?@h0H)~B>EXecn9kXa=oXrI35Dz|g7O}xOPkA@Wnptb6Q)wtL4uQ|gqdGh$=P)% zDfNLmiyB~UC22QNL)jUi7n-e>JaIna&$v`Dh(G$Y2EV+JNzJTIP`UxBL7%3kmG2Oa zN?9jFjIk8yp~VQ;iwUvnxZJ#Osyq5)@Py{fT}eSBWyPHh3H*`wk^emN(Lt`Ne;28d z5bF+d3NzehxfltbAQ2T5?*N)IIn=-^Sl#FK3aQx9=C>_eTLLCRe-{}*Vx}b(q0S61 zfx%{0#JL0v{{>o=Ra7*0i3Gd{G&4(#q_!;DeV4vfm>J=x-HTwmdDk0gv~_0$ zj%d=^?cr>}FGvCKBC3e4@g-(PTk8fQ8#*L2`)_l8a>&~3VHST7r|9k032lUyQyyY< zl~Hg`{~=q|N+z#_u;-zcFp`&@US{I0mm3py!nOea(P?Oge{2$~NLkotQ8ze>D<2SL z{Dn0v9ZmZj4o_TR)QT1C(alsW0<;e|of8sLDI^?}u;&^EV?H;%3~gsh88U~%7rhK` zJ=F)htDHDuEM1#s!OVxPy=khz5e;Qihz5z0PrEo$NNcZ%J$f+=Jz|Selxhb|AQ?3` zpYFqIM}@dBjU>F!0>MF0jCm`EpR6`ox;b65(l$bvQ}d3aSHp?K(hZs`NtQ8`I?uxr`*{yGZxhyQHhTyOtC-_%z|}^mbCyAoo##Di(@d^YEBI2Q6NA*-GQ*`XQ&?#K5{*wTaozvC0MG>SBI;sKHq4 z8XUfsu*}m0IWrrEHi9| zk*T4@+k(2D*Do8d3;MztMtHvvHr=!XOr`c}y5n%*h%2BR;S=9wuhmJ42)(Exfijbr zVW&@Aar@MB9u=AQzoHiwa?zcckzQ>IF_CkgJ@rH<(_HcU>z^MFH%dY4j~|zqAu+aj?LQCv7lRpV$tojOnuY zofogWJCf@R%bj+GIi#5$B?D_aEHK*#s@zNpQ9f2;`{VeS@B$CV19b*6gbeHbBV zsOETwG0bo%O=z7rOt%SYDX%D)8JL@FEsr>zxVX4e?{}{=3f_hHglEAc)qrCXyHaoP z`UC+@hpAH)O7?ACq}1OTkhWE)KzvG>phR%}*Z${RKNCCgu_kqW8z-)4t9~Vk$7(+x z-%)qphd6!9>y8g@=UlcE*FiV!{+-RPnEO}cF)AZNb1G;dSW{dsbKkf-hmcDS*bhPZ zd$`e_Ee=jj>SPR9#Kxgc6SfQ`!7cvv+V`#J-tJ4Km8I-mi8gq24}z?^{mxl4CeOP+ zOB*E+`)ie0 zPchL5+jtS9bpzSC4+*Tg7nC_^xt)$|SYVu@w801tEE#G|axYKq`(&V#xFh7DQQxE6 z-;X}r8EyohG3I>UsF=l#Hg84df%d&l^*e{^zIPJeH-CbdfNCJM7^sd8dVwF*d(@N{ zJ(afhvt4+2SocJ~m4^bW+YyeQ#{nbvxDyXxcM@fW76to*M({M#s^kp?LHb!h^avH5 z%l3}<>)ua94J%xxTx5iZP)9`h_+G?m`3R-ZXCDknF>%KjoZdy&AzONNr5akb zlf?Pk?IsDPn=f>;)1lFj#{4@79g`;V42ocadV2V@+Qi`r^||c(Ee}r2A$)yw^*daB zN-H=DrYxZ)5-KF|45Gn#OfEWRn;$*QFAIlXCwjRIExd_b^Hgvq^I?VY)MId{EI;!t zPI=VT^**|TzxmH`7 zi&qFC!*jR!Yi%bui_J!g^YXz4GVRnlXNJM~S@bUGvF*B7S?Rm9OUuB`O!rI2S zv8Kw2OMYovZRrTU-XfVg*w|wtc~J@(yg2d(o?Ah;8RKK}YfZxIRzhSTAr~8=#u6+H z5d-mhLucWSeZ8GRrHh`}3^JUH6%5Kf74J7~D&}h#pTkAr+M;~mYD38xF zYe0q=ZspJKrs{IjMGNL5;P0^vL`I~T3a zegk3mE;ksIBvVOra`#pneqdw=58cd)-LF?GPV?~Lds>hDDfeO_nUK7`Tku)F+e}_( zXq*Rc>><5B!ao`_Ap19|8@a-;T&IX6(Y&>uABdy(s*3n3C$93soB}mwyK8ToM%p5v zol5FR>nm)I0`K8+xqY5wwOLUGvnx|O7^=7vtsDFQyuWVy9d$HRp^09EAAj;mV0sbXfHO+P}M^)`Y&xC5{RzB63Nv$DNK+HkMv0zhozS(th zS$hit2alpk>oaM*Qv<`u=X}YIYGCqBg3PEN6Haq!*!g3zWaRSRL|EMK;g=8Njwci~ z7AlN`Y=Wl!iS^dz%X#hB@-?A;BI4#=j9Cc0$&@(qio)V4+Q6g$ht}`ttW+uOpYz+{o(uG*FbLL3;6iXxC)b?(|sm!Vh?e2C*vJQC_nb zdvf&qIgM3F95pqmHw~Um5YhXV+d0FarK!x1p7CxU(x5oef;qNKD9#i(w#CI9UYDI7 zPp4*tB1u9pO{Qyx-c8~WCP?zk{t|JrWlHux(nm#p(Zl;2BPF4Dv7dY1es`bxUvPo_ z)I0;iQDxNDMe@CmqCmDBQ{m_9_3w`$=qrBvIc@gf{3wAWJ+TpnxGFHxl!77jG#fC% zciT0&kTP&Q2*p)9H8xV%Tpa4GB@GF(&ZH%j&FZ5jteo<@Of(f3q zh1soaA&2@QsK~~hC>lo@?b9`uX}%^z`8-Yq#LMnuisy^9ZR^G&#DF%$&g@=#6gdj% zcn2|MVwB)eVKgXuW3JTR`r`^SN#s#2_MaaIbHZV@8q+4QUG0%Pv-A z8Ae1>87^Bmq*f;VUG2V%NN*Msm8>^8@!uB2=Kl6Z{0 z1PRzt00aAVPN1wZL=KMI7!r(t zH9p~>7F_S5+};UZ{@pfh)4r~;y$GFX-0<^mI10b!{#_eU&(6vs%BG@8%hiEDhX#GGzP9hD{>#jfG;g*lDO#ax;)1eljzJ!q z_`XzSM&#anD&n^5cCX*d&2AP{uWaQl4~A0xhDT1tOxZdH3e8ya0D%>~6m1QmAzIu( z!(El4{bg&~l(Jgpg0j-i9kellvu(_DA50XEuhQh!vThK)dpR_UE*E*}$Tk5sp_}{j z^JVs(=LYiT6nqaIAsiTn3agf`((AyCEuFnh&Bl=~PeDx9l8}Mskk_MX%>5i1jaG;j z-LiWN+qIYR^;OV*$g&Vl%{g*TSW&CqtEMs;>t8xRi|B5U#3vhjYS;TFl+P}k(o)$0nCXe+PggqW!rskZ!M$;n{ql*{g(!ZF-xSY-xDdt z0Qp~6G-esP>oe4nqgUKF67MN*wqIZIdUIG$joKAaC*k%52kqCN`>8ECE5&HzJP@x%__2Yj!p}So^=)IGdjrr|=LUZjaweZa2o&a`l(xmM{XWLT2|mXT zg~EjAU{-lDE^>lH!_|n}p@`oh$!8@A)6T8YOcimQ(AKL&zGTLS{8YmK9-_Sh#Kad? z&PfY?VT+QN&@{;Nw2zR7L>L#us$Qvcbhhqx>0W?to_~^F#$Shmq%9i20@q&K(UMsEjNNj^?TSkFO?WSvT2WK#4a!b zjegc3gz|zjmgu@j4&5mbkUUILh75jjQDa(%i~8UfbpCOydU^|cuY4bcn$MXph-YMB zW>Q1!HXONRSknBZN4+QTQjheoB#y}UaI_q1hBOBrx$5LvZq9zE4jquxH9S{{OM^X9 z3_Mh$T6bCJB-moV+Kq5rfaCvat?{w-hJFmRYwE7NUw~8_bZv84#9_QnSA1`#M1`S*t!JwvVj2_85a`>vcbrN%ICRhLQgIdaI8g zto<1Y7pn3pk!(JXN8k7G`f{}1f!NreWCDkV_lq>v!YCTgga+e4EwvTk2>>65IrS!_ z_#KIb+{2Yq24^-=lV5+!rMA!7xx^lQ!*tQKqP()Ot>2`i?z085!NTeR(lMF^BW0_$ zG5pE>-2HVREbpo{y}Y(WRnjkNtY7Yj_q-6+S5SUatUSoYHc|@dQaI$~_Twp4Q7Gch zt`j&Ciy!kc0y%jM%f zN*u`>jE{s&w(?Wu@i$L6x>21PHqW1y=kqwen|x?OJ*C;&$9i|dC z1SXX%=XA)5u>Ks*MIuH{>`9TN(tkk%vCG^yW8XQb^4PW zL&I?tkmu=!rae2IHVsOo3#sg${oXS6KBXC#lD-T z&&R|mar&AQIRX_zb1lf_03y8e^EZ@LXTaQ@OMpVrQ{2~CFV7XdLk=c{9atbYK}AN& z_m|)IQ!5tO=Sf^#OSjL{=WLMWY({IKv!%K5V~IVF>o%$1<8YkMS21iWcT-*V0b7Zb z)@~b~Q13xZjPVQ+BT{|Y*c}7r0{&&gyc@)(K5KS7LA!J$coz}G%~l?qYEk}NJbBa_ zYv{|hNre2MS3d+n#ajsBk7_ZG3y}?e{;%udn~CzMkplXp^ld_=)4Pb1&jF3gY?>yF zE^S>U$8t;OeF;@hQ^2igqR^)(Tit4i5sGtr*`nBp6%pe*NyHixaJtQzPSwyg!eU8s zFX7t6{N62YE-w@8OSHb@AdF%ZQ8g*$`4&I(4|IZV<43;1XC=i}7oj5#s%`Jn%EQcbL)NmGl=Hh70O_ge_QJ~IbxWP^zH|F+o}$;mN!m8i-Y#9`IPfzJ$z8S$}@@C!png<4)zg7~vqFc`Oh>y|f2KL6SwYE zG5{VP!i-PvD~G&+(g06ry2SX;bWJ%2E*F}06Ck&`%1H)$dNjE40?RHo*zO<9%JE;S zJ8hoIDk}otr3te|-eish6H(Iod~NSn`aTzP<{hZBbmC^pDl*va7&JnZ&g}p0g8T-t z?_;G^h#&S4Rr8li?T@5fvs4bswyh>ruhq4@Ccp-u9V^ef+l()dILH8$_W(S(>PdaG zKNu*pw@v=&Q_<0SwN^CUImvo1-K2z$M6~}qY8D^6ZW>LH?8Y-a7A6Y#cR8Lx>ES~@ zw+cj>SS_!%(&~u6ynsab31hg2 zO;GZ8=nqV9@AH)EYrlhfidyWUMW=FLg;r9G<21bn=HJb+F&qfg@ZuYX^MvEU&H@ca zM;EL50jcT@Tg2YKR=m8-OulJJA%(#JsY8fr392d`4Z@=11@^?(kCL;F{kXsPH{&Un zw#x9dgqSIlN4SyZi;YEOB$?Ddb0k4QuK)umiuSTo+CWX&uCaO4GFdGMGsR|A;Neze z!Je|@5D8>o6L^Gj?MV142n}zpVuBZKUAhyuE}_3VUUg*^4pk*>F2ZbgSw1aupFux1 zD+Nb}=(+n0>1K^wWNs9n7i9|ER8~kR78ay@hE2kPE^Csd%$sp7)_bLT+VsB_`{iY^{Fd$Bn!L%*pX>7bD5G zneKbeItB(=Sg&~cb(2IIfT%`XgT*A(&})7N`QypaxZHcFPwfDmsE44T{C>Oo9D1h? z`W9PT&gWAk-oNQ0c?XVcJ{o75k^@hiT3Rf3N~$&orJ$g(%#O4e>7Y%6!8F-fiL;vX zc<7~neKF%LXdTuJQGg5}6|8iT1FS~ga@x}^hNaaGO>J!!T{Ts2C9jX=)J%O6bt#tq z(4v6Ex`43Lek(bu*dX>4ff+*g_^9rUMgFxDe})Y39Hy(|X>w7MEi-;e<5ATj8|*QKQaOc-si9s0EWpd{7?V69FSB(y zNz*y|%@XG4!ME1(*0FuakquyV17QkAV`@3j%50N#QNX?lb>pmG%XCPn|MP=~q^O)o JjgUd${{gGsvZ??8 literal 0 HcmV?d00001 diff --git a/bundles/fish.payara.eclipse.tools.server/plugin.properties b/bundles/fish.payara.eclipse.tools.server/plugin.properties new file mode 100644 index 00000000..6fe5d789 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/plugin.properties @@ -0,0 +1,76 @@ +pluginName = Payara Server Tools +providerName = Eclipse.org - Payara Server Tools + +payara.wizardcategory=Payara +payara.sunresourceslabel=JDBC Resource +payara.sunresources.BeanWebRegionWizard.description=Create a new JDBC Resource +payara.mailresourceslabel=JavaMail Session Resource +payara.mailresources.BeanWebRegionWizard.description=Create a new JavaMail Session Resource +payara.jmsresourceslabel=JMS Resource +payara.jmsresources.BeanWebRegionWizard.description=Create a new JMS Resource +payara.webservletlabel=Web Servlet (Java EE 6) +payara.webservlet.BeanWebRegionWizard.description=Create a new Java EE 6 Servlet +payara.sessionbeanlabel=Session Bean (Java EE 6) +payara.sessionbean.BeanWebRegionWizard.description=Create a new Java EE 6 Session Bean +payara.ejbtimerlabel=EJB Timer (Java EE 6) +payara.ejbtimer.BeanWebRegionWizard.description=Create a new Java EE 6 EJB Timer +payara.webfilterlabel=Web Filter (Java EE 6) +payara.webfilter.BeanWebRegionWizard.description=Create a new Java EE 6 Web Filter +payara.weblistenerlabel=Web Listener (Java EE 6) +payara.weblistener.BeanWebRegionWizard.description=Create a new Java EE 6 Web Listener +payara.xhtmllabel=XHTML Page +payara.xhtml.BeanWebRegionWizard.description=Create a new XHTML Page +payara.restfulfrompatternlabel=RESTful Web Service from Pattern (Java EE 6) +payara.restfulfrompattern.BeanWebRegionWizard.description=Create RESTful Web Service from Pattern + +runtimeTypeVendor=Oracle Corporation +runtimeTypeGlassFishVendor=Payara + +runtimeTypeNameglassfish=Payara +runtimeTypeDescriptionglassfish=Supports Payara 6, 5, 4 and 3.1 +serverTypeNameglassfish=Payara +serverTypeDescriptionPayara=Supports Payara Server 6, 5 and 4. Can also be used for GlassFish. + +payara.server.runConfigurationName=Payara Server +payara.micro.runConfigurationName=Payara Micro + +glassfish.web.facet=Payara Web Extensions +glassfish.web.facet.description=Installs Payara specific deployment descriptor for web application. +glassfish.ejb.facet=Payara EJB Extensions +glassfish.ejb.facet.description=Installs Payara specific deployment descriptor for EJB module. + +payara.rootdirectory=Application &Server Directory: +payara.serveraddress=A&ddress: +payara.serverportnumber=&Server Port Number: +payara.adminserverportnumber=&Admin Server Port Number: +payara.adminname=Ad&ministrator Id: +payara.adminpassword=Administrator Pa&ssword: +payara.domainpath=Domain Directory: +payara.target=Target: +payara.ConfigurationTypeNameV2=Sun Application Server +payara.useAnonymousConnection=Use Anonymous Connection for Admin Commands +payara.keepSessions=Preserve Sessions Across Redeployment + +GF31.SystemLibrary.JSF.Label = Payara System Library +GF31.SystemLibrary.JSF.Message = Payara 3.1 includes JSF 2.1 on system classpath. + +GF31.SystemLibrary.JPA.Label = Payara System Library +GF31.SystemLibrary.JPA.Message = Payara 3.1 includes JPA 2.0 on system classpath. + +GF4.SystemLibrary.JSF.Label = Payara System Library +GF4.SystemLibrary.JSF.Message = Payara 4 includes JSF 2.2 on system classpath. + +GF4.SystemLibrary.JPA.Label = Payara System Library +GF4.SystemLibrary.JPA.Message = Payara 4 includes JPA 2.1 on system classpath. + +runtimeComponentProvidersExtensionPoint = Runtime Component Providers Extension Point + +menu.viewlogfile=View Log File +menu.viewadminconsole=View Admin Console +menu.openserverhome=Server Home Directory +menu.opendomainhome=Domain Directory +menu.payaratopmenu=Payara + + + + diff --git a/bundles/fish.payara.eclipse.tools.server/plugin.xml b/bundles/fish.payara.eclipse.tools.server/plugin.xml new file mode 100644 index 00000000..97f8885a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/plugin.xml @@ -0,0 +1,1230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %glassfish.web.facet.description + + + + + %glassfish.ejb.facet.description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1000 + + + + + + + + + + + + + + + + + + + 1000 + + + + + + + + + + + + + + + + + + + 1000 + + + + + + + + + + + + + + + + + + + 1000 + + + + + + + + + + + + + + + + + + + 10000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %payara.sunresources.BeanWebRegionWizard.description + + + + + + + %payara.mailresources.BeanWebRegionWizard.description + + + + + + + %payara.jmsresources.BeanWebRegionWizard.description + + + + + + + %payara.restfulfrompattern.BeanWebRegionWizard.description + + + + + + + + + + +
diff --git a/bundles/fish.payara.eclipse.tools.server/pom.xml b/bundles/fish.payara.eclipse.tools.server/pom.xml new file mode 100644 index 00000000..d7c3fd41 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/pom.xml @@ -0,0 +1,34 @@ + + + 4.0.0 + fish.payara.eclipse.tools.server + eclipse-plugin + Payara Server Eclipse Tools + + fish.payara.eclipse + fish.payara.eclipse.bundles + 2.0.0-SNAPSHOT + + + src + + + + org.apache.ant + ant + 1.8.1 + + + org.eclipse.wst.server + ui + 1.0.205-v20070912 + provided + + + + 17 + 17 + + diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/Messages.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/Messages.java new file mode 100644 index 00000000..c0146c6f --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/Messages.java @@ -0,0 +1,104 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2021 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + + static { + initializeMessages( + "fish.payara.eclipse.tools.server.Messages", + Messages.class); + } + + public static String serverHome; + public static String runtimeName; + public static String emptyRuntimeName; + public static String duplicateRuntimeName; + public static String runtimeIdentified; + public static String unsupportedVersion; + public static String runtimeNotValid; + public static String versionsNotMatching; + + // server status + public static String invalidCredentials; + public static String serverNotMatchingLocal; + public static String serverNotMatchingRemote; + public static String connectionError; + + public static String facetNotSupported; + + public static String AdminName; + public static String AdminPassword; + public static String ServerPortNumber; + public static String AdminServerPortNumber; + public static String wizardSectionTitle; + public static String wizardSectionDescription; + public static String DomainName; + public static String DomainDirectory; + public static String UseAnonymousConnection; + public static String keepSessions; + public static String jarDeploy; + public static String targetTooltip; + + // additional strings to workaround for issue 222688 + public static String canInstallPath; + public static String possibleInstallExists; + public static String downloadingServer; + public static String notValidPayaraInstall; + + public static String register; + public static String updateCenter; + + public static String pathDoesNotExist; + public static String pathNotDirectory; + public static String pathNotWritable; + public static String pathNotValidDomain; + public static String missingDomainLocation; + public static String invalidPortNumbers; + public static String TitleWrongDomainLocation; + public static String serverWithSameDomainPathExisting; + public static String OKButton; + + public static String startupWarning; + public static String noProfilersConfigured; + public static String profilingUnsupportedInVersion; + + public static String serverDirectoryGone; + public static String emptyTargetMsg; + public static String target; + + public static String uniqueNameNotFound; + + public static String errorAppWebContentRootMapping; + + public static String canntCommunicate; + public static String abortLaunchMsg; + public static String checkVpnOrProxy; + public static String wrongUsernamePassword; + public static String badGateway; + public static String domainNotMatch; + + public static String errorInTerminatingMicro; + public static String errorInInitializingMicroWatcher; + public static String errorInReloadingMicro; + + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/Messages.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/Messages.properties new file mode 100644 index 00000000..d0c609c3 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/Messages.properties @@ -0,0 +1,79 @@ +#runtime registration +serverHome=Payara &Server Directory +runtimeName=Runtime Name +emptyRuntimeName=Runtime name is required! +duplicateRuntimeName=Runtime name {0} is already used! +runtimeIdentified=Found Payara Server version {0}. +unsupportedVersion=Only Payara 6, 5, 4 and 3.1 are supported +versionsNotMatching=The versions of local and remote server do not match. +runtimeNotValid=There is no valid Payara runtime in specified directory. + +#server status +invalidCredentials=Invalid user name or password +serverNotMatchingLocal=Running Payara domain detected but its path does not match this server +serverNotMatchingRemote=${versionsNotMatching} +connectionError=Connection error when trying to communicate with server + +facetNotSupported=Facet {0} is not supported by the server. + +#server registration +AdminName=Admin Name +AdminPassword=Admin Password +ServerPortNumber=Server Port Number +AdminServerPortNumber=Admin Server Port Number +DomainName=Domain Name +DomainDirectory=Domain Directory +target=Target +keepSessions=Preserve Sessions Across Redeployment +jarDeploy=User Jar Archives for Deployment (slower than directory deployment) +targetTooltip=Enter the name of a server instance or cluster. +UseAnonymousConnection=Use Anonymous Connection for Admin Commands +wizardSectionTitle=Application Server +wizardSectionDescription=You can edit some runtime properties for the Application Server (Payara, GlassFish or Sun) + +# additional strings to workaround for issue 222688 +canInstallPath=There is no valid Payara installation in the specified directory. Click the Install Server button to download and install to that directory. +possibleInstallExists=The specified directory is not a valid Payara installation, but contains a {0} subdirectory which might be valid. +notValidPayaraInstall=The specified directory is not a valid Payara installation. +downloadingServer=Downloading Payara... + + +# actions +register=Register +updateCenter=Update Center + +#Domain dir errors +pathDoesNotExist={0} does not exist +pathNotDirectory={0} is not a directory +pathNotWritable={0} is not writable +pathNotValidDomain=Specified location is not a valid domain. +missingDomainLocation=Domain location must be specified. +invalidPortNumbers=The specified port numbers are invalid. +serverWithSameDomainPathExisting=A server with the same domain path already exists in the workspace. + +TitleWrongDomainLocation=Wrong domain directory location +OKButton=OK + +startupWarning=Startup Warning +noProfilersConfigured=Could not launch in profiling mode because no profilers are configured. Performing a regular launch. +profilingUnsupportedInVersion=Profiling is unsupported in releases older than Galileo. Performing a regular launch. + +#Server root directory may not exist anymore after an upgrade +serverDirectoryGone=Server Installation directory ({0}) does not exist anymore. +emptyTargetMsg=Specify target - cluster or instance. + +uniqueNameNotFound={0} could not be automatically registered because no unique name could be found. + +errorAppWebContentRootMapping=Error reading application.xml file. Reference of module '%1$s' cannot be found or is invalid. + +#server launch +canntCommunicate=The Eclipse plugin cannot communicate with the Payara server.... +abortLaunchMsg=The Eclipse plugin cannot communicate with the Payara server. +checkVpnOrProxy=Please also check for antivirus software, firewall configuration, or VPN setup which might block some ports. +wrongUsernamePassword=Wrong user name or password. +badGateway=The response code BAD GATEWAY was returned. Please check your proxy settings. +domainNotMatch=A Payara Server may be running on the same admin or HTTP port, but with a different root installation. + +errorInTerminatingMicro=Error occurred while terminating payara-micro +errorInInitializingMicroWatcher=Payara Micro watcher task initialization failed +errorInReloadingMicro=Payara Micro reload action failed diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraRuntime.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraRuntime.java new file mode 100644 index 00000000..2a407680 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraRuntime.java @@ -0,0 +1,275 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server; + +import static fish.payara.eclipse.tools.server.Messages.notValidPayaraInstall; +import static fish.payara.eclipse.tools.server.Messages.pathDoesNotExist; +import static fish.payara.eclipse.tools.server.Messages.runtimeNotValid; +import static fish.payara.eclipse.tools.server.Messages.unsupportedVersion; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.SYMBOLIC_NAME; +import static fish.payara.eclipse.tools.server.utils.PayaraLocationUtils.find; +import static org.eclipse.core.runtime.IStatus.ERROR; +import static org.eclipse.core.runtime.Status.OK_STATUS; +import static org.eclipse.osgi.util.NLS.bind; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.jdt.launching.IVMInstall; +import org.eclipse.jdt.launching.IVMInstallType; +import org.eclipse.jdt.launching.JavaRuntime; +import org.eclipse.jst.server.core.IJavaRuntime; +import org.eclipse.jst.server.core.internal.IGenericRuntimeWorkingCopy; +import org.eclipse.wst.server.core.IRuntimeType; +import org.eclipse.wst.server.core.ServerCore; +import org.eclipse.wst.server.core.model.RuntimeDelegate; + +import fish.payara.eclipse.tools.server.utils.PayaraLocationUtils; +import fish.payara.eclipse.tools.server.utils.Version; +import fish.payara.eclipse.tools.server.utils.VersionConstraint; + +/** + * This class represents the specific type of runtime associated with the server that we implement; + * Payara / GlassFish. + * + *

+ * A few methods from RuntimeDelegate are overridden here, while a whole slew of central runtime + * like functionality is put here as well. + *

+ * + *

+ * This class is registered in plug-in.xml in the + * org.eclipse.wst.server.core.runtimeTypes extension point. + *

+ * + */ +@SuppressWarnings("restriction") +public final class PayaraRuntime extends RuntimeDelegate implements IJavaRuntime { + + public static final String TYPE_ID = "payara.runtime"; + public static final IRuntimeType TYPE = ServerCore.findRuntimeType(TYPE_ID); + public static final String ATTR_SERVER_ROOT = "server.root"; //$NON-NLS-1$ + public static final String ATTR_SERVER_JDK = "server.jdk"; + + public static final boolean IS_MACOSX = Platform.OS_MACOSX.equals(Platform.getOS()); + public static final String DEFAULT_JRE_KEY = "###DefaultJREForGlassFishCode###"; + + private static final VersionConstraint VERSION_CONSTRAINT_3_1 = new VersionConstraint("[1.6-1.7]"); + private static final VersionConstraint VERSION_CONSTRAINT_4 = new VersionConstraint("[1.7"); + private static final VersionConstraint VERSION_CONSTRAINT_5 = new VersionConstraint("[1.8"); + private static final VersionConstraint VERSION_CONSTRAINT_6 = new VersionConstraint("[1.8"); + protected static final String PROP_VM_INSTALL_TYPE_ID = "vm-install-type-id"; + protected static final String PROP_VM_INSTALL_ID = "vm-install-id"; + + // #### RuntimeDelegate overridden methods + + @Override + public IStatus validate() { + IStatus status = super.validate(); + +// if (status.isOK()) { +// status = StatusBridge.create(getModel().validation()); +// } + + return status; + } + + // #### IJavaRuntime implementation methods + + @Override +// public IVMInstall getVMInstall() { +// return findOrCreateJvm(getModel().getJavaRuntimeEnvironment().text()); +// } + + public IVMInstall getVMInstall() { + if (getVMInstallTypeId() == null) + return JavaRuntime.getDefaultVMInstall(); + try { + IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(getVMInstallTypeId()); + IVMInstall[] vmInstalls = vmInstallType.getVMInstalls(); + String id = getVMInstallId(); + for (IVMInstall vmInst : vmInstalls) { + if (id.equals(vmInst.getId())) + return vmInst; + } + } catch (Exception e) { + // ignore + } + return null; + } + + private String getVMInstallTypeId() { + return this.getAttribute(PROP_VM_INSTALL_TYPE_ID, (String) null); + } + + private String getVMInstallId() { + return this.getAttribute(PROP_VM_INSTALL_ID, (String) null); + } + + /** + * @see IGenericRuntimeWorkingCopy#setVMInstall(IVMInstall) + */ + public void setVMInstall(IVMInstall vmInstall) { + if (vmInstall == null) { + setVMInstall(null, null); + } else + setVMInstall(vmInstall.getVMInstallType().getId(), vmInstall.getId()); + } + + protected void setVMInstall(String typeId, String id) { + if (typeId == null) + setAttribute(PROP_VM_INSTALL_TYPE_ID, (String)null); + else + setAttribute(PROP_VM_INSTALL_TYPE_ID, typeId); + + if (id == null) + setAttribute(PROP_VM_INSTALL_ID, (String)null); + else + setAttribute(PROP_VM_INSTALL_ID, id); + } + + @Override + public boolean isUsingDefaultJRE() { + return false; + } + + + // #### Static methods + + public static String createDefaultRuntimeName(Version version) { + String baseName = "Payara Server"; // TODO: - detect GF + + if (version != null) { + if (version.matches("[6-7)")) { + baseName += " 6"; + } else if (version.matches("[5-6)")) { + baseName += " 5"; + } else if (version.matches("[4-5)")) { + baseName += " 4"; + } else if (version.matches("[3.1-4)")) { + baseName += " 3.1"; + } + } + + baseName += " (" + version + ")"; + + int counter = 1; + + while (true) { + final String name = createDefaultRuntimeName(baseName, counter); + + if (ServerCore.findRuntime(name) == null) { + return name; + } + + counter++; + } + } + + private static String createDefaultRuntimeName(String baseName, int counter) { + StringBuilder runtimeName = new StringBuilder(); + + runtimeName.append(baseName); + + if (counter != 1) { + runtimeName.append(" (") + .append(counter) + .append(')'); + } + + return runtimeName.toString(); + } + + + // #### Other public methods + + public Version getVersion() { + IPath location = getRuntime().getLocation(); + + if (location != null) { + PayaraLocationUtils payaraInstall = find(location.toFile()); + + if (payaraInstall != null) { + return payaraInstall.version(); + } + } + + return null; + } + + public IStatus validateVersion() { + Version version = getVersion(); + + if (version == null) { + // Should not happen if called after validateServerLocation + return new Status(ERROR, SYMBOLIC_NAME, runtimeNotValid); + } + + if (!version.matches("[3.1-7)")) { + return new Status(ERROR, SYMBOLIC_NAME, unsupportedVersion); + } + + return OK_STATUS; + } + + public VersionConstraint getJavaVersionConstraint() { + Version version = getVersion(); + + if (version != null) { + if (version.matches("[6")) { + return VERSION_CONSTRAINT_6; + } + + if (version.matches("[5")) { + return VERSION_CONSTRAINT_5; + } + + if (version.matches("[4")) { + return VERSION_CONSTRAINT_4; + } + + return VERSION_CONSTRAINT_3_1; + } + + return null; + } + + public IStatus validateServerLocation() { + return validateServerLocation(getRuntime().getLocation()); + } + + public IStatus validateServerLocation(IPath location) { + + // This is maybe a redundant check to the GUI annotation but + // needed in case where a GUI is not involved (although we don't know + // yet what case that would be) + + if (location == null || !location.toFile().exists()) { + return new Status(ERROR, SYMBOLIC_NAME, bind(pathDoesNotExist, "Specified path")); + } + + if (find(location.toFile()) == null) { + return new Status(ERROR, SYMBOLIC_NAME, notValidPayaraInstall); + } + + return OK_STATUS; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraServer.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraServer.java new file mode 100644 index 00000000..68da35f0 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraServer.java @@ -0,0 +1,896 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server; + +import static fish.payara.eclipse.tools.server.Messages.facetNotSupported; +import static fish.payara.eclipse.tools.server.Messages.invalidPortNumbers; +import static fish.payara.eclipse.tools.server.Messages.pathDoesNotExist; +import static fish.payara.eclipse.tools.server.Messages.pathNotDirectory; +import static fish.payara.eclipse.tools.server.Messages.pathNotValidDomain; +import static fish.payara.eclipse.tools.server.Messages.pathNotWritable; +import static fish.payara.eclipse.tools.server.Messages.serverWithSameDomainPathExisting; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.SYMBOLIC_NAME; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.createErrorStatus; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logError; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logMessage; +import static fish.payara.eclipse.tools.server.facets.internal.GlassfishDeploymentDescriptorFactory.getWebDeploymentDescriptor; +import static fish.payara.eclipse.tools.server.sdk.server.parser.TreeParser.readXml; +import static fish.payara.eclipse.tools.server.utils.ModuleUtil.isEARModule; +import static fish.payara.eclipse.tools.server.utils.ModuleUtil.isEJBModule; +import static fish.payara.eclipse.tools.server.utils.ModuleUtil.isWebModule; +import static fish.payara.eclipse.tools.server.utils.PayaraLocationUtils.find; +import static fish.payara.eclipse.tools.server.utils.Utils.canWrite; +import static fish.payara.eclipse.tools.server.utils.Utils.getAppWebContextRoot; +import static fish.payara.eclipse.tools.server.utils.Utils.getHttpListenerProtocol; +import static fish.payara.eclipse.tools.server.utils.Utils.hasProjectFacet; +import static fish.payara.eclipse.tools.server.utils.WtpUtil.load; +import static java.io.File.separator; +import static java.net.URLEncoder.encode; +import static java.text.MessageFormat.format; +import static java.util.Arrays.asList; +import static org.eclipse.core.runtime.IStatus.ERROR; +import static org.eclipse.core.runtime.Status.OK_STATUS; +import static org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities.getServerContextRoot; +import static org.eclipse.jst.server.core.FacetUtil.getRuntime; +import static org.eclipse.jst.server.core.internal.J2EEUtil.getEnterpriseApplications; +import static org.eclipse.osgi.util.NLS.bind; +import static org.eclipse.wst.common.componentcore.internal.util.IModuleConstants.JST_WEB_MODULE; +import static org.eclipse.wst.common.project.facet.core.ProjectFacetsManager.getProjectFacet; +import static org.eclipse.wst.server.core.ServerUtil.getModules; +import static org.eclipse.wst.server.core.util.SocketUtil.isLocalhost; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.File; +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Status; +import org.eclipse.jst.server.core.IEnterpriseApplication; +import org.eclipse.jst.server.core.IWebModule; +import org.eclipse.wst.common.project.facet.core.IFacetedProject; +import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; +import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; +import org.eclipse.wst.common.project.facet.core.runtime.IRuntime; +import org.eclipse.wst.server.core.IModule; +import org.eclipse.wst.server.core.IModuleType; +import org.eclipse.wst.server.core.IServer; +import org.eclipse.wst.server.core.IServerType; +import org.eclipse.wst.server.core.IServerWorkingCopy; +import org.eclipse.wst.server.core.ServerCore; +import org.eclipse.wst.server.core.ServerPort; +import org.eclipse.wst.server.core.internal.IMonitoredServerPort; +import org.eclipse.wst.server.core.internal.IServerMonitorManager; +import org.eclipse.wst.server.core.internal.ServerMonitorManager; +import org.eclipse.wst.server.core.model.IURLProvider; +import org.eclipse.wst.server.core.model.ServerDelegate; + +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishAdminInterface; +import fish.payara.eclipse.tools.server.sdk.server.parser.HttpData; +import fish.payara.eclipse.tools.server.sdk.server.parser.HttpListenerReader; +import fish.payara.eclipse.tools.server.sdk.server.parser.NetworkListenerReader; +import fish.payara.eclipse.tools.server.sdk.server.parser.TargetConfigNameReader; +import fish.payara.eclipse.tools.server.utils.PayaraLocationUtils; +import fish.payara.eclipse.tools.server.utils.Version; + +/** + * This class represents the specific type of server that we implement; Payara / GlassFish. + * + *

+ * A few methods from ServerDelegate are overridden here, while a whole slew of central server like + * functionality is put here as well. + *

+ * + *

+ * This class is registered in plug-in.xml in the + * org.eclipse.wst.server.core.serverTypes extension point. + *

+ * + */ +@SuppressWarnings("restriction") +public final class PayaraServer extends ServerDelegate implements IURLProvider { + + public static final String TYPE_ID = "payara.server"; + public static final IServerType TYPE = ServerCore.findServerType(TYPE_ID); + + private static final String DEFAULT_SERVER_DIR_NAME = "glassfish"; // $NON-NLS-N$ + private static final String DEFAULT_DOMAIN_DIR_NAME = "domains"; // $NON-NLS-N$ + private static final String DEFAULT_DOMAIN_NAME = "domain1"; // $NON-NLS-N$ + public static final int DEFAULT_DEBUG_PORT = 9009; + public static final String ATTR_SERVERPORT = "glassfish.serverportnumber"; //$NON-NLS-1$ + public static final String ATTR_ADMINPORT = "glassfish.adminserverportnumber"; //$NON-NLS-1$ + public static final String ATTR_DEBUG_PORT = "glassfish.debugport"; + public static final String ATTR_USECUSTOMTARGET = "glassfish.usecustomtarget"; + public static final String ATTR_DOMAINPATH = "glassfish.domainpath"; //$NON-NLS-1$ + public static final String ATTR_ADMIN = "glassfish.adminname"; //$NON-NLS-1$ + public static final String ATTR_ADMINPASS = "glassfish.adminpassword"; //$NON-NLS-1$ + public static final String ATTR_KEEPSESSIONS = "glassfish.keepSessions"; //$NON-NLS-1$ + public static final String ATTR_JARDEPLOY = "glassfish.jarDeploy"; //$NON-NLS-1$ + public static final String ATTR_HOTDEPLOY = "glassfish.hotDeploy"; //$NON-NLS-1$ + public static final String ATTR_USEANONYMOUSCONNECTIONS = "glassfish.useAnonymousConnection"; //$NON-NLS-1$ + public static final String ATTR_RESTART_PATTERN = "glassfish.restartPattern"; //$NON-NLS-1$ + public static final String ATTR_ATTACH_DEBUGGER_EARLY = "glassfish.attachDebuggerEarly"; //$NON-NLS-1$ + public static final String DEFAULT_RESTART_PATTERN = "\\.(jar|class|xml)$"; //$NON-NLS-1$ + public static final String DEFAULT_HOT_DEPLOY = "false"; + private List propChangeListeners; + + // #### ServerDelegate overridden methods + + @Override + protected void initialize() { + logMessage("in PayaraServer initialize" + this.getServer().getName()); //$NON-NLS-1$ + + if (getServerWorkingCopy() != null) { + readDomainConfig(); + } + + } + + /** + * @see org.eclipse.wst.server.core.model.ServerDelegate#modifyModules(org.eclipse.wst.server.core.IModule[], + * org.eclipse.wst.server.core.IModule[], org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + public void modifyModules(IModule[] add, IModule[] remove, IProgressMonitor monitor) throws CoreException { + + } + + @Override + public ServerPort[] getServerPorts() { + try { + return new ServerPort[] { + new ServerPort("adminserver", "Admin Server Port", getAdminPort(), "HTTP"), + new ServerPort("server", "Server Port", getPort(), "HTTP") + }; + } catch (Exception e) { + return new ServerPort[0]; + } + } + + // #### IURLProvider implementation methods + + @Override + public URL getModuleRootURL(IModule module) { + String protocol = getHttpListenerProtocol(getHost(), getPort()); + String path = getModuleRootPath(module); + int serverPort = getMonitorPort(getPort()); + String hostname = getHost(); + + try { + return new URL(protocol, hostname, serverPort, path); + } catch (MalformedURLException e) { + // Shouldn't happen + e.printStackTrace(); + } + + return null; + } + + // #### Other public methods + + public PayaraServerBehaviour getServerBehaviourAdapter() { + PayaraServerBehaviour serverBehavior = getServer().getAdapter(PayaraServerBehaviour.class); + + if (serverBehavior == null) { + serverBehavior = load(getServer(), PayaraServerBehaviour.class); + } + + return serverBehavior; + } + + public static IPath getDefaultDomainDir(IPath serverLocation) { + if (DEFAULT_SERVER_DIR_NAME.equals(serverLocation.lastSegment())) { + return serverLocation + .append(DEFAULT_DOMAIN_DIR_NAME) + .append(DEFAULT_DOMAIN_NAME); + } + + return serverLocation + .append(DEFAULT_SERVER_DIR_NAME) + .append(DEFAULT_DOMAIN_DIR_NAME) + .append(DEFAULT_DOMAIN_NAME); + } + + public static String createServerNameWithDomain(String serverName, String domainPath) { + int domainStartPos = serverName.lastIndexOf("["); + if (domainStartPos == -1) { + return serverName + " [" + lastSegment(domainPath) + "]"; + } + + return serverName.substring(0, domainStartPos) + "[" + lastSegment(domainPath) + "]"; + } + + private static String lastSegment(String path) { + if (path.lastIndexOf(File.separator) != -1) { + return path.substring(path.lastIndexOf(File.separator) + 1); + } + return null; + } + + public boolean isRemote() { + return getServer().getServerType().supportsRemoteHosts() && !isLocalhost(getServer().getHost()); + } + + public String getDebugOptions(int debugPort) { + Version version = getVersion(); + + if (version.matches("[4")) { + return "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=" + debugPort; + } + + return "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=" + debugPort; + } + + private void readDomainConfig() { + if (!isRemote()) { + if (readServerConfiguration(new File(getDomainsFolder() + separator + getDomainName() + "/config/domain.xml"))) { //$NON-NLS-1$ + + logMessage("In Payara initialize done readServerConfiguration"); //$NON-NLS-1$ + + syncHostAndPortsValues(); + + // This is mainly so serversection can listen and repopulate, + // but it is not working as intended because the sunserver + // instance to which the prop change listener is attached is a different one + // than is seeing the changes. + // + // In fact, we have multiple instances of this object and the glassfishBehaviour + // object per server - see issue 140 + + // firePropertyChangeEvent(DOMAINUPDATE, null, null); + } else { + logMessage("In Payara could not readServerConfiguration - probably invalid domain"); //$NON-NLS-1$ + } + } + } + + public String validateDomainExists(String domainPath) { + if (isRemote()) { + return null; + } + + if ((domainPath != null) && (!domainPath.startsWith("${"))) { // only if we are correctly setup... //$NON-NLS-1$ + File domainPathFile = new File(domainPath); + + if (!domainPathFile.exists()) { + return format(pathDoesNotExist, domainPathFile.getAbsolutePath()); + } + + if (!domainPathFile.isDirectory()) { + return format(pathNotDirectory, domainPathFile.getAbsolutePath()); + } + + if (!canWrite(domainPathFile)) { + return format(pathNotWritable, domainPathFile.getAbsolutePath()); + } + + File configDir = new File(domainPathFile, "config"); + if (!configDir.exists()) { + return format(pathDoesNotExist, configDir.getAbsolutePath()); + } + + if (!configDir.canWrite()) { + return format(pathNotWritable, configDir.getAbsolutePath()); + } + + File domain = new File(domainPathFile, "config/domain.xml"); //$NON-NLS-1$ + if (!domain.exists()) { + return format(pathNotValidDomain, domain.getAbsolutePath()); + } + + return null; + } + + return Messages.missingDomainLocation; + } + + public IStatus validateDomainLocation() { + return validateDomainLocation(getDomainPath()); + } + + public IStatus validateDomainLocation(String domainPath) { + if (isRemote()) { + return OK_STATUS; + } + + String domainConfigPath = domainPath + separator + "config" + separator + "domain.xml"; + + File domainConfigLocation = new File(domainConfigPath); + if (!domainConfigLocation.exists()) { + return new Status(ERROR, SYMBOLIC_NAME, pathNotValidDomain); + } + + // Check if domain and config dir are writable + File domainLocation = domainConfigLocation.getParentFile().getParentFile(); + if (!canWrite(domainLocation)) { + return new Status(ERROR, SYMBOLIC_NAME, bind(pathNotWritable, domainLocation.getAbsolutePath())); + } + + File domainConfigDir = domainConfigLocation.getParentFile(); + if (!canWrite(domainConfigDir)) { + return new Status(ERROR, SYMBOLIC_NAME, bind(pathNotWritable, domainConfigDir.getAbsolutePath())); + } + + return OK_STATUS; + } + + /* + * not yet, ui nor working well for generic validation + */ + public IStatus validate() { + + logMessage("in validate"); + IStatus status = null; + if (!isRemote()) { + + // validate domain before reading domain.xml + if (!(status = validateDomainLocation()).isOK()) { + return status; + } + + for (IServer server : ServerCore.getServers()) { + if (server.getId().equals(this.getServer().getId())) { + continue; + } + + if (server.getServerType() == this.getServer().getServerType()) { + PayaraServer payaraServer = (PayaraServer) server.loadAdapter(PayaraServer.class, null); + File otherDomainPath = new File(getDomainPath()); + File payaraDomainPath = new File(payaraServer.getDomainPath()); + + if (otherDomainPath.equals(payaraDomainPath)) { + return new Status(ERROR, SYMBOLIC_NAME, serverWithSameDomainPathExisting); + } + } + } + + // reads ports from domain + readDomainConfig(); + + // validate ports + if (getAdminPort() == -1) { + return new Status(ERROR, SYMBOLIC_NAME, invalidPortNumbers); + } + + // refresh model +// getModel().setAdminPort(getAdminPort()); +// getModel().setServerPort(getPort()); + + } + + return OK_STATUS; + } + + private void syncHostAndPortsValues() { + System.err.println("syncHostAndPortsValues"); + } + + /** + * Add a property change listener to this server. + * + * @param listener java.beans.PropertyChangeListener + */ + public void addPropertyChangeListener(PropertyChangeListener listener) { + if (propChangeListeners == null) { + propChangeListeners = new ArrayList<>(); + } + + propChangeListeners.add(listener); + } + + /** + * Remove a property change listener from this server. + * + * @param listener java.beans.PropertyChangeListener + */ + public void removePropertyChangeListener(PropertyChangeListener listener) { + if (propChangeListeners != null) { + propChangeListeners.remove(listener); + } + } + + /** + * Fire a property change event. + * + * @param propertyName a property name + * @param oldValue the old value + * @param newValue the new value + */ + public void firePropertyChangeEvent(String propertyName, Object oldValue, Object newValue) { + if (propChangeListeners == null) { + return; + } + + PropertyChangeEvent event = new PropertyChangeEvent(this, propertyName, oldValue, newValue); + try { + for (PropertyChangeListener listener : propChangeListeners) { + try { + listener.propertyChange(event); + } catch (Exception e) { + logError("Error firing property change event", e); //$NON-NLS-1$ + } + } + } catch (Exception e) { + logError("Error in property event", e); //$NON-NLS-1$ + } + } + + public static PayaraServer getGlassfishServerDelegate(IServerWorkingCopy server) { + PayaraServer glassfishDelegate = server.getOriginal().getAdapter(PayaraServer.class); + if (glassfishDelegate == null) { + glassfishDelegate = (PayaraServer) server.getOriginal().loadAdapter(PayaraServer.class, + new NullProgressMonitor()); + } + + return glassfishDelegate; + } + + protected boolean readServerConfiguration(File domainXml) { + boolean result = false; + + final Map httpMap = new LinkedHashMap<>(); + + if (domainXml.exists()) { + TargetConfigNameReader configNameReader = new TargetConfigNameReader(); + readXml(domainXml, configNameReader); + String configName = configNameReader.getTargetConfigName(); + if (configName == null) { + return false; + } + + HttpListenerReader httpListenerReader = new HttpListenerReader(configName); + NetworkListenerReader networkListenerReader = new NetworkListenerReader(configName); + try { + readXml(domainXml, httpListenerReader, networkListenerReader); + + httpMap.putAll(httpListenerReader.getResult()); + httpMap.putAll(networkListenerReader.getResult()); + + // !PW This is probably more convoluted than it had to be, but while + // http-listeners are usually named "http-listener-1", "http-listener-2", ... + // technically they could be named anything. + // + // For now, the logic is as follows: + // admin port is the one named "admin-listener" + // http port is the first non-secure enabled port - typically + // http-listener-1 + // https port is the first secure enabled port - typically + // http-listener-2 + // disabled ports are ignored. + // + HttpData adminData = httpMap.remove("admin-listener"); //$NON-NLS-1$ + int adminPort = adminData != null ? adminData.getPort() : -1; + setAttribute(ATTR_ADMINPORT, String.valueOf(adminPort)); + logMessage("reading from domain.xml adminServerPortNumber=" + getAdminPort()); //$NON-NLS-1$ + + HttpData httpPortData = httpMap.remove("http-listener-1"); //$NON-NLS-1$ + int httpPort = httpPortData != null ? httpPortData.getPort() : -1; + setAttribute(ATTR_SERVERPORT, String.valueOf(httpPort)); + + result = adminPort != -1; + } catch (IllegalStateException ex) { + logError("error IllegalStateException ", ex); //$NON-NLS-1$ + } + } + + return result; + } + + public String getDomainConfigurationFilePath() { + return getDomainPath().trim() + "/config/domain.xml"; + } + + public int getDebugPort() { + return getAttribute(ATTR_DEBUG_PORT, 9009); + } + + public void setDebugPort(int value) { + setAttribute(ATTR_DEBUG_PORT, value); + } + + /* + * *************Implementation of adapter methods used by tooling SDK library. + */ + + public int getAdminPort() { + return getAttribute(ATTR_ADMINPORT, 4848); + } + + public String getAdminUser() { + return getAttribute(ATTR_ADMIN, "admin"); + } + + public void setAdminUser(String value) { + setAttribute(ATTR_ADMIN, value); + } + + public String getDomainsFolder() { + if (!isRemote()) { + return new File(getDomainPath()).getParent(); + } + + return null; + } + + public String getDomainName() { + return getDomainPath() != null ? new File(getDomainPath()).getName() : null; + } + + public String getDomainPath() { + return getAttribute(ATTR_DOMAINPATH, getDefaultDomainDir(getServer().getRuntime().getLocation()).toString()); + } + + public void setDomainPath(String value) { + setAttribute(ATTR_DOMAINPATH, value); + } + + public String getHost() { + return getServer().getHost(); + } + + public String getName() { + return getServer().getName(); + } + + public int getPort() { + return getAttribute(ATTR_SERVERPORT, 8080); + } + + public String getUrl() { + return null; + } + + public String getRestartPattern() { + return getAttribute(ATTR_RESTART_PATTERN, DEFAULT_RESTART_PATTERN); + } + + public void setRestartPattern(String value) { + setAttribute(ATTR_RESTART_PATTERN, value); + } + + public Version getVersion() { + final IPath location = getServer().getRuntime().getLocation(); + + if (location != null) { + PayaraLocationUtils payaraInstall = find(location.toFile()); + + if (payaraInstall != null) { + return payaraInstall.version(); + } + } + + return null; + } + + public GlassFishAdminInterface getAdminInterface() { + return GlassFishAdminInterface.HTTP; + } + + public String getServerHome() { + return new File(getServerInstallationDirectory()).getAbsolutePath(); + } + + public String getServerRoot() { + return null; + } + + // ********************************************************* + + public boolean getKeepSessions() { + return getAttribute(ATTR_KEEPSESSIONS, true); + } + + public void setKeepSessions(boolean value) { + setAttribute(ATTR_KEEPSESSIONS, value); + } + + public boolean getHotDeploy() { + return getAttribute(ATTR_HOTDEPLOY, true); + } + + public void setHotDeploy(boolean value) { + setAttribute(ATTR_HOTDEPLOY, value); + } + + public boolean getAttachDebuggerEarly() { + return getAttribute(ATTR_ATTACH_DEBUGGER_EARLY, false); + } + + public void setAttachDebuggerEarly(boolean value) { + setAttribute(ATTR_ATTACH_DEBUGGER_EARLY, value); + } + + public String getAdminPassword() { + return getAttribute(ATTR_ADMINPASS, ""); + } + + public void setAdminPassword(String value) { + setAttribute(ATTR_ADMINPASS, value); + } + + public String computePreserveSessions() { + if (!getKeepSessions()) { + return null; + } + + return "keepstate"; + } + + /* + * JAR deploy for v3 + */ + public boolean getJarDeploy() { + if (isRemote()) { + return true; + } + + return getAttribute(ATTR_JARDEPLOY, false); + } + + public void setJarDeploy(boolean value) { + setAttribute(ATTR_JARDEPLOY, value); + } + + public void setPort(int port) { + setAttribute(ATTR_SERVERPORT, port); + } + public boolean useAnonymousConnections() { + return getAttribute(ATTR_USEANONYMOUSCONNECTIONS, true); + } + + public String getServerInstallationDirectory() { + IPath baseLocation = getServer().getRuntime().getLocation(); + if (DEFAULT_SERVER_DIR_NAME.equals(baseLocation.lastSegment())) { + return baseLocation.toString(); + + } + + return baseLocation.append(DEFAULT_SERVER_DIR_NAME).toString(); + } + + @Override + public IStatus canModifyModules(IModule[] add, IModule[] remove) { + if (add == null || add.length == 0) { + return OK_STATUS; + } + + for (IModule module : add) { + if (!isModuleSupported(module)) { + return createErrorStatus("Module is not supported on this server", null); + } + + IStatus status = checkModule(module); + if (status.getSeverity() == ERROR) { + return status; + } + + IModule[] root = doGetParentModules(module); + if (root != null && root.length > 0 && root[0] != module) { + return createErrorStatus( + "Web module which is part of an Ear cannot be added as top level module to this server", null); + } + } + + return OK_STATUS; + } + + protected boolean isModuleSupported(IModule module) { + return isEARModule(module) || isWebModule(module) || isEJBModule(module); + } + + @Override + public IModule[] getChildModules(IModule[] modulePath) { + if ((modulePath == null) || (modulePath.length == 0)) { + return new IModule[0]; + } + + IModule module = modulePath[modulePath.length - 1]; + if (module != null && module.getModuleType() != null) { + IModuleType moduleType = module.getModuleType(); + if (moduleType != null && "jst.ear".equals(moduleType.getId())) { //$NON-NLS-1$ + IEnterpriseApplication enterpriseApplication = (IEnterpriseApplication) module + .loadAdapter(IEnterpriseApplication.class, null); + if (enterpriseApplication != null) { + IModule[] earModules = enterpriseApplication.getModules(); + if (earModules != null) { + return earModules; + } + } + } else if (moduleType != null && "jst.web".equals(moduleType.getId())) { //$NON-NLS-1$ + IWebModule webModule = (IWebModule) module.loadAdapter(IWebModule.class, null); + if (webModule != null) { + IModule[] modules = webModule.getModules(); + return modules; + } + } + } + + return new IModule[0]; + } + + @Override + public IModule[] getRootModules(IModule module) throws CoreException { + if (!isModuleSupported(module)) { + return null; + } + + IModule[] parents = doGetParentModules(module); + if (parents.length > 0) { + return parents; + } + + return new IModule[] { module }; + } + + private IModule[] doGetParentModules(IModule module) { + ArrayList list = new ArrayList<>(); + + for (IModule earModule : getModules("jst.ear")) { + IEnterpriseApplication ear = (IEnterpriseApplication) earModule.loadAdapter(IEnterpriseApplication.class, null); + + for (IModule child : ear.getModules()) { + if (child.equals(module)) { + list.add(earModule); + } + } + } + + return list.toArray(new IModule[list.size()]); + } + + protected IStatus checkModule(final IModule module) { + return canSupportModule(module); + } + + public IStatus canSupportModule(final IModule module) { + IProject project = module.getProject(); + + if (project == null) { + return createErrorStatus("module type not supported", null); + } + + try { + IFacetedProject facetedProject = ProjectFacetsManager.create(module.getProject()); + + if (facetedProject != null) { + IRuntime runtime = getRuntime(getServer().getRuntime()); + + if (runtime == null) { + return createErrorStatus("cannot bridge runtimes", null); + } + + for (Object element : facetedProject.getProjectFacets()) { + IProjectFacetVersion facetVersion = (IProjectFacetVersion) element; + + if (!runtime.supports(facetVersion)) { + return createErrorStatus(bind(facetNotSupported, facetVersion.toString()), null); + } + } + } + } catch (CoreException e) { + return e.getStatus(); + } + + for (IModule child : getChildModules(new IModule[] { module })) { + IStatus status = canSupportModule(child); + + if (status.getSeverity() == ERROR) { + return status; + } + } + + return OK_STATUS; + } + + private String getModuleRootPath(IModule module) { + if (module == null || module.getProject() == null) { + return "/"; + } + + // If we are dealing with a web module, look if there is a root ear module + + if (hasProjectFacet(module, getProjectFacet(JST_WEB_MODULE))) { + IModule[] rootEars = getRootEarModulesOnThisServer(module); + if (rootEars != null && rootEars.length > 0) { + return getModuleRootPath(module, rootEars[0]); + } + + // Try to get context root from glassfish-web.xml + + String path = getWebDeploymentDescriptor(module.getProject()).getContext(); + if (path != null) { + return path; + } + + } + + return "/" + getServerContextRoot(module.getProject()); + } + + /** + * Return the context root of a web module in ther parent EAR. + * + * @param module: the web module + * @param parent: the EAR module + * @return + */ + private String getModuleRootPath(IModule module, IModule parent) { + String context = getAppWebContextRoot(parent, module); + + if (context != null && context.length() > 0) { + try { + return "/" + encode(context, "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + + return "/"; + } + + /** + * Return only the root modules already being added to this Glassfish server + */ + private IModule[] getRootEarModulesOnThisServer(IModule module) { + // Determine the root + IModule[] ear = getEnterpriseApplications(module, null); + if (ear != null && ear.length > 0) { + ArrayList rootEarModules = new ArrayList<>(); + + // Return only the EAR modules on current server. + + HashSet allmodules = new HashSet<>(asList(getServer().getModules())); + for (IModule element : ear) { + if (allmodules.contains(element)) { + rootEarModules.add(element); + } + } + + return rootEarModules.toArray(new IModule[rootEarModules.size()]); + } + + return null; + } + + private int getMonitorPort(int configedPort) { + IServerMonitorManager manager = ServerMonitorManager.getInstance(); + + for (IMonitoredServerPort port : manager.getMonitoredPorts(getServer())) { + if (port.getServerPort().getPort() == configedPort) { + return port.getMonitorPort(); + } + } + + return configedPort; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraServerPlugin.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraServerPlugin.java new file mode 100644 index 00000000..2a0f10c1 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraServerPlugin.java @@ -0,0 +1,219 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server; + +import static fish.payara.eclipse.tools.server.preferences.PreferenceConstants.ENABLE_LOG; +import static java.lang.Runtime.getRuntime; +import static java.nio.charset.Charset.defaultCharset; +import static org.eclipse.core.runtime.IStatus.ERROR; +import static org.eclipse.core.runtime.IStatus.INFO; +import static org.eclipse.jface.resource.ImageDescriptor.createFromURL; +import static org.eclipse.wst.server.core.ServerCore.addRuntimeLifecycleListener; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +import org.eclipse.core.runtime.ILog; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.eclipse.wst.server.core.IRuntime; +import org.eclipse.wst.server.core.internal.ResourceManager; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; + +import fish.payara.eclipse.tools.server.events.RuntimeLifecycleListener; +import fish.payara.eclipse.tools.server.events.ServerLifecycleListener; + +/** + * Payara Tools Server Plugin. This is used as the OSGi bundle activator, as well as the central + * place to do logging. + */ +public class PayaraServerPlugin extends AbstractUIPlugin { + protected Map imageDescriptors = new HashMap(); + + public static final String RUNTIME_TYPE = "payara.runtime"; //$NON-NLS-1$ + + public static final String GF_SERVER_IMG = "gf-server.img"; + public static final String EAR_MODULE_IMG = "ear.img"; + public static final String EJB_MODULE_IMG = "ejb.img"; + public static final String LOG_FILE_IMG = "log-file.img"; + public static final String WEB_MODULE_IMG = "web.img"; + public static final String WEBSERVICE_IMG = "webservice.img"; + public static final String RESOURCES_IMG = "resources.img"; + public static final String GF_WIZARD = "wizard.img"; + + public static final String SYMBOLIC_NAME = "fish.payara.eclipse.tools.server"; + public static final Bundle BUNDLE = Platform.getBundle(SYMBOLIC_NAME); + private static final ILog LOG = Platform.getLog(BUNDLE); + + private static PayaraServerPlugin singleton; + private static HashSet commandsToExecuteAtExit = new HashSet<>(); + + public PayaraServerPlugin() { + singleton = this; + } + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + + addRuntimeLifecycleListener(new RuntimeLifecycleListener()); + ResourceManager.getInstance().addServerLifecycleListener(new ServerLifecycleListener()); + } + + @Override + protected void initializeImageRegistry(ImageRegistry reg) { + super.initializeImageRegistry(reg); + reg.put(GF_SERVER_IMG, createFromURL(getBundle().getEntry("icons/obj16/payara-blue.png"))); + reg.put(EAR_MODULE_IMG, createFromURL(getBundle().getEntry("icons/obj16/ear.gif"))); + reg.put(EJB_MODULE_IMG, createFromURL(getBundle().getEntry("icons/obj16/ejb_module.gif"))); + reg.put(LOG_FILE_IMG, createFromURL(getBundle().getEntry("icons/obj16/logfile.png"))); + reg.put(WEB_MODULE_IMG, createFromURL(getBundle().getEntry("icons/obj16/web_module.gif"))); + reg.put(WEBSERVICE_IMG, createFromURL(getBundle().getEntry("icons/obj16/webservice.png"))); + reg.put(RESOURCES_IMG, createFromURL(getBundle().getEntry("icons/obj16/resources.gif"))); + reg.put(GF_WIZARD, createFromURL(getBundle().getEntry("icons/wizard75x66.png"))); + } + + + /** + * Return the image with the given key from the image registry. + * @param key java.lang.String + * @return org.eclipse.jface.parts.IImage + */ + public static Image getImage(String key) { + return getInstance().getImageRegistry().get(key); + } + + /** + * Return the image with the given key from the image registry. + * @param key java.lang.String + * @return org.eclipse.jface.parts.IImage + */ + public static ImageDescriptor getImageDescriptor(String key) { + return getInstance().getImageRegistry().getDescriptor(key); + } + +// /** +// * Register an image with the registry. +// * @param key java.lang.String +// * @param partialURL java.lang.String +// */ +// private void registerImage(ImageRegistry registry, String key, String partialURL) { +// if (ICON_BASE_URL == null) { +// String pathSuffix = "icons/"; +// ICON_BASE_URL = singleton.getBundle().getEntry(pathSuffix); +// } +// +// try { +// ImageDescriptor id = ImageDescriptor.createFromURL(new URL(ICON_BASE_URL, partialURL)); +// registry.put(key, id); +// imageDescriptors.put(key, id); +// } catch (Exception e) { +// Trace.trace(Trace.WARNING, "Error registering image", e); +// } +// } + + @Override + public void stop(BundleContext v) throws Exception { + logMessage("STOP IS CALLED!!!!!!!!!!!!!!!!"); + + for (String[] command : commandsToExecuteAtExit) { + try { + logMessage(">>> " + command[0]); + BufferedReader input = new BufferedReader(new InputStreamReader( + getRuntime().exec(command).getInputStream(), defaultCharset())); + + String line = null; + while ((line = input.readLine()) != null) { + logMessage(">>> " + line); + } + + input.close(); + } catch (Exception ex) { + logMessage("Error executing process:\n" + ex); + } + } + + super.stop(v); + } + + public static PayaraServerPlugin getInstance() { + return singleton; + } + + public void addCommandToExecuteAtExit(String command[]) { + for (String[] com : commandsToExecuteAtExit) { + if (Arrays.equals(com, command)) { + logMessage("Command already there"); + return; + } + } + + commandsToExecuteAtExit.add(command); + logMessage("addCommandToExecuteAtExit size=" + commandsToExecuteAtExit.size()); + } + + public static void logMessage(String message) { + if (getInstance().getPreferenceStore().getBoolean(ENABLE_LOG)) { + log(new Status(INFO, SYMBOLIC_NAME, 1, "Payara: " + message, null)); + } + } + + public static void logError(String message, Exception e) { + log(createErrorStatus(message, e)); + } + + public static void logError(String message) { + logError(message, null); + } + + public static void log(Exception e) { + log(createErrorStatus(e)); + } + + public static IStatus createErrorStatus(String message) { + return createErrorStatus(message, null); + } + + public static IStatus createErrorStatus(Exception e) { + return createErrorStatus(null, e); + } + + public static IStatus createErrorStatus(String message, Exception e) { + return new Status(ERROR, SYMBOLIC_NAME, 0, message == null ? e.getMessage() : message, e); + } + + public static void log(final IStatus status) { + LOG.log(status); + } + + public static boolean is31OrAbove(IRuntime runtime) { + return runtime.getRuntimeType().getId().equals(RUNTIME_TYPE); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ServerStatus.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ServerStatus.java new file mode 100644 index 00000000..6d2375e9 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ServerStatus.java @@ -0,0 +1,27 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server; + +public enum ServerStatus { + + RUNNING_DOMAIN_MATCHING, RUNNING_CONNECTION_ERROR, RUNNING_PROXY_ERROR, RUNNING_CREDENTIAL_PROBLEM, RUNNING_REMOTE_NOT_SECURE, STOPPED_NOT_LISTENING, STOPPED_DOMAIN_NOT_MATCHING, + + NOT_DEFINED; + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/Status.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/Status.java new file mode 100644 index 00000000..ce4a3197 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/Status.java @@ -0,0 +1,423 @@ +/****************************************************************************** + * Copyright (c) 2016 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Konstantin Komissarchik - initial implementation and ongoing maintenance + ******************************************************************************/ + +package fish.payara.eclipse.tools.server; + +import static fish.payara.eclipse.tools.server.utils.MiscUtil.equal; +import fish.payara.eclipse.tools.server.utils.SortedSetFactory; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Comparator; +import java.util.Iterator; +import java.util.SortedSet; + +/** + * @author Konstantin Komissarchik + */ + +public final class Status +{ + public static final String TYPE_MISC_OK = "Miscellaneous.Ok"; + public static final String TYPE_MISC_PROBLEM = "Miscellaneous.Problem"; + + private static final String DEFAULT_OK_MESSAGE = "ok"; + + private static final Status OK_STATUS = new Status( Severity.OK, TYPE_MISC_OK, DEFAULT_OK_MESSAGE, null, SortedSetFactory.empty() ); + + public static Status createOkStatus() + { + return OK_STATUS; + } + + public static Status createWarningStatus( final String message ) + { + return createStatus( Severity.WARNING, message ); + } + + public static Status createErrorStatus( final String message ) + { + return createErrorStatus( message, null ); + } + + public static Status createErrorStatus( final Throwable exception ) + { + if( exception == null ) + { + throw new IllegalArgumentException(); + } + + final String text = exception.getMessage(); + final StringBuilder msg = new StringBuilder(); + + msg.append( exception.getClass().getSimpleName() ); + + if( text != null && text.length() != 0 ) + { + msg.append( ": " ); + msg.append( text ); + } + + return createErrorStatus( msg.toString(), exception ); + } + + public static Status createErrorStatus( final String message, + final Throwable exception ) + { + return createStatus( Severity.ERROR, message, exception ); + } + + public static Status createStatus( final Severity severity, + final String message, + final Throwable exception ) + { + return factoryForLeaf().severity( severity ).message( message ).exception( exception ).create(); + } + + public static Status createStatus( final Severity severity, + final String message ) + { + return createStatus( severity, message, null ); + } + + public static LeafStatusFactory factoryForLeaf() + { + return new LeafStatusFactory(); + } + + public static CompositeStatusFactory factoryForComposite() + { + return new CompositeStatusFactory(); + } + + private final Severity severity; + private final String type; + private final String message; + private final Throwable exception; + private final SortedSet children; + + private Status( final Severity severity, + final String type, + final String message, + final Throwable exception, + final SortedSet children ) + { + this.severity = severity; + this.type = ( type == null ? ( severity == Severity.OK ? TYPE_MISC_OK : TYPE_MISC_PROBLEM ) : type ); + this.message = message; + this.exception = exception; + this.children = children; + } + + public boolean ok() + { + return ( this.severity == Severity.OK ); + } + + public Severity severity() + { + return this.severity; + } + + public String type() + { + return this.type; + } + + public String message() + { + return this.message; + } + + public Throwable exception() + { + return this.exception; + } + + public SortedSet children() + { + return this.children; + } + + public boolean contains( final String type ) + { + if( equal( this.type, type ) ) + { + return true; + } + + for( Status child : this.children ) + { + if( child.contains( type ) ) + { + return true; + } + } + + return false; + } + + @Override + public boolean equals( final Object obj ) + { + if( obj == this ) + { + return true; + } + + if( obj instanceof Status ) + { + final Status st = (Status) obj; + + if( st.severity() == severity() && + st.children().size() == children().size() && + st.exception() == exception() && + st.message().equals( message() ) ) + { + for( Iterator itr1 = st.children().iterator(), itr2 = children().iterator(); itr1.hasNext(); ) + { + if( ! itr1.next().equals( itr2.next() ) ) + { + return false; + } + } + + return true; + } + } + + return false; + } + + @Override + public int hashCode() + { + return severity().code() ^ message().hashCode(); + } + + @Override + public String toString() + { + final StringBuilder buf = new StringBuilder(); + + buf.append( severity().name() ); + buf.append( " : " ); + buf.append( message() ); + + final Throwable e = exception(); + + if( e != null ) + { + buf.append( System.getProperty( "line.separator" ) ); + + final StringWriter sw = new StringWriter(); + e.printStackTrace( new PrintWriter( sw ) ); + buf.append( sw.toString() ); + } + + return buf.toString(); + } + + public enum Severity + { + OK( 0 ), + WARNING( 1 ), + ERROR( 2 ); + + private int code; + + private Severity( final int code ) + { + this.code = code; + } + + public int code() + { + return this.code; + } + } + + public static final class LeafStatusFactory + { + private Severity severity; + private String type; + private String message; + private Throwable exception; + + private LeafStatusFactory() + { + // No direct public instantiation. Use factoryForLeaf() method instead. + } + + public LeafStatusFactory severity( final Severity severity ) + { + this.severity = severity; + return this; + } + + public LeafStatusFactory type( final String type ) + { + this.type = type; + return this; + } + + public LeafStatusFactory message( final String message ) + { + this.message = message; + return this; + } + + public LeafStatusFactory exception( final Throwable exception ) + { + this.exception = exception; + return this; + } + + public Status create() + { + if( this.severity == null ) + { + throw new IllegalStateException(); + } + + if( this.message == null ) + { + throw new IllegalStateException(); + } + + return new Status( this.severity, this.type, this.message, this.exception, SortedSetFactory.empty() ); + } + } + + public static final class CompositeStatusFactory + { + private final SortedSetFactory children = SortedSetFactory.start( StatusComparator.INSTANCE ); + + private CompositeStatusFactory() + { + // No direct public instantiation. Use factoryForComposite() method instead. + } + + public CompositeStatusFactory merge( final Status status ) + { + if( status != null ) + { + final SortedSet children = status.children(); + + if( children.isEmpty() ) + { + final Severity sev = status.severity(); + + if( sev != Severity.OK ) + { + this.children.add( status ); + } + } + else + { + for( Status st : children ) + { + merge( st ); + } + } + } + + return this; + } + + public Status create() + { + final int count = this.children.size(); + + if( count == 0 ) + { + return createOkStatus(); + } + else + { + final Status first = this.children.first(); + + if( count == 1 ) + { + return first; + } + else + { + return new Status( first.severity(), TYPE_MISC_PROBLEM, first.message(), first.exception(), this.children.result() ); + } + } + } + } + + private static final class StatusComparator implements Comparator + { + private static final StatusComparator INSTANCE = new StatusComparator(); + + public int compare( final Status x, + final Status y ) + { + int result = y.severity.code() - x.severity.code(); + + if( result == 0 ) + { + result = x.message.compareTo( y.message ); + + if( result == 0 ) + { + result = x.type.compareTo( y.type ); + + if( result == 0 ) + { + if( x.exception != y.exception ) + { + if( x.exception == null ) + { + result = -1; + } + else if( y.exception == null ) + { + result = 1; + } + else + { + result = x.exception.getClass().getName().compareTo( y.exception.getClass().getName() ); + + if( result == 0 ) + { + result = System.identityHashCode( x.exception ) - System.identityHashCode( y.exception ); + } + } + } + + if( result == 0 ) + { + result = x.children.size() - y.children.size(); + + if( result == 0 ) + { + final Iterator xChildren = x.children.iterator(); + final Iterator yChildren = y.children.iterator(); + + while( xChildren.hasNext() && result == 0 ) + { + result = compare( xChildren.next(), yChildren.next() ); + } + } + } + } + } + } + + return result; + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/AssembleModules.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/AssembleModules.java new file mode 100644 index 00000000..25780602 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/AssembleModules.java @@ -0,0 +1,500 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2019-2021 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.archives; + +import static fish.payara.eclipse.tools.server.PayaraServer.ATTR_RESTART_PATTERN; +import static fish.payara.eclipse.tools.server.PayaraServer.DEFAULT_RESTART_PATTERN; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.SYMBOLIC_NAME; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logMessage; +import static fish.payara.eclipse.tools.server.utils.WtpUtil.load; +import static java.lang.System.arraycopy; +import static org.eclipse.core.runtime.IStatus.ERROR; +import static org.eclipse.jst.server.generic.core.internal.CorePlugin.PLUGIN_ID; +import static org.eclipse.wst.server.core.IServer.PUBLISH_STATE_NONE; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.jst.server.core.IEnterpriseApplication; +import org.eclipse.jst.server.core.IJ2EEModule; +import org.eclipse.jst.server.core.IWebModule; +import org.eclipse.jst.server.generic.core.internal.CorePlugin; +import org.eclipse.jst.server.generic.core.internal.publishers.ModulePackager; +import org.eclipse.wst.server.core.IModule; +import org.eclipse.wst.server.core.IServer; +import org.eclipse.wst.server.core.internal.Server; +import org.eclipse.wst.server.core.model.IModuleFolder; +import org.eclipse.wst.server.core.model.IModuleResource; +import org.eclipse.wst.server.core.model.IModuleResourceDelta; +import org.eclipse.wst.server.core.util.ProjectModule; +import org.eclipse.wst.server.core.util.PublishHelper; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.PayaraServerPlugin; +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; + +/* + * Assemble modules (i.e if a web app depends on a utility lib, we need to create the jar file for this utility and + * put it in the web-inf/lib area of the web app. + */ +@SuppressWarnings("restriction") +public class AssembleModules { + + protected IModule[] modulePath; // Full path of the module. We need the path to get publish state and query + // resource delta, etc + protected IModule module; // Module to be assembled + protected IPath assembleRoot; + protected PublishHelper publishHelper; + protected PayaraServer server; + protected boolean childNeedsARedeployment; + + public AssembleModules(IModule[] modulePath, IPath assembleRoot, PayaraServer server, PublishHelper helper) { + this.modulePath = modulePath; + this.module = modulePath[modulePath.length - 1]; // last segment of the module path + this.assembleRoot = assembleRoot; + this.server = server; + this.publishHelper = helper; + + logMessage("AssembleModules assembleRoot=" + assembleRoot); + } + + public IPath assembleWebModule(IProgressMonitor monitor) throws CoreException { + IPath parent = assembleRoot; + + if (PUBLISH_STATE_NONE != server.getServer().getModulePublishState(modulePath)) { + copyModule(module, monitor); + } + + IWebModule webModule = (IWebModule) module.loadAdapter(IWebModule.class, monitor); + IModule[] childModules = webModule.getModules(); + for (IModule childModule : childModules) { + String uri = webModule.getURI(childModule); + if (uri == null) { // The bad memories of WTP 1.0 + throw new CoreException(new Status(ERROR, PLUGIN_ID, 0, "unable to assemble module null uri", null)); + } + + IJ2EEModule jeeModule = (IJ2EEModule) childModule.loadAdapter(IJ2EEModule.class, monitor); + if (jeeModule != null && jeeModule.isBinary()) { // Binary module + ProjectModule pm = (ProjectModule) childModule.loadAdapter(ProjectModule.class, null); + IModuleResource[] resources = pm.members(); + publishHelper.publishToPath(resources, parent.append(uri), monitor); + } else { // Project module + String version = PayaraServerBehaviour.getVersion(server); + if (version.indexOf(" 3.1") == -1) { + packModule(childModule, uri, parent); + } else { + + if (shouldRepack(childModule)) { + + IModule[] childModulePath = new IModule[modulePath.length + 1]; + arraycopy(modulePath, 0, childModulePath, 0, modulePath.length); + childModulePath[childModulePath.length - 1] = childModule; + + AssembleModules assembler = new AssembleModules(childModulePath, assembleRoot.append(uri), + server, publishHelper); + childNeedsARedeployment = (childNeedsARedeployment || assembler.needsARedeployment()); + assembler.copyModule(childModule, monitor); + } + } + } + } + + return parent; + } + + public static boolean isModuleType(IModule module, String moduleTypeId) { + return module.getModuleType() != null && moduleTypeId.equals(module.getModuleType().getId()); + } + + protected void packModule(IModule module, String deploymentUnitName, IPath destination) throws CoreException { + String dest = destination.append(deploymentUnitName).toString(); + logMessage("AssembleModules dest=" + dest); + + ModulePackager packager = null; + try { + packager = new ModulePackager(dest, false); + for (IModuleResource resource : load(module, ProjectModule.class).members()) { + logMessage("AssembleModules resources=" + resource); + + doPackModule(resource, packager); + } + } catch (IOException e) { + throw new CoreException(new Status(ERROR, SYMBOLIC_NAME, 0, "unable to assemble module", e)); + } finally { + try { + packager.finished(); + } catch (Exception e) { + } + } + } + + private void doPackModule(IModuleResource resource, ModulePackager packager) throws CoreException, IOException { + if (resource instanceof IModuleFolder) { + IModuleFolder mFolder = (IModuleFolder) resource; + IModuleResource[] resources = mFolder.members(); + + logMessage("AssembleModules doPackModule IModuleFolder=" + mFolder); + logMessage("AssembleModules doPackModule resource.getModuleRelativePath()=" + + resource.getModuleRelativePath()); + logMessage( + "AssembleModules resource.getModuleRelativePath().append(resource.getName()).toPortableString()=" + + resource.getModuleRelativePath().append(resource.getName()).toPortableString()); + + packager.writeFolder(resource.getModuleRelativePath().append(resource.getName()).toPortableString()); + + for (int i = 0; resources != null && i < resources.length; i++) { + logMessage("AssembleModules resources[i]=" + resources[i]); + + doPackModule(resources[i], packager); + } + } else { + String destination = resource.getModuleRelativePath().append(resource.getName()).toPortableString(); + IFile file = resource.getAdapter(IFile.class); + if (file != null) { + packager.write(file, destination); + } else { + File file2 = resource.getAdapter(File.class); + packager.write(file2, destination); + } + } + } + + protected IPath copyModule(IModule module, IProgressMonitor monitor) throws CoreException { + ProjectModule pm = (ProjectModule) module.loadAdapter(ProjectModule.class, monitor); + + IPath[] jarPaths = null; + if (module.getModuleType().getId().equals("jst.web")) { + IWebModule webModule = (IWebModule) module.loadAdapter(IWebModule.class, monitor); + + // Child module of the web project, e.g., Utility project added through + // Deployment Assembly + IModule[] childModules = webModule.getModules(); + if (childModules != null && childModules.length > 0) { + jarPaths = new IPath[childModules.length]; + for (int i = 0; i < childModules.length; i++) { + jarPaths[i] = new Path(webModule.getURI(childModules[i])); + } + } + + } + IStatus[] status = publishHelper.publishSmart(pm.members(), assembleRoot, jarPaths, monitor); + if (status != null && status.length > 0) { + // no need to emit an error like CoreException(status[0]); just log in the entry + // see https://glassfishplugins.dev.java.net/issues/show_bug.cgi?id=268 + for (IStatus statu : status) { + PayaraServerPlugin.logMessage("warning copying module: " + statu.getMessage()); + } + } + + return assembleRoot; + } + + protected IPath copyEarModule(IModule module, IProgressMonitor monitor) throws CoreException { + ProjectModule pm = (ProjectModule) module.loadAdapter(ProjectModule.class, monitor); + IEnterpriseApplication earModule = (IEnterpriseApplication) module.loadAdapter(IEnterpriseApplication.class, + monitor); + + // Get publish paths of child modules so we do not delete them with publishSmart + // call + IModule[] childModules = earModule.getModules(); + logMessage("copyEarModule childModules.length=" + childModules.length); + ArrayList ignorePaths = new ArrayList<>(childModules.length); + for (IModule childModule2 : childModules) { + + IModule childModule = childModule2; + String uri = earModule.getURI(childModule); + if (uri == null) { + IStatus status = new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, 0, + "unable to assemble module null uri", null); //$NON-NLS-1$ + throw new CoreException(status); + } + if (!childModule.getModuleType().getId().equals("jst.utility")) {//$NON-NLS-1$ see bug + // https://glassfishplugins.dev.java.net/issues/show_bug.cgi?id=251 + if (uri.endsWith(".war")) { + uri = uri.substring(0, uri.length() - 4) + "_war"; + } else if (uri.endsWith(".jar")) { + uri = uri.substring(0, uri.length() - 4) + "_jar"; + } else if (uri.endsWith(".rar")) { // http://java.net/jira/browse/GLASSFISHPLUGINS-333 + uri = uri.substring(0, uri.length() - 4) + "_rar"; + } + } + ignorePaths.add(new Path(uri)); + } + IPath[] pathArr = new IPath[ignorePaths.size()]; + pathArr = ignorePaths.toArray(pathArr); + IStatus[] status = publishHelper.publishSmart(pm.members(), assembleRoot, pathArr, monitor); + if (status != null && status.length > 0) { + // no need to emit an error like CoreException(status[0]); just log in the entry + // see https://glassfishplugins.dev.java.net/issues/show_bug.cgi?id=268 + for (IStatus statu : status) { + PayaraServerPlugin.logMessage("warning copying module: " + statu.getMessage()); + } + } + + return assembleRoot; + } + + /* + * not used for now... Would be ejb module when v3 has them + * + */ + public IPath assembleNonWebOrNonEARModule(IProgressMonitor monitor) throws CoreException { + return copyModule(module, monitor); + } + + public IPath assembleEARModule(IProgressMonitor monitor) throws CoreException { + // Copy ear root to the temporary assembly directory + IPath parent = assembleRoot; + + boolean shouldCopy = (IServer.PUBLISH_STATE_NONE != server.getServer().getModulePublishState(modulePath)); + if (shouldCopy) { + copyModule(module, monitor); + } + + IEnterpriseApplication earModule = (IEnterpriseApplication) module.loadAdapter(IEnterpriseApplication.class, + monitor); + + IModule[] childModules = earModule.getModules(); + for (IModule module : childModules) { + String uri = earModule.getURI(module); + if (uri == null) { + throw new CoreException(new Status(ERROR, PLUGIN_ID, 0, "unable to assemble module null uri", null)); + } + IJ2EEModule jeeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, monitor); + if (jeeModule != null && jeeModule.isBinary()) {// Binary module just copy + ProjectModule pm = (ProjectModule) module.loadAdapter(ProjectModule.class, null); + IModuleResource[] resources = pm.members(); + publishHelper.publishToPath(resources, parent.append(uri), monitor); + + continue;// done! no need to go further + } + if (shouldRepack(module)) { + packModuleEARModule(module, uri, parent); + } + } + + return parent; + + } + + /** + * Checks if there has been a change in the published resources. + * + * @param module + * @return module changed + */ + private boolean shouldRepack(IModule lmodule) { + IModule[] childModulePath = new IModule[modulePath.length + 1]; + arraycopy(modulePath, 0, childModulePath, 0, modulePath.length); + childModulePath[childModulePath.length - 1] = lmodule; + + boolean repack = PUBLISH_STATE_NONE != server.getServer().getModulePublishState(childModulePath); + repack |= PUBLISH_STATE_NONE != server.getServer().getModulePublishState(modulePath); + + return repack; + } + + /* + * Returns true is a deploy command has to be run. for example a simple JSP + * change does not need a redeployment as the file is already been copied by the + * assembly in the correct directory + */ + public boolean needsARedeployment() { + Server _server = (Server) server.getServer(); + + return childNeedsARedeployment || criticalResourceChangeThatNeedsARedeploy( + // The path that's going to be published + _server.getPublishedResourceDelta(modulePath), + + // The pattern that denotes whether a restart is needed for that path + Pattern.compile(_server.getAttribute(ATTR_RESTART_PATTERN, DEFAULT_RESTART_PATTERN))); + } + + public List getModifiedSourceFiles() { + + List files = new ArrayList<>(); + Server _server = (Server) server.getServer(); + + IModuleResourceDelta[] deltas = _server.getPublishedResourceDelta(modulePath); + Pattern restartPattern = Pattern + .compile(_server.getAttribute(ATTR_RESTART_PATTERN, DEFAULT_RESTART_PATTERN)); + if (deltas != null) { + for (IModuleResourceDelta delta : deltas) { + getModifiedSourceFiles(files, delta.getAffectedChildren(), restartPattern); + } + } + + return files; + } + + private List getModifiedSourceFiles(final List files, final IModuleResourceDelta[] deltas, + final Pattern restartPattern) { + if (deltas == null) { + return files; + } + + for (IModuleResourceDelta delta : deltas) { + IModuleResource resource = delta.getModuleResource(); + if (restartPattern.matcher(resource.getName()).find()) { + File parent = resource.getModuleRelativePath().toFile(); + files.add(new File(parent, resource.getName())); + continue; + } + + getModifiedSourceFiles(files, delta.getAffectedChildren(), restartPattern); + } + + return files; + } + + /* + * return true is a module resource change requires a redeploy command for + * example, web.xml or a .class file change needs a redeploy. a jsp or html + * change just needs a file copy not a redeploy command. + */ + private boolean criticalResourceChangeThatNeedsARedeploy(IModuleResourceDelta[] deltas, Pattern restartPattern) { + if (deltas == null) { + return false; + } + + for (IModuleResourceDelta delta : deltas) { + if (restartPattern.matcher(delta.getModuleResource().getName()).find()) { + return true; + } + + logMessage("AssembleModules no pattern matched."); + + if (criticalResourceChangeThatNeedsARedeploy(delta.getAffectedChildren(), restartPattern)) { + return true; + } + } + + return false; + } + + protected void packModuleEARModule(IModule module, String deploymentUnitName, IPath destination) + throws CoreException { + logMessage("AssembleModules packModuleEARModule=" + module.getId() + " " + module.getName()); + logMessage("AssembleModules deploymentUnitName=" + deploymentUnitName); // ie foo.war or myejbs.jar + + // Need to replace the , with_ ie _war or _jar as the dirname for dir deploy + logMessage("AssembleModules destination=" + destination); + if (module.getModuleType().getId().equals("jst.web")) {//$NON-NLS-1$ + + AssembleModules assembler = new AssembleModules(modulePath, assembleRoot, server, publishHelper); + IPath webAppPath = assembler.assembleWebModule(new NullProgressMonitor()); + String realDestination = destination.append(deploymentUnitName).toString(); + logMessage("AssembleModules realDestination=" + realDestination); + + ModulePackager packager = null; + try { + packager = new ModulePackager(realDestination, false); + packager.pack(webAppPath.toFile(), webAppPath.toOSString()); + + } catch (IOException e) { + throw new CoreException(new Status(ERROR, PLUGIN_ID, 0, "unable to assemble module", e)); + } finally { + if (packager != null) { + try { + packager.finished(); + } catch (IOException e) { + } + } + } + + } else { + packModule(module, deploymentUnitName, destination); + } + + } + + public IPath assembleDirDeployedEARModule(IProgressMonitor monitor) throws CoreException { + // Copy ear root to the temporary assembly directory + IPath parent = assembleRoot; + + if (PUBLISH_STATE_NONE != server.getServer().getModulePublishState(modulePath)) { + copyEarModule(module, monitor); + } + + IEnterpriseApplication earModule = (IEnterpriseApplication) module.loadAdapter(IEnterpriseApplication.class, + monitor); + IModule[] childModules = earModule.getModules(); + logMessage("assembleDirDeployedEARModule childModules.length=" + childModules.length); + for (IModule childModule2 : childModules) { + + IModule childModule = childModule2; + String uri = earModule.getURI(childModule); + if (uri == null) { + throw new CoreException(new Status(ERROR, PLUGIN_ID, 0, "unable to assemble module null uri", null)); + } + + IJ2EEModule jeeModule = (IJ2EEModule) childModule.loadAdapter(IJ2EEModule.class, monitor); + if (jeeModule != null && jeeModule.isBinary()) {// Binary module just copy + publishHelper.publishToPath(load(childModule, ProjectModule.class).members(), parent.append(uri), + monitor); + + continue; // Done! no need to go further + } + + if (!childModule.getModuleType().getId().equals("jst.utility")) {//$NON-NLS-1$ see bug + // https://glassfishplugins.dev.java.net/issues/show_bug.cgi?id=251 + if (uri.endsWith(".war")) { + uri = uri.substring(0, uri.length() - 4) + "_war"; + } else if (uri.endsWith(".jar")) { + uri = uri.substring(0, uri.length() - 4) + "_jar"; + } else if (uri.endsWith(".rar")) { // http://java.net/jira/browse/GLASSFISHPLUGINS-333 + uri = uri.substring(0, uri.length() - 4) + "_rar"; + } + } + + if (shouldRepack(childModule)) { + IModule[] childModulePath = new IModule[modulePath.length + 1]; + arraycopy(modulePath, 0, childModulePath, 0, modulePath.length); + childModulePath[childModulePath.length - 1] = childModule; + + if (childModule.getModuleType().getId().equals("jst.web")) {//$NON-NLS-1$ + AssembleModules assembler = new AssembleModules(childModulePath, assembleRoot.append(uri), server, + publishHelper); + childNeedsARedeployment = (childNeedsARedeployment || assembler.needsARedeployment()); + assembler.assembleWebModule(new NullProgressMonitor()); + } else { + AssembleModules assembler = new AssembleModules(childModulePath, assembleRoot.append(uri), server, + publishHelper); + childNeedsARedeployment = (childNeedsARedeployment || assembler.needsARedeployment()); + assembler.copyModule(childModule, monitor); + } + + } + } + + return parent; + + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/EclipseToPayaraArchiveConverter.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/EclipseToPayaraArchiveConverter.java new file mode 100644 index 00000000..e75f53b6 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/EclipseToPayaraArchiveConverter.java @@ -0,0 +1,181 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.archives; + +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logError; +import static fish.payara.eclipse.tools.server.utils.Utils.hasProjectFacet; +import static fish.payara.eclipse.tools.server.utils.WtpUtil.load; +import static org.eclipse.wst.common.componentcore.internal.util.IModuleConstants.JST_WEB_MODULE; +import static org.eclipse.wst.common.project.facet.core.ProjectFacetsManager.getProjectFacet; + +import java.io.UnsupportedEncodingException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLDecoder; +import java.net.URLEncoder; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jst.server.core.Servlet; +import org.eclipse.wst.server.core.IModuleArtifact; +import org.eclipse.wst.server.core.IServer; +import org.eclipse.wst.server.core.model.IURLProvider; +import org.eclipse.wst.server.core.model.LaunchableAdapterDelegate; +import org.eclipse.wst.server.core.util.HttpLaunchable; +import org.eclipse.wst.server.core.util.WebResource; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * This class converts / adapts an Eclipse generic {@link IModuleArtifact} into an + * {@link HttpLaunchable}, which represents an archive that can be deployed to Payara / GlassFish + * + *

+ * This class is registered in plug-in.xml in the + * org.eclipse.wst.server.core.launchableAdapters extension point. + *

+ * + */ +@SuppressWarnings("restriction") +public class EclipseToPayaraArchiveConverter extends LaunchableAdapterDelegate { + + @Override + public Object getLaunchable(IServer server, IModuleArtifact moduleArtifact) throws CoreException { + if (server == null) { + return null; + } + + String serverTypeId = server.getServerType().getId(); + + if (!serverTypeId.equals("payara.server")) { + return null; + } + + PayaraServer glassfish = load(server, PayaraServer.class); + + + + // Implementation borrowed from org.eclipse.jst.server.tomcat.core. + // TomcatServerLaunchableAdapterDelegate.java + if ((glassfish == null) || (!(moduleArtifact instanceof Servlet) && !(moduleArtifact instanceof WebResource)) || !hasProjectFacet(moduleArtifact.getModule(), getProjectFacet(JST_WEB_MODULE))) { + return null; + } + + try { + IURLProvider delegate = load(server, IURLProvider.class); + if (delegate == null) { + return null; + } + + URL url = delegate.getModuleRootURL(moduleArtifact.getModule()); + if (url == null) { + return null; + } + + if (moduleArtifact instanceof Servlet) { + Servlet servlet = (Servlet) moduleArtifact; + + String base, path; + if (servlet.getAlias() != null) { + base = normalize(url.getFile()); + path = normalize(servlet.getAlias()); + url = new URL(url, base + path); + } else { + base = "/servlet"; + path = servlet.getServletClassName(); + } + + url = new URL(url.getProtocol(), url.getHost(), url.getPort(), base + path); + } else if (moduleArtifact instanceof WebResource) { + WebResource resource = (WebResource) moduleArtifact; + + String path = normalize(resource.getPath().toPortableString()); + if (path.length() != 0) { + String base = normalize(url.getFile()); + url = new URL(url.getProtocol(), url.getHost(), url.getPort(), base + path); + } + } + + return new HttpLaunchable((new UrlPathEncoder(url)).asURL()); + } catch (Exception e) { + logError("Error getting URL for " + moduleArtifact, e); + return null; + } + } + + private String normalize(String path) { + if ((path == null) || path.equals("/")) { + return ""; + } + + if (path.length() > 0 && path.endsWith("/")) { + return path.substring(0, path.length() - 2); + } + + if (path.length() > 0 && !path.startsWith("/")) { + return "/" + path; + } + + return path; + } + + static class UrlPathEncoder { + + private URL _url = null; + + public UrlPathEncoder(URL theUrl) throws MalformedURLException { + this(theUrl.toString()); + } + + public UrlPathEncoder(String urlString) throws MalformedURLException { + try { + + // Need to decode the URL to make sure we don't re-encode + // any already encoded characters + String urlStringDecoded = URLDecoder.decode(urlString, "UTF-8"); //$NON-NLS-1$ + + // Now split the URL into path and query (they get encoded differently) + URL tmpUrl = new URL(urlStringDecoded); + String query = tmpUrl.getQuery(); + StringBuilder path = new StringBuilder(); + + // Encode the path and put the '/'s back + path.append(URLEncoder.encode(tmpUrl.getPath(), "UTF-8") //$NON-NLS-1$ + .replaceAll("%2[fF]", "/")); //$NON-NLS-1$ //$NON-NLS-2$ + + if (query != null) { + path.append("?").append(URLEncoder.encode(query, "UTF-8")); //$NON-NLS-1$//$NON-NLS-2$ + } + + // Rebuild using the encoded path and query with the original scheme + _url = new URL(tmpUrl.getProtocol(), tmpUrl.getHost(), tmpUrl.getPort(), path.toString()); + } catch (UnsupportedEncodingException uee) { + logError("Fatal: Unsupported encoding", uee); + } + } + + public String asString() { + return _url.toString(); + } + + public URL asURL() { + return _url; + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/ExportJavaEEArchive.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/ExportJavaEEArchive.java new file mode 100644 index 00000000..fafeecfc --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/ExportJavaEEArchive.java @@ -0,0 +1,74 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.archives; + +import static fish.payara.eclipse.tools.server.archives.AssembleModules.isModuleType; +import static org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties.ARCHIVE_DESTINATION; +import static org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties.EXPORT_SOURCE_FILES; +import static org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties.OVERWRITE_EXISTING; +import static org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties.PROJECT_NAME; +import static org.eclipse.wst.common.frameworks.datamodel.DataModelFactory.createDataModel; + +import java.io.File; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jst.j2ee.application.internal.operations.EARComponentExportDataModelProvider; +import org.eclipse.jst.j2ee.internal.ejb.project.operations.EJBComponentExportDataModelProvider; +import org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportDataModelProvider; +import org.eclipse.wst.common.frameworks.datamodel.IDataModel; +import org.eclipse.wst.server.core.IModule; + +@SuppressWarnings("restriction") +public class ExportJavaEEArchive { + + public static File export(final IModule module, final IProgressMonitor monitor) throws ExecutionException { + + final File root = ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile(); + + IProject p = module.getProject(); + File archiveName = null; + IDataModel dataModel = null; + + if (isModuleType(module, "jst.web")) { + dataModel = createDataModel(new WebComponentExportDataModelProvider()); + archiveName = new File(root, p.getName() + ".war"); + } else if (isModuleType(module, "jst.ear")) { + dataModel = createDataModel(new EARComponentExportDataModelProvider()); + archiveName = new File(root, p.getName() + ".ear"); + } else { // default + dataModel = createDataModel(new EJBComponentExportDataModelProvider()); + archiveName = new File(root, p.getName() + ".jar"); + + } + + dataModel.setProperty(PROJECT_NAME, p.getName()); + dataModel.setProperty(EXPORT_SOURCE_FILES, false); + dataModel.setProperty(OVERWRITE_EXISTING, true); + dataModel.setProperty(ARCHIVE_DESTINATION, archiveName.getAbsolutePath()); + + dataModel.getDefaultOperation().execute(monitor, null); + + return archiveName; + + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/deploying/PayaraServerBehaviour.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/deploying/PayaraServerBehaviour.java new file mode 100644 index 00000000..35babe2b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/deploying/PayaraServerBehaviour.java @@ -0,0 +1,961 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2021 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.deploying; + +import static fish.payara.eclipse.tools.server.Messages.connectionError; +import static fish.payara.eclipse.tools.server.Messages.invalidCredentials; +import static fish.payara.eclipse.tools.server.Messages.serverDirectoryGone; +import static fish.payara.eclipse.tools.server.Messages.serverNotMatchingLocal; +import static fish.payara.eclipse.tools.server.Messages.serverNotMatchingRemote; +import static fish.payara.eclipse.tools.server.PayaraServer.DEFAULT_DEBUG_PORT; +import static fish.payara.eclipse.tools.server.PayaraServer.DEFAULT_HOT_DEPLOY; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.SYMBOLIC_NAME; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.createErrorStatus; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logError; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logMessage; +import static fish.payara.eclipse.tools.server.ServerStatus.RUNNING_DOMAIN_MATCHING; +import static fish.payara.eclipse.tools.server.ServerStatus.STOPPED_NOT_LISTENING; +import static fish.payara.eclipse.tools.server.archives.AssembleModules.isModuleType; +import static fish.payara.eclipse.tools.server.archives.ExportJavaEEArchive.export; +import static fish.payara.eclipse.tools.server.log.PayaraConsoleManager.getStandardConsole; +import static fish.payara.eclipse.tools.server.sdk.TaskState.COMPLETED; +import static fish.payara.eclipse.tools.server.sdk.admin.CommandStopDAS.stopDAS; +import static fish.payara.eclipse.tools.server.sdk.admin.ServerAdmin.exec; +import static fish.payara.eclipse.tools.server.utils.ResourceUtils.RESOURCE_FILE_NAME; +import static fish.payara.eclipse.tools.server.utils.ResourceUtils.checkUpdateServerResources; +import static fish.payara.eclipse.tools.server.utils.Utils.isEmpty; +import static fish.payara.eclipse.tools.server.utils.Utils.simplifyModuleID; +import static java.io.File.separatorChar; +import static java.lang.Thread.currentThread; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.eclipse.core.runtime.IStatus.ERROR; +import static org.eclipse.core.runtime.IStatus.OK; +import static org.eclipse.core.runtime.IStatus.WARNING; +import static org.eclipse.debug.core.DebugEvent.TERMINATE; +import static org.eclipse.debug.core.ILaunchManager.DEBUG_MODE; +import static org.eclipse.debug.core.ILaunchManager.RUN_MODE; +import static org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP; +import static org.eclipse.osgi.util.NLS.bind; +import static org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities.getServerContextRoot; +import static org.eclipse.wst.server.core.IServer.PUBLISH_AUTO; +import static org.eclipse.wst.server.core.IServer.PUBLISH_CLEAN; +import static org.eclipse.wst.server.core.IServer.PUBLISH_FULL; +import static org.eclipse.wst.server.core.IServer.PUBLISH_INCREMENTAL; +import static org.eclipse.wst.server.core.IServer.PUBLISH_STATE_FULL; +import static org.eclipse.wst.server.core.IServer.PUBLISH_STATE_NONE; +import static org.eclipse.wst.server.core.IServer.STATE_STARTED; +import static org.eclipse.wst.server.core.IServer.STATE_STOPPED; +import static org.eclipse.wst.server.core.IServer.STATE_STOPPING; +import static org.eclipse.wst.server.core.internal.ProgressUtil.getMonitorFor; +import static org.eclipse.wst.server.core.util.PublishHelper.deleteDirectory; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeoutException; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.DebugEvent; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.IDebugEventSetListener; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget; +import org.eclipse.jdt.internal.launching.JavaRemoteApplicationLaunchConfigurationDelegate; +import org.eclipse.jst.server.core.IEnterpriseApplication; +import org.eclipse.wst.server.core.IModule; +import org.eclipse.wst.server.core.internal.DeletedModule; +import org.eclipse.wst.server.core.internal.Server; +import org.eclipse.wst.server.core.model.ServerBehaviourDelegate; +import org.eclipse.wst.server.core.util.PublishHelper; + +import fish.payara.eclipse.tools.server.PayaraRuntime; +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.ServerStatus; +import fish.payara.eclipse.tools.server.archives.AssembleModules; +import fish.payara.eclipse.tools.server.exceptions.HttpPortUpdateException; +import fish.payara.eclipse.tools.server.internal.PayaraStateResolver; +import fish.payara.eclipse.tools.server.internal.ServerStateListener; +import fish.payara.eclipse.tools.server.internal.ServerStatusMonitor; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; +import fish.payara.eclipse.tools.server.sdk.admin.CommandAddResources; +import fish.payara.eclipse.tools.server.sdk.admin.CommandDeploy; +import fish.payara.eclipse.tools.server.sdk.admin.CommandGetProperty; +import fish.payara.eclipse.tools.server.sdk.admin.CommandRedeploy; +import fish.payara.eclipse.tools.server.sdk.admin.CommandTarget; +import fish.payara.eclipse.tools.server.sdk.admin.CommandUndeploy; +import fish.payara.eclipse.tools.server.sdk.admin.CommandVersion; +import fish.payara.eclipse.tools.server.sdk.admin.ResultMap; +import fish.payara.eclipse.tools.server.sdk.admin.ResultString; +import fish.payara.eclipse.tools.server.sdk.admin.ServerAdmin; +import fish.payara.eclipse.tools.server.starting.PayaraServerLaunchDelegate; +import fish.payara.eclipse.tools.server.utils.ResourceUtils; + +/** + * This behavior class is called back by WTP to perform the standard operations + * on the Payara / GlassFish server such as deploy/undeploy etc. + * Starting/restarting is delegated to {@link PayaraServerLaunchDelegate}. + * + *

+ * This class is registered in plug-in.xml in the + * org.eclipse.wst.server.core.serverTypes extension point. + *

+ * + */ +@SuppressWarnings("restriction") +public final class PayaraServerBehaviour extends ServerBehaviourDelegate implements ServerStateListener { + + private static final IStatus OK_STATUS = new Status(OK, SYMBOLIC_NAME, ""); + + // initialized + protected boolean needARedeploy = true; // by default, will be calculated.. + + private PayaraStateResolver stateResolver = new PayaraStateResolver(); + + private ServerStatusMonitor statusMonitor; + + private static final ExecutorService asyncJobsService = Executors.newCachedThreadPool(); + + private static JavaRemoteApplicationLaunchConfigurationDelegate REMOTE_JAVA_APP_LAUNCH_DELEGATE = new JavaRemoteApplicationLaunchConfigurationDelegate(); + + public PayaraServerBehaviour() { + logMessage("in PayaraServerBehaviour CTOR "); + } + + @Override + protected void initialize(IProgressMonitor monitor) { + super.initialize(monitor); + logMessage("in Behaviour initialize for " + getPayaraServerDelegate().getName()); + + statusMonitor = ServerStatusMonitor.getInstance(getPayaraServerDelegate(), this); + statusMonitor.start(); + } + + // ### Life-cycle methods called by Eclipse WTP + + @Override + public IStatus canStart(String launchMode) { + if (getPayaraServerDelegate().isRemote()) { + return new Status(ERROR, SYMBOLIC_NAME, "Start remote Glassfish server is not supported"); + } + + return super.canStart(launchMode); + } + + @Override + public boolean canRestartModule(IModule[] module) { + // Holds for both start, stop and restart + return true; + } + + @Override + public void stopModule(IModule[] module, IProgressMonitor monitor) throws CoreException { + if (getServer().getModuleState(module) != STATE_STARTED) { + // Nothing to stop at this moment + return; + } + undeploy(module); + } + + @Override + public void startModule(IModule[] module, IProgressMonitor monitor) throws CoreException { + publishModule(PUBLISH_FULL, module, ADDED, monitor); + } + + @Override + public IStatus canRestart(String mode) { + if (getPayaraServerDelegate().isRemote() && !mode.equals(DEBUG_MODE)) { + return new Status(ERROR, SYMBOLIC_NAME, "Restart remote Glassfish server is not supported"); + } + + return super.canRestart(mode); + } + + @Override + public void restart(final String launchMode) throws CoreException { + if (getPayaraServerDelegate().isRemote() && launchMode.equals(DEBUG_MODE)) { + ((Server) getServer()).setServerStatus(new Status(OK, SYMBOLIC_NAME, "Attaching to remote server...")); + } + + logMessage("in PayaraServerBehaviourDelegate restart"); + stopServer(false); + + Thread thread = new Thread("Synchronous server start") { + @Override + public void run() { + try { + getServer().getLaunchConfiguration(true, null).launch(launchMode, new NullProgressMonitor()); + logMessage("PayaraServerBehaviourDelegate restart done"); + + } catch (Exception e) { + logError("in PayaraServerBehaviourDelegate restart", e); + } + } + }; + + thread.setDaemon(true); + thread.start(); + } + + @Override + public void publishModule(int kind, int deltaKind, IModule[] module, IProgressMonitor monitor) + throws CoreException { + + // First, test if the server still exists + File serverloc = new File(getPayaraServerDelegate().getServerInstallationDirectory()); + if (!serverloc.exists()) { + logError(bind(serverDirectoryGone, serverloc.getAbsolutePath()), null); + return; + } + + long publishStartTime = System.currentTimeMillis(); + + publishModuleForPayara(kind, deltaKind, module, monitor); + + logMessage("done publishModule in " + (System.currentTimeMillis() - publishStartTime) + " ms"); + } + + @Override + public void serverStatusChanged(ServerStatus newStatus) { + synchronized (this) { + int currentState = getServer().getServerState(); + int nextState = stateResolver.resolve(newStatus, currentState); + + if (currentState != nextState) { + setPayaraServerState(nextState); + serverStateChanged(nextState); + updateServerStatus(newStatus); + } + + notify(); + } + } + + @Override + protected void publishFinish(IProgressMonitor monitor) throws CoreException { + boolean allpublished = true; + + for (IModule module : getServer().getModules()) { + if (getServer().getModulePublishState(new IModule[] { module }) != PUBLISH_STATE_NONE) { + allpublished = false; + } + } + + if (allpublished) { + setServerPublishState(PUBLISH_STATE_NONE); + } + } + + @Override + public IStatus canStop() { + if (!getPayaraServerDelegate().isRemote()) { + return OK_STATUS; + } + + return new Status(ERROR, SYMBOLIC_NAME, "Start remote Glassfish server is not supported"); + } + + @Override + public void stop(boolean force) { + logMessage("in PayaraServerBehaviourDelegate stop"); + stopServer(true); + } + + @Override + public void dispose() { + super.dispose(); + statusMonitor.stop(); + logMessage("in Behaviour dispose for " + getPayaraServerDelegate().getName()); + } + + // #### API for external callers + + /* + * get the correct adapter for the Payara server + */ + public PayaraServer getPayaraServerDelegate() { + PayaraServer payaraServer = getServer().getAdapter(PayaraServer.class); + if (payaraServer == null) { + payaraServer = (PayaraServer) getServer().loadAdapter(PayaraServer.class, new NullProgressMonitor()); + } + + return payaraServer; + } + + public ServerStatus getServerStatus(boolean forceUpdate) { + return statusMonitor.getServerStatus(forceUpdate); + } + + public static String getVersion(PayaraServer server) throws PayaraIdeException { + Future future = ServerAdmin.exec(server, new CommandVersion()); + + try { + return future.get(30, SECONDS).getValue(); + } catch (InterruptedException | ExecutionException e) { + throw new PayaraIdeException("Exception by calling getVersion", e); + } catch (TimeoutException e) { + throw new PayaraIdeException("Timeout for getting version command exceeded", e); + } + } + + public void updateServerStatus() { + updateServerStatus(getServerStatus(true)); + } + + public String getModuleDeployPath(IModule module) { + return (String) loadPublishProperties().get(module.getId()); + } + + public void undeploy(String moduleName, IProgressMonitor monitor) throws CoreException { + undeploy(moduleName); + + // Retrieve the Module for the module name we want to undeploy + IModule[] undeployModule = null; + for (IModule[] module : getAllModules()) { + if (module.length == 1 && module[0].getName().equals(moduleName)) { + undeployModule = module; + break; + } + } + + // If we were able to map module name to IModule, set publish state + // to Full to tell a full deploy would be needed + if (undeployModule != null) { + setModulePublishState(undeployModule, PUBLISH_STATE_FULL); + } + } + + public PayaraRuntime getRuntimeDelegate() { + return (PayaraRuntime) getServer().getRuntime().loadAdapter(PayaraRuntime.class, null); + } + + /** + * This is the only modification point of server state. + * + * @param state + */ + public synchronized void setPayaraServerState(int state) { + setServerState(state); + } + + /** + * Sets the server status. + * + * @param status the status of the server + */ + public void setPayaraServerStatus(IStatus status) { + setServerStatus(status); + } + + /** + * Sets the server publish state. + * + * @param state the publish state of the server + */ + public void setPayaraServerPublishState(int state) { + setServerPublishState(state); + } + + /** + * Sets the server mode. + * + * @param mode the mode of the server + */ + public void setPayaraServerMode(String mode) { + setMode(mode); + } + + /** + * Called to attempt to attach debugger to running Payara. + * + * @param launch + * @param config + * @param monitor + * @throws CoreException + */ + public void attach(ILaunch launch, ILaunchConfigurationWorkingCopy config, IProgressMonitor monitor) + throws CoreException { + int debugPort = getPayaraServerDelegate().getDebugPort(); + + attach(launch, config, monitor, debugPort == -1 ? DEFAULT_DEBUG_PORT : debugPort); + } + + public void attach(ILaunch launch, ILaunchConfigurationWorkingCopy config, IProgressMonitor monitor, int debugPort) + throws CoreException { + setDebugArgument(config, "hostname", getServer().getHost()); + setDebugArgument(config, "port", String.valueOf(debugPort)); + + REMOTE_JAVA_APP_LAUNCH_DELEGATE.launch(config, DEBUG_MODE, launch, getMonitorFor(monitor)); + + DebugPlugin.getDefault().addDebugEventListener(new IDebugEventSetListener() { + + @Override + public void handleDebugEvents(DebugEvent[] events) { + for (DebugEvent event : events) { + if (event.getKind() == TERMINATE && event.getSource() instanceof JDIDebugTarget) { + JDIDebugTarget debugTarget = (JDIDebugTarget) event.getSource(); + + if (debugTarget == null) { + continue; + } + + if (debugTarget.getLaunch().getLaunchConfiguration() == launch.getLaunchConfiguration()) { + + DebugPlugin.getDefault().removeDebugEventListener(this); + + setPayaraServerMode(RUN_MODE); + setPayaraServerStatus(OK_STATUS); + + return; + } + } + } + } + }); + } + + // #### Implementation of life-cycle methods defined above + + public void serverStateChanged(int serverState) { + switch (serverState) { + case STATE_STARTED: + try { + updateHttpPort(); + } catch (HttpPortUpdateException e) { + logError("Unable to update HTTP port for server started outside of IDE!", e); + } + break; + case STATE_STOPPED: + setLaunch(null); + break; + default: + break; + } + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + private void setDebugArgument(ILaunchConfigurationWorkingCopy config, String key, String arg) { + try { + Map args = config.getAttribute(ATTR_CONNECT_MAP, (Map) null); + + if (args != null) { + args = new HashMap<>(args); + } else { + args = new HashMap<>(); + } + args.put(key, String.valueOf(arg)); + + config.setAttribute(ATTR_CONNECT_MAP, args); + } catch (CoreException ce) { + logError("Error when setting debug argument for remote Payara", ce); + } + } + + /** + * Checks if the Ant publisher actually needs to publish. For ear modules it + * also checks if any of the children modules requires publishing. + * + * @return true if ant publisher needs to publish. + */ + private boolean publishNeeded(int kind, int deltaKind, IModule[] module) { + if ((getServer().getServerPublishState() == PUBLISH_CLEAN) || (kind != PUBLISH_INCREMENTAL && kind != PUBLISH_AUTO) || (deltaKind != NO_CHANGE)) { + return true; + } + + if (module[0] instanceof DeletedModule) { + return false; + } + + if (AssembleModules.isModuleType(module[0], "jst.ear")) { //$NON-NLS-1$ + IEnterpriseApplication earModule = (IEnterpriseApplication) module[0] + .loadAdapter(IEnterpriseApplication.class, new NullProgressMonitor()); + + for (IModule m : earModule.getModules()) { + IModule[] modules = { module[0], m }; + if (PUBLISH_STATE_NONE != getPayaraServerDelegate().getServer().getModulePublishState(modules)) { + return true; + } + } + } else if (PUBLISH_STATE_NONE != getPayaraServerDelegate().getServer().getModulePublishState(module)) { + return true; + } + + return false; + } + + private void publishModuleForPayara(int kind, int deltaKind, IModule[] module, IProgressMonitor monitor) + throws CoreException { + if (module.length > 1) {// only publish root modules, i.e web modules + setModulePublishState(module, PUBLISH_STATE_NONE); + return; + } + + if (!publishNeeded(kind, deltaKind, module) || monitor.isCanceled()) { + return; + } + + Properties publishProperties = loadPublishProperties(); + + boolean isRemote = getPayaraServerDelegate().isRemote(); + boolean isJarDeploy = getPayaraServerDelegate().getJarDeploy(); + + if ((!isRemote && !isJarDeploy)) { + publishDeployedDirectory(kind, deltaKind, publishProperties, module, monitor); + } else { + publishJarFile(kind, deltaKind, publishProperties, module, monitor); + + } + + setModulePublishState(module, PUBLISH_STATE_NONE); + savePublishProperties(publishProperties); + } + + private Properties loadPublishProperties() { + Properties publishProperties = new Properties(); + + try (FileInputStream fis = new FileInputStream(getPublishPropertiesFile())) { + publishProperties.load(fis); + } catch (Exception e) { + // Ignore + } + + return publishProperties; + } + + private void savePublishProperties(Properties publishProperties) { + try (FileOutputStream fos = new FileOutputStream(getPublishPropertiesFile())) { + publishProperties.store(fos, "GlassFish 3"); + } catch (Exception e) { + logError("Error in PUBLISH_STATE_NONE", e); + } + } + + private File getPublishPropertiesFile() { + return getTempDirectory().append("publish.txt").toFile(); + } + + private void publishDeployedDirectory(int kind, int deltaKind, Properties publishProperties, IModule module[], + IProgressMonitor monitor) throws CoreException { + + if (deltaKind == REMOVED) { + + // Undeploy + + String publishPath = (String) publishProperties.get(module[0].getId()); + logMessage("REMOVED in publishPath" + publishPath); + + try { + undeploy(module); + } catch (Exception e) { + // Bug 16876200 - UNABLE TO CLEAN PAYARA SERVER INSTANCE + // In case undeploy with asadmin failed, catch the exception and + // try delete the app directory from server directly next + } + + if (publishPath != null) { + try { + File pub = new File(publishPath); + if (pub.exists()) { + logMessage("PublishUtil.deleteDirectory called"); + IStatus[] stat = deleteDirectory(pub, monitor); + analyseReturnedStatus(stat); + } + } catch (Exception e) { + throw new CoreException( + new Status(WARNING, SYMBOLIC_NAME, 0, "cannot remove " + module[0].getName(), e)); + } + } + } else { + + // Deploy + + if (module[0] instanceof DeletedModule) { + return; + } + + IPath path = new Path(getPayaraServerDelegate().getDomainPath() + "/eclipseApps/" + module[0].getName()); + + // Using PublishHelper to control the temp area to be in the same file system of + // the deployed apps + // so that the move operation Eclipse is doing sometimes can work. + PublishHelper helper = new PublishHelper( + new Path(getPayaraServerDelegate().getDomainPath() + "/eclipseAppsTmp").toFile()); + + AssembleModules assembler = new AssembleModules(module, path, getPayaraServerDelegate(), helper); + logMessage("Deploy direcotry " + path.toFile().getAbsolutePath()); + + String contextRoot = null; + + // Either web, ear or non of these + if (isModuleType(module[0], "jst.web")) { + logMessage("is WEB"); + + assembler.assembleWebModule(monitor); + contextRoot = getContextRoot(module); + } else if (isModuleType(module[0], "jst.ear")) { + logMessage("is EAR"); + + assembler.assembleDirDeployedEARModule(monitor); + } else { + // default + assembler.assembleNonWebOrNonEARModule(monitor); + } + + if (kind == PUBLISH_INCREMENTAL || kind == PUBLISH_AUTO) { + needARedeploy = assembler.needsARedeployment(); + } else { + needARedeploy = true; + } + + // deploy the sun resource file if there is one in path: + registerSunResource(module, publishProperties, path); + + // BUG NEED ALSO to test if it has been deployed + // once...isDeployed() + if (needARedeploy) { + + String name = simplifyModuleID(module[0].getName()); + Map properties = getDeploymentProperties(); + boolean keepSession = getPayaraServerDelegate().getKeepSessions(); + + boolean hotDeploy = getServer().getAttribute(PayaraServer.ATTR_HOTDEPLOY, + Boolean.parseBoolean(DEFAULT_HOT_DEPLOY)); + List filesChanged = assembler.getModifiedSourceFiles(); + boolean metadataChanged = false; + List sourcesChanged = new ArrayList<>(); + if (hotDeploy) { + for (File fileChanged : filesChanged) { + String ext = ""; + + int i = fileChanged.getName().lastIndexOf('.'); + if (i >= 0) { + ext = fileChanged.getName().substring(i + 1); + } + sourcesChanged.add(fileChanged.getPath().replace('\\', '/')); + + if (ext.equals("xml") || ext.equals("properties")) { + metadataChanged = true; + } + } + } + CommandTarget command = null; + if (deltaKind == ADDED) { + command = new CommandDeploy(name, null, new File("" + path), contextRoot, properties, new File[0], + hotDeploy); + } else { + command = new CommandRedeploy(name, null, contextRoot, properties, new File[0], keepSession, + hotDeploy, metadataChanged, sourcesChanged); + } + + try { + ServerAdmin.executeOn(getPayaraServerDelegate()).command(command).onNotCompleted(result -> { + logMessage("deploy is failing=" + result.getValue()); + throw new IllegalStateException("deploy is failing=" + result.getValue()); + }).get(); + + setModuleState(module, STATE_STARTED); + + } catch (Exception ex) { + setModuleState(module, STATE_STOPPED); + logError("deploy is failing=", ex); + throw new CoreException(new Status(ERROR, SYMBOLIC_NAME, 0, "cannot Deploy " + name, ex)); + } + } else { + logMessage("optimal: NO NEED TO DO A REDEPLOYMENT, !!!"); + } + } + } + + private void publishJarFile(int kind, int deltaKind, Properties p, IModule[] module, IProgressMonitor monitor) + throws CoreException { + // first try to see if we need to undeploy: + + if (deltaKind == REMOVED) { + + // Same logic as directory undeploy + publishDeployedDirectory(kind, deltaKind, p, module, monitor); + + } else { + + try { + File archivePath = export(module[0], monitor); + logMessage("Deploy archive " + archivePath.getAbsolutePath()); + + String name = simplifyModuleID(module[0].getName()); + String contextRoot = null; + + if (isModuleType(module[0], "jst.web")) { + contextRoot = getContextRoot(module); + } + + // keepSession state is NOT supported in redeploy as JAR + + boolean hotDeploy = getServer().getAttribute(PayaraServer.ATTR_HOTDEPLOY, + Boolean.parseBoolean(DEFAULT_HOT_DEPLOY)); + try { + ServerAdmin + .executeOn(getPayaraServerDelegate()).command(new CommandDeploy(name, null, archivePath, + contextRoot, getDeploymentProperties(), new File[0], hotDeploy)) + .timeout(520).onNotCompleted(result -> { + logMessage("deploy is failing=" + result.getValue()); + throw new IllegalStateException("deploy is failing=" + result.getValue()); + }).get(); + + } catch (Exception ex) { + logError("deploy is failing=", ex); + throw new CoreException(new Status(ERROR, SYMBOLIC_NAME, 0, "cannot Deploy " + name, ex)); + } + } catch (org.eclipse.core.commands.ExecutionException e) { + e.printStackTrace(); + } + } + } + + private void registerSunResource(IModule module[], Properties properties, IPath path) throws CoreException { + // Get correct location for sun-resources.xml + IProject project = module[0].getProject(); + String location = ResourceUtils.getRuntimeResourceLocation(project); + if (location != null) { + if (location.trim().length() > 0) { + location = location + separatorChar + RESOURCE_FILE_NAME; + } else { + location = RESOURCE_FILE_NAME; + } + } + + File sunResource = new File("" + path, location); + if (sunResource.exists()) { + checkUpdateServerResources(sunResource, getPayaraServerDelegate()); + try { + Future future = ServerAdmin.exec(getPayaraServerDelegate(), + new CommandAddResources(sunResource, null)); + ResultString result = future.get(120, SECONDS); + + if (!COMPLETED.equals(result.getState())) { + throw new Exception("register resource is failing=" + result.getValue()); + } + } catch (Exception ex) { + throw new CoreException(new Status(ERROR, SYMBOLIC_NAME, 0, + "cannot register sun-resource.xml for " + module[0].getName(), ex)); + } + } + + properties.put(module[0].getId(), path.toOSString()); + } + + private void undeploy(IModule module[]) throws CoreException { + setModuleState(module, STATE_STOPPING); + undeploy(simplifyModuleID(module[0].getName())); + setModuleState(module, STATE_STOPPED); + } + + private void undeploy(String moduleName) throws CoreException { + try { + ServerAdmin.executeOn(getPayaraServerDelegate()).command(new CommandUndeploy(moduleName)).timeout(520) + .onNotCompleted(result -> { + throw new IllegalStateException("undeploy is failing=" + result.getValue()); + }).get(); + } catch (Exception ex) { + throw new CoreException(new Status(ERROR, SYMBOLIC_NAME, 0, "cannot UnDeploy " + moduleName, ex)); + } + } + + public void updateHttpPort() throws HttpPortUpdateException { + PayaraServer server = (PayaraServer) getServer().createWorkingCopy().loadAdapter(PayaraServer.class, null); + + Future> future = exec(getPayaraServerDelegate(), + new CommandGetProperty("*.server-config.*.http-listener-1.port")); + + ResultMap result = null; + + try { + result = future.get(20, SECONDS); + } catch (InterruptedException | ExecutionException | TimeoutException e) { + if (e instanceof InterruptedException) { + Thread.currentThread().interrupt(); + } + + throw new HttpPortUpdateException(e); + } + + if (result != null && COMPLETED.equals(result.getState())) { + for (Entry entry : result.getValue().entrySet()) { + String val = entry.getValue(); + try { + if (val != null && !val.trim().isEmpty()) { + server.setPort(Integer.parseInt(val)); + server.getServerWorkingCopy().save(true, null); + break; + } + } catch (NumberFormatException | CoreException nfe) { + throw new HttpPortUpdateException(nfe); + } + } + } + } + + private String getContextRoot(IModule[] module) { + String projectContextRoot = getServerContextRoot(module[0].getProject()); + + return !isEmpty(projectContextRoot) ? projectContextRoot : module[0].getName(); + } + + private Map getDeploymentProperties() { + Map properties = new HashMap<>(); + + String preserveSessionKey = getPayaraServerDelegate().computePreserveSessions(); + if (preserveSessionKey != null) { + properties.put(preserveSessionKey, Boolean.toString(getPayaraServerDelegate().getKeepSessions())); + } + + return properties; + } + + private void analyseReturnedStatus(IStatus[] status) throws CoreException { + if (status == null || status.length == 0) { + return; + } + + for (IStatus s : status) { + logMessage("analyseReturnedStatus: " + s.getMessage()); + } + } + + /** + * Updates server status. + */ + private void updateServerStatus(ServerStatus status) { + Server server = ((Server) getServer()); + + if (status != RUNNING_DOMAIN_MATCHING) { + String statusMsg = null; + + switch (status) { + case RUNNING_CREDENTIAL_PROBLEM: + statusMsg = invalidCredentials; + break; + case STOPPED_DOMAIN_NOT_MATCHING: + if (!getPayaraServerDelegate().isRemote()) { + statusMsg = serverNotMatchingLocal; + } else { + statusMsg = serverNotMatchingRemote; + } + break; + case RUNNING_CONNECTION_ERROR: + if (server.getServerState() != STATE_STOPPED) { + statusMsg = connectionError; + } + break; + default: + server.setServerStatus(null); + } + + if (statusMsg != null) { + server.setServerStatus(createErrorStatus(statusMsg)); + } + + } else { + server.setServerStatus(null); + } + } + + /** + * + * @stop GlassFish v3 or v3 prelude via http command + */ + private void stopServer(boolean stopLogging) { + PayaraServer server = getPayaraServerDelegate(); + + // Shouldn't allow stop remote server + if (server.isRemote()) { + return; + } + + stopImpl(server); + + if (stopLogging) { + getStandardConsole(server).stopLogging(3); + } + } + + private void stopImpl(PayaraServer server) { + setPayaraServerState(STATE_STOPPING); + + Future futureStop = asyncJobsService.submit(new StopJob()); + + // TODO how to let user know about possible failures + try { + futureStop.get(getServer().getStopTimeout(), SECONDS); + setPayaraServerState(STATE_STOPPED); + } catch (InterruptedException e) { + currentThread().interrupt(); + e.printStackTrace(); + } catch (ExecutionException e) { + logError("Stop server could not be finished because of exception.", e); + } catch (TimeoutException e1) { + futureStop.cancel(true); + logMessage("Stop server could not be finished in time."); + } + + setLaunch(null); + } + + // ### Jobs + + private class StopJob implements Callable { + + @Override + public ResultString call() throws Exception { + ResultString result = stopDAS(getPayaraServerDelegate()); + + // Check if server is stopped + if (!COMPLETED.equals(result.getState())) { + throw new Exception("Stop call failed. Reason: " + result.getValue()); + } + + // Check if server is *really* stopped + while (!getServerStatus(true).equals(STOPPED_NOT_LISTENING)) { + Thread.sleep(100); + } + + ((Server) getServer()).setServerStatus(null); + + return result; + } + + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/events/RuntimeLifecycleListener.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/events/RuntimeLifecycleListener.java new file mode 100644 index 00000000..17edd80e --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/events/RuntimeLifecycleListener.java @@ -0,0 +1,73 @@ +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.events; + +import static fish.payara.eclipse.tools.server.internal.SystemLibrariesContainer.getContainersRefresherThread; +import static fish.payara.eclipse.tools.server.internal.SystemLibrariesContainer.isOnClasspath; +import static fish.payara.eclipse.tools.server.utils.IsPayaraUtil.isPayara; +import static org.eclipse.core.resources.ResourcesPlugin.getWorkspace; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.wst.server.core.IRuntime; +import org.eclipse.wst.server.core.IRuntimeLifecycleListener; + +import fish.payara.eclipse.tools.server.PayaraServerPlugin; + +public class RuntimeLifecycleListener implements IRuntimeLifecycleListener { + + @Override + public void runtimeAdded(IRuntime runtime) { + if (!isPayara(runtime)) { + return; + } + + tryRefreshContainers(runtime); + } + + @Override + public void runtimeChanged(IRuntime runtime) { + if (!isPayara(runtime)) { + return; + } + + tryRefreshContainers(runtime); + } + + @Override + public void runtimeRemoved(IRuntime runtime) { + if (!isPayara(runtime)) { + return; + } + + tryRefreshContainers(runtime); + } + + private void tryRefreshContainers(IRuntime runtime) { + for (IProject project : getWorkspace().getRoot().getProjects()) { + try { + if (isOnClasspath(project)) { + getContainersRefresherThread().addProjectToQueue(project); + } + } catch (CoreException e) { + PayaraServerPlugin.log(e); + } + } + } +} \ No newline at end of file diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/events/ServerLifecycleListener.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/events/ServerLifecycleListener.java new file mode 100644 index 00000000..3678fbea --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/events/ServerLifecycleListener.java @@ -0,0 +1,235 @@ +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.events; + +import static fish.payara.eclipse.tools.server.PayaraServer.ATTR_DOMAINPATH; +import static fish.payara.eclipse.tools.server.utils.IsPayaraUtil.isPayara; +import static fish.payara.eclipse.tools.server.utils.Jobs.scheduleShortJob; +import static fish.payara.eclipse.tools.server.utils.WtpUtil.load; +import static java.io.File.separator; +import static org.eclipse.wst.server.core.IServer.STATE_UNKNOWN; + +import java.io.File; +import java.io.IOException; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.wst.server.core.IServer; +import org.eclipse.wst.server.core.IServerLifecycleListener; +import org.eclipse.wst.server.core.IServerWorkingCopy; +import org.eclipse.wst.server.core.internal.UpdateServerJob; +import org.eclipse.wst.server.ui.internal.editor.GlobalCommandManager; + +import fish.payara.eclipse.tools.server.PayaraServer; + + +/** + * This listener listens to servers being added, changed or removed in Eclipse. + * + *

+ * The main (and currently only) action that's is taken after such an event is creating + * and updating a project in the workspace that shows the content of the Payara's domain + * folder to which this server corresponds. + * + * @author Arjan Tijms + * + */ +public class ServerLifecycleListener implements IServerLifecycleListener { + + @Override + public void serverAdded(IServer server) { + if (!isPayara(server)) { + return; + } + + // Start a UpdateServerJob to update status when GF server is added + if (server.loadAdapter(PayaraServer.class, new NullProgressMonitor()) != null) { + if (server.getServerState() == STATE_UNKNOWN) { + UpdateServerJob job = new UpdateServerJob(new IServer[] { server }); + job.schedule(); + } + } + + // Copy the server name and server domain to separate attributes so we can + // track domain changes + resetPreviousServerNameAndDomain(server); + + // Create a project in the workspace that shows the Server's domain + // directory. + createServerProject(load(server, PayaraServer.class)); + } + + @Override + public void serverChanged(IServer server) { + if (!isPayara(server)) { + return; + } + + String domainPath = server.getAttribute(ATTR_DOMAINPATH, ""); + String previousDomainPath = server.getAttribute("previous-domain", ""); + + String serverName = server.getAttribute("name", ""); + String previousServerName = server.getAttribute("previous-name", ""); + + if (!domainPath.equals(previousDomainPath)) { + + // Server domain has been changed + + // There doesn't seem to be an option to retarget to a new location, so + // delete the existing project and re-create. This will set both the server domain + // as well as the server name (should it have changed too). + + deleteServerProject(previousServerName); + + // Copy the server name and server domain to separate attributes so we can + // track domain changes + resetPreviousServerNameAndDomain(server); + + // Create a project in the workspace that shows the Server's domain + // directory. + createServerProject(load(server, PayaraServer.class)); + + // Updating the previous name is a change in the server storage, so need to refresh any + // editor(s) that have this server open. + GlobalCommandManager.getInstance().reload(server.getId()); + + return; + } + + if (!serverName.equals(previousServerName)) { + + // Only server name has been changed (we capture domain and the both case above). + + // Rename the project associated with the server to the new server's + // name + renameServerProject(previousServerName, serverName); + + // Update the previous name to the current name, so we can track the + // next name change. + resetPreviousServerName(server); + + // Updating the previous name is a change in the server storage, so need to refresh any + // editor(s) that have this server open. + GlobalCommandManager.getInstance().reload(server.getId()); + } + } + + @Override + public void serverRemoved(IServer server) { + if (!isPayara(server)) { + return; + } + + // Since the server is removed, we can remove the corresponding project + // as well. + deleteServerProject(server.getAttribute("name", "")); + } + + private void createServerProject(PayaraServer payaraServer) { + + IWorkspace workSpace = ResourcesPlugin.getWorkspace(); + IProject project = workSpace.getRoot().getProject(payaraServer.getName()); + + if (project.exists()) { + // Another project with the same name already exists. + return; + } + + // Schedule a job to create the new project + scheduleShortJob("Create project for new server", + monitor -> { + IProjectDescription projectDescription = workSpace.newProjectDescription(payaraServer.getName()); + monitor.worked(10); + + try { + projectDescription + .setLocation(Path.fromOSString( + new File(payaraServer.getDomainsFolder() + separator + payaraServer.getDomainName()).getCanonicalPath())); + + project.create(projectDescription, monitor); + monitor.worked(25); + + project.open(null); + monitor.worked(50); + + } catch (IOException | CoreException e) { + e.printStackTrace(); + } + + }); + } + + private void renameServerProject(String projectName, String newProjectName) { + + IWorkspace workSpace = ResourcesPlugin.getWorkspace(); + IProject project = workSpace.getRoot().getProject(projectName); + + if (project.exists()) { + + try { + if (!project.isOpen()) { + project.open(null); + } + + IProjectDescription projectDescription = project.getDescription(); + projectDescription.setName(newProjectName); + project.move(projectDescription, true, null); + + } catch (CoreException e) { + e.printStackTrace(); + } + } + } + + private void deleteServerProject(String projectName) { + + IWorkspace workSpace = ResourcesPlugin.getWorkspace(); + IProject project = workSpace.getRoot().getProject(projectName); + + if (!project.exists()) { + // No need to delete that what doesn't exist + return; + } + + try { + project.delete(false, true, null); + } catch (CoreException e) { + e.printStackTrace(); + } + } + + + private void resetPreviousServerName(IServer server) { + try { + IServerWorkingCopy serverWorkingCopy = server.createWorkingCopy(); + serverWorkingCopy.setAttribute("previous-name", serverWorkingCopy.getAttribute("name", "")); + serverWorkingCopy.save(true, null); + } catch (CoreException e) { + e.printStackTrace(); + } + } + + private void resetPreviousServerNameAndDomain(IServer server) { + try { + IServerWorkingCopy serverWorkingCopy = server.createWorkingCopy(); + serverWorkingCopy.setAttribute("previous-name", serverWorkingCopy.getAttribute("name", "")); + serverWorkingCopy.setAttribute("previous-domain", serverWorkingCopy.getAttribute(ATTR_DOMAINPATH, "")); + serverWorkingCopy.save(true, null); + } catch (CoreException e) { + e.printStackTrace(); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/HttpPortUpdateException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/HttpPortUpdateException.java new file mode 100644 index 00000000..c022d99b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/HttpPortUpdateException.java @@ -0,0 +1,44 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.exceptions; + +public class HttpPortUpdateException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 7714377871660146294L; + + public HttpPortUpdateException() { + super(); + } + + public HttpPortUpdateException(String message, Throwable cause) { + super(message, cause); + } + + public HttpPortUpdateException(String message) { + super(message); + } + + public HttpPortUpdateException(Throwable cause) { + super(cause); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/PayaraLaunchException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/PayaraLaunchException.java new file mode 100644 index 00000000..bf80ebb4 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/PayaraLaunchException.java @@ -0,0 +1,56 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.exceptions; + +public class PayaraLaunchException extends Exception { + + private static final long serialVersionUID = -3931653934641477601L; + + private Process payaraProcess; + + public PayaraLaunchException() { + super(); + } + + public PayaraLaunchException(String message, Throwable cause) { + this(message, cause, null); + } + + public PayaraLaunchException(String message, Process gfProcess) { + this(message, null, gfProcess); + } + + public PayaraLaunchException(String message, Throwable cause, Process payaraProcess) { + super(message, cause); + this.payaraProcess = payaraProcess; + } + + public PayaraLaunchException(String message) { + this(message, null, null); + } + + public PayaraLaunchException(Throwable cause) { + this(null, cause, null); + } + + public Process getStartedProcess() { + return payaraProcess; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/UniqueNameNotFound.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/UniqueNameNotFound.java new file mode 100644 index 00000000..90ce335c --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/UniqueNameNotFound.java @@ -0,0 +1,25 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.exceptions; + +public class UniqueNameNotFound extends Exception { + + private static final long serialVersionUID = -1463584291761928966L; + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishEjbFacetInstallDelegate.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishEjbFacetInstallDelegate.java new file mode 100644 index 00000000..7e934868 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishEjbFacetInstallDelegate.java @@ -0,0 +1,41 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.facets; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.wst.common.project.facet.core.IDelegate; +import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; + +import fish.payara.eclipse.tools.server.facets.internal.GlassfishDeploymentDescriptorFactory; + +public class GlassfishEjbFacetInstallDelegate implements IDelegate { + + @Override + public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor) throws CoreException { + IGlassfishDeploymentDescriptor ejbDescriptor = GlassfishDeploymentDescriptorFactory + .getEjbDeploymentDescriptor(project); + + if (ejbDescriptor != null) { + ejbDescriptor.store(monitor); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishEjbFacetUninstallDelegate.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishEjbFacetUninstallDelegate.java new file mode 100644 index 00000000..d533dda1 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishEjbFacetUninstallDelegate.java @@ -0,0 +1,34 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.facets; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.wst.common.project.facet.core.IDelegate; +import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; + +public class GlassfishEjbFacetUninstallDelegate implements IDelegate { + + @Override + public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor) throws CoreException { + + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishWebFacetInstallDelegate.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishWebFacetInstallDelegate.java new file mode 100644 index 00000000..93585fed --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishWebFacetInstallDelegate.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.facets; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.wst.common.componentcore.ComponentCore; +import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; +import org.eclipse.wst.common.project.facet.core.IDelegate; +import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; + +import fish.payara.eclipse.tools.server.facets.internal.GlassfishDeploymentDescriptorFactory; + +public class GlassfishWebFacetInstallDelegate implements IDelegate { + + @Override + public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor) throws CoreException { + IGlassfishWebDeploymentDescriptor webDescriptor = GlassfishDeploymentDescriptorFactory + .getWebDeploymentDescriptor(project); + + if (webDescriptor != null) { + IVirtualComponent comp = ComponentCore.createComponent(project); + + String contextRoot = (String) comp.getMetaProperties().get("context-root"); + webDescriptor.setContext("/" + contextRoot); + + webDescriptor.store(monitor); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishWebFacetUninstallDelegate.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishWebFacetUninstallDelegate.java new file mode 100644 index 00000000..d5b467b1 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishWebFacetUninstallDelegate.java @@ -0,0 +1,34 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.facets; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.wst.common.project.facet.core.IDelegate; +import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; + +public class GlassfishWebFacetUninstallDelegate implements IDelegate { + + @Override + public void execute(IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor) throws CoreException { + + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishDeploymentDescriptor.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishDeploymentDescriptor.java new file mode 100644 index 00000000..1c1e73d3 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishDeploymentDescriptor.java @@ -0,0 +1,28 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.facets; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; + +public interface IGlassfishDeploymentDescriptor { + + public void store(IProgressMonitor monitor) throws CoreException; + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishEjbDeploymentDescriptor.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishEjbDeploymentDescriptor.java new file mode 100644 index 00000000..48b298c0 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishEjbDeploymentDescriptor.java @@ -0,0 +1,25 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.facets; + +public interface IGlassfishEjbDeploymentDescriptor extends IGlassfishDeploymentDescriptor { + + static final String SUN_EJB_DEPLOYMENT_DESCRIPTOR_NAME = "sun-ejb-jar.xml"; + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishWebDeploymentDescriptor.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishWebDeploymentDescriptor.java new file mode 100644 index 00000000..8d4f952e --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishWebDeploymentDescriptor.java @@ -0,0 +1,28 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.facets; + +public interface IGlassfishWebDeploymentDescriptor extends IGlassfishDeploymentDescriptor { + + static final String SUN_WEB_DEPLOYMENT_DESCRIPTOR_NAME = "sun-web.xml"; + + public void setContext(String context); + + public String getContext(); +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/AbstractGlassfishDeploymentDescriptor.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/AbstractGlassfishDeploymentDescriptor.java new file mode 100644 index 00000000..659cedbb --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/AbstractGlassfishDeploymentDescriptor.java @@ -0,0 +1,47 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.facets.internal; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; + +import fish.payara.eclipse.tools.server.facets.IGlassfishDeploymentDescriptor; + +abstract class AbstractGlassfishDeploymentDescriptor implements + IGlassfishDeploymentDescriptor { + + /** + * Created new deployment descriptor if it's not already there. + * + */ + @Override + public final void store(IProgressMonitor monitor) throws CoreException { + if (isPossibleToCreate()) { + prepareDescriptor(); + save(); + } + } + + protected abstract void save(); + + protected abstract void prepareDescriptor(); + + protected abstract boolean isPossibleToCreate(); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishDeploymentDescriptorFactory.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishDeploymentDescriptorFactory.java new file mode 100644 index 00000000..a79f4ba0 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishDeploymentDescriptorFactory.java @@ -0,0 +1,53 @@ +/** **************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ***************************************************************************** */ +/** **************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ***************************************************************************** */ +package fish.payara.eclipse.tools.server.facets.internal; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IPath; +import org.eclipse.wst.common.componentcore.ComponentCore; +import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; + +import fish.payara.eclipse.tools.server.facets.IGlassfishEjbDeploymentDescriptor; +import fish.payara.eclipse.tools.server.facets.IGlassfishWebDeploymentDescriptor; + +public class GlassfishDeploymentDescriptorFactory { + + static final String WEB_INF = "WEB-INF"; + static final String META_INF = "META-INF"; + + static final String WEB_DEPLOYMENT_DESCRIPTOR_NAME = "glassfish-web.xml"; + static final String EJB_DEPLOYMENT_DESCRIPTOR_NAME = "glassfish-ejb-jar.xml"; + + public static IGlassfishWebDeploymentDescriptor getWebDeploymentDescriptor(IProject project) { + IVirtualComponent comp = ComponentCore.createComponent(project); + IPath projectPath = comp.getRootFolder().getUnderlyingFolder() + .getProjectRelativePath(); + + return new GlassfishWebDeploymentDescriptor( + project.getFile(projectPath.append(WEB_INF).append(WEB_DEPLOYMENT_DESCRIPTOR_NAME))); + } + + public static IGlassfishEjbDeploymentDescriptor getEjbDeploymentDescriptor(IProject project) { + IVirtualComponent comp = ComponentCore.createComponent(project); + IPath projectPath = comp.getRootFolder().getUnderlyingFolder() + .getProjectRelativePath(); + + return new GlassfishEjbDeploymentDescriptor( + project.getFile(projectPath.append(META_INF).append(EJB_DEPLOYMENT_DESCRIPTOR_NAME))); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishDescriptorType.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishDescriptorType.java new file mode 100644 index 00000000..1b82b1c7 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishDescriptorType.java @@ -0,0 +1,70 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.facets.internal; + +enum GlassfishDescriptorType { + GF_WEB, GF_EJB; + + private static final GlassfishRootElementInfo WEB_ROOT_INFO_V31 = new GlassfishRootElementInfo( + "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN", + "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd", + "glassfish-web-app"); + + private static final GlassfishRootElementInfo EJB_ROOT_INFO_V31 = new GlassfishRootElementInfo( + "-//GlassFish.org//DTD GlassFish Application Server 3.1 EJB 3.1//EN", + "http://glassfish.org/dtds/glassfish-ejb-jar_3_1-1.dtd", + "glassfish-ejb-jar"); + + public static GlassfishRootElementInfo getGlassfishRootElementInfo( + GlassfishDescriptorType type) { + switch (type) { + case GF_WEB: + return WEB_ROOT_INFO_V31; + case GF_EJB: + return EJB_ROOT_INFO_V31; + } + return null; + } +} + +class GlassfishRootElementInfo { + private final String publicId; + private final String systemId; + private final String rootElementName; + + GlassfishRootElementInfo(final String namespace, + final String schemaLocation, final String rootElementName) { + this.publicId = namespace; + this.systemId = schemaLocation; + this.rootElementName = rootElementName; + } + + public String getPublicId() { + return this.publicId; + } + + public String getSystemId() { + return this.systemId; + } + + public String getRootElementName() { + return this.rootElementName; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishEjbDeploymentDescriptor.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishEjbDeploymentDescriptor.java new file mode 100644 index 00000000..8f786b78 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishEjbDeploymentDescriptor.java @@ -0,0 +1,54 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.facets.internal; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IPath; +import fish.payara.eclipse.tools.server.facets.IGlassfishEjbDeploymentDescriptor; + +class GlassfishEjbDeploymentDescriptor extends + AbstractGlassfishDeploymentDescriptor implements IGlassfishEjbDeploymentDescriptor { + + private IFile file; + + GlassfishEjbDeploymentDescriptor(IFile file) { + this.file = file; + } + + @Override + protected void prepareDescriptor() { + + } + + @Override + protected boolean isPossibleToCreate() { + // check for existence of older sun descriptor + IPath sunDescriptor = file.getLocation().removeLastSegments(1) + .append(IGlassfishEjbDeploymentDescriptor.SUN_EJB_DEPLOYMENT_DESCRIPTOR_NAME); + if (sunDescriptor.toFile().exists()) { + return false; + } + return true; + } + + @Override + protected void save() { + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishWebDeploymentDescriptor.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishWebDeploymentDescriptor.java new file mode 100644 index 00000000..045ea572 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishWebDeploymentDescriptor.java @@ -0,0 +1,126 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.facets.internal; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IPath; +import fish.payara.eclipse.tools.server.facets.IGlassfishWebDeploymentDescriptor; + +import java.io.File; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +class GlassfishWebDeploymentDescriptor extends + AbstractGlassfishDeploymentDescriptor implements IGlassfishWebDeploymentDescriptor { + + private static final Logger LOGGER = Logger.getLogger(GlassfishWebDeploymentDescriptor.class.getName()); + + private final IFile file; + private final Document document; + + GlassfishWebDeploymentDescriptor(IFile file) { + this.file = file; + this.document = readDocument(file); + } + + @Override + protected void prepareDescriptor() { + + } + + @Override + protected boolean isPossibleToCreate() { + // check for existence of older sun descriptor + IPath sunDescriptor = file.getLocation().removeLastSegments(1) + .append(IGlassfishWebDeploymentDescriptor.SUN_WEB_DEPLOYMENT_DESCRIPTOR_NAME); + return !sunDescriptor.toFile().exists(); + } + + @Override + protected void save() { + saveDocument(document); + } + + @Override + public void setContext(String context) { + Element rootElement = document.getDocumentElement(); + if (rootElement != null) { + for (int i = 0; i < rootElement.getChildNodes().getLength(); i++) { + Node node = rootElement.getChildNodes().item(i); + if (node.getNodeName().equals("context-root")) { + node.setTextContent(context); + break; + } + } + } + } + + @Override + public String getContext() { + Element rootElement = document.getDocumentElement(); + if (rootElement != null) { + for (int i = 0; i < rootElement.getChildNodes().getLength(); i++) { + Node node = rootElement.getChildNodes().item(i); + if (node.getNodeName().equals("context-root")) { + return node.getTextContent(); + } + } + } + return null; + } + + private Document readDocument(IFile file) { + try { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); + DocumentBuilder builder = factory.newDocumentBuilder(); + return builder.parse(new File(file.getRawLocationURI())); + } catch (SAXException | IOException | ParserConfigurationException ex) { + LOGGER.log(Level.SEVERE, null, ex); + } + return null; + } + + private void saveDocument(Document document) { + try { + Transformer transformer = TransformerFactory.newInstance().newTransformer(); + Result output = new StreamResult(new File(file.getRawLocationURI())); + Source input = new DOMSource(document); + transformer.transform(input, output); + } catch (TransformerException ex) { + LOGGER.log(Level.SEVERE, null, ex); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/AbstractPayaraSelectionHandler.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/AbstractPayaraSelectionHandler.java new file mode 100644 index 00000000..4b1a943e --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/AbstractPayaraSelectionHandler.java @@ -0,0 +1,79 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.handlers; + +import static org.eclipse.ui.browser.IWorkbenchBrowserSupport.LOCATION_BAR; +import static org.eclipse.ui.browser.IWorkbenchBrowserSupport.NAVIGATION_BAR; +import static org.eclipse.ui.handlers.HandlerUtil.getActiveWorkbenchWindow; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.wst.server.core.IServer; + +public abstract class AbstractPayaraSelectionHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + ISelection selection = getActiveWorkbenchWindow(event).getActivePage().getSelection(); + if (selection != null && !selection.isEmpty()) { + processSelection((IStructuredSelection) selection); + } + + return null; + } + + public void processSelection(IStructuredSelection selection) { + IServer server = (IServer) selection.getFirstElement(); + if (server != null) { + processSelection(server); + } + } + + public void processSelection(IServer server) { + + } + + protected void showMessageDialog() { + showMessageDialog("Payara Server has to be up and running...\nPlease start the server."); + } + + protected void showMessageDialog(String msg) { + new MessageDialog( + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), + "Cannot Execute this action", null, msg, 2, new String[] { "OK" }, 1) + .open(); + } + + protected void showPageInDefaultBrowser(String url) throws PartInitException, MalformedURLException { + PlatformUI.getWorkbench() + .getBrowserSupport() + .createBrowser(LOCATION_BAR | NAVIGATION_BAR, null, null, null) + .openURL(new URL(url)); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/OpenDomainHomeHandler.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/OpenDomainHomeHandler.java new file mode 100644 index 00000000..5844aaa2 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/OpenDomainHomeHandler.java @@ -0,0 +1,41 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.handlers; + +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logMessage; +import static fish.payara.eclipse.tools.server.utils.URIHelper.getDomainHomeURI; +import static fish.payara.eclipse.tools.server.utils.URIHelper.showURI; +import static fish.payara.eclipse.tools.server.utils.WtpUtil.load; + +import org.eclipse.wst.server.core.IServer; + +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; + +public class OpenDomainHomeHandler extends AbstractPayaraSelectionHandler { + + @Override + public void processSelection(IServer server) { + try { + showURI(getDomainHomeURI(load(server, PayaraServerBehaviour.class).getPayaraServerDelegate())); + } catch (Exception e) { + logMessage("Error opening browser: " + e.getMessage()); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/OpenServerHomeHandler.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/OpenServerHomeHandler.java new file mode 100644 index 00000000..00163128 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/OpenServerHomeHandler.java @@ -0,0 +1,41 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.handlers; + +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logMessage; +import static fish.payara.eclipse.tools.server.utils.URIHelper.getServerHomeURI; +import static fish.payara.eclipse.tools.server.utils.URIHelper.showURI; +import static fish.payara.eclipse.tools.server.utils.WtpUtil.load; + +import org.eclipse.wst.server.core.IServer; + +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; + +public class OpenServerHomeHandler extends AbstractPayaraSelectionHandler { + + @Override + public void processSelection(IServer server) { + try { + showURI(getServerHomeURI(load(server, PayaraServerBehaviour.class).getPayaraServerDelegate())); + } catch (Exception e) { + logMessage("Error opening folder in desktop " + e.getMessage()); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/PayaraStateTester.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/PayaraStateTester.java new file mode 100644 index 00000000..c74e4bca --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/PayaraStateTester.java @@ -0,0 +1,50 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.handlers; + +import static fish.payara.eclipse.tools.server.utils.WtpUtil.load; +import static org.eclipse.wst.server.core.IServer.STATE_STARTED; + +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.wst.server.core.IServer; + +import fish.payara.eclipse.tools.server.PayaraServer; + +public class PayaraStateTester extends PropertyTester { + + @Override + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + IServer server = (IServer) receiver; + + if (property.equals("isRunning")) { + return (server.getServerState() == STATE_STARTED); + } + + if (property.equals("isRemote")) { + PayaraServer payaraServer = load(server, PayaraServer.class); + + if (payaraServer != null) { + return payaraServer.isRemote(); + } + } + + return false; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/PayaraVersionTester.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/PayaraVersionTester.java new file mode 100644 index 00000000..4fddf5e6 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/PayaraVersionTester.java @@ -0,0 +1,37 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.handlers; + +import static fish.payara.eclipse.tools.server.utils.WtpUtil.load; + +import java.io.File; + +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.wst.server.core.IServer; + +import fish.payara.eclipse.tools.server.PayaraServer; + +public class PayaraVersionTester extends PropertyTester { + + @Override + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + return new File(load((IServer) receiver, PayaraServer.class).getServerInstallationDirectory() + "/modules").exists(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ShowURLHandler.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ShowURLHandler.java new file mode 100644 index 00000000..60cfa437 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ShowURLHandler.java @@ -0,0 +1,55 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.handlers; + +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logMessage; +import static org.eclipse.ui.browser.IWorkbenchBrowserSupport.LOCATION_BAR; +import static org.eclipse.ui.browser.IWorkbenchBrowserSupport.NAVIGATION_BAR; + +import java.net.URL; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.PlatformUI; + +public class ShowURLHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + String url = event.getParameter("fish.payara.eclipse.tools.server.commands.urlParam"); + + // This should not happen + if (url == null) { + return null; + } + + try { + PlatformUI.getWorkbench() + .getBrowserSupport() + .createBrowser(LOCATION_BAR | NAVIGATION_BAR, null, null, null) + .openURL(new URL(url)); + } catch (Exception e) { + logMessage("Error opening browser: " + e.getMessage()); + } + + return null; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ViewAdminConsoleHandler.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ViewAdminConsoleHandler.java new file mode 100644 index 00000000..d61412a9 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ViewAdminConsoleHandler.java @@ -0,0 +1,52 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.handlers; + +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logMessage; +import static fish.payara.eclipse.tools.server.utils.URIHelper.getServerAdminURI; +import static fish.payara.eclipse.tools.server.utils.WtpUtil.load; +import static org.eclipse.ui.browser.IWorkbenchBrowserSupport.LOCATION_BAR; +import static org.eclipse.ui.browser.IWorkbenchBrowserSupport.NAVIGATION_BAR; + +import org.eclipse.ui.PlatformUI; +import org.eclipse.wst.server.core.IServer; + +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; + +public class ViewAdminConsoleHandler extends AbstractPayaraSelectionHandler { + + @Override + public void processSelection(IServer server) { + try { + PlatformUI.getWorkbench() + .getBrowserSupport() + .createBrowser( + LOCATION_BAR | NAVIGATION_BAR, + null, null, null) + .openURL( + getServerAdminURI( + load(server, PayaraServerBehaviour.class).getPayaraServerDelegate()) + .toURL()); + + } catch (Exception e) { + logMessage("Error opening browser: " + e.getMessage()); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ViewLogHandler.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ViewLogHandler.java new file mode 100644 index 00000000..b98aad04 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ViewLogHandler.java @@ -0,0 +1,63 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.handlers; + +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logMessage; +import static fish.payara.eclipse.tools.server.log.PayaraConsoleManager.getServerLogFileConsole; +import static fish.payara.eclipse.tools.server.log.PayaraConsoleManager.removeServerLogFileConsole; +import static fish.payara.eclipse.tools.server.log.PayaraConsoleManager.showConsole; +import static fish.payara.eclipse.tools.server.utils.WtpUtil.load; + +import org.eclipse.wst.server.core.IServer; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.ServerStatus; +import fish.payara.eclipse.tools.server.log.IPayaraConsole; +import fish.payara.eclipse.tools.server.sdk.server.FetchLogPiped; + +public class ViewLogHandler extends AbstractPayaraSelectionHandler { + + @Override + public void processSelection(IServer server) { + try { + PayaraServer serverAdapter = load(server, PayaraServer.class); + + if (serverAdapter.isRemote()) { + if (!serverAdapter.getServerBehaviourAdapter().getServerStatus(true).equals(ServerStatus.RUNNING_DOMAIN_MATCHING)) { + showMessageDialog(); + return; + } + + removeServerLogFileConsole(serverAdapter); + } + + IPayaraConsole console = getServerLogFileConsole(serverAdapter); + showConsole(getServerLogFileConsole(serverAdapter)); + + if (!console.isLogging()) { + console.startLogging(FetchLogPiped.create(serverAdapter, false)); + } + + } catch (Exception e) { + logMessage("Error opening log: " + e.getMessage()); + + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ContainersRefresherThread.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ContainersRefresherThread.java new file mode 100644 index 00000000..38cfdd38 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ContainersRefresherThread.java @@ -0,0 +1,83 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.internal; + +import java.util.LinkedList; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; + +import fish.payara.eclipse.tools.server.PayaraServerPlugin; + +/** + * This thread refreshes the Payara libraries container, effectively + * whenever ".settings/org.eclipse.wst.common.project.facet.core.xml" in + * a project changes. + * + * TODO: Can't this just use the Eclipse job framework? + */ +public class ContainersRefresherThread extends Thread { + + private final LinkedList projects = new LinkedList<>(); + + + public IProject getProjectFromQueue() { + synchronized (projects) { + if (projects.isEmpty()) { + try { + projects.wait(); + } catch (InterruptedException e) { + return null; + } + } + + return projects.removeFirst(); + } + } + + public void addProjectToQueue(final IProject project) { + synchronized (projects) { + projects.addLast(project); + projects.notify(); + } + } + + @Override + public void run() { + while (true) { + IProject project = getProjectFromQueue(); + + if (project == null) { + return; + } + + try { + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + + workspace.run( + monitor -> SystemLibrariesContainer.refresh(project), + workspace.getRoot(), 0, null); + } catch (CoreException e) { + PayaraServerPlugin.log(e); + } + } + } +} \ No newline at end of file diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ContainsRuntimeComponentType.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ContainsRuntimeComponentType.java new file mode 100644 index 00000000..9f1842b0 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ContainsRuntimeComponentType.java @@ -0,0 +1,116 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.internal; + +import java.util.Collection; + +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.wst.common.project.facet.core.runtime.IRuntime; +import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent; +import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponentType; +import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager; + +import fish.payara.eclipse.tools.server.PayaraServerPlugin; + +/** + * @author Konstantin Komissarchik + */ + +public final class ContainsRuntimeComponentType extends PropertyTester { + + private static final String PROP_CONTAINS_RUNTIME_COMPONENT_TYPE = "containsRuntimeComponentType"; //$NON-NLS-1$ + + @Override + public boolean test(Object receiver, String property, Object[] args, Object value) { + try { + if (!property.equals(PROP_CONTAINS_RUNTIME_COMPONENT_TYPE)) { + throw new IllegalStateException(); + } + + String val = (String) value; + int colon = val.indexOf(':'); + + String typeid; + String vexpr; + + if (colon == -1 || colon == val.length() - 1) { + typeid = val; + vexpr = null; + } else { + typeid = val.substring(0, colon); + vexpr = val.substring(colon + 1); + } + + if (!RuntimeManager.isRuntimeComponentTypeDefined(typeid)) { + return false; + } + + IRuntimeComponentType type = RuntimeManager.getRuntimeComponentType(typeid); + + if (receiver instanceof IRuntime) { + for (Object component : ((IRuntime) receiver).getRuntimeComponents()) { + if (match((IRuntimeComponent) component, type, vexpr)) { + return true; + } + } + + return false; + } + + if (receiver instanceof Collection) { + for (Object obj : ((Collection) receiver)) { + if (obj instanceof IRuntimeComponent) { + if (match((IRuntimeComponent) obj, type, vexpr)) { + return true; + } + } else if (obj instanceof IRuntime) { + if (test(obj, property, args, value)) { + return true; + } + } else { + throw new IllegalStateException(); + } + } + + return false; + } + + throw new IllegalStateException(); + + } catch (CoreException e) { + PayaraServerPlugin.log(e); + return false; + } + } + + private static final boolean match(IRuntimeComponent component, IRuntimeComponentType type, String vexpr) throws CoreException { + if (component.getRuntimeComponentType() == type) { + if (vexpr == null) { + return true; + } + + return type.getVersions(vexpr) + .contains(component.getRuntimeComponentVersion()); + } + + return false; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/InstallJAXRS.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/InstallJAXRS.java new file mode 100644 index 00000000..e9d8cc07 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/InstallJAXRS.java @@ -0,0 +1,36 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.internal; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperation; +import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig; + +/** + * @author ludo> + */ +public class InstallJAXRS extends LibraryProviderOperation { + + @Override + public void execute(final LibraryProviderOperationConfig config, final IProgressMonitor monitor) throws CoreException { + monitor.beginTask("", 1); + monitor.done(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/Library.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/Library.java new file mode 100644 index 00000000..295400cf --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/Library.java @@ -0,0 +1,51 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.internal; + +public class Library { + + private String path; + private String javadoc; + private String source; + + public String getPath() { + return path; + } + + public void setPath(String name) { + this.path = name; + } + + public String getJavadoc() { + return javadoc; + } + + public void setJavadoc(String doc) { + this.javadoc = doc; + } + + public String getSource() { + return source; + } + + public void setSource(String src) { + this.source = src; + } + +} \ No newline at end of file diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ManifestUtil.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ManifestUtil.java new file mode 100644 index 00000000..c8922125 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ManifestUtil.java @@ -0,0 +1,163 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.internal; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.Enumeration; +import java.util.Map; +import java.util.jar.Attributes; +import java.util.jar.Manifest; +import java.util.zip.ZipEntry; +import java.util.zip.ZipError; +import java.util.zip.ZipFile; + +/** + * Utility class for reading the manifest file. + * + * @author Konstantin Komissarchik + */ + +public final class ManifestUtil { + public static final String MANIFEST_FILE_NAME = "MANIFEST.MF"; + public static final String MANIFEST_PATH = "META-INF/" + MANIFEST_FILE_NAME; + + private ManifestUtil() { + } + + public static Manifest readManifest(final File library) throws IOException { + if (library.isFile()) { + final ZipFile zip = openZipFile(library); + + try { + return readManifest(zip); + } finally { + try { + zip.close(); + } catch (IOException e) { + } + } + } else { + final File manifestFile = new File(library, MANIFEST_PATH); + + if (manifestFile.exists()) { + final InputStream in = new FileInputStream(manifestFile); + + try { + return readManifest(new BufferedInputStream(in)); + } finally { + try { + in.close(); + } catch (IOException e) { + } + } + } + + return null; + } + } + + public static Manifest readManifest(final ZipFile zip) throws IOException { + final ZipEntry zipentry = getZipEntry(zip, MANIFEST_PATH); + + if (zipentry != null) { + final InputStream in = zip.getInputStream(zipentry); + + try { + return readManifest(in); + } finally { + try { + in.close(); + } catch (IOException e) { + } + } + } + + return null; + } + + public static Manifest readManifest(final InputStream stream) throws IOException { + final Manifest manifest = new Manifest(); + manifest.read(stream); + return manifest; + } + + public static String readManifestEntry(final File location, final String key) throws IOException { + final Manifest manifest = readManifest(location); + + if (manifest != null) { + return readManifestEntry(manifest, key); + } + + return null; + } + + public static String readManifestEntry(final Manifest manifest, final String key) { + for (Map.Entry entry : manifest.getMainAttributes().entrySet()) { + final String name = ((Attributes.Name) entry.getKey()).toString(); + + if (key.equals(name)) { + return (String) entry.getValue(); + } + } + + return null; + } + + private static ZipFile openZipFile(final File file) throws IOException { + try { + return new ZipFile(file); + } catch (FileNotFoundException e) { + final FileNotFoundException fnfe = new FileNotFoundException(file.getAbsolutePath()); + + fnfe.initCause(e); + + throw fnfe; + } + } + + private static ZipEntry getZipEntry(final ZipFile zip, final String name) throws IOException { + final String lcasename = name.toLowerCase(); + + try { + for (Enumeration itr = zip.entries(); itr.hasMoreElements();) { + final ZipEntry zipentry = (ZipEntry) itr.nextElement(); + + if (zipentry.getName().toLowerCase().equals(lcasename)) { + return zipentry; + } + } + } catch (ZipError e) { + // This error can be thrown if the ZIP file is corrupt. Note that it's + // an Error, not an Exception. We are going to convert it to an IOException, + // which the code dealing with ZIP files generally knows how to handle. + // + // See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4615343 + + throw new IOException(e); + } + + return null; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraClasspathProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraClasspathProvider.java new file mode 100644 index 00000000..3292c512 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraClasspathProvider.java @@ -0,0 +1,69 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.internal; + +import static java.util.Collections.singletonList; +import static org.eclipse.jdt.core.JavaCore.newContainerEntry; +import static org.eclipse.wst.common.project.facet.core.ProjectFacetsManager.getGroup; + +import java.util.List; + +import org.eclipse.core.runtime.IAdapterFactory; +import org.eclipse.core.runtime.Path; +import org.eclipse.jdt.core.IClasspathEntry; +import org.eclipse.jst.common.project.facet.core.IClasspathProvider; +import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; +import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; + +/** + * @author Konstantin Komissarchik + */ + +public final class PayaraClasspathProvider implements IClasspathProvider { + private static final String MODULES_GROUP_ID = "modules"; + + @Override + public List getClasspathEntries(IProjectFacetVersion facetVersion) { + if (!ProjectFacetsManager.isGroupDefined(MODULES_GROUP_ID)) { + return null; + } + + if (getGroup(MODULES_GROUP_ID).getMembers().contains(facetVersion)) { + return singletonList(newContainerEntry(new Path(SystemLibrariesContainer.ID))); + } + + return null; + } + + @SuppressWarnings("rawtypes") + public static final class Factory implements IAdapterFactory { + private static final Class[] ADAPTER_TYPES = { IClasspathProvider.class }; + + @Override + public Class[] getAdapterList() { + return ADAPTER_TYPES; + } + + @Override + public Object getAdapter(final Object adaptableObject, final Class adapterType) { + return new PayaraClasspathProvider(); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraRuntimeBridge.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraRuntimeBridge.java new file mode 100644 index 00000000..3ff9403f --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraRuntimeBridge.java @@ -0,0 +1,179 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.internal; + +import static org.eclipse.core.runtime.Status.OK_STATUS; +import static org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager.createRuntimeComponent; +import static org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager.getRuntimeComponentType; +import static org.eclipse.wst.server.core.ServerCore.getRuntimes; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.jst.common.project.facet.core.StandardJreRuntimeComponent; +import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeBridge; +import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent; +import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponentVersion; +import org.eclipse.wst.server.core.IRuntime; +import org.eclipse.wst.server.core.IRuntimeType; +import org.eclipse.wst.server.core.ServerCore; +import org.eclipse.wst.server.core.internal.Runtime; + +import fish.payara.eclipse.tools.server.PayaraRuntime; +import fish.payara.eclipse.tools.server.utils.SetFactory; +import fish.payara.eclipse.tools.server.utils.Version; + +@SuppressWarnings("restriction") +public final class PayaraRuntimeBridge implements IRuntimeBridge { + + @Override + public Set getExportedRuntimeNames() throws CoreException { + final SetFactory namesSetFactory = SetFactory.start(); + + for (IRuntime runtime : getRuntimes()) { + IRuntimeType type = runtime.getRuntimeType(); + + if (type != null && "payara.runtime".equals(type.getId())) { + namesSetFactory.add(runtime.getId()); + } + } + + return namesSetFactory.result(); + } + + @Override + public IStub bridge(final String name) throws CoreException { + if (name == null) { + throw new IllegalArgumentException(); + } + + return new Stub(name); + } + + private static class Stub extends IRuntimeBridge.Stub { + private String id; + + public Stub(String id) { + this.id = id; + } + + @Override + public List getRuntimeComponents() { + List components = new ArrayList<>(2); + final IRuntime runtime = findRuntime(this.id); + + if (runtime == null) { + return components; + } + + final PayaraRuntime payaraRuntime = (PayaraRuntime) runtime.loadAdapter(PayaraRuntime.class, new NullProgressMonitor()); + + if (payaraRuntime != null) { + final Version payaraVersion = payaraRuntime.getVersion(); + + if (payaraVersion != null) { + String payaraMainVersion; + if(payaraVersion.matches("[6")) { + payaraMainVersion = "6"; + } else if(payaraVersion.matches("[5")) { + payaraMainVersion = "5"; + } else if(payaraVersion.matches("[4")) { + payaraMainVersion = "4"; + } else { + payaraMainVersion = "3.1"; + } + IRuntimeComponentVersion payaraComponentVersion = getRuntimeComponentType("payara.runtime").getVersion(payaraMainVersion); + + Map properties = new HashMap<>(5); + if (runtime.getLocation() != null) { + properties.put("location", runtime.getLocation().toPortableString()); + } else { + properties.put("location", ""); + } + + properties.put("name", runtime.getName()); + properties.put("id", runtime.getId()); + if (runtime.getRuntimeType() != null) { + properties.put("type", runtime.getRuntimeType().getName()); + properties.put("type-id", runtime.getRuntimeType().getId()); + } + + components.add(createRuntimeComponent(payaraComponentVersion, properties)); + + // Java Runtime Environment + + components.add(StandardJreRuntimeComponent.create(payaraRuntime.getVMInstall())); + + // Other + + components.addAll(RuntimeComponentProvidersExtensionPoint.getRuntimeComponents(runtime)); + } + } + + return components; + } + + @Override + public Map getProperties() { + Map properties = new HashMap<>(); + IRuntime runtime = findRuntime(id); + if (runtime != null) { + properties.put("id", runtime.getId()); + properties.put("localized-name", runtime.getName()); + String s = ((Runtime) runtime).getAttribute("alternate-names", (String) null); + if (s != null) { + properties.put("alternate-names", s); + } + } + + return properties; + } + + @Override + public IStatus validate(final IProgressMonitor monitor) { + final IRuntime runtime = findRuntime(this.id); + if (runtime != null) { + return runtime.validate(monitor); + } + return OK_STATUS; + } + + private static final IRuntime findRuntime(final String id) { + IRuntime[] runtimes = ServerCore.getRuntimes(); + int size = runtimes.length; + + for (int i = 0; i < size; i++) { + if (runtimes[i].getId().equals(id) || runtimes[i].getName().equals(id)) { + return runtimes[i]; + } + + } + + return null; + } + } + +} \ No newline at end of file diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraStateResolver.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraStateResolver.java new file mode 100644 index 00000000..e93f77a9 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraStateResolver.java @@ -0,0 +1,96 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.internal; + +import static fish.payara.eclipse.tools.server.ServerStatus.RUNNING_DOMAIN_MATCHING; +import static fish.payara.eclipse.tools.server.ServerStatus.STOPPED_DOMAIN_NOT_MATCHING; +import static fish.payara.eclipse.tools.server.ServerStatus.STOPPED_NOT_LISTENING; +import static org.eclipse.wst.server.core.IServer.STATE_STARTED; +import static org.eclipse.wst.server.core.IServer.STATE_STARTING; +import static org.eclipse.wst.server.core.IServer.STATE_STOPPED; +import static org.eclipse.wst.server.core.IServer.STATE_STOPPING; +import static org.eclipse.wst.server.core.IServer.STATE_UNKNOWN; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.wst.server.core.IServer; + +import fish.payara.eclipse.tools.server.ServerStatus; + +public class PayaraStateResolver { + + private static final Map> matrix = new HashMap<>(); + + private static final int DEFAULT_ACTION = Integer.MAX_VALUE; + + // This is a decision matrix for finding the correct new state based + // on the current state and status + static { + HashMap m = new HashMap<>(); + + // NOT_DEFINED + m.put(DEFAULT_ACTION, STATE_UNKNOWN); + matrix.put(ServerStatus.NOT_DEFINED, m); + m = new HashMap<>(); + + // RUNNING_CONNECTION_ERROR + m.put(DEFAULT_ACTION, STATE_STOPPED); + m.put(IServer.STATE_STARTING, STATE_STARTING); + matrix.put(ServerStatus.RUNNING_CONNECTION_ERROR, m); + m = new HashMap<>(); + + // RUNNING_PROXY_ERROR + m.put(DEFAULT_ACTION, STATE_STOPPED); + matrix.put(ServerStatus.RUNNING_PROXY_ERROR, m); + m = new HashMap<>(); + + // RUNNING_CREDENTIAL_ERROR + m.put(DEFAULT_ACTION, STATE_STOPPED); + matrix.put(ServerStatus.RUNNING_CREDENTIAL_PROBLEM, m); + m = new HashMap<>(); + + // STOPPED_DOMAIN_NOT_MATCHING + m.put(DEFAULT_ACTION, STATE_STOPPED); + matrix.put(STOPPED_DOMAIN_NOT_MATCHING, m); + m = new HashMap<>(); + + // STOPPED_NOT_LISTENING + m.put(DEFAULT_ACTION, STATE_STOPPED); + m.put(STATE_STARTING, STATE_STARTING); + matrix.put(STOPPED_NOT_LISTENING, m); + m = new HashMap<>(); + + // RUNNING_DOMAIN_MATCHING + m.put(DEFAULT_ACTION, STATE_STARTED); + m.put(IServer.STATE_STOPPING, STATE_STOPPING); + matrix.put(RUNNING_DOMAIN_MATCHING, m); + } + + public int resolve(ServerStatus status, int actualState) { + Integer state = matrix.get(status).get(actualState); + + if (state == null) { + state = matrix.get(status).get(DEFAULT_ACTION); + } + + return state; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/RuntimeComponentProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/RuntimeComponentProvider.java new file mode 100644 index 00000000..98770b7a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/RuntimeComponentProvider.java @@ -0,0 +1,44 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.internal; + +import java.util.List; + +import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent; +import org.eclipse.wst.server.core.IRuntime; + +/** + * This abstract class is used in conjunction with runtimeComponentProviders extension + * point to extend the list of runtime components that make up a Payara Server runtime. + * + * @author Konstantin Komissarchik + */ + +public abstract class RuntimeComponentProvider { + + /** + * Returns additional components to add to the runtime that represents the provided GlassFish Server + * installation. + * + * @param runtime the WTP server tools runtime definition + * @return list of additional components or null to not contribute anything + */ + public abstract List getRuntimeComponents(IRuntime runtime); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/RuntimeComponentProvidersExtensionPoint.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/RuntimeComponentProvidersExtensionPoint.java new file mode 100644 index 00000000..bba2b4a3 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/RuntimeComponentProvidersExtensionPoint.java @@ -0,0 +1,115 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.internal; + +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.SYMBOLIC_NAME; +import static fish.payara.eclipse.tools.server.utils.PluginUtil.findExtensions; +import static fish.payara.eclipse.tools.server.utils.PluginUtil.findRequiredAttribute; +import static fish.payara.eclipse.tools.server.utils.PluginUtil.getTopLevelElements; +import static fish.payara.eclipse.tools.server.utils.PluginUtil.instantiate; +import static java.util.Collections.unmodifiableList; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent; +import org.eclipse.wst.server.core.IRuntime; + +import fish.payara.eclipse.tools.server.PayaraServerPlugin; +import fish.payara.eclipse.tools.server.utils.PluginUtil.InvalidExtensionException; + +/** + * Contains the logic for processing the runtimeComponentProviders extension point. + * + * @author Konstantin Komissarchik + */ +public final class RuntimeComponentProvidersExtensionPoint { + public static final String EXTENSION_POINT_ID = "runtimeComponentProviders"; + private static final String EL_RUNTIME_COMPONENT_PROVIDER = "runtime-component-provider"; + private static final String ATTR_CLASS = "class"; + + private static List providers; + + public static List getRuntimeComponents(IRuntime runtime) { + List components = new ArrayList<>(); + + for (RuntimeComponentProvider provider : getProviders()) { + try { + List runtimeComponents = provider.getRuntimeComponents(runtime); + + if (runtimeComponents != null) { + components.addAll(runtimeComponents); + } + } catch (final Exception e) { + PayaraServerPlugin.log(e); + } + } + + return components; + } + + private static synchronized List getProviders() { + if (providers == null) { + List modifiableProviders = new ArrayList<>(); + + for (ProviderDef providerDef : readExtensions()) { + RuntimeComponentProvider provider = instantiate(providerDef.pluginId, providerDef.className, RuntimeComponentProvider.class); + + if (provider != null) { + modifiableProviders.add(provider); + } + } + + providers = unmodifiableList(modifiableProviders); + } + + return providers; + } + + private static List readExtensions() { + List providers = new ArrayList<>(); + + for (IConfigurationElement element : getTopLevelElements(findExtensions(SYMBOLIC_NAME, EXTENSION_POINT_ID))) { + + String pluginId = element.getContributor().getName(); + + if (element.getName().equals(EL_RUNTIME_COMPONENT_PROVIDER)) { + try { + providers.add(new ProviderDef(pluginId, findRequiredAttribute(element, ATTR_CLASS))); + } catch (final InvalidExtensionException e) { + // Continue. The problem has been reported to the user via the log. + } + } + } + + return providers; + } + + private static final class ProviderDef { + public final String pluginId; + public final String className; + + public ProviderDef(String pluginId, String className) { + this.pluginId = pluginId; + this.className = className; + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ServerStateListener.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ServerStateListener.java new file mode 100644 index 00000000..1272aedc --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ServerStateListener.java @@ -0,0 +1,25 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.internal; + +import fish.payara.eclipse.tools.server.ServerStatus; + +public interface ServerStateListener { + void serverStatusChanged(ServerStatus newStatus); +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ServerStatusMonitor.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ServerStatusMonitor.java new file mode 100644 index 00000000..8fcd9ae2 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ServerStatusMonitor.java @@ -0,0 +1,117 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.internal; + +import static fish.payara.eclipse.tools.server.ServerStatus.NOT_DEFINED; +import static java.util.concurrent.TimeUnit.SECONDS; + +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.ServerStatus; +import fish.payara.eclipse.tools.server.utils.ServerStatusHelper; + +public class ServerStatusMonitor implements Runnable { + + private static final int DEFAULT_DELAY_IN_SEC = 5; + + private ScheduledExecutorService scheduler; + private PayaraServer server; + private int delay; + private ScheduledFuture scheduledTask; + + private volatile ServerStatus status = NOT_DEFINED; + private CopyOnWriteArrayList listeners; + + private ServerStatusMonitor(PayaraServer server) { + this(server, DEFAULT_DELAY_IN_SEC); + } + + private ServerStatusMonitor(PayaraServer server, ServerStateListener... listeners) { + this(server, DEFAULT_DELAY_IN_SEC, listeners); + } + + private ServerStatusMonitor(PayaraServer server, int checkInterval, ServerStateListener... listeners) { + this.server = server; + this.delay = checkInterval; + this.listeners = new CopyOnWriteArrayList<>(listeners); + } + + public static ServerStatusMonitor getInstance(PayaraServer server) { + return new ServerStatusMonitor(server); + } + + public static ServerStatusMonitor getInstance(PayaraServer server, ServerStateListener... listeners) { + return new ServerStatusMonitor(server, listeners); + } + + public static ServerStatusMonitor getInstance(PayaraServer server, int checkInterval) { + return new ServerStatusMonitor(server, checkInterval); + } + + public void start() { + scheduler = Executors.newSingleThreadScheduledExecutor(); + scheduledTask = scheduler.scheduleWithFixedDelay(this, 0, delay, SECONDS); + } + + public void stop() { + scheduledTask.cancel(true); + scheduler.shutdown(); + } + + @Override + public void run() { + status = ServerStatusHelper.checkServerStatus(server); + notifyListeners(status); + } + + public ServerStatus getServerStatus() { + return getServerStatus(false); + } + + public ServerStatus getServerStatus(boolean forceUpdate) { + if (forceUpdate) { + try { + scheduler.submit(this).get(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } catch (ExecutionException e) { + } + } + + return status; + } + + public void registerServerStatusListener(ServerStateListener listener) { + listeners.add(listener); + } + + private void notifyListeners(ServerStatus newStatus) { + for (ServerStateListener listener : listeners) { + listener.serverStatusChanged(newStatus); + } + } + + + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibraries.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibraries.java new file mode 100644 index 00000000..4256deab --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibraries.java @@ -0,0 +1,148 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.internal; + +import fish.payara.eclipse.tools.server.utils.Version; + +/** + * This class supplies all the libraries that will be contributed to the classpath + * when Payara is used as a target runtime. + * + *

+ * This is typically only used for Eclipse proprietary projects. Maven projects for instance + * handle their own dependency management. + * + * @author Arjan Tijms + * + */ +public class SystemLibraries { + + private static final String[] LIBRARIES_3_1 = { + "glassfish/modules/javax.*.jar", + "glassfish/modules/weld-osgi-bundle.jar", + "glassfish/modules/bean-validator.jar", + "glassfish/modules/jersey-*.jar", + "glassfish/modules/grizzly-comet.jar", + "glassfish/modules/grizzly-websockets.jar", + "glassfish/modules/glassfish-api.jar", + "glassfish/modules/ha-api.jar", + "glassfish/modules/endorsed/*.jar", + "glassfish/modules/jsf-api.jar", + "glassfish/modules/jsf-impl.jar", + "glassfish/modules/jstl-impl.jar", + "glassfish/modules/org.eclipse.persistence*.jar", + "glassfish/modules/jaxb*.jar", + "glassfish/modules/webservices*.jar", + "glassfish/modules/woodstox-osgi*.jar", + "mq/lib/jaxm-api*.jar" + }; + + private static final String[] LIBRARIES_3_1_2 = { + "glassfish/modules/javax.*.jar", + "glassfish/modules/weld-osgi-bundle.jar", + "glassfish/modules/bean-validator.jar", + "glassfish/modules/jersey-*.jar", + "glassfish/modules/grizzly-comet.jar", // + "glassfish/modules/grizzly-websockets.jar", // + "glassfish/modules/glassfish-api.jar", + "glassfish/modules/ha-api.jar", + "glassfish/modules/endorsed/*.jar", + "glassfish/modules/org.eclipse.persistence*.jar", + "glassfish/modules/jaxb*.jar", + "glassfish/modules/webservices*.jar", + "glassfish/modules/woodstox-osgi*.jar", // + "mq/lib/jaxm-api*.jar" + }; + + private static final String[] LIBRARIES_4 = { + "glassfish/modules/javax.*.jar", + "glassfish/modules/weld-osgi-bundle.jar", + "glassfish/modules/bean-validator.jar", + "glassfish/modules/jersey-*.jar", + "glassfish/modules/glassfish-api.jar", + "glassfish/modules/ha-api.jar", + "glassfish/modules/endorsed/*.jar", + "glassfish/modules/org.eclipse.persistence*.jar", + "glassfish/modules/jaxb*.jar", + "glassfish/modules/webservices*.jar", + "glassfish/modules/cdi-api.jar", // + + "mq/lib/jaxm-api.jar" + }; + + private static final String[] LIBRARIES_5 = LIBRARIES_4; + + private static final String[] LIBRARIES_5_191 = { + "glassfish/modules/javax.*.jar", + "glassfish/modules/jakarta.*.jar", + "glassfish/modules/weld-osgi-bundle.jar", + "glassfish/modules/bean-validator.jar", + "glassfish/modules/jersey-*.jar", + "glassfish/modules/glassfish-api.jar", + "glassfish/modules/ha-api.jar", + "glassfish/modules/endorsed/*.jar", + "glassfish/modules/org.eclipse.persistence*.jar", + "glassfish/modules/jaxb*.jar", + "glassfish/modules/webservices*.jar", + "glassfish/modules/cdi-api.jar", // + + "mq/lib/jaxm-api.jar" + }; + + private static final String[] LIBRARIES_6 = { + "glassfish/modules/jakarta.*.jar", + "glassfish/modules/weld-osgi-bundle.jar", + "glassfish/modules/bean-validator.jar", + "glassfish/modules/jersey-*.jar", + "glassfish/modules/glassfish-api.jar", + "glassfish/modules/ha-api.jar", + "glassfish/modules/endorsed/*.jar", + "glassfish/modules/org.eclipse.persistence*.jar", + "glassfish/modules/jaxb*.jar", + "glassfish/modules/webservices*.jar", + "mq/lib/jaxm-api.jar" + }; + + public static String[] getLibraryIncludesByVersion(Version version) { + if (version.matches("[6")) { + return LIBRARIES_6; + } + + if (version.matches("[5.191")) { + return LIBRARIES_5_191; + } + + if (version.matches("[5")) { + return LIBRARIES_5; + } + + if (version.matches("[4-5)")) { + return LIBRARIES_4; + } + + if (version.matches("[3.1.2-4)")) { + return LIBRARIES_3_1_2; + } + + if (version.matches("[3.1-3.1.2)")) { + return LIBRARIES_3_1; + } + + return null; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesContainer.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesContainer.java new file mode 100644 index 00000000..e04a7db9 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesContainer.java @@ -0,0 +1,390 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.internal; + +import static fish.payara.eclipse.tools.server.utils.PayaraLocationUtils.DEFAULT_LIBRARIES; +import static java.util.Collections.emptyList; +import static org.eclipse.core.resources.IResourceChangeEvent.POST_CHANGE; +import static org.eclipse.jdt.core.IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME; +import static org.eclipse.jdt.core.JavaCore.getClasspathContainer; +import static org.eclipse.jdt.core.JavaCore.newClasspathAttribute; +import static org.eclipse.jdt.core.JavaCore.newLibraryEntry; +import static org.eclipse.jdt.core.JavaCore.setClasspathContainer; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResourceChangeEvent; +import org.eclipse.core.resources.IResourceChangeListener; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.jdt.core.ClasspathContainerInitializer; +import org.eclipse.jdt.core.IAccessRule; +import org.eclipse.jdt.core.IClasspathAttribute; +import org.eclipse.jdt.core.IClasspathContainer; +import org.eclipse.jdt.core.IClasspathEntry; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.osgi.util.NLS; + +import fish.payara.eclipse.tools.server.PayaraServerPlugin; +import fish.payara.eclipse.tools.server.utils.ListFactory; +import fish.payara.eclipse.tools.server.utils.PayaraLocationUtils; +import fish.payara.eclipse.tools.server.utils.Version; + +/** + * This container manages the Payara "system" libraries, which is a selection from the + * jar files in mostly glassfish/modules + * + * @author Konstantin Komissarchik + */ +public final class SystemLibrariesContainer implements IClasspathContainer { + + public static final String ID = "fish.payara.eclipse.tools.server.lib.system"; + private static final IPath PATH = new Path(ID); + + private static final String FPROJ_METADATA_FILE = ".settings/org.eclipse.wst.common.project.facet.core.xml"; + + private static boolean initialized; + private static ContainersRefresherThread containersRefresherThread; + + private final List classpathEntries; + + private static synchronized void initialize() { + if (!initialized) { + initialized = true; + + ResourceChangeListener.register(); + + containersRefresherThread = new ContainersRefresherThread(); + containersRefresherThread.setName("PayaraLibraryContainersRefresher"); + containersRefresherThread.start(); + } + } + + private SystemLibrariesContainer(IPath containerPath, IJavaProject project) { + PayaraLocationUtils locationUtils = PayaraLocationUtils.find(project); + + String libraryGroup = DEFAULT_LIBRARIES; + if (containerPath.segmentCount() > 1) { + libraryGroup = containerPath.segment(1); + } + + // Sets + classpathEntries = locationUtils == null ? + emptyList() : + createClasspathEntriesForLibraries( + project.getProject(), locationUtils.version(), locationUtils.getLibraries(libraryGroup)); + } + + @Override + public IClasspathEntry[] getClasspathEntries() { + return classpathEntries.toArray(new IClasspathEntry[classpathEntries.size()]); + } + + @Override + public String getDescription() { + return Resources.containerLabel; + } + + @Override + public int getKind() { + return K_APPLICATION; + } + + @Override + public IPath getPath() { + return PATH; + } + + public static ContainersRefresherThread getContainersRefresherThread() { + return containersRefresherThread; + } + + public static boolean isOnClasspath(IProject project) throws CoreException { + if (isJavaProject(project)) { + return isOnClasspath(JavaCore.create(project)); + } + + return false; + } + + private static boolean isOnClasspath(IJavaProject project) throws CoreException { + for (IClasspathEntry classpathEntry : project.getRawClasspath()) { + if (isSystemLibrariesContainer(classpathEntry)) { + return true; + } + } + + return false; + } + + private static boolean isSystemLibrariesContainer(IClasspathEntry classpathEntry) { + return classpathEntry.getPath().equals(PATH); + } + + static void refresh(IProject project) throws CoreException { + if (isJavaProject(project)) { + refresh(JavaCore.create(project)); + } + } + + private static void refresh(IJavaProject project) throws CoreException { + IPath containerPath = null; + + for (IClasspathEntry classpathEntry : project.getRawClasspath()) { + if (isSystemLibrariesContainer(classpathEntry)) { + containerPath = classpathEntry.getPath(); + break; + } + } + + if (containerPath != null) { + SystemLibrariesContainer existingContainer = (SystemLibrariesContainer) getClasspathContainer(containerPath, project); + SystemLibrariesContainer newContainer = new SystemLibrariesContainer(containerPath, project); + + if (!existingContainer.equals(newContainer)) { + IJavaProject[] projectsArray = { project }; + IClasspathContainer[] containersArray = { newContainer }; + + JavaCore.setClasspathContainer(containerPath, projectsArray, containersArray, null); + } + } + } + + /** + * Checks whether the specified project is a Java project. + * + * @param project the project to check + * @return true if the project is a Java project + */ + + private static boolean isJavaProject(IProject project) { + try { + return project.getNature(JavaCore.NATURE_ID) != null; + } catch (CoreException e) { + } + + return false; + } + + public static final class Initializer extends ClasspathContainerInitializer { + @Override + public void initialize(IPath containerPath, IJavaProject project) throws CoreException { + SystemLibrariesContainer.initialize(); + + setClasspathContainer( + containerPath, + new IJavaProject[] { project }, + new IClasspathContainer[] { new SystemLibrariesContainer(containerPath, project) }, + null); + } + + @Override + public boolean canUpdateClasspathContainer(IPath containerPath, IJavaProject project) { + return true; + } + + @Override + public void requestClasspathContainerUpdate(IPath containerPath, IJavaProject project, IClasspathContainer containerSuggestion) throws CoreException { + super.requestClasspathContainerUpdate(containerPath, project, containerSuggestion); + + // Save source path in meta data file + IProject proj = project.getProject(); + SystemLibrariesSetting settings = SystemLibrariesSetting.load(proj); + if (settings == null) { + settings = new SystemLibrariesSetting(); + } + + List libraries = settings.getLibraryList(); + + boolean needUpdate = false; + for (IClasspathEntry classpathEntry : containerSuggestion.getClasspathEntries()) { + IPath srcPath = classpathEntry.getSourceAttachmentPath(); + + if (srcPath != null) { + needUpdate = true; + + boolean foudEntry = false; + for (Library library : libraries) { + String cpePath = classpathEntry.getPath().toString(); + if (library.getPath().equals(cpePath)) { + // Update source path + library.setSource(srcPath.toPortableString()); + foudEntry = true; + break; + } + } + + if (!foudEntry) { + Library newLibrary = new Library(); + newLibrary.setPath(classpathEntry.getPath().toString()); + newLibrary.setSource(srcPath.toString()); + libraries.add(newLibrary); + } + } else { + // Remove entry from settings file + + Iterator it = libraries.iterator(); + while (it.hasNext()) { + Library lib = it.next(); + String cpePath = classpathEntry.getPath().toString(); + if (lib.getPath().equals(cpePath)) { + it.remove(); + needUpdate = true; + break; + } + } + + } + } + + if (needUpdate) { + SystemLibrariesSetting.save(proj, settings); + // Update the classpath container to reflect the changes + initialize(containerPath, project); + } + } + } + + public static List createClasspathEntriesForLibraries(IProject project, Version version, List libraries) { + ListFactory classpathListFactory = ListFactory.start(); + + URL doc; + String javaEEVersion; + if(version.matches("[6")) { + javaEEVersion = "9"; + } else if(version.matches("[5")) { + javaEEVersion = "8"; + } else if(version.matches("[4")) { + javaEEVersion = "7"; + } else { + javaEEVersion = "6"; + } + try { + if(Integer.valueOf(javaEEVersion) >= 8) { + doc = new URL("https://jakarta.ee/specifications/platform/"+javaEEVersion+"/apidocs"); + } else { + doc = new URL("http://docs.oracle.com/javaee/" + javaEEVersion + "/api/"); + } + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + + SystemLibrariesSetting libSettings = SystemLibrariesSetting.load(project); + + if (libSettings != null) { + + // We have settings for our system library, check it for each entry + // if we have a source attachment + + for (File library : libraries) { + classpathListFactory.add( + createLibraryEntry( + new Path(library.toString()), + libSettings.getSourcePath(library), + doc)); + } + } else { + + // No settings for our system library, source is always null + + for (File library : libraries) { + classpathListFactory.add( + createLibraryEntry( + new Path(library.toString()), + null, + doc)); + } + } + + + return classpathListFactory.result(); + } + + private static IClasspathEntry createLibraryEntry(IPath library, File src, URL javadoc) { + IPath librarySourcePath = src == null ? null : new Path(src.getAbsolutePath()); + IAccessRule[] access = {}; + IClasspathAttribute[] libraryJavadocAttributes; + + if (javadoc == null) { + libraryJavadocAttributes = new IClasspathAttribute[0]; + } else { + libraryJavadocAttributes = new IClasspathAttribute[] { newClasspathAttribute(JAVADOC_LOCATION_ATTRIBUTE_NAME, javadoc.toExternalForm()) }; + } + + return newLibraryEntry(library, librarySourcePath, null, access, libraryJavadocAttributes, false); + } + + private static final class ResourceChangeListener implements IResourceChangeListener { + private final List triggerFiles; + + public static void register() { + ResourcesPlugin.getWorkspace().addResourceChangeListener(new ResourceChangeListener(), POST_CHANGE); + } + + private ResourceChangeListener() { + triggerFiles = new ArrayList<>(); + triggerFiles.add(new Path(FPROJ_METADATA_FILE)); + } + + @Override + public void resourceChanged(IResourceChangeEvent event) { + for (IResourceDelta subdelta : event.getDelta().getAffectedChildren()) { + IProject project = (IProject) subdelta.getResource(); + boolean relevant = false; + + for (IPath triggerFile : triggerFiles) { + if (subdelta.findMember(triggerFile) != null) { + try { + if (isOnClasspath(project)) { + relevant = true; + } + } catch (CoreException e) { + PayaraServerPlugin.log(e); + } + + break; + } + } + + if (relevant) { + containersRefresherThread.addProjectToQueue(project); + } + } + } + } + + private static final class Resources extends NLS { + public static String containerLabel; + + static { + initializeMessages(SystemLibrariesContainer.class.getName(), Resources.class); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesContainer.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesContainer.properties new file mode 100644 index 00000000..52ac49c9 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesContainer.properties @@ -0,0 +1 @@ +containerLabel = Payara System Libraries \ No newline at end of file diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesSetting.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesSetting.java new file mode 100644 index 00000000..0e5007e1 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesSetting.java @@ -0,0 +1,204 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.internal; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; + +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + +/** + * This class represents the settings that users manually did to the system + * library container added by this plug-in. + * + *

+ * This is done for instance to attach sources, which in fact is the only user + * applied setting we actually make use of. + * + */ +public class SystemLibrariesSetting { + + private static final String SYSTEM_LIBRARIES_TAG = "system-libraries"; //$NON-NLS-1$ + private static final String LIBRARY_TAG = "library"; //$NON-NLS-1$ + private static final String PATH_TAG = "path"; //$NON-NLS-1$ + private static final String SOURCE_TAG = "source"; //$NON-NLS-1$ + private static final String JAVADOC_TAG = "javadoc"; //$NON-NLS-1$ + private static final String NEW_LINE = "\n"; //$NON-NLS-1$ + private static final String SETTING_XML = "/.settings/fish.payara.eclipse.tools.server.syslib.xml"; //$NON-NLS-1$ + + private ArrayList libraries = new ArrayList<>(); + + public void setLibraryList(ArrayList libraries) { + this.libraries = libraries; + } + + public ArrayList getLibraryList() { + return libraries; + } + + public static SystemLibrariesSetting load(IProject project) { + SystemLibrariesSetting settings = null; + + try { + IFile settingsXmlFile = project.getFile(SETTING_XML); + + if (!settingsXmlFile.exists()) { + return null; + } + + try (InputStream stream = settingsXmlFile.getContents()) { + SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); + SAXParser saxParser = saxParserFactory.newSAXParser(); + SysLibHandler handler = new SysLibHandler(); + saxParser.parse(stream, handler); + settings = handler.getSystemLibrariesSetting(); + } + + if (settings.getLibraryList() == null) { + settings.setLibraryList(new ArrayList<>()); + } + + } catch (Exception e) { + e.printStackTrace(); + } + + return settings; + } + + public static void save(IProject project, SystemLibrariesSetting settings) { + IFile settingsXmlFile = project.getFile(SETTING_XML); + try (FileOutputStream output = new FileOutputStream(settingsXmlFile.getLocation().toFile())) { + save(output, settings); + } catch (Exception e) { + throw new IllegalStateException("Could not write the system libraries settings to the file " + settingsXmlFile, e); + } + // refresh the file after it is closed. + try { + settingsXmlFile.refreshLocal(0, new NullProgressMonitor()); + } catch (CoreException e) { + throw new IllegalStateException("Could not refresh the system libraries settings from the file " + settingsXmlFile, e); + } + } + + + public static void save(OutputStream output, SystemLibrariesSetting settings) throws XMLStreamException { + XMLOutputFactory factory = XMLOutputFactory.newInstance(); + XMLStreamWriter writer = factory.createXMLStreamWriter(output, StandardCharsets.UTF_8.name()); + try { + writer.writeStartDocument(StandardCharsets.UTF_8.name(), "1.0"); + writer.writeCharacters(NEW_LINE); + writer.writeStartElement(SYSTEM_LIBRARIES_TAG); + writer.writeCharacters(NEW_LINE); + for (Library library : settings.getLibraryList()) { + writer.writeStartElement(LIBRARY_TAG); + if (library.getPath() != null) { + writer.writeAttribute(PATH_TAG, library.getPath()); + } + if (library.getSource() != null) { + writer.writeAttribute(SOURCE_TAG, library.getSource()); + } + if (library.getJavadoc() != null) { + writer.writeAttribute(JAVADOC_TAG, library.getJavadoc()); + } + writer.writeEndElement(); + writer.writeCharacters(NEW_LINE); + } + writer.writeEndElement(); + writer.writeCharacters(NEW_LINE); + writer.writeEndDocument(); + } finally { + // does not close the output stream variable + writer.close(); + } + } + + public File getSourcePath(File jar) { + for (Library library : libraries) { + if (jar.equals(new File(library.getPath()))) { + File librarySource = new File(library.getSource()); + if (librarySource.exists()) { + return librarySource; + } + + // Workspace location + return ResourcesPlugin.getWorkspace() + .getRoot() + .getFile(new Path(library.getSource())) + .getLocation() + .toFile(); + } + } + + return null; + } + + static class SysLibHandler extends DefaultHandler { + + private ArrayList libs = new ArrayList<>(); + + @Override + public void startElement(String uri, String localName, String tag, Attributes attributes) throws SAXException { + if (tag.equals(LIBRARY_TAG)) { + Library library = new Library(); + for (int i = 0; i < attributes.getLength(); i++) { + switch (attributes.getQName(i)) { + case PATH_TAG: + library.setPath(attributes.getValue(i)); + break; + case SOURCE_TAG: + library.setSource(attributes.getValue(i)); + break; + case JAVADOC_TAG: + library.setJavadoc(attributes.getValue(i)); + break; + default: + break; + } + } + libs.add(library); + } + } + + public SystemLibrariesSetting getSystemLibrariesSetting() { + SystemLibrariesSetting systemLibrariesSetting = new SystemLibrariesSetting(); + systemLibrariesSetting.setLibraryList(libs); + return systemLibrariesSetting; + } + + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/AbstractLogFilter.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/AbstractLogFilter.java new file mode 100644 index 00000000..b140b850 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/AbstractLogFilter.java @@ -0,0 +1,106 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.log; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Common base class for log filters. They are used to transform standard GF log records to more + * human readable format. + * + * @author Peter Benedikovic + */ +public abstract class AbstractLogFilter implements ILogFilter { + + private static final String DEFAULT_DELIMETER = ""; + + protected StringBuilder buffer; + + protected String logRecordDelimeter = ""; + + protected ILevelResolver levelResolver; + + protected LogRecord record; + + protected ILogFormatter formatter; + + protected AbstractLogFilter() { + this(new LogFormatterSimple(), new LevelResolver(), DEFAULT_DELIMETER); + } + + protected AbstractLogFilter(ILogFormatter formatter, ILevelResolver resolver) { + this(formatter, resolver, DEFAULT_DELIMETER); + } + + protected AbstractLogFilter(ILogFormatter formatter, ILevelResolver resolver, + String logRecordDelimeter) { + buffer = new StringBuilder(1024); // 1 kB + record = new LogRecord(); + + this.formatter = formatter; + this.levelResolver = resolver; + this.logRecordDelimeter = logRecordDelimeter; + } + + /** + * Resets log filter after reading complete log record. + */ + @Override + public void reset() { + record.reset(); + buffer.setLength(0); + } + + protected abstract boolean isReadingUserMessage(); + + /** + * Processes read line. + * + * @param line - mustn't contain new line character + * @return Complete log record or null if the read line haven't completed the log record. + */ + @Override + public abstract String process(String line); + + public static AbstractLogFilter createFilter(PayaraServer server) { + if (server.getVersion().matches("[4")) { + return new PatternLogFilterV4(); + } else { + return new StateLogFilterV3(); + } + } + + public static interface ILevelResolver { + + public String resolve(String level); + + } + + public static interface ILogFormatter { + + public String formatLogRecord(LogRecord record); + + } + + public enum GlassfishLogFields { + + DATETIME, LEVEL, VERSION, CLASSINFO, THREADINFO, MESSAGE; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/AbstractPayaraConsole.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/AbstractPayaraConsole.java new file mode 100644 index 00000000..d07a6526 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/AbstractPayaraConsole.java @@ -0,0 +1,43 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.log; + +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ScheduledFuture; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.console.MessageConsole; +import org.eclipse.ui.console.MessageConsoleStream; + +public abstract class AbstractPayaraConsole extends MessageConsole implements IPayaraConsole { + + protected List readers; + protected MessageConsoleStream out; + protected CountDownLatch latch; + protected ILogFilter filter; + protected ScheduledFuture stopJobResult; + + public AbstractPayaraConsole(String name, ImageDescriptor imageDescriptor, ILogFilter filter) { + super(name, imageDescriptor); + this.filter = filter; + this.out = newMessageStream(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/ILogFilter.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/ILogFilter.java new file mode 100644 index 00000000..f8ff0219 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/ILogFilter.java @@ -0,0 +1,39 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.log; + +public interface ILogFilter { + + /** + * Resets log filter after reading complete log record. + */ + void reset(); + + /** + * Processes read line. + * + * @param line - mustn't contain new line character + * @return Complete log record or null if the read line haven't completed the log record. + */ + String process(String line); + + default boolean hasProcessedPayara() { + return false; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/IPayaraConsole.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/IPayaraConsole.java new file mode 100644 index 00000000..1e177a17 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/IPayaraConsole.java @@ -0,0 +1,47 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.log; + +import org.eclipse.ui.console.IConsole; + +import fish.payara.eclipse.tools.server.sdk.server.FetchLog; + +public interface IPayaraConsole extends IConsole { + + void startLogging(); + + void startLogging(FetchLog... logFetchers); + + void setLogFilter(ILogFilter filter); + + boolean isLogging(); + + boolean hasLogged(); + + boolean hasLoggedPayara(); + + void stopLogging(); + + void stopLogging(int afterSeconds); + + + + + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LevelResolver.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LevelResolver.java new file mode 100644 index 00000000..47fd94ec --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LevelResolver.java @@ -0,0 +1,77 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.log; + +import static java.util.logging.Level.ALL; +import static java.util.logging.Level.CONFIG; +import static java.util.logging.Level.FINE; +import static java.util.logging.Level.FINER; +import static java.util.logging.Level.FINEST; +import static java.util.logging.Level.INFO; +import static java.util.logging.Level.SEVERE; +import static java.util.logging.Level.WARNING; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.log.AbstractLogFilter.ILevelResolver; + +class LevelResolver implements ILevelResolver { + + private Map localizedLevels; + + LevelResolver() { + Locale defaultLocale = null; + + try { + Locale logLocale = getLogLocale(); + if (!logLocale.equals(Locale.getDefault())) { + defaultLocale = Locale.getDefault(); + Locale.setDefault(logLocale); + } + + localizedLevels = new HashMap<>(); + for (Level level : new Level[] { ALL, CONFIG, FINE, FINER, FINEST, INFO, SEVERE, WARNING }) { + localizedLevels.put(level.getName(), level.getLocalizedName()); + } + } finally { + if (defaultLocale != null) { + Locale.setDefault(defaultLocale); + } + } + } + + private Locale getLogLocale() { + // XXX detect and use server language/country/variant instead of IDE's. + String language = System.getProperty("user.language"); + if (language != null) { + return new Locale(language, System.getProperty("user.country", ""), System.getProperty("user.variant", "")); + } + return Locale.getDefault(); + } + + @Override + public String resolve(String level) { + String localizedLevel = localizedLevels.get(level); + return localizedLevel != null ? localizedLevel : level; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogFormatterSimple.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogFormatterSimple.java new file mode 100644 index 00000000..6880bbe0 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogFormatterSimple.java @@ -0,0 +1,55 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.log; + +import static fish.payara.eclipse.tools.server.log.AbstractLogFilter.GlassfishLogFields.DATETIME; +import static fish.payara.eclipse.tools.server.log.AbstractLogFilter.GlassfishLogFields.LEVEL; +import static fish.payara.eclipse.tools.server.log.AbstractLogFilter.GlassfishLogFields.MESSAGE; + +import java.util.Formatter; + +import fish.payara.eclipse.tools.server.log.AbstractLogFilter.GlassfishLogFields; +import fish.payara.eclipse.tools.server.log.AbstractLogFilter.ILogFormatter; + +public class LogFormatterSimple implements ILogFormatter { + + private GlassfishLogFields[] fields; + private String format; + private StringBuilder logRecordBuilder = new StringBuilder(1024); + + public LogFormatterSimple() { + format = "%s|%s: %s"; + fields = new GlassfishLogFields[] { DATETIME, LEVEL, MESSAGE }; + } + + public LogFormatterSimple(String delimeter, GlassfishLogFields[] fields) { + this.fields = fields; + } + + @Override + public String formatLogRecord(LogRecord record) { + logRecordBuilder.setLength(0); + Formatter logRecorFormatter = new Formatter(logRecordBuilder); + logRecorFormatter.format(format, record.getRecordFieldValues(fields)); + logRecorFormatter.close(); + + return logRecordBuilder.toString(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogReader.java new file mode 100644 index 00000000..e57d1eba --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogReader.java @@ -0,0 +1,85 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.log; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.util.concurrent.CountDownLatch; + +import org.eclipse.ui.console.MessageConsoleStream; + +import fish.payara.eclipse.tools.server.sdk.server.FetchLog; + +public class LogReader implements Runnable { + + private FetchLog logFetcher; + private MessageConsoleStream output; + private CountDownLatch latch; + private ILogFilter filter; + + private boolean hasLogged; + private boolean hasProcessedPayara; + + LogReader(FetchLog logFetcher, MessageConsoleStream outputStream, CountDownLatch latch, ILogFilter filter) { + this.logFetcher = logFetcher; + this.output = outputStream; + this.latch = latch; + this.filter = filter; + } + + @Override + public void run() { + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(logFetcher.getInputStream(), StandardCharsets.UTF_8)); + + for (String line = null; (line = reader.readLine()) != null;) { + line = filter.process(line); + if (line != null) { + hasLogged = true; + if (!hasProcessedPayara) { + hasProcessedPayara = filter.hasProcessedPayara(); + } + output.println(line); + } + } + output.flush(); + } catch (IOException e) { + // this happens when input stream is closed, no need to print + // e.printStackTrace(); + } finally { + logFetcher.close(); + latch.countDown(); + } + } + + public synchronized boolean hasLogged() { + return hasLogged; + } + + public synchronized boolean hasProcessedPayara() { + return hasProcessedPayara; + } + + public synchronized void stop() { + logFetcher.close(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogRecord.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogRecord.java new file mode 100644 index 00000000..d2fca6c9 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogRecord.java @@ -0,0 +1,116 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.log; + +import fish.payara.eclipse.tools.server.log.AbstractLogFilter.GlassfishLogFields; + +class LogRecord { + + private String time; + private String level; + private String version; + private String classinfo; + private String threadinfo; + private String message; + + LogRecord() { + time = level = version = classinfo = threadinfo = message = ""; + } + + public void reset() { + time = level = version = classinfo = threadinfo = message = ""; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + public String getClassInfo() { + return classinfo; + } + + public void setClassInfo(String classinfo) { + this.classinfo = classinfo; + } + + public String getThreadInfo() { + return threadinfo; + } + + public void setThreadInfo(String threadinfo) { + this.threadinfo = threadinfo; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getRecordFieldValue(GlassfishLogFields field) { + switch (field) { + case CLASSINFO: + return getClassInfo(); + case VERSION: + return getVersion(); + case THREADINFO: + return getThreadInfo(); + case DATETIME: + return getTime(); + case MESSAGE: + return getMessage(); + case LEVEL: + return getLevel(); + + default: + throw new IllegalArgumentException(); + } + } + + public String[] getRecordFieldValues(GlassfishLogFields... fields) { + String[] res = new String[fields.length]; + int i = 0; + for (GlassfishLogFields f : fields) { + res[i++] = getRecordFieldValue(f); + } + return res; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/NoOpFilter.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/NoOpFilter.java new file mode 100644 index 00000000..5a90496c --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/NoOpFilter.java @@ -0,0 +1,32 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.log; + +public class NoOpFilter implements ILogFilter { + + @Override + public void reset() { + } + + @Override + public String process(String line) { + return line; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PatternLogFilterV4.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PatternLogFilterV4.java new file mode 100644 index 00000000..3d0e85c5 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PatternLogFilterV4.java @@ -0,0 +1,82 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.log; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import fish.payara.eclipse.tools.server.PayaraServerPlugin; + +public class PatternLogFilterV4 extends AbstractLogFilter { + + private static final Pattern logPattern = Pattern.compile("^\\[([^\\]]*)\\]\\s+" + // date-time + "\\[([^\\]]*)\\]\\s+" + // server name + "\\[([^\\]]*)\\]\\s+" + // level name + "\\[([^\\]]*)\\]\\s+" + // version + "\\[([^\\]]*)\\]\\s+" + // class info + "\\[([^\\]]*)\\]\\s+" + // thread info + "\\[([^\\]]*)\\]\\s+" + // time millis + "\\[([^\\]]*)\\]\\s+" + // level value + "\\[{2}\\s*(.+)\\]{2}\\s$", Pattern.DOTALL); // log message + + private static final Pattern endOfMessagePattern = Pattern.compile("^//s*[^//]]{2}\\s$"); // log message + + private boolean hasProcessedPayara; + + @Override + public boolean hasProcessedPayara() { + return hasProcessedPayara; + } + + PatternLogFilterV4() { + super(); + } + + @Override + public String process(String line) { + String result = null; + if (line.equals(logRecordDelimeter)) { + Matcher m = logPattern.matcher(buffer); + if (m.matches()) { + record.setTime(m.group(1)); + record.setLevel(levelResolver.resolve(m.group(3))); + record.setVersion(m.group(2)); + record.setClassInfo(m.group(5)); + record.setThreadInfo(m.group(6)); + record.setMessage(m.group(9)); + result = formatter.formatLogRecord(record); + reset(); + hasProcessedPayara = true; + } else if (!isReadingUserMessage()) { + PayaraServerPlugin.logMessage("Log record that does not match expected format detected!"); + PayaraServerPlugin.logMessage(buffer.toString()); + } + } else { + buffer.append(line); + buffer.append('\n'); + } + return result; + } + + @Override + protected boolean isReadingUserMessage() { + return !endOfMessagePattern.matcher(buffer).matches(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraConsole.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraConsole.java new file mode 100644 index 00000000..bea9cbef --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraConsole.java @@ -0,0 +1,171 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.log; + +import static java.util.concurrent.TimeUnit.SECONDS; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; + +import fish.payara.eclipse.tools.server.PayaraServerPlugin; +import fish.payara.eclipse.tools.server.sdk.server.FetchLog; + +// TODO will be GlassfishLocalConsole in the future, new GlassfishRemoteConsole to be implemented +public class PayaraConsole extends AbstractPayaraConsole implements IPayaraConsole { + + private static ScheduledExecutorService stopService = Executors.newSingleThreadScheduledExecutor(); + + PayaraConsole(String name, ILogFilter filter) { + super(name, + PayaraServerPlugin.getInstance().getImageRegistry().getDescriptor(PayaraServerPlugin.GF_SERVER_IMG), + filter); + } + + // PayaraConsole(String name, FetchLog[] logFetchers) { + // this(name); + // } + // + // PayaraConsole(String name, FetchLog logFetcher) { + // this(name, new FetchLog[] {logFetcher}); + // } + + @Override + public void startLogging() { + // will work after we make fetchlog class runnable more than once + // stopLogging(); + // readers = new ArrayList(logFetchers.length); + // out = newMessageStream(); + // for (FetchLog logFetcher : logFetchers) { + // LogReader reader = new LogReader(logFetcher, out); + // readers.add(reader); + // Thread t = new Thread(reader); + // t.start(); + // } + } + + @Override + public synchronized void startLogging(FetchLog... logFetchers) { + if (stopJobResult != null) { + try { + stopJobResult.get(); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + } + stopJobResult = null; + } else { + stopLoggingImpl(); + } + + readers = new ArrayList<>(logFetchers.length); + latch = new CountDownLatch(logFetchers.length); + filter.reset(); + + int i = 0; + for (FetchLog logFetcher : logFetchers) { + LogReader reader = new LogReader(logFetcher, out, latch, filter); + readers.add(reader); + new Thread(reader, "LogReader Thread" + i++).start(); + } + } + + @Override + public synchronized void stopLogging() { + if (isLogging()) { + stopLoggingImpl(); + } + } + + private void stopLoggingImpl() { + if (readers == null) { + return; + } + + for (LogReader logReader : readers) { + logReader.stop(); + } + + readers = null; + } + + @Override + public synchronized void stopLogging(int afterSeconds) { + if (isLogging()) { + stopJobResult = stopService.schedule(() -> stopLoggingImpl(), afterSeconds, SECONDS); + } + } + + @Override + protected void dispose() { + super.dispose(); + stopLogging(); + try { + if (latch != null) { + latch.await(); + } + out.close(); + } catch (IOException | InterruptedException e) { + e.printStackTrace(); + } + } + + @Override + public synchronized boolean isLogging() { + return (readers != null) && (readers.size() > 0) && (stopJobResult == null); + } + + @Override + public synchronized boolean hasLogged() { + if (readers == null) { + return false; + } + + for (LogReader logReader : readers) { + if (logReader.hasLogged()) { + return true; + } + } + + return false; + } + + @Override + public synchronized boolean hasLoggedPayara() { + if (readers == null) { + return false; + } + + for (LogReader logReader : readers) { + if (logReader.hasProcessedPayara()) { + return true; + } + } + + return false; + } + + @Override + public synchronized void setLogFilter(ILogFilter filter) { + this.filter = filter; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraConsoleManager.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraConsoleManager.java new file mode 100644 index 00000000..7f49e192 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraConsoleManager.java @@ -0,0 +1,137 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.log; + +import static fish.payara.eclipse.tools.server.log.AbstractLogFilter.createFilter; +import static java.io.File.separator; + +import org.eclipse.ui.console.ConsolePlugin; +import org.eclipse.ui.console.IConsole; +import org.eclipse.ui.console.IConsoleManager; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * This factory class enforces certain rules regarding Payara consoles. + * + *

    + *
  1. There is only one standard Payara console.
  2. + *
  3. A user can trigger showing the server log file console that shows the whole server.log file.
  4. + *
  5. A startup process console exists during the startup process of Payara. Unless the startup + * does not fail it will not be shown to the user.
  6. + *
+ * + * @author Peter Benedikovic + * + */ +public class PayaraConsoleManager { + + private static IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); + + public static IPayaraConsole showConsole(IPayaraConsole console) { + manager.addConsoles(new IConsole[] { console }); + manager.showConsoleView(console); + return console; + } + + /** + * Returns standard console for specified server. For each server there is only one console. It + * reads information from server.log file but only newly added lines. + * + * @param server + * @return + */ + public static IPayaraConsole getStandardConsole(PayaraServer server) { + String consoleID = createStandardConsoleName(server); + IPayaraConsole gfConsole = findConsole(consoleID); + if (gfConsole == null) { + gfConsole = new PayaraConsole(consoleID, AbstractLogFilter.createFilter(server)); + } + + return gfConsole; + } + + /** + * Returns console for showing contents of the whole server.log file. For the same server.log file + * there is only one console at the time. + * + * @param server + * @return + */ + public static IPayaraConsole getServerLogFileConsole(PayaraServer server) { + String consoleID = createServerLogConsoleName(server); + IPayaraConsole gfConsole = findConsole(consoleID); + if (gfConsole == null) { + gfConsole = new PayaraConsole(consoleID, createFilter(server)); + } + + return gfConsole; + } + + /** + * Creates new startup process console. There should be only one for a particular Payara server. + * + * @param server + * @return + */ + public static IPayaraConsole getStartupProcessConsole(PayaraServer server, Process launchProcess) { + String consoleID = createStartupProcessConsoleName(server); + IPayaraConsole payaraConsole = findConsole(consoleID); + if (payaraConsole == null) { + payaraConsole = new PayaraStartupConsole(consoleID, new NoOpFilter()); + } + + return payaraConsole; + } + + public static void removeServerLogFileConsole(PayaraServer server) { + String consoleID = createServerLogConsoleName(server); + IPayaraConsole payaraConsole = findConsole(consoleID); + if (payaraConsole != null) { + manager.removeConsoles(new IConsole[] { payaraConsole }); + } + } + + private static String createServerLogConsoleName(PayaraServer server) { + return server.isRemote() ? server.getServer().getName() + : server.getDomainsFolder() + separator + server.getDomainName() + separator + "logs" + + separator + "server.log"; + } + + private static String createStartupProcessConsoleName(PayaraServer server) { + return server.getServer().getName() + " startup process"; + } + + private static String createStandardConsoleName(PayaraServer server) { + return server.getServer().getName(); + } + + private static IPayaraConsole findConsole(String name) { + IConsole[] existing = manager.getConsoles(); + + for (IConsole element : existing) { + if (name.equals(element.getName())) { + return (IPayaraConsole) element; + } + } + + return null; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraStartupConsole.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraStartupConsole.java new file mode 100644 index 00000000..430a653d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraStartupConsole.java @@ -0,0 +1,33 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.log; + +public class PayaraStartupConsole extends PayaraConsole { + + PayaraStartupConsole(String name, ILogFilter filter) { + super(name, filter); + } + + @Override + public synchronized void stopLogging() { + // do nothing... + readers = null; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/StateLogFilterV3.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/StateLogFilterV3.java new file mode 100644 index 00000000..4fe167b6 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/StateLogFilterV3.java @@ -0,0 +1,230 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.log; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; + +public class StateLogFilterV3 extends AbstractLogFilter { + + private int state; + + StateLogFilterV3() { + super(); + } + + @Override + public String process(String line) { + if (line.equals(logRecordDelimeter) && !isReadingUserMessage()) { + reset(); + } + + String result = null; + for (char c : line.toCharArray()) { + result = process(c); + } + process('\n'); + return result;// process('\n'); + } + + /** + * GlassFish server log entry format (unformatted), when read from file: + * + * [#| 2008-07-20T16:59:11.738-0700| INFO| GlassFish10.0| org.jvnet.hk2.osgiadapter| + * _ThreadID=11;_ThreadName=Thread-6;org.glassfish.admin.config-api [1794];| Started bundle + * org.glassfish.admin.config-api [1794] |#] + * + * !PW FIXME This parser should be checked for I18N stability. + */ + public String process(char c) { + String result = null; + + switch (state) { + case 0: + if (c == '[') { + state = 1; + } else { + if (c == '\n') { + if (buffer.length() > 0) { + buffer.append(c); + result = buffer.toString(); + buffer.setLength(0); + } + } else if (c != '\r') { + buffer.append(c); + } + } + break; + case 1: + if (c == '#') { + state = 2; + } else { + state = 0; + if (c == '\n') { + if (buffer.length() > 0) { + buffer.append(c); + result = buffer.toString(); + buffer.setLength(0); + } + } else if (c != '\r') { + buffer.append('['); + buffer.append(c); + } + } + break; + case 2: + if (c == '|') { + state = 3; + buffer.setLength(0); + } else { + if (c == '\n') { + if (buffer.length() > 0) { + buffer.append(c); + result = buffer.toString(); + buffer.setLength(0); + } + } else if (c != '\r') { + state = 0; + buffer.append('['); + buffer.append('#'); + buffer.append(c); + } + } + break; + case 3: + if (c == '|') { + state = 4; + record.setTime(buffer.toString()); + buffer.setLength(0); + } else { + buffer.append(c); + } + break; + case 4: + if (c == '|') { + state = 5; + record.setLevel(levelResolver.resolve(buffer.toString())); + buffer.setLength(0); + } else { + buffer.append(c); + } + break; + case 5: + if (c == '|') { + state = 6; + record.setVersion(buffer.toString()); + buffer.setLength(0); + } else { + buffer.append(c); + } + break; + case 6: + if (c == '|') { + state = 7; + record.setClassInfo(buffer.toString()); + buffer.setLength(0); + } else { + buffer.append(c); + } + break; + case 7: + if (c == '|') { + state = 8; + record.setThreadInfo(buffer.toString()); + buffer.setLength(0); + } else { + buffer.append(c); + } + break; + case 8: // reading message + if (c == '|') { + state = 9; + record.setMessage(buffer.toString()); + } else if (c == '\n') { + if (buffer.length() > 0) { // suppress blank lines in multiline messages + buffer.append('\n'); + // result = !multiline ? type + ": " + buffer.toString() : buffer.toString(); + // multiline = true; + // buffer.setLength(0); + } + } else if (c != '\r') { + buffer.append(c); + } + break; + case 9: + if (c == '#') { + state = 10; + } else { + state = 8; + buffer.append('|'); + buffer.append(c); + } + break; + case 10: + if (c == ']') { + state = 0; + result = formatter.formatLogRecord(record);// (multiline ? message : type + ": " + message) + '\n'; + reset(); + } else { + state = 8; + buffer.append('|'); + buffer.append('#'); + buffer.append(c); + } + break; + } + return result; + } + + public static void main(String[] args) throws IOException { + final InputStream stream = new FileInputStream("src/oracle/eclipse/tools/glassfish/log/logv4.txt"); + + try { + final BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8)); + + PatternLogFilterV4 filter = new PatternLogFilterV4(); + // StateLogFilterV3 filter = new StateLogFilterV3(); + + for (String line = null; (line = reader.readLine()) != null;) { + line = filter.process(line); + if (line != null) { + // output.println("line:"); + System.out.println(line); + } + } + + reader.close(); + } finally { + try { + stream.close(); + } catch (final IOException e) { + } + } + } + + @Override + protected boolean isReadingUserMessage() { + return state == 8; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/V3LogFilter.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/V3LogFilter.java new file mode 100644 index 00000000..94deaa93 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/V3LogFilter.java @@ -0,0 +1,273 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.log; + +import static java.util.logging.Level.ALL; +import static java.util.logging.Level.CONFIG; +import static java.util.logging.Level.FINE; +import static java.util.logging.Level.FINER; +import static java.util.logging.Level.FINEST; +import static java.util.logging.Level.INFO; +import static java.util.logging.Level.SEVERE; +import static java.util.logging.Level.WARNING; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.ResourceBundle; +import java.util.logging.Level; + +/** + * author: Peter Williams + */ +public class V3LogFilter { + + private final Locale logLocale = getLogLocale(); + private final String logBundleName = getLogBundle(); + private final Map localizedLevels = getLevelMap(); + + private Locale getLogLocale() { + // XXX detect and use server language/country/variant instead of IDE's. + String language = System.getProperty("user.language"); + if (language != null) { + return new Locale(language, System.getProperty("user.country", ""), System.getProperty("user.variant", "")); + } + + return Locale.getDefault(); + } + + private String getLogBundle() { + return Level.INFO.getResourceBundleName(); + } + + private String getLocalized(String text) { + ResourceBundle bundle = ResourceBundle.getBundle(logBundleName, logLocale); + String localized = bundle.getString(text); + return localized; + } + + public Map getLevelMap() { + Map levelMap = new HashMap<>(); + for (Level l : new Level[] { ALL, CONFIG, FINE, FINER, FINEST, INFO, SEVERE, WARNING }) { + String name = l.getName(); + levelMap.put(name, getLocalized(name)); + } + return levelMap; + } + + public String getLocalizedLevel(String level) { + String localizedLevel = localizedLevels.get(level); + return localizedLevel != null ? localizedLevel : level; + } + + public static interface Filter { + + public String process(char c); + + } + + public static final class LogFileFilter implements Filter { + protected String message; + + protected int state; + protected StringBuilder msg; + + private String time; + private String type; + private String version; + private String classinfo; + private String threadinfo; + private boolean multiline; + private final Map typeMap; + + public LogFileFilter(Map typeMap) { + state = 0; + msg = new StringBuilder(128); + this.typeMap = typeMap; + reset(); + } + + protected void reset() { + message = ""; + time = ""; + type = ""; + version = ""; + classinfo = ""; + threadinfo = ""; + multiline = false; + } + + private String getLocalizedType(String type) { + String localizedType = typeMap.get(type); + return localizedType != null ? localizedType : type; + } + + /** + * GlassFish server log entry format (unformatted), when read from file: + * + * [#| 2008-07-20T16:59:11.738-0700| INFO| GlassFish10.0| org.jvnet.hk2.osgiadapter| + * _ThreadID=11;_ThreadName=Thread-6;org.glassfish.admin.config-api [1794];| Started bundle + * org.glassfish.admin.config-api [1794] |#] + * + * !PW FIXME This parser should be checked for I18N stability. + */ + @Override + public String process(char c) { + String result = null; + + switch (state) { + case 0: + if (c == '[') { + state = 1; + } else { + if (c == '\n') { + if (msg.length() > 0) { + msg.append(c); + result = msg.toString(); + msg.setLength(0); + } + } else if (c != '\r') { + msg.append(c); + } + } + break; + case 1: + if (c == '#') { + state = 2; + } else { + state = 0; + if (c == '\n') { + if (msg.length() > 0) { + msg.append(c); + result = msg.toString(); + msg.setLength(0); + } + } else if (c != '\r') { + msg.append('['); + msg.append(c); + } + } + break; + case 2: + if (c == '|') { + state = 3; + msg.setLength(0); + } else { + if (c == '\n') { + if (msg.length() > 0) { + msg.append(c); + result = msg.toString(); + msg.setLength(0); + } + } else if (c != '\r') { + state = 0; + msg.append('['); + msg.append('#'); + msg.append(c); + } + } + break; + case 3: + if (c == '|') { + state = 4; + time = msg.toString(); + msg.setLength(0); + } else { + msg.append(c); + } + break; + case 4: + if (c == '|') { + state = 5; + type = getLocalizedType(msg.toString()); + msg.setLength(0); + } else { + msg.append(c); + } + break; + case 5: + if (c == '|') { + state = 6; + version = msg.toString(); + msg.setLength(0); + } else { + msg.append(c); + } + break; + case 6: + if (c == '|') { + state = 7; + classinfo = msg.toString(); + msg.setLength(0); + } else { + msg.append(c); + } + break; + case 7: + if (c == '|') { + state = 8; + threadinfo = msg.toString(); + msg.setLength(0); + } else { + msg.append(c); + } + break; + case 8: + if (c == '|') { + state = 9; + message = msg.toString(); + } else if (c == '\n') { + if (msg.length() > 0) { // suppress blank lines in multiline messages + msg.append('\n'); + result = !multiline ? type + ": " + msg.toString() : msg.toString(); + multiline = true; + msg.setLength(0); + } + } else if (c != '\r') { + msg.append(c); + } + break; + case 9: + if (c == '#') { + state = 10; + } else { + state = 8; + msg.append('|'); + msg.append(c); + } + break; + case 10: + if (c == ']') { + state = 0; + msg.setLength(0); + result = (multiline ? message : type + ": " + message) + '\n'; + reset(); + } else { + state = 8; + msg.append('|'); + msg.append('#'); + msg.append(c); + } + break; + } + return result; + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/preferences/PreferenceConstants.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/preferences/PreferenceConstants.java new file mode 100644 index 00000000..e3d3254a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/preferences/PreferenceConstants.java @@ -0,0 +1,32 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.preferences; + +/** + * Constant definitions for plug-in preferences + * + * @author Ludovic Champenois + */ +public class PreferenceConstants { + + public static final String ENABLE_LOG = "EnableLogPreference"; + public static final String ENABLE_START_VERBOSE = "EnableStartVerboseModePreference"; + public static final String ENABLE_COLORS_CONSOLE = "EnableColorsInConsolePreference"; + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/preferences/PreferenceInitializer.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/preferences/PreferenceInitializer.java new file mode 100644 index 00000000..0d74135b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/preferences/PreferenceInitializer.java @@ -0,0 +1,47 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.preferences; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; + +import fish.payara.eclipse.tools.server.PayaraServerPlugin; + +/** + * Class used to initialize default preference values. + * + * @author Ludovic Champenois + */ +public class PreferenceInitializer extends AbstractPreferenceInitializer { + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() + */ + @Override + public void initializeDefaultPreferences() { + IPreferenceStore store = PayaraServerPlugin.getInstance().getPreferenceStore(); + store.setDefault(PreferenceConstants.ENABLE_LOG, false); + store.setDefault(PreferenceConstants.ENABLE_START_VERBOSE, false); + store.setDefault(PreferenceConstants.ENABLE_COLORS_CONSOLE, true); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sapphire/PayaraServerConfigServices.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sapphire/PayaraServerConfigServices.java new file mode 100644 index 00000000..af986afc --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sapphire/PayaraServerConfigServices.java @@ -0,0 +1,182 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sapphire; + +import static fish.payara.eclipse.tools.server.Messages.duplicateRuntimeName; +import static org.eclipse.osgi.util.NLS.bind; +//import static org.eclipse.sapphire.modeling.Status.createErrorStatus; +//import static org.eclipse.sapphire.modeling.Status.createOkStatus; +import static org.eclipse.wst.server.core.ServerCore.getRuntimes; + + +import org.eclipse.core.runtime.IStatus; +//import org.eclipse.sapphire.DefaultValueService; +//import org.eclipse.sapphire.Event; +//import org.eclipse.sapphire.Listener; +//import org.eclipse.sapphire.Value; +//import org.eclipse.sapphire.modeling.Status; +//import org.eclipse.sapphire.platform.StatusBridge; +//import org.eclipse.sapphire.services.ValidationService; +import org.eclipse.wst.server.core.IRuntime; +import org.eclipse.wst.server.core.IRuntimeWorkingCopy; +import org.eclipse.wst.server.core.IServerWorkingCopy; + +import fish.payara.eclipse.tools.server.PayaraRuntime; +import fish.payara.eclipse.tools.server.PayaraServer; + +public final class PayaraServerConfigServices { + + + +// public static final class JdkDefaultValueService extends JavaLocationDefaultValueService { +// @Override +// protected void initDefaultValueService() { +// super.initDefaultValueService(); +// +// // There is no need to detach the listener as the life cycle of the JDK and +// // Payara location properties is the same. +// +// context(IPayaraRuntimeModel.class).getServerRoot().attach(new FilteredListener() { +// @Override +// protected void handleTypedEvent(final PropertyEvent event) { +// refresh(); +// } +// }); +// } +// +// @Override +// protected boolean acceptable(final IVMInstall jvm) { +// if (context(IPayaraRuntimeModel.class).getServerRoot().validation().ok()) { +// final IRuntime r = context(Value.class).element().adapt(IRuntime.class); +// final PayaraRuntime gf = (PayaraRuntime) r.loadAdapter(PayaraRuntime.class, null); +// return validateJvm(jvm).jdk().version(gf.getJavaVersionConstraint()).result().ok(); +// } +// +// return false; +// } + +// import static fish.payara.eclipse.tools.server.utils.JdtUtil.newer; +// +//import org.eclipse.jdt.launching.AbstractVMInstall; +//import org.eclipse.jdt.launching.IVMInstall; +//import org.eclipse.jdt.launching.IVMInstallChangedListener; +//import org.eclipse.jdt.launching.IVMInstallType; +//import org.eclipse.jdt.launching.JavaRuntime; +//import org.eclipse.jdt.launching.PropertyChangeEvent; +//import org.eclipse.sapphire.DefaultValueService; +// protected synchronized String compute() { +// this.computing = true; +// +// try { +// IVMInstall jvm = null; +// +// for (IVMInstallType vmInstallType : JavaRuntime.getVMInstallTypes()) { +// for (IVMInstall vmInstall : vmInstallType.getVMInstalls()) { +// if (!internal(vmInstall) && acceptable(vmInstall)) { +// jvm = newer(jvm, vmInstall); +// } +// } +// } +// +// return (jvm == null ? null : jvm.getInstallLocation().getAbsolutePath()); +// } finally { +// this.computing = false; +// } +// } +// + +// } +// +// public static final class JdkValidationService extends JavaLocationValidationService { +// protected Status compute() { +// final String location = context(Value.class).text(); +// +// if (location != null) { +// final File locationFile = new File(location); +// +// if (locationFile.exists() && locationFile.isDirectory()) { +// return validate(locationFile); +// } +// } +// +// return Status.createOkStatus(); +// } +// protected void initValidationService() { +// super.initValidationService(); +// +// // There is no need to detach the listener as the life cycle of the JDK and +// // Payara location properties is the same. +// +// context(IPayaraRuntimeModel.class).getServerRoot().attach(new FilteredListener() { +// @Override +// protected void handleTypedEvent(final PropertyContentEvent event) { +// refresh(); +// } +// }); +// } +// +// @Override +// protected Status validate(final File location) { +// final IRuntime r = context(Value.class).element().adapt(IRuntime.class); +// final PayaraRuntime gf = (PayaraRuntime) r.loadAdapter(PayaraRuntime.class, null); +// return validateJvm(location).jdk().version(gf.getJavaVersionConstraint()).result(); +// } +// } +// public static final class ServerLocationListener extends Listener { +// private static final List subFoldersToSearch = ListFactory.start() +// .add(new Path("glassfish")) +// .add(new Path("glassfish4/glassfish")) +// .add(new Path("glassfish3/glassfish")).result(); +// +// @Override +// public void handle(final Event event) { +// IPayaraRuntimeModel model = ((PropertyEvent) event) +// .property() +// .nearest(IPayaraRuntimeModel.class); +// +// Version payaraVersion = null; +// +// Path payaraRootLocation = model.getServerRoot().content(); +// +// if (payaraRootLocation != null) { +// PayaraLocationUtils payaraInstall = find(payaraRootLocation.toFile()); +// +// if (payaraInstall == null) { +// for (Path subFolder : subFoldersToSearch) { +// Path potentialRootLocation = payaraRootLocation.append(subFolder); +// payaraInstall = PayaraLocationUtils.find(potentialRootLocation.toFile()); +// +// if (payaraInstall != null) { +// model.setServerRoot(potentialRootLocation); +// break; +// } +// } +// } +// +// if (payaraInstall != null) { +// payaraVersion = payaraInstall.version(); +// } +// } +// +// model.setName(createDefaultRuntimeName(payaraVersion)); +// } +// } + + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/ExceptionMessages.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/ExceptionMessages.properties new file mode 100644 index 00000000..5bce83b7 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/ExceptionMessages.properties @@ -0,0 +1,12 @@ +################################################################################ +# Exception messages # +# Use .. notation for keys. # +################################################################################ + +# GlassFishIdeException class +GlassFishIdeException.init.empty=Caught GlassFishIdeException. +GlassFishIdeException.init.msg=Caught GlassFishIdeException +GlassFishIdeException.init.cause=GlassFishIdeException was caused by + +# GlassFishStatus class +GlassFishStatus.toString.invalidState=Invalid GlassFish server state diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishStatus.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishStatus.java new file mode 100644 index 00000000..b18c8a65 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishStatus.java @@ -0,0 +1,524 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ScheduledThreadPoolExecutor; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.data.DataException; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishServerStatus; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.server.state.GlassFishStatusEntity; +import fish.payara.eclipse.tools.server.sdk.server.state.StatusJob; +import fish.payara.eclipse.tools.server.sdk.server.state.StatusScheduler; + +/** + * GlassFish server status. + *

+ * Local server can be in 4 possible states: + *

+ *

    + *
  • Offline: Server is not running
  • + *
      + *
    • no process
    • + *
    • no network listeners
    • + *
    • no administration interface responses
    • + *
    + *
  • Startup/Restart: Server start or restart was requested
  • + *
      + *
    • active process (PID should change for restart)
    • + *
    • network listeners may or may not be active
    • + *
    • no administration interface responses
    • + *
    + *
  • Online: Server is running
  • + *
      + *
    • active process
    • + *
    • active network listeners
    • + *
    • valid administration interface responses
    • + *
    + *
  • Shutdown: Server shutdown was requested but server is still running
  • + *
      + *
    • active process
    • + *
    • network listeners may or may not be active
    • + *
    • administration interface may or may not be active
    • + *
    + *
+ *

+ * Remote server can be in 4 possible states: + *

+ *
    + *
  • Offline: Server is not running + *
      + *
    • no network listeners + *
    • no administration interface responses
    • + *
    + *
  • Restart: Server restart was requested
  • + *
      + *
    • network listeners may or may not be active
    • + *
    • no administration interface responses
    • + *
    + *
  • Online: Server is running
  • + *
      + *
    • active network listeners
    • + *
    • valid administration interface responses
    • + *
    + *
  • Shutdown: Server shutdown was requested but server is still running
  • + *
      + *
    • network listeners may or may not be active
    • + *
    • administration interface may or may not be active
    • + *
    + *
+ *

+ * + * @author Tomas Kraus + */ +public enum GlassFishStatus { + + //////////////////////////////////////////////////////////////////////////// + // Enum values // + //////////////////////////////////////////////////////////////////////////// + + /** Server status is unknown. */ + UNKNOWN, + + /** Server is offline (not running or not responding). */ + OFFLINE, + + /** + * Server start or restart was requested but server is still not fully responding. + */ + STARTUP, + + /** Server is running an responding. */ + ONLINE, + + /** + * Server shutdown was requested but server is still running or responding. + */ + SHUTDOWN; + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(GlassFishStatus.class); + + /** GlassFish version enumeration length. */ + public static final int length = GlassFishStatus.values().length; + + /** A String representation of UNKNOWN value. */ + private static final String UNKNOWN_STR = "UNKNOWN"; + + /** A String representation of OFFLINE value. */ + private static final String OFFLINE_STR = "OFFLINE"; + + /** A String representation of STARTUP value. */ + private static final String STARTUP_STR = "STARTUP"; + + /** A String representation of ONLINE value. */ + private static final String ONLINE_STR = "ONLINE"; + + /** A String representation of SHUTDOWN value. */ + private static final String SHUTDOWN_STR = "SHUTDOWN"; + + /** + * Stored String values for backward String conversion. + */ + private static final Map stringValuesMap = new HashMap<>(values().length); + static { + for (GlassFishStatus state : GlassFishStatus.values()) { + stringValuesMap.put(state.toString().toUpperCase(), state); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Returns a GlassFishStatus with a value represented by the specified + * String. + *

+ * The GlassFishStatus returned represents existing value only if specified + * String matches any String returned by toString method. + * Otherwise null value is returned. + *

+ * + * @param name Value containing GlassFishStatus toString representation. + * @return GlassFishStatus value represented by String or + * null if value was not recognized. + */ + public static GlassFishStatus toValue(final String name) { + if (name != null) { + return (stringValuesMap.get(name.toUpperCase())); + } else { + return null; + } + } + + /** + * Initialize GlassFish server status task scheduler to use external executor. + *

+ * This method must be called before adding first GlassFisg server instance into scheduler. + *

+ * + * @param executor External executor to be used in scheduler. + */ + public static void initScheduler( + final ScheduledThreadPoolExecutor executor) { + StatusScheduler.init(executor); + } + + /** + * Register GlassFish server instance into scheduler and launch server status checking jobs. + *

+ * It is possible to call this method for the same GlassFisg server instance many times. Server + * instance will be added only if it is not already registered. + *

+ * + * @param srv GlassFish server instance to be registered. + * @return Value of true when server instance was successfully added into scheduler and + * status checking job was started or false otherwise. + */ + public static boolean add(final PayaraServer srv) { + StatusScheduler scheduler = StatusScheduler.getInstance(); + if (!scheduler.exists(srv)) { + GlassFishStatusEntity status = new GlassFishStatusEntity(srv); + return StatusScheduler.getInstance().add(status); + } else { + return false; + } + } + + /** + * Register GlassFish server instance into scheduler, register server status listener and launch + * server status checking jobs. + *

+ * It is possible to call this method for the same GlassFisg server instance many times. Server + * instance and listener will be added only if it is not already registered. + *

+ * + * @param srv GlassFish server instance to be registered. + * @param listener Server status listener to be registered. + * @param currentState Notify about current server status after every check when true. + * @param newState Notify about server status change for new states provided as this argument. + * @return Value of true when server instance was successfully added into scheduler and + * status checking job was started or false otherwise. + */ + public static boolean add(final PayaraServer srv, + final GlassFishStatusListener listener, final boolean currentState, + final GlassFishStatus... newState) { + StatusScheduler scheduler = StatusScheduler.getInstance(); + if (!scheduler.exists(srv)) { + GlassFishStatusEntity status = new GlassFishStatusEntity(srv); + return StatusScheduler.getInstance() + .add(status, listener, currentState, newState); + } else { + return false; + } + } + + /** + * Get current GlassFish server instance status. + *

+ * When status checking is disabled, it will restart it and return current status which is probably + * UNKNOWN. + *

+ * + * @param srv GlassFish server instance to be searched. + * @return GlassFish server instance status. Returns UNKNOWN value for unregistered + * server instance. + */ + public static GlassFishStatus getStatus(final PayaraServer srv) { + GlassFishServerStatus status = StatusScheduler.getInstance().get(srv, null); + return status != null ? status.getStatus() : GlassFishStatus.UNKNOWN; + } + + /** + * Get current GlassFish server instance status. + *

+ * When status checking is disabled, it will restart it and return current status which is probably + * UNKNOWN. If listener is provided, it will be registered to receive any state change + * notification following status checking restart. This listener won't be unregistered automatically + * so caller should handle it properly. + *

+ * + * @param srv GlassFish server instance to be searched. + * @param listener Server status listener to be registered when status checking is being restarted. + * @return GlassFish server instance status. Returns UNKNOWN value for unregistered + * server instance. + */ + public static GlassFishStatus getStatus(final PayaraServer srv, + final GlassFishStatusListener listener) { + GlassFishServerStatus status = StatusScheduler.getInstance().get(srv, listener); + return status != null ? status.getStatus() : GlassFishStatus.UNKNOWN; + } + + /** + * Get current GlassFish server instance {@link GlassFishServerStatus} object. + *

+ * When status checking is disabled, it will restart it and return current status which is probably + * UNKNOWN. + *

+ * + * @param srv GlassFish server instance to be searched. + * @return GlassFish server status {@link GlassFishServerStatus} object. Returns null + * value for unregistered server instance. + */ + public static GlassFishServerStatus get(final PayaraServer srv) { + return StatusScheduler.getInstance().get(srv, null); + } + + /** + * Get current GlassFish server instance {@link GlassFishServerStatus} object. + *

+ * When status checking is disabled, it will restart it and return current status which is probably + * UNKNOWN. If listener is provided, it will be registered to receive any state change + * notification following status checking restart. This listener won't be unregistered automatically + * so caller should handle it properly. + *

+ * + * @param srv GlassFish server instance to be searched. + * @param listener Server status listener to be registered when status checking is being restarted. + * @return GlassFish server status {@link GlassFishServerStatus} object. Returns null + * value for unregistered server instance. + */ + public static GlassFishServerStatus get(final PayaraServer srv, + final GlassFishStatusListener listener) { + return StatusScheduler.getInstance().get(srv, listener); + } + + /** + * Trigger startup mode for GlassFish server instance. + *

+ * This will switch status monitoring into startup mode where server is being checked more often. + *

+ * + * @param srv GlassFish server instance to be switched into startup mode. + * @param force Force startup mode for GlassFish server instance from any state then + * true. + * @param listener Server status listener to be registered together with switching into startup + * mode. + * @param newState Notify about server status change for new states provided as this argument. + * @return Value of true when server instance was successfully added into scheduler and + * status checking job was started or false otherwise. + */ + public static boolean start(final PayaraServer srv, final boolean force, + final GlassFishStatusListener listener, + final GlassFishStatus... newState) { + return StatusScheduler.getInstance().start( + srv, force, listener, newState); + } + + /** + * Trigger startup mode for GlassFish server instance. + *

+ * This will switch status monitoring into startup mode where server is being checked more often. + *

+ * + * @param srv GlassFish server instance to be switched into startup mode. + * @return Value of true when server instance was successfully added into scheduler and + * status checking job was started or false otherwise. + */ + public static boolean start(final PayaraServer srv) { + return StatusScheduler.getInstance().start(srv, false, null); + } + + /** + * Trigger shutdown mode for GlassFish server instance. + *

+ * This will switch status monitoring into shutdown mode where server is being checked more often. + *

+ * + * @param srv GlassFish server instance to be switched into shutdown mode. + * @return Value of true when server instance was successfully added into scheduler and + * status checking job was started or false otherwise. + */ + public static boolean shutdown(final PayaraServer srv) { + return StatusScheduler.getInstance().shutdown(srv); + } + + /** + * Remove GlassFish server instance from scheduler and stop server status checking jobs. + *

+ * It is possible to call this method for the same GlassFisg server instance many times. Server + * instance will be removed only if it is registered. + *

+ * + * @param srv GlassFish server instance to be removed. + * @return Value of true when server instance was successfully removed from scheduler + * and status checking job was stopped or false when server instance was not + * registered. + */ + public static boolean remove(final PayaraServer srv) { + return StatusScheduler.getInstance().remove(srv); + } + + /** + * Suspend server status monitoring for GlassFisg server instance. + *

+ * + * @param srv GlassFish server instance for which to suspend monitoring. + * @return Value of true when server instance monitoring was suspended or + * false when server instance is not registered. + */ + public static boolean suspend(final PayaraServer srv) { + return StatusScheduler.getInstance().suspend(srv); + } + + /** + * Register server status listener to be notified about current server status after every check. + *

+ * + * @param srv GlassFish server instance being monitored. + * @param listener Server status listener to be registered. + * @return Value of true when listener was added or false when this + * listener was already registered or GlassFish server instance was not registered. + */ + public static boolean addCheckListener(final PayaraServer srv, + final GlassFishStatusListener listener) { + final StatusJob job = StatusScheduler.getInstance().getJob(srv); + if (job != null) { + return job.addCurrStatusListener(listener); + } else { + return false; + } + } + + /** + * Register server status listener to be notified about server status change. + *

+ * + * @param srv GlassFish server instance being monitored. + * @param listener Server status listener to be registered. + * @param newState Notify about server status change for new states provided as this argument. + * @return Value of true when listener was added in at least one list or + * false when this listener was already registered in all requested lists or GlassFish + * server instance was not registered. + */ + public static boolean addChangeListener(final PayaraServer srv, + final GlassFishStatusListener listener, + final GlassFishStatus... newState) { + final StatusJob job = StatusScheduler.getInstance().getJob(srv); + if (job != null) { + return job.addNewStatusListener(listener, newState); + } else { + return false; + } + } + + /** + * Register server status listener to be notified about server status change. + *

+ * + * @param srv GlassFish server instance being monitored. + * @param listener Server status listener to be registered. + * @return Value of true when listener was added in at least one list or + * false when this listener was already registered in all requested lists or GlassFish + * server instance was not registered. + */ + public static boolean addErrorListener(final PayaraServer srv, + final GlassFishStatusListener listener) { + final StatusJob job = StatusScheduler.getInstance().getJob(srv); + if (job != null) { + return job.addErrorListener(listener); + } else { + return false; + } + } + + /** + * Register server status listener. + *

+ * + * @param srv GlassFish server instance being monitored. + * @param listener Server status listener to be registered. + * @param currentState Notify about current server status after every check when true. + * @param newState Notify about server status change for new states provided as this argument. + * @return Value of true when listener was added in at least one list or + * false when this listener was already registered in all requested lists or GlassFish + * server instance was not registered. + */ + public static boolean addListener(final PayaraServer srv, + final GlassFishStatusListener listener, final boolean currentState, + final GlassFishStatus... newState) { + final StatusJob job = StatusScheduler.getInstance().getJob(srv); + if (job != null) { + return job.addStatusListener(listener, currentState, newState); + } else { + return false; + } + } + + /** + * Unregister server status listener. + *

+ * + * @param srv GlassFish server instance being monitored. + * @param listener Server status listener to be unregistered. + * @return Value of true when listener was found and removed or false when + * listener was not found among registered listeners or GlassFish server instance was not + * registered. + */ + public static boolean removeListener(final PayaraServer srv, + final GlassFishStatusListener listener) { + final StatusJob job = StatusScheduler.getInstance().getJob(srv); + if (job != null) { + return job.removeStatusListener(listener); + } else { + return false; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Convert GlassFishStatus value to String. + *

+ * + * @return A String representation of the value of this object. + */ + @Override + public String toString() { + final String METHOD = "toString"; + switch (this) { + case UNKNOWN: + return UNKNOWN_STR; + case OFFLINE: + return OFFLINE_STR; + case STARTUP: + return STARTUP_STR; + case ONLINE: + return ONLINE_STR; + case SHUTDOWN: + return SHUTDOWN_STR; + // This is unrecheable. Being here means this class does not handle + // all possible values correctly. + default: + throw new DataException( + LOGGER.excMsg(METHOD, "invalidState")); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishStatusListener.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishStatusListener.java new file mode 100644 index 00000000..f69c0f67 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishStatusListener.java @@ -0,0 +1,82 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishStatusTask; + +/** + * GlassFish server status listener. + *

+ * Receives notifications about every GlassFish server status check result or about GlassFish server + * status changes. + *

+ * + * @author Tomas Kraus + */ +public interface GlassFishStatusListener { + + /** + * Callback to notify about current server status after every check when enabled. + *

+ * + * @param server GlassFish server instance being monitored. + * @param status Current server status. + * @param task Last GlassFish server status check task details. + */ + public void currentState(final PayaraServer server, + final GlassFishStatus status, final GlassFishStatusTask task); + + /** + * Callback to notify about server status change when enabled. + *

+ * + * @param server GlassFish server instance being monitored. + * @param status Current server status. + * @param task Last GlassFish server status check task details. + */ + public void newState(final PayaraServer server, + final GlassFishStatus status, final GlassFishStatusTask task); + + /** + * Callback to notify about server status check failures. + *

+ * + * @param server GlassFish server instance being monitored. + * @param task GlassFish server status check task details. + */ + public void error(final PayaraServer server, + final GlassFishStatusTask task); + + /** + * Callback to notify about status listener being registered. + *

+ * May be called multiple times for individual event sets during registration phase. + */ + public void added(); + + /** + * Callback to notify about status listener being unregistered. + *

+ * Will be called once during listener removal phase when was found registered for at least one + * event set. + */ + public void removed(); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishToolsConfig.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishToolsConfig.java new file mode 100644 index 00000000..d711b7d7 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishToolsConfig.java @@ -0,0 +1,71 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk; + +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * GlassFisg Tooling Library configuration. + *

+ * + * @author Tomas Kraus + */ +public class GlassFishToolsConfig { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(GlassFishToolsConfig.class); + + /** Proxy settings usage for loopback addresses. */ + private static volatile boolean proxyForLoopback = true; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Do not use proxy settings for loopback addresses. + */ + public static void noProxyForLoopback() { + proxyForLoopback = false; + } + + /** + * Use proxy settings for loopback addresses. + *

+ * This is default behavior. + */ + public static void useProxyForLoopback() { + proxyForLoopback = true; + } + + /** + * Get proxy settings usage for loopback addresses configuration value. + *

+ * + * @return Proxy settings usage for loopback addresses configuration value. + */ + public static boolean getProxyForLoopback() { + return proxyForLoopback; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/LogMessages.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/LogMessages.properties new file mode 100644 index 00000000..189aed26 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/LogMessages.properties @@ -0,0 +1,21 @@ +################################################################################ +# Log messages # +# Use .. notation for keys. # +################################################################################ + +################################################################################ +# Log messages for tests # +################################################################################ + +# CommonTest class +CommonTest.intProperty.undefined=Property {0} is not defined. +CommonTest.intGlassFishProperty.undefined=Property {0} is not defined. +CommonTest.intGlassFishProperty.cantSet=Cannot set {0} property. +CommonTest.intGlassFishProperty.numberFormat=Caught NumberFormatException \ +exception in intGlassFishProperty() method: +CommonTest.createGlassfishServer.accessorFailed=Getting GlassFish property \ +accessor method failed: +CommonTest.createGlassfishServer.unknownVersion=Cannot set {0} property: \ +Version number was not recognized. +CommonTest.createGlassfishServer.unknownAdminInterface=Cannot set {0} \ +property: Admin interface was not recognized. diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/PayaraIdeException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/PayaraIdeException.java new file mode 100644 index 00000000..788578e6 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/PayaraIdeException.java @@ -0,0 +1,167 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk; + +import java.text.MessageFormat; +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * Common GlassFish IDE SDK Exception. + *

+ * Base exception for GlassFish IDE SDK Exception contains all common code. All exceptions are + * logging themselves on WARNING level when created. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class PayaraIdeException extends RuntimeException { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * + */ + private static final long serialVersionUID = 1L; + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(PayaraIdeException.class); + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create exception message from message pattern and arguments using + * {@link java.text.MessageFormat}. + *

+ * + * @param msg The detail message pattern. + * @param arguments Arguments to be inserted into message pattern. + */ + private static String formatMessage(String msg, Object... arguments) { + if (arguments != null && arguments.length > 0) { + return MessageFormat.format(msg, arguments); + } else { + return msg; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFishIdeException without detail message. + */ + public PayaraIdeException() { + super(); + final String METHOD = "init"; + // Log exception in WARNING level. + LOGGER.exception(Level.WARNING, LOGGER.excMsg(METHOD, "empty")); + } + + /** + * Constructs an instance of GlassFishIdeException with the specified detail message. + *

+ * + * @param msg The detail message. + */ + public PayaraIdeException(String msg) { + super(msg); + final String METHOD = "init"; + // Log exception in WARNING level. + if (LOGGER.isLoggable(Level.WARNING)) { + String hdr = LOGGER.excMsg(METHOD, "msg"); + String sep = msg != null ? ": " : "."; + StringBuilder sb = new StringBuilder(hdr.length() + sep.length() + + (msg != null ? msg.length() : 0)); + sb.append(hdr); + sb.append(sep); + if (msg != null) { + sb.append(msg); + } + LOGGER.exception(Level.WARNING, sb.toString()); + } + } + + /** + * Constructs an instance of GlassFishIdeException with the specified detail message + * and arguments. + *

+ * Uses {@link java.text.MessageFormat} to format message. + *

+ * + * @param msg The detail message. + * @param arguments Arguments to be inserted into message. + */ + public PayaraIdeException(String msg, Object... arguments) { + this(formatMessage(msg, arguments)); + } + + /** + * Constructs an instance of GlassFishIdeException with the specified detail message + * and cause. Exception is logged on WARN level. + *

+ * Note that the detail message associated with {@code cause} is not automatically + * incorporated int his runtime exception's detail message. + *

+ * + * @param msg the detail message (which is saved for later retrieval by the {@link #getMessage()} + * method). + * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A + * null value is permitted, and indicates that the cause is nonexistent or unknown.) + */ + public PayaraIdeException(String msg, Throwable cause) { + super(msg, cause); + final String METHOD = "init"; + // Log exception in WARNING level. + if (LOGGER.isLoggable(Level.WARNING)) { + String hdr = LOGGER.excMsg(METHOD, "msg"); + String sep = msg != null ? ": " : "."; + StringBuilder sb = new StringBuilder(hdr.length() + sep.length() + + (msg != null ? msg.length() : 0)); + sb.append(hdr); + sb.append(sep); + if (msg != null) { + sb.append(msg); + } + LOGGER.exception(Level.WARNING, sb.toString()); + // Log cause exception in WARNING level. + if (cause != null) { + String className = cause.getClass().getName(); + msg = cause.getMessage(); + sep = msg != null ? ": " : "."; + hdr = LOGGER.excMsg(METHOD, "cause"); + sb = new StringBuilder(hdr.length() + className.length() + + sep.length() + (msg != null ? msg.length() : 0)); + sb.append(hdr); + sb.append(className); + sb.append(sep); + if (msg != null) { + sb.append(msg); + } + LOGGER.exception(Level.WARNING, sb.toString()); + } + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskEvent.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskEvent.java new file mode 100644 index 00000000..1ab2f30e --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskEvent.java @@ -0,0 +1,221 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk; + +import java.util.HashMap; +import java.util.Map; + +/** + * Events that caused state of GlassFish server administration command execution change. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public enum TaskEvent { + + //////////////////////////////////////////////////////////////////////////// + // Enum values // + //////////////////////////////////////////////////////////////////////////// + + /** Task queued for execution. */ + SUBMIT, + /** Start of task. */ + START, + /** Exception in task. */ + EXCEPTION, + /** Illegal task state. */ + ILLEGAL_STATE, + /** Missing server process. */ + PROCESS_NOT_EXISTS, + /** Process not running. */ + PROCESS_NOT_RUNNING, + /** Server command running. */ + CMD_RUNNING, + /** Server command exception. */ + CMD_EXCEPTION, + /** Server command completed. */ + CMD_COMPLETED, + /** Server command failed. */ + CMD_FAILED, + /** + * Authorization failed on HTTP protocol level (401 or 403 response). This is usually handled by + * java.net.Authenticator. + */ + AUTH_FAILED_HTTP, + /** + * Authorization failed on asadmin response level (response in Manifest). Here + * java.net.Authenticator does nothing. + */ + AUTH_FAILED, + /** Empty message received. */ + EMPTY_MESSAGE, + /** Java VM not found. */ + NO_JAVA_VM, + /** Java VM version is wrong. */ + WRONG_JAVA_VM, + /** Java VM execution failed. */ + JAVA_VM_EXEC_FAILED, + /** Signals wrong proxy settings. */ + BAD_GATEWAY; + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** A String representation of SUBMIT value. */ + private static final String SUBMIT_STR = "Submit"; + + /** A String representation of START value. */ + private static final String START_STR = "Start"; + + /** A String representation of EXCEPTION value. */ + private static final String EXCEPTION_STR = "Exception"; + + /** A String representation of ILLEGAL_STATE value. */ + private static final String ILLEGAL_STATE_STR = "IllegalState"; + + /** A String representation of PROCESS_NOT_EXISTS value. */ + private static final String PROCESS_NOT_EXISTS_STR = "ProcessNotExists"; + + /** A String representation of PROCESS_NOT_RUNNING value. */ + private static final String PROCESS_NOT_RUNNING_STR = "ProcessNotRunning"; + + /** A String representation of CMD_RUNNING value. */ + private static final String CMD_RUNNING_STR = "CmdRunning"; + + /** A String representation of CMD_EXCEPTION value. */ + private static final String CMD_EXCEPTION_STR = "CmdException"; + + /** A String representation of CMD_COMPLETED value. */ + private static final String CMD_COMPLETED_STR = "CmdCompleted"; + + /** A String representation of CMD_FAILED value. */ + private static final String CMD_FAILED_STR = "CmdFailed"; + + /** A String representation of AUTH_FAILED_HTTP value. */ + private static final String AUTH_FAILED_HTTP_STR = "AuthFailedHttp"; + + /** A String representation of AUTH_FAILED value. */ + private static final String AUTH_FAILED_STR = "AuthFailed"; + + /** A String representation of EMPTY_MESSAGE value. */ + private static final String EMPTY_MESSAGE_STR = "EmptyMessage"; + + /** A String representation of NO_JAVA_VM value. */ + private static final String NO_JAVA_VM_STR = "NoJavaVm"; + + /** A String representation of NO_JAVA_VM value. */ + private static final String WRONG_JAVA_VM_STR = "WrongJavaVm"; + + /** A String representation of JAVA_VM_EXEC_FAILED value. */ + private static final String JAVA_VM_EXEC_FAILED_STR = "JavaVmExecFailed"; + + /** A String representation of BAD_GATEWAY value. */ + private static final String BAD_GATEWAY_STR = "BadGateway"; + + /** + * Stored String values for backward String conversion. + */ + private static final Map stringValuesMap = new HashMap(values().length); + + // Initialize backward String conversion Map. + static { + for (TaskEvent state : TaskEvent.values()) { + stringValuesMap.put(state.toString().toUpperCase(), state); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Returns a TaskEvent with a value represented by the specified String. + * The TaskEvent returned represents existing value only if specified + * String matches any String returned by toString method. + * Otherwise null value is returned. + *

+ * + * @param eventStr Value containing TaskEvent toString representation. + * @return TaskEvent value represented by String or null if + * value was not recognized. + */ + public static TaskEvent toValue(String eventStr) { + if (eventStr != null) { + return (stringValuesMap.get(eventStr.toUpperCase())); + } else { + return null; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Convert TaskEvent value to String. + *

+ * + * @return A String representation of the value of this object. + */ + @Override + public String toString() { + switch (this) { + case SUBMIT: + return SUBMIT_STR; + case START: + return START_STR; + case EXCEPTION: + return EXCEPTION_STR; + case ILLEGAL_STATE: + return ILLEGAL_STATE_STR; + case PROCESS_NOT_EXISTS: + return PROCESS_NOT_EXISTS_STR; + case PROCESS_NOT_RUNNING: + return PROCESS_NOT_RUNNING_STR; + case CMD_RUNNING: + return CMD_RUNNING_STR; + case CMD_EXCEPTION: + return CMD_EXCEPTION_STR; + case CMD_COMPLETED: + return CMD_COMPLETED_STR; + case CMD_FAILED: + return CMD_FAILED_STR; + case AUTH_FAILED_HTTP: + return AUTH_FAILED_HTTP_STR; + case AUTH_FAILED: + return AUTH_FAILED_STR; + case EMPTY_MESSAGE: + return EMPTY_MESSAGE_STR; + case NO_JAVA_VM: + return NO_JAVA_VM_STR; + case WRONG_JAVA_VM: + return WRONG_JAVA_VM_STR; + case JAVA_VM_EXEC_FAILED: + return JAVA_VM_EXEC_FAILED_STR; + case BAD_GATEWAY: + return BAD_GATEWAY_STR; + // This is unrecheable. Returned null value means that some + // enum value is not handled correctly. + default: + return null; + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskState.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskState.java new file mode 100644 index 00000000..d1c52ebc --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskState.java @@ -0,0 +1,127 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk; + +import java.util.HashMap; +import java.util.Map; + +/** + * Current state of GlassFish server administration command execution + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public enum TaskState { + + //////////////////////////////////////////////////////////////////////////// + // Enum values // + //////////////////////////////////////////////////////////////////////////// + + /** Value representing task waiting in executor queue. */ + READY, + + /** Value representing running task. */ + RUNNING, + + /** Value representing successfully completed task (with no errors). */ + COMPLETED, + + /** Value representing failed task. */ + FAILED; + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** A String representation of READY value. */ + private static final String READY_STR = "READY"; + + /** A String representation of RUNNING value. */ + private static final String RUNNING_STR = "RUNNING"; + + /** A String representation of COMPLETED value. */ + private static final String COMPLETED_STR = "COMPLETED"; + + /** A String representation of FAILED value. */ + private static final String FAILED_STR = "FAILED"; + + /** + * Stored String values for backward String conversion. + */ + private static final Map stringValuesMap = new HashMap(values().length); + + // Initialize backward String conversion Map. + static { + for (TaskState state : TaskState.values()) { + stringValuesMap.put(state.toString().toUpperCase(), state); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Returns a TaskState with a value represented by the specified String. + * The TaskState returned represents existing value only if specified + * String matches any String returned by toString method. + * Otherwise null value is returned. + *

+ * + * @param stateStr Value containing TaskState toString representation. + * @return TaskState value represented by String or null if + * value was not recognized. + */ + public static TaskState toValue(final String stateStr) { + if (stateStr != null) { + return (stringValuesMap.get(stateStr.toUpperCase())); + } else { + return null; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Convert TaskState value to String. + *

+ * + * @return A String representation of the value of this object. + */ + @Override + public String toString() { + switch (this) { + case READY: + return READY_STR; + case RUNNING: + return RUNNING_STR; + case COMPLETED: + return COMPLETED_STR; + case FAILED: + return FAILED_STR; + // This is unrecheable. Returned null value means that some + // enum value is not handled correctly. + default: + return null; + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskStateListener.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskStateListener.java new file mode 100644 index 00000000..4ad86c0a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskStateListener.java @@ -0,0 +1,44 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk; + +/** + * GlassFish server administration command execution state report callback. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public interface TaskStateListener { + + //////////////////////////////////////////////////////////////////////////// + // Interface Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Callback to notify about GlassFish server administration command execution state change. + *

+ * + * @param newState New command execution state. + * @param event Event related to execution state change. + * @param args Additional String arguments. + */ + public void operationStateChanged(TaskState newState, TaskEvent event, + String... args); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ActionReport.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ActionReport.java new file mode 100644 index 00000000..a8f6ca98 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ActionReport.java @@ -0,0 +1,42 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * Represents response returned from server after command execution. + *

+ * Inspired by ActionReport class from module GF Admin Rest Service. In our case the interface + * allows just read-only access. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public interface ActionReport { + + public enum ExitCode { + SUCCESS, WARNING, FAILURE + } + + public ExitCode getExitCode(); + + public String getMessage(); + + public String getCommand(); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactory.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactory.java new file mode 100644 index 00000000..24b27a55 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactory.java @@ -0,0 +1,149 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import static fish.payara.eclipse.tools.server.sdk.admin.CommandException.RUNNER_INIT; +import static fish.payara.eclipse.tools.server.sdk.admin.CommandException.UNKNOWN_ADMIN_INTERFACE; +import static java.util.logging.Level.WARNING; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishAdminInterface; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.utils.Version; + +/** + * GlassFish Abstract Server Command Factory. + *

+ * Selects correct GlassFish server administration functionality depending on given GlassFish server + * entity object. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public abstract class AdminFactory { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(AdminFactory.class); + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates specific AdminFactory child class instance to build GlassFish server + * administration command runner and data objects based on provided GlassFish server version. + *

+ * + * @param version GlassFish server version. + * @return Child factory class instance to work with given GlassFish server. + */ + static AdminFactory getInstance(Version version) throws CommandException { + // Use REST interface for GlassFish 3 and 4. + return AdminFactoryRest.getInstance(); + } + + /** + * Creates specific AdminFactory child class instance to build GlassFish server + * administration command runner and data objects based on provided GlassFish server administration + * interface type. + *

+ * + * @param adminInterface GlassFish server administration interface type. + * @return Child factory class instance to work with given GlassFish server. + */ + public static AdminFactory getInstance(GlassFishAdminInterface adminInterface) throws CommandException { + switch (adminInterface) { + case REST: + return AdminFactoryRest.getInstance(); + case HTTP: + return AdminFactoryHttp.getInstance(); + // Anything else is unknown. + default: + throw new CommandException(UNKNOWN_ADMIN_INTERFACE); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Abstract methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Build runner for command interface execution and connect it with provided Command + * instance. + *

+ * + * @param payaraServer Target GlassFish server. + * @param command GlassFish server administration command entity. + * @return GlassFish server administration command execution object. + */ + public abstract Runner getRunner(PayaraServer payaraServer, Command command); + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of selected Runner child class. + *

+ * + * @param payaraServer Target GlassFish server. + * @param command GlassFish server administration command entity. + * @param runnerClass Class of newly instantiated runner + * @return GlassFish server administration command execution object. + * @throws CommandException if construction of new instance fails. + */ + Runner newRunner(PayaraServer payaraServer, Command command, Class runnerClass) throws CommandException { + + Constructor runnerConstructor = null; + Runner runner = null; + try { + runnerConstructor = runnerClass.getConstructor(PayaraServer.class, Command.class); + } catch (NoSuchMethodException | SecurityException nsme) { + throw new CommandException(RUNNER_INIT, nsme); + } + + if (runnerConstructor == null) { + return runner; + } + + try { + runner = runnerConstructor.newInstance(payaraServer, command); + } catch (InstantiationException | IllegalAccessException ie) { + throw new CommandException(RUNNER_INIT, ie); + } catch (InvocationTargetException ite) { + LOGGER.log(WARNING, "exceptionMsg", ite.getMessage()); + Throwable t = ite.getCause(); + if (t != null) { + LOGGER.log(WARNING, "cause", t.getMessage()); + } + + throw new CommandException(RUNNER_INIT, ite); + } + + return runner; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactoryHttp.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactoryHttp.java new file mode 100644 index 00000000..21adeff9 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactoryHttp.java @@ -0,0 +1,99 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Payara Server HTTP Command Factory. + *

+ * Selects correct Payara server administration functionality using HTTP command interface. + *

+ * Factory is implemented as singleton. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class AdminFactoryHttp extends AdminFactory { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Singleton object instance. */ + private static volatile AdminFactoryHttp instance; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Return existing singleton instance of this class or create a new one when no instance exists. + *

+ * + * @return AdminFactoryHttp singleton instance. + */ + static AdminFactoryHttp getInstance() { + if (instance != null) { + return instance; + } + + synchronized (AdminFactoryHttp.class) { + if (instance == null) { + instance = new AdminFactoryHttp(); + } + } + + return instance; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Build runner for HTTP command interface execution and connect it with provided + * Command instance. + *

+ * + * @param server GlassFish server entity object. + * @param cmd GlassFish server administration command entity. + * @return GlassFish server administration command execution object. + */ + @Override + public Runner getRunner(PayaraServer server, Command cmd) { + Runner runner; + + Class commandClass = cmd.getClass(); + RunnerHttpClass runnerHttpClass = commandClass.getAnnotation(RunnerHttpClass.class); + + if (runnerHttpClass != null) { + String command = runnerHttpClass.command(); + runner = newRunner(server, cmd, runnerHttpClass.runner()); + if (command != null && !command.isEmpty()) { + cmd.command = command; + } + } else { + runner = new RunnerHttp(server, cmd); + } + + return runner; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactoryRest.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactoryRest.java new file mode 100644 index 00000000..39b3aa9e --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactoryRest.java @@ -0,0 +1,100 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * GlassFish Server REST Command Factory. + *

+ * Selects correct GlassFish server administration functionality using REST command interface. + *

+ * Factory is implemented as singleton. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class AdminFactoryRest extends AdminFactory { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Singleton object instance. */ + private static volatile AdminFactoryRest instance; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Return existing singleton instance of this class or create a new one when no instance exists. + *

+ * + * @return AdminFactoryRest singleton instance. + */ + static AdminFactoryRest getInstance() { + if (instance != null) { + return instance; + } + + synchronized (AdminFactoryRest.class) { + if (instance == null) { + instance = new AdminFactoryRest(); + } + } + + return instance; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Build runner for REST command interface execution and connect it with provided + * Command instance. + *

+ * + * @param payaraServer GlassFish server entity object. + * @param cmd GlassFish server administration command entity. + * @return GlassFish server administration command execution object. + */ + @Override + public Runner getRunner(final PayaraServer payaraServer, final Command cmd) { + Runner runner; + + Class commandClass = cmd.getClass(); + RunnerRestClass runnerRestClass = commandClass.getAnnotation(RunnerRestClass.class); + + if (runnerRestClass != null) { + String command = runnerRestClass.command(); + runner = newRunner(payaraServer, cmd, runnerRestClass.runner()); + + if (command != null && !command.isEmpty()) { + cmd.command = command; + } + } else { + runner = new RunnerRest(payaraServer, cmd); + } + + return runner; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Command.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Command.java new file mode 100644 index 00000000..055f5635 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Command.java @@ -0,0 +1,86 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * GlassFish server administration command entity. + *

+ * Holds common data for administration command. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public abstract class Command { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Server command represented by this object. */ + protected String command; + + /** Indicate whether we shall retry command execution. */ + protected boolean retry; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server administration command entity with specified server + * command. + *

+ * + * @param command Server command represented by this object. + */ + protected Command(final String command) { + this.command = command; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Returns server command represented by this object. Set in constructor. e.g. "deploy", + * "list-applications", etc. + *

+ * + * @return command string represented by this object. + */ + public String getCommand() { + return command; + } + + // This is also kind of getter. + /** + * Sometimes (e.g. during startup), the server does not accept commands. In such cases, it will + * block for 20 seconds and then return with the message "V3 cannot process this command at this + * time, please wait". + *

+ * In such cases, we set a flag and have the option to reissue the command. + *

+ * + * @return true if server responded with its "please wait" message. + */ + public boolean retry() { + return retry; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandAddResources.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandAddResources.java new file mode 100644 index 00000000..45167e48 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandAddResources.java @@ -0,0 +1,127 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import static java.util.concurrent.TimeUnit.MILLISECONDS; + +import java.io.File; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeoutException; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * Command registers resources defined in provided xml file on specified target. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +@RunnerHttpClass(runner = RunnerHttpAddResources.class) +@RunnerRestClass(runner = RunnerRestAddResources.class) +public class CommandAddResources extends CommandTarget { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(CommandAddResources.class); + + /** Command string for create-cluster command. */ + private static final String COMMAND = "add-resources"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Add resource to target server. + *

+ * + * @param server GlassFish server entity. + * @param xmlResourceFile File object pointing to XML file containing resources to be added. + * @param target GlassFish server target. + * @return Add resource task response. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultString addResource(PayaraServer server, File xmlResourceFile, String target) throws PayaraIdeException { + String METHOD = "addResource"; + + Command command = new CommandAddResources(xmlResourceFile, target); + Future future = ServerAdmin.exec(server, command); + try { + return future.get(); + } catch (InterruptedException | ExecutionException | CancellationException ie) { + throw new PayaraIdeException(LOGGER.excMsg(METHOD, "exception"), ie); + } + } + + /** + * Add resource to target server. + *

+ * + * @param server GlassFish server entity. + * @param xmlResourceFile File object pointing to XML file containing resources to be added. + * @param target GlassFish server target. + * @param timeout Administration command execution timeout [ms]. + * @return Add resource task response. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultString addResource(PayaraServer server, File xmlResourceFile, String target, long timeout) + throws PayaraIdeException { + String METHOD = "addResource"; + Command command = new CommandAddResources(xmlResourceFile, target); + Future future = ServerAdmin.exec(server, command); + + try { + return future.get(timeout, MILLISECONDS); + } catch (InterruptedException | ExecutionException | CancellationException ie) { + throw new PayaraIdeException(LOGGER.excMsg(METHOD, "exception"), ie); + } catch (TimeoutException te) { + throw new PayaraIdeException(LOGGER.excMsg(METHOD, "exceptionWithTimeout", Long.toString(timeout)), te); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** File object pointing to xml file that contains resources to be added. */ + File xmlResFile; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server add-resources command entity. + *

+ * + * @param xmlResourceFile File object pointing to XML file containing resources to be added. + * @param target GlassFish server target. + */ + public CommandAddResources(final File xmlResourceFile, final String target) { + super(COMMAND, target); + xmlResFile = xmlResourceFile; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandChangeAdminPassword.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandChangeAdminPassword.java new file mode 100644 index 00000000..6bd196db --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandChangeAdminPassword.java @@ -0,0 +1,66 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * GlassFish server change administrator's password administration command entity. + *

+ * + * @author Tomas Kraus + */ +@RunnerHttpClass(runner = RunnerAsadminChangeAdminPassword.class) +@RunnerRestClass(runner = RunnerAsadminChangeAdminPassword.class) +public class CommandChangeAdminPassword extends CommandJava { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for change administrator's password command. */ + private static final String COMMAND = "change-admin-password"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * GlassFish administrator's new password to be set. Value of null or empty + * String means no password. + */ + final String password; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server administration command entity with specified server + * command, Java SE home and class path. + *

+ * + * @param javaHome Java SE home used to select JRE for GlassFish server. + * @param password GlassFish administrator's new password to be set. + */ + public CommandChangeAdminPassword(final String javaHome, + final String password) { + super(COMMAND, javaHome); + this.password = password; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateAdminObject.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateAdminObject.java new file mode 100644 index 00000000..7a2e1316 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateAdminObject.java @@ -0,0 +1,103 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.Map; + +/** + * Command that creates administered object with the specified JNDI name and the interface + * definition for a resource adapter on server. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpCreateAdminObject.class) +public class CommandCreateAdminObject extends Command { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for create administered object command. */ + private static final String COMMAND = "create-admin-object"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** The JNDI name of this JDBC resource. */ + final String jndiName; + + /** Resource type. */ + final String resType; + + /** + * The name of the resource adapter associated with this administered object. + */ + final String raName; + + /** Optional properties for configuring administered object. */ + final Map properties; + + /** If this object is enabled. */ + final boolean enabled; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server create administered object command entity. + *

+ * + * @param jndiName The JNDI name of this JDBC resource. + * @param resType Resource type. + * @param raName The name of the resource adapter associated with this administered object. + * @param properties Optional properties for configuring the pool. + * @param enabled If this object is enabled. + */ + public CommandCreateAdminObject(final String jndiName, + final String resType, final String raName, + final Map properties, final boolean enabled) { + super(COMMAND); + this.resType = resType; + this.jndiName = jndiName; + this.raName = raName; + this.properties = properties; + this.enabled = enabled; + } + + /** + * Constructs an instance of GlassFish server create administered object command entity. + *

+ * This object will be enabled on server by default. + *

+ * + * @param jndiName The JNDI name of this JDBC resource. + * @param resType Resource type. + * @param raName The name of the resource adapter associated with this administered object. + * @param properties Optional properties for configuring the pool. + */ + public CommandCreateAdminObject(final String jndiName, + final String resType, final String raName, + final Map properties) { + this(jndiName, resType, raName, properties, true); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateCluster.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateCluster.java new file mode 100644 index 00000000..6880d1fb --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateCluster.java @@ -0,0 +1,54 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * GlassFish Server Cerate Cluster Command Entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpTarget.class) +@RunnerRestClass(runner = RunnerRestCreateCluster.class) +public class CommandCreateCluster extends CommandTarget { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for create-cluster command. */ + private static final String COMMAND = "create-cluster"; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server create-cluster command entity. + *

+ * + * @param clusterName Name of the created cluster. + */ + public CommandCreateCluster(String clusterName) { + super(COMMAND, clusterName); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateConnector.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateConnector.java new file mode 100644 index 00000000..f372b3ae --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateConnector.java @@ -0,0 +1,109 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.Map; + +/** + * Command that creates connector resource with the specified JNDI name and the interface definition + * for a resource adapter on server. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpCreateConnector.class) +@RunnerRestClass(runner = RunnerRestCreateConnector.class) +public class CommandCreateConnector extends CommandTarget { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for create connector resource command. */ + private static final String COMMAND = "create-connector-resource"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** The JNDI name of this connector resource. */ + final String jndiName; + + /** Connection pool unique name (and ID). */ + final String poolName; + + /** Optional properties for configuring the resource. */ + final Map properties; + + /** If this object is enabled. */ + final boolean enabled; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server create connector resource command entity. + *

+ * + * @param jndiName The JNDI name of this connector resource. + * @param poolName Connection pool unique name (and ID). + * @param properties Optional properties for configuring the pool. + * @param enabled If this object is enabled. + * @param target Name of the cluster or instance where the resource will be created. + */ + public CommandCreateConnector(final String jndiName, final String poolName, + final Map properties, final boolean enabled, final String target) { + super(COMMAND, target); + this.jndiName = jndiName; + this.poolName = poolName; + this.properties = properties; + this.enabled = enabled; + } + + /** + * Constructs an instance of GlassFish server create connector resource command entity. + *

+ * + * @param jndiName The JNDI name of this connector resource. + * @param poolName Connection pool unique name (and ID). + * @param properties Optional properties for configuring the pool. + * @param enabled If this object is enabled. + */ + public CommandCreateConnector(final String jndiName, final String poolName, + final Map properties, final boolean enabled) { + this(jndiName, poolName, properties, enabled, null); + } + + /** + * Constructs an instance of GlassFish server create connector resource command entity. + *

+ * This object will be enabled on server by default. + *

+ * + * @param jndiName The JNDI name of this connector resource. + * @param poolName Connection pool unique name (and ID). + * @param properties Optional properties for configuring the pool. + */ + public CommandCreateConnector(final String jndiName, final String poolName, + final Map properties) { + this(jndiName, poolName, properties, true); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateConnectorConnectionPool.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateConnectorConnectionPool.java new file mode 100644 index 00000000..5d17dd35 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateConnectorConnectionPool.java @@ -0,0 +1,100 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.Map; + +/** + * Command that creates a pool of connections to an enterprise information system (EIS). + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpCreateConnectorConnectionPool.class) +@RunnerRestClass(runner = RunnerRestCreateConnectorPool.class) +public class CommandCreateConnectorConnectionPool extends Command { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for create EIS connection pool command. */ + private static final String COMMAND = "create-connector-connection-pool"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Connection pool unique name (and ID). */ + final String poolName; + + /** The name of the resource adapter. */ + final String raName; + + /** The name of the connection definition. */ + final String connectionDefinition; + + /** + * Optional properties for configuring the pool. + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
LazyConnectionEnlistmentDeprecated. Use the equivalent option. Default value is false.
LazyConnectionAssociationDeprecated. Use the equivalent option. Default value is false.
AssociateWithThreadDeprecated. Use the equivalent option. Default value is false.
MatchConnectionsDeprecated. Use the equivalent option. Default value is false.
+ */ + final Map properties; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server create EIS connection pool command entity. + *

+ * + * @param poolName Connection pool unique name (and ID). + * @param raName The name of the resource adapter. + * @param connectionDefinition The name of the connection definition. + * @param properties Optional properties for configuring the resource. + */ + public CommandCreateConnectorConnectionPool(final String poolName, + final String raName, final String connectionDefinition, + final Map properties) { + super(COMMAND); + this.poolName = poolName; + this.raName = raName; + this.connectionDefinition = connectionDefinition; + this.properties = properties; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateInstance.java new file mode 100644 index 00000000..de5d644a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateInstance.java @@ -0,0 +1,64 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * GlassFish Server Create Instance Command Entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpCreateInstance.class) +@RunnerRestClass(runner = RunnerRestCreateInstance.class) +public class CommandCreateInstance extends CommandTargetName { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for create-instance command. */ + private static final String COMMAND = "create-instance"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Target GlassFish node where instance will be created. */ + final String node; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server create-instance command entity. + *

+ * + * @param name Name of instance to create. + * @param target Target GlassFish cluster or null for standalone instance. + * @param node Target GlassFish node where instance will be created. + */ + public CommandCreateInstance(String name, String target, String node) { + super(COMMAND, name, target); + this.node = node; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateJDBCConnectionPool.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateJDBCConnectionPool.java new file mode 100644 index 00000000..29a204e1 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateJDBCConnectionPool.java @@ -0,0 +1,245 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.Map; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * Command that creates JDBC connection pool on server. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpCreateJDBCConnectionPool.class) +@RunnerRestClass(runner = RunnerRestCreateJDBCConnectionPool.class) +public class CommandCreateJDBCConnectionPool extends Command { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for create JDBC connection pool command. */ + private static final String COMMAND = "create-jdbc-connection-pool"; + + /** Error message for administration command execution exception . */ + private static final String ERROR_MESSAGE = "Create JDBC connection pool failed."; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * create JDBC connection pool. + *

+ * + * @param server GlassFish server entity. + * @param connectionPoolId Connection pool unique name (and ID). + * @param dataSourceClassName The name of the vendor-supplied JDBC data source resource manager. + * @param resType Resource type. + * @param properties Optional properties for configuring the pool. + * @return Create JDBC connection pool task response. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultString createJDBCConnectionPool( + final PayaraServer server, final String connectionPoolId, + final String dataSourceClassName, final String resType, + final Map properties) throws PayaraIdeException { + Command command = new CommandCreateJDBCConnectionPool(connectionPoolId, + dataSourceClassName, resType, properties); + Future future = ServerAdmin + .exec(server, command); + try { + return future.get(); + } catch (InterruptedException | ExecutionException + | CancellationException ie) { + throw new PayaraIdeException(ERROR_MESSAGE, ie); + } + } + + /** + * Create JDBC connection pool. + *

+ * + * @param server GlassFish server entity. + * @param connectionPoolId Connection pool unique name (and ID). + * @param dataSourceClassName The name of the vendor-supplied JDBC data source resource manager. + * @param resType Resource type. + * @param properties Optional properties for configuring the pool. + * @param timeout Administration command execution timeout [ms]. + * @return Create JDBC connection pool task response. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultString createJDBCConnectionPool( + final PayaraServer server, final String connectionPoolId, + final String dataSourceClassName, final String resType, + final Map properties, final long timeout) + throws PayaraIdeException { + Command command = new CommandCreateJDBCConnectionPool(connectionPoolId, + dataSourceClassName, resType, properties); + Future future = ServerAdmin + .exec(server, command); + try { + return future.get(timeout, TimeUnit.MILLISECONDS); + } catch (InterruptedException | ExecutionException + | CancellationException ie) { + throw new PayaraIdeException(ERROR_MESSAGE, ie); + } catch (TimeoutException te) { + throw new PayaraIdeException( + ERROR_MESSAGE + " in " + timeout + "ms", te); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Connection pool unique name (and ID). */ + final String connectionPoolId; + + /** The name of the vendor-supplied JDBC data source resource manager. */ + final String dataSourceClassName; + + /** Resource type. */ + final String resType; + + /** + * Optional properties for configuring the pool. + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
userSpecifies the user name for connecting to the database.
passwordSpecifies the password for connecting to the database.
databaseNameSpecifies the database for this connection pool.
serverNameSpecifies the database server for this connection pool.
portSpecifies the port on which the database server listens for requests.
networkProtocolSpecifies the communication protocol.
roleNameSpecifies the initial SQL role name.
datasourceNameSpecifies an underlying XADataSource, or a ConnectionPoolDataSource if connection pooling is + * done.
descriptionSpecifies a text description.
urlSpecifies the URL for this connection pool. Although this is not a standard property, it is + * commonly used.
dynamic-reconfiguration-wait-timeout-in-secondsUsed to enable dynamic reconfiguration of the connection pool transparently to the + * applications that are using the pool, so that applications need not be re-enabled for the + * attribute or property changes to the pool to take effect. Any in-flight transaction's connection + * requests will be allowed to complete with the old pool configuration as long as the connection + * requests are within the timeout period, so as to complete the transaction. New connection + * requests will wait for the pool reconfiguration to complete and connections will be acquired + * using the modified pool configuration.
LazyConnectionEnlistmentDeprecated. Use the equivalent attribute. The default value is false.
LazyConnectionAssociationDeprecated. Use the equivalent attribute. The default value is false.
AssociateWithThreadDeprecated. Use the equivalent attribute. The default value is false.
MatchConnectionsDeprecated. Use the equivalent attribute. The default value is true.
Prefer-Validate-Over-RecreateSpecifies whether pool resizer should validate idle connections before destroying and + * recreating them. The default value is true.
time-to-keep-queries-in-minutesSpecifies the number of minutes that will be cached for use in calculating frequently used + * queries. Takes effect when SQL tracing and monitoring are enabled for the JDBC connection pool. + * The default value is 5 minutes.
number-of-top-queries-to-reportSpecifies the number of queries to list when reporting the top and most frequently used + * queries. Takes effect when SQL tracing and monitoring are enabled for the JDBC connection pool. + * The default value is 10 queries.
+ */ + final Map properties; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server create JDBC connection pool command entity. + *

+ * + * @param connectionPoolId Connection pool unique name (and ID). + * @param dataSourceClassName The name of the vendor-supplied JDBC data source resource manager. + * @param resType Resource type. + * @param properties Optional properties for configuring the pool. + */ + public CommandCreateJDBCConnectionPool(final String connectionPoolId, + final String dataSourceClassName, final String resType, + final Map properties) { + super(COMMAND); + this.connectionPoolId = connectionPoolId; + this.dataSourceClassName = dataSourceClassName; + this.resType = resType; + this.properties = properties; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateJDBCResource.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateJDBCResource.java new file mode 100644 index 00000000..92a2470c --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateJDBCResource.java @@ -0,0 +1,177 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.Map; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * Command that creates JDBC resource on server. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpCreateJDBCResource.class) +@RunnerRestClass(runner = RunnerRestCreateJDBCResource.class) +public class CommandCreateJDBCResource extends Command { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for create JDBC resource command. */ + private static final String COMMAND = "create-jdbc-resource"; + + /** Error message for administration command execution exception . */ + private static final String ERROR_MESSAGE = "Create JDBC resource failed."; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create JDBC resource. + *

+ * + * @param server GlassFish server entity. + * @param connectionPoolId Connection pool unique name (and ID). + * @param jndiName The JNDI name of this JDBC resource. + * @param target Helps specify the target to which you are deploying. + * @param properties Optional properties for configuring the pool. + * @return Create JDBC connection pool task response. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultString createJDBCResource( + final PayaraServer server, final String connectionPoolId, + final String jndiName, final String target, + final Map properties) throws PayaraIdeException { + Command command = new CommandCreateJDBCResource(connectionPoolId, + jndiName, target, properties); + Future future = ServerAdmin + .exec(server, command); + try { + return future.get(); + } catch (InterruptedException | ExecutionException + | CancellationException ie) { + throw new PayaraIdeException(ERROR_MESSAGE, ie); + } + } + + /** + * Create JDBC resource. + *

+ * + * @param server GlassFish server entity. + * @param connectionPoolId Connection pool unique name (and ID). + * @param jndiName The JNDI name of this JDBC resource. + * @param target Helps specify the target to which you are deploying. + * @param properties Optional properties for configuring the pool. + * @param timeout Administration command execution timeout [ms]. + * @return Create JDBC resource task response. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultString createJDBCResource( + final PayaraServer server, final String connectionPoolId, + final String jndiName, final String target, + final Map properties, final long timeout) + throws PayaraIdeException { + Command command = new CommandCreateJDBCResource(connectionPoolId, + jndiName, target, properties); + Future future = ServerAdmin + .exec(server, command); + try { + return future.get(timeout, TimeUnit.MILLISECONDS); + } catch (InterruptedException | ExecutionException + | CancellationException ie) { + throw new PayaraIdeException(ERROR_MESSAGE, ie); + } catch (TimeoutException te) { + throw new PayaraIdeException( + ERROR_MESSAGE + " in " + timeout + "ms", te); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Connection pool unique name (and ID). */ + final String connectionPoolId; + + /** The JNDI name of this JDBC resource. */ + final String jndiName; + + /** + * Helps specify the target to which you are deploying. + *

+ * Valid values are:
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
serverDeploys the component to the default server instance. This is the default value.
domainDeploys the component to the domain.
cluster_nameDeploys the component to every server instance in the cluster.
instance_nameDeploys the component to a particular sever instance.
+ */ + final String target; + + /** Optional properties for configuring the resource. */ + final Map properties; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server create JDBC resource command entity. + *

+ * + * @param connectionPoolId Connection pool unique name (and ID). + * @param jndiName The JNDI name of this JDBC resource. + * @param target Specify the target to which you are deploying. + * @param properties Optional properties for configuring the resource. + */ + public CommandCreateJDBCResource(final String connectionPoolId, + final String jndiName, final String target, + final Map properties) { + super(COMMAND); + this.connectionPoolId = connectionPoolId; + this.jndiName = jndiName; + this.target = target; + this.properties = properties; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteCluster.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteCluster.java new file mode 100644 index 00000000..1d06bfd1 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteCluster.java @@ -0,0 +1,54 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * GlassFish Server Delete Cluster Command Entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpTarget.class) +@RunnerRestClass(runner = RunnerRestDeleteCluster.class) +public class CommandDeleteCluster extends CommandTarget { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for delete-cluster command. */ + private static final String COMMAND = "delete-cluster"; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server delete-cluster command entity. + *

+ * + * @param target Target GlassFish instance. + */ + public CommandDeleteCluster(String target) { + super(COMMAND, target); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteInstance.java new file mode 100644 index 00000000..13fe8fb5 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteInstance.java @@ -0,0 +1,54 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * GlassFish Server Delete Instance Command Entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpDeleteInstance.class) +@RunnerRestClass(runner = RunnerRestDeleteInstance.class) +public class CommandDeleteInstance extends CommandTarget { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for delete-instance command. */ + private static final String COMMAND = "delete-instance"; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server delete-instance command entity. + *

+ * + * @param target Target GlassFish instance. + */ + public CommandDeleteInstance(String target) { + super(COMMAND, target); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteResource.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteResource.java new file mode 100644 index 00000000..b5b15f5e --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteResource.java @@ -0,0 +1,79 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * Command that deletes resource from server. + * + * @author Peter Benedikovic, Tomas Kraus + */ +@RunnerHttpClass(runner = RunnerHttpDeleteResource.class) +@RunnerRestClass(runner = RunnerRestDeleteResource.class) +public class CommandDeleteResource extends CommandTarget { + + private static final String COMMAND_PREFIX = "delete-"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Name of the resource. */ + String name; + + /** Key name that defines the deleted property. */ + String cmdPropertyName; + + /** Delete also dependent resources. */ + boolean cascade; + + /** + * Constructor for delete resource command entity. + *

+ * + * @param target Target GlassFish instance or cluster. + * @param name Name of resource to be deleted. + * @param resourceCmdSuffix Resource related command suffix. Command string is build by appending + * this value after delete-. + * @param cmdPropertyName Name of query property which contains resource name. + * @param cascade Delete also dependent resources. + */ + public CommandDeleteResource(String target, String name, + String resourceCmdSuffix, String cmdPropertyName, boolean cascade) { + super(COMMAND_PREFIX + resourceCmdSuffix, target); + this.name = name; + this.cmdPropertyName = cmdPropertyName; + this.cascade = cascade; + } + + /** + * Constructor for delete resource command entity. + *

+ * + * @param name Name of resource to be deleted. + * @param resourceCmdSuffix Resource related command suffix. Command string is build by appending + * this value after delete-. + * @param cmdPropertyName Name of query property which contains resource name. + * @param cascade Delete also dependent resources. + */ + public CommandDeleteResource(String name, + String resourceCmdSuffix, String cmdPropertyName, boolean cascade) { + this(null, name, resourceCmdSuffix, cmdPropertyName, cascade); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeploy.java new file mode 100644 index 00000000..dc2a0c6a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeploy.java @@ -0,0 +1,129 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2021 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.File; +import java.util.Map; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; +import fish.payara.eclipse.tools.server.sdk.TaskStateListener; + +/** + * Payara Server Deploy Command Entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic, Gaurav Gupta + */ +@RunnerHttpClass(runner = RunnerHttpDeploy.class) +@RunnerRestClass(runner = RunnerRestDeploy.class) +public class CommandDeploy extends CommandTargetName { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for deploy command. */ + private static final String COMMAND = "deploy"; + + /** Error message for administration command execution exception . */ + private static final String ERROR_MESSAGE = "Application deployment failed."; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Deploy task that deploys application on server. + *

+ * + * @param server GlassFish server entity. + * @param application File object representing archive or directory to be + * deployed. + * @param listener Command execution events listener. + * @return Deploy task response. + * @throws PayaraIdeException When error occurred during administration command + * execution. + */ + public static ResultString deploy(PayaraServer server, File application, TaskStateListener listener) + throws PayaraIdeException { + try { + return ServerAdmin.exec(server, + new CommandDeploy(null, null, application, null, null, null, false), listener).get(); + } catch (InterruptedException | ExecutionException | CancellationException ie) { + throw new PayaraIdeException(ERROR_MESSAGE, ie); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** File to deploy. */ + final File path; + + /** Deployed application context root. */ + final String contextRoot; + + /** Deployment properties. */ + final Map properties; + + /** Deployment libraries. */ + final File[] libraries; + + /** Is this deployment of a directory? */ + final boolean dirDeploy; + + /** Hot Deploy. */ + final boolean hotDeploy; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server deploy command entity. + *

+ * + * @param name Name of module/cluster/instance to modify. + * @param target Target GlassFish instance or cluster where + * name is stored. + * @param path File to deploy. + * @param contextRoot Deployed application context root. + * @param properties Deployment properties. + * @param libraries Not used in actual deploy command. + * @param hotDeploy Hot Deploy. + */ + public CommandDeploy(String name, String target, File path, String contextRoot, Map properties, + File[] libraries, final boolean hotDeploy) { + super(COMMAND, name, target); + + this.path = path; + this.contextRoot = contextRoot; + this.properties = properties; + this.libraries = libraries; + this.dirDeploy = path.isDirectory(); + this.hotDeploy = hotDeploy; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDisable.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDisable.java new file mode 100644 index 00000000..f6cd130d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDisable.java @@ -0,0 +1,55 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * GlassFish Server Disable (a deployed application) Command Entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpEnableDisable.class) +@RunnerRestClass(runner = RunnerRestDisable.class) +public class CommandDisable extends CommandTargetName { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for disable command. */ + private static final String COMMAND = "disable"; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server disable command entity. + *

+ * + * @param name Name of module to disable. + * @param target Target GlassFish instance. + */ + public CommandDisable(String name, String target) { + super(COMMAND, name, target); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandEnable.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandEnable.java new file mode 100644 index 00000000..c18278aa --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandEnable.java @@ -0,0 +1,55 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * GlassFish Server Enable (a deployed application) Command Entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpEnableDisable.class) +@RunnerRestClass(runner = RunnerRestEnable.class) +public class CommandEnable extends CommandTargetName { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for enable command. */ + private static final String COMMAND = "enable"; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server enable command entity. + *

+ * + * @param name Name of module to enable. + * @param target Target GlassFish instance. + */ + public CommandEnable(String name, String target) { + super(COMMAND, name, target); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandException.java new file mode 100644 index 00000000..da4402dc --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandException.java @@ -0,0 +1,140 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * GlassFish IDE SDK Exception related to server administration command package problems. + *

+ * All exceptions are logging themselves on WARNING level when created. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class CommandException extends PayaraIdeException { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + private static final long serialVersionUID = 1L; + + /** Exception message for unsupported GlassFish version. */ + static final String UNSUPPORTED_VERSION = "Unsupported GlassFish version"; + + /** + * Exception message for unknown GlassFish administration interface type. + */ + static final String UNKNOWN_ADMIN_INTERFACE = "Unknown GlassFish administration interface type"; + + /** Exception message for unknown GlassFish version. */ + static final String UNKNOWN_VERSION = "Unknown GlassFish version"; + + /** Exception message for unsupported operation. */ + static final String UNSUPPORTED_OPERATION = "Operation is not supported"; + + /** Exception message for IOException when reading HTTP response. */ + static final String HTTP_RESP_IO_EXCEPTION = "Can not read HTTP response, caught IOException"; + /** + * Exception message for exceptions when initializing Runner object. + */ + static final String RUNNER_INIT = "Cannot initialize Runner class"; + + /** + * Exception message for exceptions when preparing headers for HTTP connection. + */ + static final String RUNNER_HTTP_HEADERS = "Cannos set headers for HTTP connection"; + + /** Exception message for exceptions when building command URL. */ + static final String RUNNER_HTTP_URL = "Cannot build HTTP command URL"; + + /** Exception message for illegal Command instance provided. */ + static final String ILLEGAL_COMAND_INSTANCE = "Illegal command instance provided"; + + /** Exception message for illegal null value provided. */ + static final String ILLEGAL_NULL_VALUE = "Value shall not be null"; + + /** + * Exception message for UnsupportedEncodingException when processing Manifest + * retrieved from server. + */ + static final String HTTP_RESP_UNS_ENC_EXCEPTION = "Can not read HTTP response, caught UnsupportedEncodingException"; + + /** Exception message for invalid server component (application) item. */ + public static final String MANIFEST_INVALID_COMPONENT_ITEM = "Invalid component item"; + + /** + * Exception message for invalid constant representing boolean value. + */ + public static final String INVALID_BOOLEAN_CONSTANT = "Invalid String representing boolean constant."; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of CommandException without detail message. + */ + public CommandException() { + super(); + } + + /** + * Constructs an instance of CommandException with the specified detail message. + *

+ * + * @param msg The detail message. + */ + public CommandException(String msg) { + super(msg); + } + + /** + * Constructs an instance of CommandException with the specified detail message and + * arguments. + *

+ * Uses {@link java.text.MessageFormat} to format message. + *

+ * + * @param msg The detail message. + * @param arguments Arguments to be inserted into message. + */ + public CommandException(String msg, Object... arguments) { + super(msg, arguments); + } + + /** + * Constructs an instance of CommandException with the specified detail message and + * cause. Exception is logged on WARN level. + *

+ * Note that the detail message associated with {@code cause} is not automatically + * incorporated in this runtime exception's detail message. + *

+ * + * @param msg the detail message (which is saved for later retrieval by the {@link #getMessage()} + * method). + * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A + * null value is permitted, and indicates that the cause is nonexistent or unknown.) + */ + public CommandException(String msg, Throwable cause) { + super(msg, cause); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandFetchLogData.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandFetchLogData.java new file mode 100644 index 00000000..38720423 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandFetchLogData.java @@ -0,0 +1,81 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * GlassFish Server View Log Command Entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerRestFetchLogData.class) +@RunnerRestClass(runner = RunnerRestFetchLogData.class) +public class CommandFetchLogData extends Command { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for view log command. */ + private static final String COMMAND = "view-log"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Query parameters to be used to read only log entries added in particular interval starting from + * previous call that returned this value of paramsAppendNext stored in returned + * ValueLog. + *

+ * Content of HTTP header X-Text-Append-Next. + */ + final String paramsAppendNext; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server view log command entity. + *

+ * All existing log entries will be returned. + */ + public CommandFetchLogData() { + super(COMMAND); + this.paramsAppendNext = null; + } + + /** + * Constructs an instance of GlassFish server view log command entity. + *

+ * Only log entries added in particular interval starting from previous call that returned this + * value of paramsAppendNext will be returned. + *

+ * + * @param paramsAppendNext Interval query parameters from Last View Log command execution. + */ + public CommandFetchLogData(String paramsAppendNext) { + super(COMMAND); + this.paramsAppendNext = paramsAppendNext; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandGetProperty.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandGetProperty.java new file mode 100644 index 00000000..602f7a6e --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandGetProperty.java @@ -0,0 +1,132 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * Command that retrieves property (properties) from server. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpGetProperty.class) +@RunnerRestClass(runner = RunnerRestGetProperty.class) +public class CommandGetProperty extends Command { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(CommandGetProperty.class); + + /** Command string for create-cluster command. */ + private static final String COMMAND = "get"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Pattern that defines properties to retrieve. */ + String propertyPattern; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Retrieve properties from server. + *

+ * + * @param server GlassFish server entity. + * @param propertyPattern Pattern that defines properties to retrieve. + * @return GlassFish command result containing map with key-value pairs returned by server. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultMap getProperties( + final PayaraServer server, final String propertyPattern) + throws PayaraIdeException { + final String METHOD = "getProperties"; + Future> future = ServerAdmin.>exec( + server, new CommandGetProperty(propertyPattern)); + try { + return future.get(); + } catch (ExecutionException | InterruptedException + | CancellationException ee) { + throw new PayaraIdeException( + LOGGER.excMsg(METHOD, "exception", propertyPattern), ee); + } + } + + /** + * Retrieve properties from server with timeout. + *

+ * + * @param server GlassFish server entity. + * @param propertyPattern Pattern that defines properties to retrieve. + * @param timeout Administration command execution timeout [ms]. + * @return GlassFish command result containing map with key-value pairs returned by server. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultMap getProperties( + final PayaraServer server, final String propertyPattern, + final long timeout) + throws PayaraIdeException { + final String METHOD = "getProperties"; + Future> future = ServerAdmin.>exec( + server, new CommandGetProperty(propertyPattern)); + try { + return future.get(timeout, TimeUnit.MILLISECONDS); + } catch (ExecutionException | InterruptedException + | CancellationException ee) { + throw new PayaraIdeException( + LOGGER.excMsg(METHOD, "exception", propertyPattern), ee); + } catch (TimeoutException te) { + throw new PayaraIdeException( + LOGGER.excMsg(METHOD, "exceptionWithTimeout", + propertyPattern, Long.toString(timeout)), + te); + } + + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server get property command entity. + *

+ * + * @param property Pattern that defines property tor retrieve. + */ + public CommandGetProperty(final String property) { + super(COMMAND); + propertyPattern = property; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandJava.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandJava.java new file mode 100644 index 00000000..01ecaab3 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandJava.java @@ -0,0 +1,67 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * GlassFish server administration command entity with local Java SE support. + *

+ * + * @author Tomas Kraus + */ +public abstract class CommandJava extends Command { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Java SE home used to select JRE for GlassFish server. */ + final String javaHome; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server administration command entity with specified server + * command and Java SE home. + *

+ * + * @param command Server command represented by this object. + * @param javaHome Java SE home used to select JRE for GlassFish server. + */ + public CommandJava(final String command, final String javaHome) { + super(command); + this.javaHome = javaHome; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get Java SE home used to select JRE for GlassFish server. + *

+ * + * @return Java SE home used to select JRE for GlassFish server. + */ + public String getJavaHome() { + return javaHome; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandJavaClassPath.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandJavaClassPath.java new file mode 100644 index 00000000..335d776d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandJavaClassPath.java @@ -0,0 +1,71 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * GlassFish server administration command entity with local Java SE support and class path. + *

+ * + * @author Tomas Kraus + */ +public abstract class CommandJavaClassPath extends CommandJava { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Class path to be passed to java executable formated as + * -cp <path1>:<path2>:...:<pathN>. + */ + final String classPath; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server administration command entity with specified server + * command, Java SE home and class path. + *

+ * + * @param command Server command represented by this object. + * @param javaHome Java SE home used to select JRE for GlassFish server. + * @param classPath Java SE class path. + */ + public CommandJavaClassPath(final String command, final String javaHome, final String classPath) { + super(command, javaHome); + this.classPath = classPath; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get class path to be passed to java executable. + *

+ * + * @return the classPath Class path to be passed to java executable. + */ + public String getClassPath() { + return classPath; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListComponents.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListComponents.java new file mode 100644 index 00000000..29570bd7 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListComponents.java @@ -0,0 +1,90 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.List; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * Command that retrieves list of components defined on server. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpListComponents.class) +@RunnerRestClass(runner = RunnerRestListApplications.class, command = "list-applications") +public class CommandListComponents extends CommandTarget { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for list components command. */ + private static final String COMMAND = "list-components"; + + /** Error message for administration command execution exception . */ + private static final String ERROR_MESSAGE = "List components failed."; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * List components. + *

+ * + * @param server GlassFish server entity. + * @param target Target server instance or cluster. + * @return List components task response. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultMap> listComponents( + final PayaraServer server, final String target) + throws PayaraIdeException { + Command command = new CommandListComponents(target); + Future>> future = ServerAdmin + .>>exec(server, command); + try { + return future.get(); + } catch (InterruptedException | ExecutionException + | CancellationException ie) { + throw new PayaraIdeException(ERROR_MESSAGE, ie); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server list components command entity. + *

+ * + * @param target Target GlassFish instance or cluster. + */ + public CommandListComponents(final String target) { + super(COMMAND, target); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListResources.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListResources.java new file mode 100644 index 00000000..022b8a04 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListResources.java @@ -0,0 +1,117 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * Command that retrieves list of JDBC resources defined on server. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpListResources.class) +@RunnerRestClass(runner = RunnerRestListResources.class) +public class CommandListResources extends CommandTarget { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(CommandListResources.class); + + /** + * Command string prefix used to construct list JDBC resources HTTP command. + */ + private static final String COMMAND_PREFIX = "list-"; + + /** + * Command string suffix used to construct list JDBC resources HTTP command. + */ + private static final String COMMAND_SUFFIX = "s"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Add resource to target server. + *

+ * + * @param server GlassFish server entity. + * @param cmdSuffix Resource command suffix. Value should not be null. + * @param target GlassFish server target. + * @return Add resource task response. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultList listResources(final PayaraServer server, + final String cmdSuffix, final String target) + throws PayaraIdeException { + final String METHOD = "listResources"; + Command command = new CommandListResources(command(cmdSuffix), target); + Future> future = ServerAdmin.>exec(server, command); + try { + return future.get(); + } catch (InterruptedException | ExecutionException + | CancellationException ie) { + throw new PayaraIdeException( + LOGGER.excMsg(METHOD, "exception"), ie); + } + } + + /** + * Constructs command string for provided resource command suffix. + *

+ * + * @param resourceCmdSuffix Resource command suffix. Value should not be null. + */ + public static String command(String resourceCmdSuffix) { + StringBuilder sb = new StringBuilder(COMMAND_PREFIX.length() + + COMMAND_SUFFIX.length() + resourceCmdSuffix.length()); + sb.append(COMMAND_PREFIX); + sb.append(resourceCmdSuffix); + sb.append(COMMAND_SUFFIX); + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server list JDBC resources command entity. + *

+ * Command string is supplied as an argument. + *

+ * + * @param command Server command represented by this object. Use command static method + * to build this string using resource command suffix. + * @param target Target GlassFish instance or cluster. + */ + public CommandListResources(final String command, final String target) { + super(command, target); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListWebServices.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListWebServices.java new file mode 100644 index 00000000..c13dc1b8 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListWebServices.java @@ -0,0 +1,49 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * Command that retrieves list of web services defined on server. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpListWebServices.class) +@RunnerRestClass(runner = RunnerRestListWebServices.class) +public class CommandListWebServices extends Command { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for list web services command. */ + private static final String COMMAND = "__list-webservices"; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server list web services command entity. + */ + public CommandListWebServices() { + super(COMMAND); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandLocation.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandLocation.java new file mode 100644 index 00000000..32acfc71 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandLocation.java @@ -0,0 +1,105 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.File; +import java.net.URI; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.utils.ServerUtils; + +/** + * Locations command used to determine locations (installation, domain etc.) where the DAS is + * running. + *

+ * Result of the command will be in the form of Map object. The keys to + * particular locations are as followed: Installation root - "Base-Root_value" Domain root - + * "Domain-Root_value" + *

+ * Minimal __locations command support exists since GlassFish 3.0.1 where both + * Base-Root and Domain-Root values are returned. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpLocation.class) +@RunnerRestClass(runner = RunnerRestLocation.class) +public class CommandLocation extends Command { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for location command. */ + private static final String COMMAND = "__locations"; + + /** Result key to retrieve Domain-Root value. */ + public static final String DOMAIN_ROOT_RESULT_KEY = "Domain-Root_value"; + + /** Result key to retrieve Basic-Root value. */ + public static final String BASIC_ROOT_RESULT_KEY = "Base-Root_value"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Verifies if domain directory returned by location command result matches domain directory of + * provided GlassFish server entity. + *

+ * + * @param resultMap Locations command result. + * @param server GlassFish server entity. + * @return For local server value of true means that domain directory returned by + * location command result matches domain directory of provided GlassFish server entity and value of + * false that they differs. For remote serve this test makes no sense and value of + * true is always returned. + */ + public static boolean verifyResult( + final ResultMap resultMap, + final PayaraServer server) { + if (!server.isRemote()) { + boolean result = false; + String domainRootResult = resultMap.getValue().get(DOMAIN_ROOT_RESULT_KEY); + String domainRootServer = ServerUtils.getDomainPath(server); + if (domainRootResult != null && domainRootServer != null) { + URI rootResult = new File(domainRootResult).toURI().normalize(); + URI rootServer = new File(domainRootServer).toURI().normalize(); + if (rootResult != null && rootServer != null) { + result = rootServer.equals(rootResult); + } + } + return result; + } else { + return true; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server location command entity. + */ + public CommandLocation() { + super(COMMAND); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRedeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRedeploy.java new file mode 100644 index 00000000..f7a9aa65 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRedeploy.java @@ -0,0 +1,101 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2021 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.File; +import java.util.List; +import java.util.Map; + +/** + * Payara Server Redeploy Command Entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic, Gaurav Gupta + */ +@RunnerHttpClass(runner = RunnerHttpRedeploy.class) +@RunnerRestClass(runner = RunnerRestDeploy.class) +public class CommandRedeploy extends CommandTargetName { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for deploy command. */ + private static final String COMMAND = "redeploy"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Deployed application context root. */ + final String contextRoot; + + /** Deployment properties. */ + final Map properties; + + /** Deployment libraries. */ + final File[] libraries; + + /** Keep state. */ + final boolean keepState; + + /** Hot Deploy. */ + final boolean hotDeploy; + + /** Metadata Changed. */ + final boolean metadataChanged; + + /** Source files Changed. */ + final List sourcesChanged; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of Payara server deploy command entity. + *

+ * + * @param name Name of module/cluster/instance to modify. + * @param target Target Payara instance or cluster where + * name is stored. + * @param contextRoot Deployed application context root. + * @param properties Deployment properties. + * @param libraries Deployment libraries. + * @param keepState Keep state. + * @param hotDeploy Hot Deploy. + * @param metadataChanged Metadata Changed. + * @param sourcesChanged Sources Changed. + */ + public CommandRedeploy(final String name, final String target, final String contextRoot, + final Map properties, final File[] libraries, final boolean keepState, + final boolean hotDeploy, final boolean metadataChanged, final List sourcesChanged) { + super(COMMAND, name, target); + this.contextRoot = contextRoot; + this.properties = properties; + this.libraries = libraries; + this.keepState = keepState; + this.hotDeploy = hotDeploy; + this.metadataChanged = metadataChanged; + this.sourcesChanged = sourcesChanged; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRestartDAS.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRestartDAS.java new file mode 100644 index 00000000..c09754e5 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRestartDAS.java @@ -0,0 +1,97 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * GlassFish server restart DAS command entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpRestartDAS.class) +@RunnerRestClass(command = "restart") +public class CommandRestartDAS extends Command { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for version command. */ + private static final String COMMAND = "restart-domain"; + + /** Error message for administration command execution exception . */ + private static final String ERROR_MESSAGE = "DAS restart failed."; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Restarts running DAS server. + *

+ * + * @param server GlassFish server entity. + * @param debug Specifies whether the domain is restarted with JPDA. + * @return Restart DAS task response. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultString restartDAS(final PayaraServer server, + final boolean debug) throws PayaraIdeException { + Command command = new CommandRestartDAS(debug); + Future future = ServerAdmin.exec(server, command); + try { + return future.get(); + } catch (InterruptedException | ExecutionException + | CancellationException ie) { + throw new PayaraIdeException(ERROR_MESSAGE, ie); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Specifies whether the domain is restarted with JPDA. */ + final boolean debug; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server version command entity. + *

+ * + * @param debug Specifies whether the domain is restarted with JPDA. + */ + public CommandRestartDAS(final boolean debug) { + super(COMMAND); + this.debug = debug; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRestoreDomain.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRestoreDomain.java new file mode 100644 index 00000000..b1233e0c --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRestoreDomain.java @@ -0,0 +1,63 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.File; + +/** + * Offline asadmin command used to restore domain in junit tests. + * + * @author Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerAsadminRestoreDomain.class) +@RunnerRestClass(runner = RunnerAsadminRestoreDomain.class) +public class CommandRestoreDomain extends CommandJava { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for change administrator's password command. */ + private static final String COMMAND = "restore-domain"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Domain backup archive. */ + final File domainBackup; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server administration command entity with specified server + * command, Java SE home and class path. + *

+ * + * @param javaHome Java SE home used to select JRE for GlassFish server. + * @param domainBackup archive that contains domain restore. + */ + public CommandRestoreDomain(final String javaHome, + final File domainBackup) { + super(COMMAND, javaHome); + this.domainBackup = domainBackup; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandSetProperty.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandSetProperty.java new file mode 100644 index 00000000..da30e7d5 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandSetProperty.java @@ -0,0 +1,197 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import static fish.payara.eclipse.tools.server.sdk.admin.ServerAdmin.exec; +import static java.util.concurrent.TimeUnit.MILLISECONDS; + +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeoutException; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * Command that sets property (properties) on the server. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpSetProperty.class) +@RunnerRestClass(runner = RunnerRestSetProperty.class) +public class CommandSetProperty extends Command { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for create-cluster command. */ + private static final String COMMAND = "set"; + + /** Error message prefix for administration command execution exception . */ + private static final String ERROR_MESSAGE_PREFIX = "Could not set value "; + + /** + * Error message middle part for administration command execution exception . + */ + private static final String ERROR_MESSAGE_MIDDLE = " of property "; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Build error message from command property name and it's value. + *

+ * + * @param command Command used to build error message. + * @return Error message for administration command execution exception. + */ + private static String errorMessage(final CommandSetProperty command) { + int valueLen = command.value != null + ? command.value.length() + : 0; + + int propertyLen = command.property != null + ? command.property.length() + : 0; + + return new StringBuilder(ERROR_MESSAGE_PREFIX.length() + ERROR_MESSAGE_MIDDLE.length() + valueLen + propertyLen) + .append(ERROR_MESSAGE_PREFIX) + .append(valueLen > 0 ? command.value : "") + .append(ERROR_MESSAGE_MIDDLE) + .append(propertyLen > 0 ? command.property : "") + .toString(); + } + + /** + * Put property to server. + *

+ * + * @param server GlassFish server entity. + * @param command Command to set property value. + * @return GlassFish command result containing String with result message. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultString setProperty(PayaraServer server, CommandSetProperty command) throws PayaraIdeException { + Future future = exec(server, command); + + try { + return future.get(); + } catch (ExecutionException | InterruptedException | CancellationException ee) { + throw new PayaraIdeException(errorMessage(command), ee); + } + } + + /** + * Put property to server. + *

+ * + * @param server GlassFish server entity. + * @param command Command to set property value. + * @param timeout Administration command execution timeout [ms]. + * @return GlassFish command result containing String with result message. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultString setProperty(PayaraServer server, CommandSetProperty command, long timeout) throws PayaraIdeException { + Future future = exec(server, command); + + try { + return future.get(timeout, MILLISECONDS); + } catch (ExecutionException | InterruptedException | CancellationException ee) { + throw new PayaraIdeException(errorMessage(command), ee); + } catch (TimeoutException te) { + throw new PayaraIdeException(errorMessage(command) + + " in " + timeout + "ms", te); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Name of the property to set. */ + final String property; + + /** Value of the property to set. */ + final String value; + + /** Format for the query string. */ + final String format; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server set property command entity. + *

+ * + * @param property Name of the property to set. + * @param value Value of the property to set. + * @param format Format for the query string. + */ + public CommandSetProperty(String property, String value, String format) { + super(COMMAND); + this.property = property; + this.value = value; + this.format = format; + } + + /** + * Constructs an instance of GlassFish server set property command entity. + *

+ * + * @param property Name of the property to set. + * @param value Value of the property to set. + */ + public CommandSetProperty(String property, String value) { + super(COMMAND); + this.property = property; + this.value = value; + this.format = "DEFAULT={0}={1}"; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get name of the property to set. + *

+ * + * @return Name of the property to set. + */ + public String getProperty() { + return property; + } + + /** + * Get value of the property to set. + *

+ * + * @return Value of the property to set. + */ + public String getValue() { + return value; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartCluster.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartCluster.java new file mode 100644 index 00000000..43988f88 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartCluster.java @@ -0,0 +1,89 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * GlassFish Server Start Cluster Command Entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpTarget.class) +@RunnerRestClass(runner = RunnerRestStartCluster.class) +public class CommandStartCluster extends CommandTarget { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for start-cluster command. */ + private static final String COMMAND = "start-cluster"; + + /** Error message for administration command execution exception . */ + private static final String ERROR_MESSAGE = "Cluster start failed."; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Starts cluster. + *

+ * + * @param server GlassFish server entity. + * @param target Cluster name. + * @return Start cluster task response. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultString startCluster(PayaraServer server, + String target) throws PayaraIdeException { + Command command = new CommandStartCluster(target); + Future future = ServerAdmin.exec(server, command); + try { + return future.get(); + } catch (InterruptedException | ExecutionException + | CancellationException ie) { + throw new PayaraIdeException(ERROR_MESSAGE, ie); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server start-cluster command entity. + *

+ * + * @param target Target GlassFish cluster. + */ + public CommandStartCluster(String target) { + super(COMMAND, target); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartDAS.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartDAS.java new file mode 100644 index 00000000..61651294 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartDAS.java @@ -0,0 +1,81 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * GlassFish Server Start DAS Command Entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerLocal.class) +@RunnerRestClass(runner = RunnerLocal.class) +public class CommandStartDAS extends CommandJavaClassPath { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * No command string is needed for Start DAS command but we may use it in logs. + */ + private static final String COMMAND = "start-das"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * JVM options to be passed to java executable. Typically options as as + * -D<name>=<value> or -X<option>. + */ + final String javaOpts; + + /** + * GlassFish specific arguments to be passed to bootstrap main method, e.g. + * --domain domain_name. + */ + final String glassfishArgs; + + /** GlassFish server domain directory (full path). */ + final String domainDir; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server start DAS command entity. + * + * @param javaHome Java SE home used to select JRE for GlassFish server. + * @param classPath Java SE class path. + * @param javaOptions JVM options to be passed to java executable. + * @param glassfishArgs GlassFish specific arguments to be passed to bootstrap main method. + * @param domainDir GlassFish server domain directory (full path). + */ + public CommandStartDAS(String javaHome, String classPath, String javaOptions, String glassfishArgs, String domainDir) { + super(COMMAND, javaHome, classPath); + this.javaOpts = javaOptions; + this.glassfishArgs = glassfishArgs; + this.domainDir = domainDir; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartInstance.java new file mode 100644 index 00000000..f55b07f5 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartInstance.java @@ -0,0 +1,89 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import static fish.payara.eclipse.tools.server.sdk.admin.ServerAdmin.exec; + +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * GlassFish Server Start Instance Command Entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpTarget.class) +@RunnerRestClass(runner = RunnerRestStartInstance.class) +public class CommandStartInstance extends CommandTarget { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for start-instance command. */ + private static final String COMMAND = "start-instance"; + + /** Error message for administration command execution exception . */ + private static final String ERROR_MESSAGE = "Instance start failed."; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Starts server instance. + *

+ * + * @param server GlassFish server entity. + * @param target Instance name. + * @return Start instance task response. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultString startInstance(PayaraServer server, String target) throws PayaraIdeException { + Future future = exec(server, new CommandStartInstance(target)); + + try { + return future.get(); + } catch (InterruptedException | ExecutionException | CancellationException ie) { + throw new PayaraIdeException(ERROR_MESSAGE, ie); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server start-instance command entity. + *

+ * + * @param target Target GlassFish instance. + */ + public CommandStartInstance(final String target) { + super(COMMAND, target); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopCluster.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopCluster.java new file mode 100644 index 00000000..ef5613a6 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopCluster.java @@ -0,0 +1,89 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import static fish.payara.eclipse.tools.server.sdk.admin.ServerAdmin.exec; + +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * GlassFish Server Stop Cluster Command Entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpTarget.class) +@RunnerRestClass(runner = RunnerRestStopCluster.class) +public class CommandStopCluster extends CommandTarget { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for stop-cluster command. */ + private static final String COMMAND = "stop-cluster"; + + /** Error message for administration command execution exception . */ + private static final String ERROR_MESSAGE = "Cluster stop failed."; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Stops cluster. + *

+ * + * @param server GlassFish server entity. + * @param target Cluster name. + * @return Stop cluster task response. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultString stopCluster(PayaraServer server, String target) throws PayaraIdeException { + Future future = exec(server, new CommandStopCluster(target)); + + try { + return future.get(); + } catch (InterruptedException | ExecutionException| CancellationException ie) { + throw new PayaraIdeException(ERROR_MESSAGE, ie); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server stop-cluster command entity. + *

+ * + * @param target Target GlassFish cluster. + */ + public CommandStopCluster(String target) { + super(COMMAND, target); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopDAS.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopDAS.java new file mode 100644 index 00000000..d2b39023 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopDAS.java @@ -0,0 +1,85 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import static fish.payara.eclipse.tools.server.sdk.admin.ServerAdmin.exec; + +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * GlassFish server stop DAS command entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass +@RunnerRestClass(runner = RunnerRestStopDAS.class) +public class CommandStopDAS extends Command { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for version command. */ + private static final String COMMAND = "stop-domain"; + + /** Error message for administration command execution exception . */ + private static final String ERROR_MESSAGE = "DAS stop failed."; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Stops running DAS server. + *

+ * + * @param server GlassFish server entity. + * @return Stop DAS task response. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultString stopDAS(final PayaraServer server) throws PayaraIdeException { + Future future = exec(server, new CommandStopDAS()); + + try { + return future.get(); + } catch (InterruptedException | ExecutionException | CancellationException ie) { + throw new PayaraIdeException(ERROR_MESSAGE, ie); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server version command entity. + */ + public CommandStopDAS() { + super(COMMAND); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopInstance.java new file mode 100644 index 00000000..ed547eab --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopInstance.java @@ -0,0 +1,84 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * Payara Server Stop Instance Command Entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpTarget.class) +@RunnerRestClass(runner = RunnerRestStopInstance.class) +public class CommandStopInstance extends CommandTarget { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for stop-instance command. */ + private static final String COMMAND = "stop-instance"; + + /** Error message for administration command execution exception . */ + private static final String ERROR_MESSAGE = "Instance stop failed."; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Stops server instance. + *

+ * + * @param server GlassFish server entity. + * @param target Instance name. + * @return Stop instance task response. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultString stopInstance(PayaraServer server, String target) throws PayaraIdeException { + try { + return ServerAdmin.exec(server, new CommandStopInstance(target)).get(); + } catch (InterruptedException | ExecutionException | CancellationException ie) { + throw new PayaraIdeException(ERROR_MESSAGE, ie); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server stop-instance command entity. + *

+ * + * @param target Target GlassFish instance. + */ + public CommandStopInstance(String target) { + super(COMMAND, target); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandTarget.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandTarget.java new file mode 100644 index 00000000..33e08fa1 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandTarget.java @@ -0,0 +1,55 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * Abstract GlassFish Server Command Entity containing target. + *

+ * Contains common target attribute. Holds data for command. Objects of this class are + * created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public abstract class CommandTarget extends Command { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Target GlassFish instance or cluster. */ + final String target; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server enable command entity. + *

+ * + * @param command Server command represented by this object. + * @param target Target GlassFish instance or cluster. + */ + CommandTarget(String command, String target) { + super(command); + this.target = target; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandTargetName.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandTargetName.java new file mode 100644 index 00000000..3eb030ca --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandTargetName.java @@ -0,0 +1,56 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * Abstract GlassFish Server Command Entity containing name and target. + *

+ * Contains common name and target attribute. Holds data for command. + * Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public abstract class CommandTargetName extends CommandTarget { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Name of module/cluster/instance to modify. */ + final String name; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server enable command entity. + *

+ * + * @param command Server command represented by this object. + * @param name Name of module/cluster/instance to modify. + * @param target Target GlassFish instance or cluster where name is stored. + */ + CommandTargetName(String command, String name, String target) { + super(command, target); + this.name = name; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandUndeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandUndeploy.java new file mode 100644 index 00000000..b1f14960 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandUndeploy.java @@ -0,0 +1,64 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * GlassFish Server Undeploy Command Entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpUndeploy.class) +@RunnerRestClass(runner = RunnerRestUndeploy.class) +public class CommandUndeploy extends CommandTargetName { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for undeploy command. */ + private static final String COMMAND = "undeploy"; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of the Payara server undeploy command entity. + *

+ * + * @param target Target GlassFish instance. + */ + public CommandUndeploy(String name) { + this(name, null); + } + + /** + * Constructs an instance of Payara server undeploy command entity. + *

+ * + * @param target Target Payara instance. + */ + public CommandUndeploy(String name, String target) { + super(COMMAND, name, target); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandVersion.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandVersion.java new file mode 100644 index 00000000..41ff13b6 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandVersion.java @@ -0,0 +1,141 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import static fish.payara.eclipse.tools.server.sdk.admin.ServerAdmin.exec; + +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.utils.ServerUtils; +import fish.payara.eclipse.tools.server.utils.Version; + +/** + * GlassFish Server Version Command Entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass +@RunnerRestClass +public class CommandVersion extends Command { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(CommandVersion.class); + + /** Command string for version command. */ + private static final String COMMAND = "version"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Retrieve version from server. + *

+ * + * @param server GlassFish server entity. + * @return GlassFish command result containing version string returned by server. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static ResultString getVersion(final PayaraServer server) throws PayaraIdeException { + Future future = exec(server, new CommandVersion()); + + try { + return future.get(); + } catch (ExecutionException | InterruptedException | CancellationException e) { + throw new CommandException(LOGGER.excMsg("getVersion", "exception"), e.getLocalizedMessage()); + } + } + + /** + * Retrieve version from server. + *

+ * + * @param server GlassFish server entity. + * @return GlassFish command result containing {@link GlassFishVersion} object retrieved from server + * or null if no version was returned. + * @throws PayaraIdeException When error occurred during administration command execution. + */ + public static Version getGlassFishVersion(PayaraServer server) { + ResultString result; + try { + result = getVersion(server); + } catch (CommandException ce) { + return null; + } + + String value = result != null + ? ServerUtils.getVersionString(result.getValue()) + : null; + + if (value != null) { + return new Version(value); + } + + return null; + } + + /** + * Verifies if domain directory returned by version command result matches domain directory of + * provided GlassFish server entity. + *

+ * + * @param result Version command result. + * @param server GlassFish server entity. + * @return For local server value of true means that server major and minor version + * value matches values returned by version command and value of false that they + * differs. + */ + public static boolean verifyResult(ResultString result, PayaraServer server) { + boolean verifyResult = false; + String value = ServerUtils.getVersionString(result.getValue()); + if (value != null) { + Version valueVersion = new Version(value); + Version serverVersion = server.getVersion(); + if (valueVersion != null && serverVersion != null) { + verifyResult = serverVersion.equals(valueVersion); + } + } + + return verifyResult; + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server version command entity. + */ + public CommandVersion() { + super(COMMAND); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ExceptionMessages.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ExceptionMessages.properties new file mode 100644 index 00000000..a0e54bd3 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ExceptionMessages.properties @@ -0,0 +1,60 @@ +################################################################################ +# Exception messages # +# Use .. notation for keys. # +################################################################################ + +# CommandAddResources class +CommandAddResources.addResource.exception=Add resource failed. +CommandAddResources.addResource.exceptionWithTimeout=Add resource failed \ +in {0} ms. + +# CommandGetProperty class +CommandGetProperty.getProperties.exception=Could not retrieve properties \ +for {0}. +CommandGetProperty.getProperties.exceptionWithTimeout=Could not retrieve properties \ +for {0} in {1} ms. + +# CommandListResources class +CommandListResources.listResources.exception=List resources failed. + +# CommandVersion class +CommandVersion.getVersion.exception=Could not retrieve version from server: {0} + +# PasswordFile class +PasswordFile.buildPasswordFilePath.nullValue=Domains folder and domain name \ +shall not be null. +PasswordFile.write.noAdminPassword=No administrator password value is set. + +# ProcessIOParser class +ProcessIOParser.getOutput.illegalState=Process output stream verification \ +was not called yet. + +# RunnerJava class +RunnerJava.getServerConfig.noConfig=Cannot find GlassFish features configuration file \ +for GlassFish {0} +RunnerJava.getJavaSEConfig.noJavaSEConfig=Cannot find GlassFish features \ +Java SE configuration +RunnerJava.init.noCommandJava=Command argument is not an instance \ +of CommandJava class +RunnerJava.init.noJavaVMExe=No suitable Java VM executable found in {0} \ +for {1} + +# RunnerAsadminChangeAdminPassword class +RunnerAsadminChangeAdminPassword.init.illegalInstance=Illegal command \ +instance provided. Expected instance of CommandChangeAdminPassword class. +RunnerAsadminChangeAdminPassword.query.nullValue=Value of domain name \ +or domains folder shall not be null. + +# RunnerHttpCreateInstance class +RunnerHttpCreateInstance.query.nullValue=Value of name or node shall not \ +be null. +RunnerHttpCreateInstance.query.illegalInstance=Illegal command instance \ +provided. Expected instance of CommandCreateInstance class. + +# RunnerAsadmin class +RunnerAsadmin.buildProcessArgs.nullValue=Value of administrator user \ +name shall not be null. +RunnerAsadmin.extractPath.noToolsConfig=Cannot find tools configuration \ +in GlassFish features configuration file for GlassFish {0} +RunnerAsadmin.extractPath.noAsadminConfig=Cannot find asadmin configuration \ +in GlassFish features configuration file for GlassFish {0} \ No newline at end of file diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/LogMessages.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/LogMessages.properties new file mode 100644 index 00000000..2440f3f1 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/LogMessages.properties @@ -0,0 +1,126 @@ +################################################################################ +# Log messages # +# Use .. notation for keys. # +################################################################################ + +# AdminFactory class +AdminFactory.newRunner.exception=Caught: {0} +AdminFactory.newRunner.cause=Caused by: {0} + +# PasswordFile class +PasswordFile.createFilePosix.exists=File {0} already exists +PasswordFile.createFilePosix.ioException=IO exception caught when creating \ +new file: +PasswordFile.createFilePosix.unsupported=Could not set file permissions. \ +File system is not POSIX compliant. +PasswordFile.finishFilePosix.unsupported=Could not set file permissions. \ +File system is not POSIX compliant. +PasswordFile.finishFilePosix.ioException=IO exception caught when updating \ +file permissions: +PasswordFile.write.writeException=Caught IOException when writting {0}: {1} +PasswordFile.write.closeException=Cannot close {0} Writer + +# Runner class +Runner.prepareHttpConnection.setting=Setting HTTP connection attributes: \ +timeout = {0} user = {1} password = {2} +Runner.prepareHttpConnection.using=Using "Basic" authorization with user \ +and password +Runner.handleSecureConnection.issue=Trust manager issue when processing {0} +Runner.handleSecureConnection.exception=Trust manager caught an exception: +Runner.handleReceive.exception=Caught an exception when reading response: +Runner.handleHTTPConnection.connect=Connecting to {0}:{1} +Runner.handleHTTPResponse.response=Receiving response, code: {0} +Runner.handleHTTPResponse.invalidRedirect=Invalid redirect for {0} +Runner.handleHTTPResponse.locationMoved=Location moved to {0} +Runner.call.thread=Runner call() method called on URL {0} thread {1} +Runner.call.connect=Connecting to {0}:{1} +Runner.call.response=Receiving response, code: {0} +Runner.call.failure={0} failure, ContentType: {1}, ContentEncoding: {2} +Runner.call.headerFields=Header Fields: +Runner.call.headerField= * {0} = {1} +Runner.call.unexpectedConnection=Unexpected connection type: {0} +Runner.call.sleepInterrupted=Thread sleep interrupted in call() method: +Runner.call.malformedURLException=Caught MalformedURLException in call() method: + +# RunnerAsadminChangeAdminPassword class + +# RunnerHttpCreateInstance class +RunnerHttpCreateInstance.processResponse.illegalArgument=Caught \ +IllegalArgumentException when processing command execution response + +# RunnerHttpDeploy class +RunnerHttpDeploy.handleSend.ioException=IO exception caught in handleSend() \ +method: +RunnerHttpDeploy.handleSend.noData=HTTP POST request but no data stream provided +RunnerHttpDeploy.getInputStream.fileNotFound=File not found exception caught \ +in getInputStream() method: + +# RunnerHttpGetProperty class +RunnerHttpGetProperty.processResponse.manifestNull=info is null \ +for GetProperty command with {0} +RunnerHttpGetProperty.processResponse.unsupportedEncoding=Caught \ +UnsupportedEncodingException exception in processResponse() method \ +while processing {0} +RunnerHttpGetProperty.processResponse.exceptionDetails=\ +UnsupportedEncodingException details: +RunnerHttpGetProperty.processResponse.illegalArgument=Caught \ +IllegalArgumentException in processResponse() method while processing {0}:{1} +RunnerHttpGetProperty.processResponse.emptyString=Inserting empty string \ +as value for key {0} + +# RunnerRestGetProperty class +RunnerRestGetProperty.processResponse.unsupportedEncoding=Caught \ +UnsupportedEncodingException exception in processResponse() method \ +while processing {0} +RunnerRestGetProperty.processResponse.illegalArgument=Caught \ +IllegalArgumentException in processResponse() method while processing {0}:{1} +RunnerRestGetProperty.processResponse.emptyString=Inserting empty string \ +as value for key {0} + +# RunnerJava class +RunnerJava.getJavaVM.noJavaVMExe="Java VM {0} executable was not found" +RunnerJava.verifyJavaVM.unknown=Java VM {0} executable version is unknown +RunnerJava.verifyJavaVM.info=Java VM {0} executable version {1} +RunnerJava.verifyJavaVM.unsupported=Java VM {0} executable version is \ +not supported by {1} +RunnerJava.setProcessCurrentDir.dir=Setting {0} process current directory to {1} + +################################################################################ +# Log messages for tests # +################################################################################ + +# CommandAsadminTest class +CommandAsadminTest.testCommandChangeAdminPasswordGFv3.output=StdOut: {0} +CommandAsadminTest.testCommandChangeAdminPasswordGFv4.output=StdOut: {0} + +# CommandHttpTest class +CommandHttpTest.startGlassFish.startFrame=+------------------------------------------+ +CommandHttpTest.startGlassFish.startText=| Starting GlassFish server for HTTP tests | +CommandHttpTest.startGlassFish.stdout=STDOUT: {0} +CommandHttpTest.startGlassFish.failed=GlassFish exited on error. +CommandHttpTest.stopGlassFish.stopFrame=+------------------------------------------+ +CommandHttpTest.stopGlassFish.stopText=| Stopping GlassFish server for HTTP tests | + +# CommandRestTest class +CommandRestTest.startGlassFish.startFrame=+------------------------------------------+ +CommandRestTest.startGlassFish.startText=| Starting GlassFish server for REST tests | +CommandRestTest.startGlassFish.stdout=STDOUT: {0} +CommandRestTest.startGlassFish.failed=GlassFish exited on error. +CommandRestTest.stopGlassFish.stopFrame=+------------------------------------------+ +CommandRestTest.stopGlassFish.stopText=| Stopping GlassFish server for REST tests | + +# ProcessIOTest class +ProcessIOTest.threadClose.in=Could not close standard input Reader: {0} +ProcessIOTest.threadClose.out=Could not close standard output Writer: {0} +ProcessIOTest.threadClose.err=Could not close standard error output Writer: {0} +ProcessIOTest.run.io=Could not simulate process IO: {0} +ProcessIOTest.testProcessIOSuccess.thread=Could not initialize process IO simulation \ +thread: {0} +ProcessIOTest.testProcessIOSuccess.output=StdOut: {0} +ProcessIOTest.testProcessIOFailure.thread=Could not initialize process IO simulation \ +thread: {0} +ProcessIOTest.testProcessIOFailure.output=StdOut: {0} +ProcessIOTest.close.in=Could not close standard input stream: {0} +ProcessIOTest.close.out=Could not close standard output stream: {0} +ProcessIOTest.close.err=Could not close standard error output stream: {0} + diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/MessagePart.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/MessagePart.java new file mode 100644 index 00000000..53f33ff9 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/MessagePart.java @@ -0,0 +1,47 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +/** + * + * @author Tomas Kraus, Peter Benedikovic + */ +public class MessagePart { + + Properties props = new Properties(); + String message; + + List children = new ArrayList<>(); + + public List getChildren() { + return children; + } + + public String getMessage() { + return message; + } + + public Properties getProps() { + return props; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/PasswordFile.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/PasswordFile.java new file mode 100644 index 00000000..0f17b05b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/PasswordFile.java @@ -0,0 +1,377 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import static fish.payara.eclipse.tools.server.sdk.utils.ServerUtils.GF_DOMAIN_CONFIG_DIR_NAME; + +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import java.nio.file.FileAlreadyExistsException; +import java.nio.file.Files; +import java.nio.file.LinkOption; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.attribute.PosixFilePermission; +import java.nio.file.attribute.PosixFilePermissions; +import java.util.HashSet; +import java.util.Set; +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.utils.OsUtils; + +/** + * Support for asadmin --passwordfile file format. + *

+ * asadmin --passwordfile argument specifies the name, including the full + * path, of a file that contains password entries in a specific format. + *

+ * Note that any password file created to pass as an argument by using the + * --passwordfile option should be protected with file system permissions. + * Additionally, any password file being used for a transient purpose, such as setting up SSH among + * nodes, should be deleted after it has served its purpose. + *

+ * The entry for a password must have the AS_ADMIN_ prefix followed by the password name in + * uppercase letters, an equals sign, and the password. + *

+ * The entries in the file that are read by the asadmin utility are as follows: + *

    + *
  • AS_ADMIN_PASSWORD=administration-password
  • + *
  • AS_ADMIN_MASTERPASSWORD=master-password
  • The entries in this file that are + * read by subcommands are as follows: + *
  • AS_ADMIN_NEWPASSWORD=new-administration-password (read by the + * start-domain subcommand)
  • + *
  • AS_ADMIN_USERPASSWORD=user-password (read by the create-file-user + * subcommand)
  • + *
  • AS_ADMIN_ALIASPASSWORD=alias-password (read by the + * create-password-alias subcommand)
  • + *
  • AS_ADMIN_MAPPEDPASSWORD=mapped-password (read by the + * create-connector-security-map subcommand)
  • + *
  • AS_ADMIN_WINDOWSPASSWORD=windows-password (read by the + * create-node-dcom, install-node-dcom, and update-node-dcom + * subcommands)
  • + *
  • AS_ADMIN_SSHPASSWORD=sshd-password (read by the create-node-ssh, + * install-node, install-node-ssh, and update-node-ssh + * subcommands)
  • + *
  • AS_ADMIN_SSHKEYPASSPHRASE=sshd-passphrase (read by the + * create-node-ssh, install-node, install-node-ssh, and + * update-node-ssh subcommands)
  • + *
  • AS_ADMIN_JMSDBPASSWORD=jdbc-user-password (read by the + * configure-jms-cluster subcommand)
  • + *
+ * These password entries are stored in clear text in the password file. To provide additional + * security, the create-password-alias subcommand can be used to create aliases for passwords that + * are used by remote subcommands. The password for which the alias is created is stored in an + * encrypted form. If an alias exists for a password, the alias is specified in the entry for the + * password as follows: + *

+ * AS_ADMIN_password-name=${ALIAS=password-alias-name} For example: + *

    + *
  • AS_ADMIN_SSHPASSWORD=${ALIAS=ssh-password-alias}
  • + *
  • AS_ADMIN_SSHKEYPASSPHRASE=${ALIAS=ssh-key-passphrase-alias}
  • + *
+ *

+ * + * @author Tomas Kraus + */ +public class PasswordFile { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(PasswordFile.class); + + /** Name of password file. */ + public static final String PASSWORD_FILE_NAME = "password-file"; + + /** + * Password file permissions when file is being created before writing it's content. + */ + private static final Set CREATE_FILE_PERMISSIONS = new HashSet<>(); + static { + CREATE_FILE_PERMISSIONS.add(PosixFilePermission.OWNER_READ); + CREATE_FILE_PERMISSIONS.add(PosixFilePermission.OWNER_WRITE); + } + + /** Password file permissions when file is finished. */ + private static final Set FINAL_FILE_PERMISSIONS = new HashSet<>(); + static { + FINAL_FILE_PERMISSIONS.add(PosixFilePermission.OWNER_READ); + } + + /** Key to value assignment character. */ + private static final char ASSIGN_VALUE = '='; + + /** Administrator password key (mandatory). */ + private static final String AS_ADMIN_PASSWORD = "AS_ADMIN_PASSWORD"; + + /** Master password key (optional). */ + private static final String AS_ADMIN_MASTERPASSWORD = "AS_ADMIN_MASTERPASSWORD"; + + /** New administrator password to be set (optional). */ + private static final String AS_ADMIN_NEWPASSWORD = "AS_ADMIN_NEWPASSWORD"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + public static Path buildPasswordFilePath(final PayaraServer server) { + final String METHOD = "buildPasswordFilePath"; + String domainsFolder = server.getDomainsFolder(); + String domainName = server.getDomainName(); + if (domainsFolder == null || domainName == null) { + throw new CommandException(LOGGER.excMsg(METHOD, "nullValue")); + } + return Paths.get(domainsFolder, domainName, + GF_DOMAIN_CONFIG_DIR_NAME, PASSWORD_FILE_NAME); + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Password file path. */ + Path file; + + /** Administrator password value (mandatory). */ + private String adminPassword; + + /** Master password value (optional). */ + private String masterPassword; + + /** New administrator password to be set (optional). */ + private String adminNewPassword; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of Support for asadmin --passwordfile file + * format. + *

+ * Content of password file is not read from file so at least administrator password from + * {@link PayaraServer} must be provided. + *

+ * + * @param server GlassFish server instance. + */ + PasswordFile(final PayaraServer server) { + file = buildPasswordFilePath(server); + this.adminPassword = server.getAdminPassword(); + masterPassword = null; + adminNewPassword = null; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get password file path as {@link String}. + */ + public String getFilePath() { + return file.toString(); + } + + /** + * Get administrator password value (mandatory). + *

+ * + * @return Administrator password value (mandatory). + */ + public String getAdminPassword() { + return adminPassword; + } + + /** + * Get administrator password value (mandatory). + *

+ * + * @param adminPassword Administrator password value (mandatory). + */ + public void setAdminPassword(String adminPassword) { + this.adminPassword = adminPassword; + } + + /** + * Get master password value (optional). + *

+ * + * @return Master password value (optional). + */ + public String getMasterPassword() { + return masterPassword; + } + + /** + * Get master password value (optional). + *

+ * + * @param masterPassword Master password value (optional). + */ + public void setMasterPassword(String masterPassword) { + this.masterPassword = masterPassword; + } + + /** + * Get new administrator password to be set (optional). + *

+ * + * @return New administrator password to be set (optional). + */ + public String getAdminNewPassword() { + return adminNewPassword; + } + + /** + * Get new administrator password to be set (optional). + *

+ * + * @param adminNewPassword New administrator password to be set (optional). + */ + public void setAdminNewPassword(String adminNewPassword) { + this.adminNewPassword = adminNewPassword; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Build password file content to be written into file. + *

+ * + * @return Password file content. + */ + private String dataToWrite() { + int len = AS_ADMIN_PASSWORD.length() + 1 + adminPassword.length(); + if (masterPassword != null) { + len += AS_ADMIN_MASTERPASSWORD.length() + + 1 + masterPassword.length(); + } + if (adminNewPassword != null) { + len += AS_ADMIN_NEWPASSWORD.length() + + 1 + adminNewPassword.length(); + } + StringBuilder sb = new StringBuilder(len); + sb.append(AS_ADMIN_PASSWORD).append(ASSIGN_VALUE); + sb.append(adminPassword).append(OsUtils.LINES_SEPARATOR); + if (masterPassword != null) { + sb.append(AS_ADMIN_MASTERPASSWORD).append(ASSIGN_VALUE); + sb.append(masterPassword).append(OsUtils.LINES_SEPARATOR); + } + if (adminNewPassword != null) { + sb.append(AS_ADMIN_NEWPASSWORD).append(ASSIGN_VALUE); + sb.append(adminNewPassword).append(OsUtils.LINES_SEPARATOR); + } + return sb.toString(); + } + + /** + * Create password file to be written with access permissions to read and write by user only. + *

+ * + * @return Value of true if new file was created or false otherwise + */ + private boolean createFilePosix() { + final String METHOD = "createFilePosix"; + boolean success = false; + try { + if (Files.notExists(file, new LinkOption[0])) { + Files.createFile(file, PosixFilePermissions + .asFileAttribute(CREATE_FILE_PERMISSIONS)); + success = true; + } else { + Files.setPosixFilePermissions(file, CREATE_FILE_PERMISSIONS); + LOGGER.log(Level.INFO, METHOD, "exists", file.toString()); + } + } catch (UnsupportedOperationException uoe) { + LOGGER.log(Level.INFO, METHOD, "unsupported", file.toString()); + } catch (FileAlreadyExistsException faee) { + LOGGER.log(Level.INFO, METHOD, "exists", file.toString()); + } catch (IOException ioe) { + LOGGER.log(Level.INFO, METHOD, "ioException", ioe); + } + return success; + } + + /** + * Update password file permissions when finished. + *

+ * File should exist. + */ + private boolean finishFilePosix() { + final String METHOD = "finishFilePosix"; + boolean success = false; + try { + Files.setPosixFilePermissions(file, FINAL_FILE_PERMISSIONS); + success = true; + } catch (UnsupportedOperationException uoe) { + LOGGER.log(Level.INFO, METHOD, "unsupported", file.toString()); + } catch (IOException ioe) { + LOGGER.log(Level.INFO, METHOD, "ioException", ioe); + } + return success; + } + + /** + * Write GlassFish password file using stored values. + *

+ * Attempts to set file access permissions to read by user only. + *

+ * + * @return Value of true when file was successfully written or false + * otherwise. + */ + public boolean write() { + final String METHOD = "write"; + if (adminPassword == null) { + // throw new CommandException("noAdminPassword"); + adminPassword = ""; + } + boolean success = true; + Writer out = null; + createFilePosix(); + try { + out = new FileWriter(file.toFile()); + out.write(dataToWrite()); + } catch (IOException ioe) { + success = false; + LOGGER.log(Level.INFO, METHOD, "writeException", + new Object[] { file.toString(), ioe.getMessage() }); + } finally { + if (out != null) { + try { + out.close(); + } catch (IOException ioe) { + success = false; + LOGGER.log(Level.INFO, METHOD, + "closeException", file.toString()); + } + finishFilePosix(); + } + } + return success; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOContent.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOContent.java new file mode 100644 index 00000000..d9fbd146 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOContent.java @@ -0,0 +1,438 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.utils.LinkedList; +import fish.payara.eclipse.tools.server.sdk.utils.StringPrefixTree; + +/** + * Content to verify on server administration command execution standard output and data to send on + * standard input. + *

+ * + * @author Tomas Kraus + */ +public class ProcessIOContent { + + //////////////////////////////////////////////////////////////////////////// + // Inner classes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Prefix tree final node content. + */ + protected static class TreeNode { + /** Match array index. */ + private final Short index; + + /** Response result. */ + private final ProcessIOResult result; + + /** + * Creates an instance of prefix tree final node content. + *

+ * + * @param index Match array index. + * @param result Response result. + */ + private TreeNode(final Short index, final ProcessIOResult result) { + this.index = index; + this.result = result; + } + } + + /** + * Abstract input or output token. + */ + protected abstract static class Token { + + /** + * Array of match indicators for individual success input strings. This value shall not be null. + */ + private final boolean matchSuccess[]; + + /** + * Array of match indicators for individual error input strings. This value shall not be null. + */ + private final boolean matchError[]; + + /** Strings to be matched on standard output stored in prefix tree. */ + private final StringPrefixTree outputStrings; + + /** Maximum length of all stored strings. */ + private final int maxLen; + + /** + * Create an instance of abstract token expecting set of strings on standard output. + *

+ * + * @param inputSuccess Array of input strings considered as successful response to be matched before + * prompt. + * @param inputError Array of input strings considered as error response to be matched before + * prompt. + */ + protected Token(final String[] inputSuccess, final String[] inputError) { + int lenSuccess = inputSuccess != null ? inputSuccess.length : 0; + int lenError = inputError != null ? inputError.length : 0; + int maxLenLocal = 0; + matchSuccess = new boolean[lenSuccess]; + matchError = new boolean[lenError]; + outputStrings = new StringPrefixTree<>(false); + for (short i = 0; i < lenSuccess; i++) { + matchSuccess[i] = false; + outputStrings.add(inputSuccess[i], + new TreeNode(i, ProcessIOResult.SUCCESS)); + if (inputSuccess[i].length() > maxLenLocal) { + maxLenLocal = inputSuccess[i].length(); + } + } + for (short i = 0; i < lenError; i++) { + matchError[i] = false; + outputStrings.add(inputError[i], + new TreeNode(i, ProcessIOResult.ERROR)); + if (inputError[i].length() > maxLenLocal) { + maxLenLocal = inputError[i].length(); + } + } + maxLen = maxLenLocal; + } + + /** + * Get process input prompt different from global input prompt. + *

+ * + * @return Always returns null. + */ + protected String getPrompt() { + return null; + } + + /** + * Returns status of success matching. + *

+ * + * @return Value of true when all successful input strings were matched or + * false otherwise. + */ + protected boolean isSuccess() { + boolean success = true; + for (boolean matchSucces : matchSuccess) { + success = success && matchSucces; + } + return success; + } + + /** + * Array of match indicators for individual error input strings. This value shall not be null. + * + * @return the matchError + */ + protected boolean[] getMatchError() { + return matchError; + } + + /** + * Get strings to be matched on standard output stored in prefix tree. + *

+ * + * @return Strings to be matched on standard output stored in prefix tree. + */ + protected StringPrefixTree getOutputStrings() { + return outputStrings; + } + + /** + * Get maximum length of all stored strings. + *

+ * + * @return Maximum length of all stored strings. + */ + protected int getMaxLen() { + return maxLen; + } + + /** + * Search for tokens in provided string. + *

+ * + * @param str String to be compared with stored tokens. + * @param offset Beginning index for searching. + * @return Search result. + */ + protected ProcessIOResult match(CharSequence str, int offset) { + TreeNode node = outputStrings.prefixMatch(str, offset); + if (node != null) { + switch (node.result) { + case SUCCESS: + matchSuccess[node.index] = true; + return isSuccess() + ? ProcessIOResult.SUCCESS + : ProcessIOResult.UNKNOWN; + case ERROR: + matchError[node.index] = true; + return ProcessIOResult.ERROR; + } + } + return ProcessIOResult.UNKNOWN; + } + } + + /** + * Output token contains data to be send on prompt. + */ + protected static class OutputToken extends Token { + + /** + * Create an instance of output token expecting set of strings on standard output. + *

+ * + * @param inputSuccess Array of input strings considered as successful response to be matched before + * prompt. + * @param inputError Array of input strings considered as error response to be matched before + * prompt. + */ + protected OutputToken(final String[] inputSuccess, final String[] inputError) { + super(inputSuccess, inputError); + } + + } + + /** + * Input token contains data to be send on prompt. + */ + protected static class InputToken extends Token { + + /** Process input prompt when differs from global input prompt. */ + private final String prompt; + + /** + * Create an instance of input token expecting custom input prompt and set of strings on standard + * output. + *

+ * + * @param prompt Process input prompt different from global input prompt. + * @param input Array of input strings to be matched before prompt. + * @param output Output to be sent after all input strings are matched and prompt is received. + */ + protected InputToken(final String prompt, final String[] input, + final String output) { + super(input, null); + this.prompt = prompt; + } + + /** + * Get process input prompt different from global input prompt. + *

+ * + * @return Process input prompt different from global input prompt or null when no such + * prompt is set. + */ + @Override + protected String getPrompt() { + return prompt; + } + + } + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(ProcessIOContent.class); + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Process input prompt. Data on standard input are expected after sending this string to standard + * output. + */ + private final String prompt; + + /** List of tokens to be processed. */ + private final LinkedList tokens; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of server administration command execution content. + *

+ * + * @param prompt Process input prompt. + */ + public ProcessIOContent(final String prompt) { + this.prompt = prompt; + tokens = new LinkedList<>(); + } + + /** + * Creates an instance of server administration command execution content. + *

+ * No input prompt is set. This constructor may be used for commands which are expecting no input. + */ + public ProcessIOContent() { + this(null); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get global process input prompt. + *

+ * + * @return Global process input prompt. + */ + public String getPrompt() { + return prompt; + } + + /** + * Get current input prompt. + *

+ * + * @return Current input prompt. + */ + public String getCurrentPrompt() { + Token token = tokens.getCurrent(); + String tokenPrompt = token != null ? token.getPrompt() : null; + return tokenPrompt != null ? tokenPrompt : prompt; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Add next expected process output to be matched. + *

+ * All strings in inputSuccess array must be matched for successful evaluation. Any + * matching string from inputError will cause evaluation as error. + *

+ * + * @param inputSuccess Array of input strings considered as successful response to be matched before + * prompt. + * @param inputError Array of input strings considered as error response to be matched before + * prompt. + */ + public void addOutput(final String[] inputSuccess, + final String[] inputError) { + tokens.addLast(new OutputToken(inputSuccess, inputError)); + } + + /** + * Add next expected process output to be matched. + *

+ * All strings in inputSuccess array must be matched for successful evaluation. + *

+ * + * @param inputSuccess Array of input strings considered as successful response to be matched before + * prompt. + */ + public void addOutput(final String[] inputSuccess) { + tokens.addLast(new OutputToken(inputSuccess, null)); + } + + /** + * Add next expected process input dependent on matched process output. + *

+ * All strings in inputSuccess array must be matched for successful evaluation. Any + * matching string from inputError will cause evaluation as error. + *

+ * + * @param prompt Process input prompt different from global input prompt. + * @param input Array of input strings to be matched before prompt. + * @param output Output to be sent after all input strings are matched and prompt is received. + */ + public void addInput(final String prompt, final String[] input, + final String output) { + tokens.addLast(new InputToken(prompt, input, output)); + } + + /** + * Add next expected process input dependent on matched process output. + *

+ * inputSuccess string must be matched for successful evaluation. Any matching string + * from inputError will cause evaluation as error. + *

+ * + * @param prompt Process input prompt different from global input prompt. + * @param input Input string to be matched before prompt. + * @param output Output to be sent after all input strings are matched and prompt is received. + */ + public void addInput(final String prompt, final String input, + final String output) { + tokens.addLast(new InputToken(prompt, new String[] { input }, output)); + } + + /** + * Add next expected process input dependent on matched process output. + *

+ * All strings in inputSuccess array must be matched for successful evaluation. Any + * matching string from inputError will cause evaluation as error. + *

+ * + * @param input Array of input strings to be matched before prompt. + * @param output Output to be sent after all input strings are matched and prompt is received. + */ + public void addInput(final String[] input, final String output) { + tokens.addLast(new InputToken(prompt, input, output)); + } + + /** + * Add next expected process input dependent on matched process output. + *

+ * inputSuccess string must be matched for successful evaluation. Any matching string + * from inputError will cause evaluation as error. + *

+ * + * @param input Input string to be matched before prompt. + * @param output Output to be sent after all input strings are matched and prompt is received. + */ + public void addInput(final String input, final String output) { + tokens.addLast(new InputToken(prompt, new String[] { input }, output)); + } + + /** + * Get first token to be processed from list. + *

+ * + * @return First token from list or null when list is empty. + */ + public Token firstToken() { + tokens.first(); + return tokens.getCurrent(); + } + + /** + * Get next token to be processed from list. + *

+ * Next token from list or null when there are no more tokens in the list. + */ + public Token nextToken() { + return tokens.next() ? tokens.getCurrent() : null; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOParser.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOParser.java new file mode 100644 index 00000000..f1fb0c92 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOParser.java @@ -0,0 +1,436 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.Reader; +import java.io.Writer; + +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.utils.CyclicStringBuffer; +import fish.payara.eclipse.tools.server.sdk.utils.LinkedList; +import fish.payara.eclipse.tools.server.sdk.utils.OsUtils; + +/** + * Parse process IO and verify it against content verification data. + *

+ * + * @author Tomas Kraus + */ +public class ProcessIOParser { + + //////////////////////////////////////////////////////////////////////////// + // Inner classes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Parse process output. + *

+ * Process output is being read as text lines separated by prompt string, CR or CRLF. Each finished + * line is searched for provided process IO content. + */ + protected static class Parser { + + /** + * State machine input classes. + */ + protected enum Input { + /** Content of user, password hash or tool strings. */ + STRING, + /** Separator character. */ + PROMPT, + /** CR character, beginning of CRLF sequence. */ + CR, + /** LF Character. */ + LF; + + /** Enumeration length. */ + protected static final int length = Input.values().length; + + /** + * Get input class value for provided character. + *

+ * + * @param c Character to check tor input class. + * @return Input class of provided character. + */ + protected static Input value(final char c, final String prompt, + final CyclicStringBuffer promptBuff) { + if (prompt != null && promptBuff.equals(prompt)) { + return PROMPT; + } + switch (c) { + case '\r': + return CR; + case '\n': + return LF; + default: + return STRING; + } + } + + } + + /** + * State machine internal states. + */ + protected enum State { + /** Initial state, expecting line 1st character. */ + START, + /** Reading line characters until line separator or prompt. */ + LINE, + /** Got '\r', expecting '\n' from EOL. */ + CR, + /** Error state. */ + ERROR; + + /** Enumeration length. */ + protected static final int length = State.values().length; + + /** Transition table for [State, Input]. */ + protected static final State transition[][] = { + // STRING PROMPT CR LF + { LINE, START, CR, START }, // START + { LINE, START, CR, START }, // LINE + { LINE, START, CR, START }, // CR + { ERROR, ERROR, ERROR, ERROR } // ERROR + }; + + /** + * State machine transition. + *

+ * + * @param s Current machine state. + * @param i current input class. + * @return Next machine state. + */ + protected static State next(final State s, final Input i) { + return transition[s.ordinal()][i.ordinal()]; + } + + } + + /** Content to verify on server administration command execution IO. */ + private final ProcessIOContent content; + + /** Content token to be verified. */ + private ProcessIOContent.Token token; + + /** Content verification result. */ + private ProcessIOResult result; + + /** Process input prompt length. Value of zero indicates no prompt. */ + private int promptLen; + + /** Current line being processed. */ + private final StringBuilder line; + + /** Cyclic buffer to compare input against prompt. */ + CyclicStringBuffer promptBuff; + + /** Machine internal state. */ + private State state; + + /** Process output log lines. */ + private final LinkedList output; + + /** + * Creates an instance of process output parser. + *

+ * + * @param content Content to verify on server administration command execution IO. + */ + protected Parser(ProcessIOContent content) { + this.content = content; + line = new StringBuilder(BUFF_SIZE); + state = State.START; + token = this.content.firstToken(); + result = ProcessIOResult.UNKNOWN; + String prompt = content.getCurrentPrompt(); + promptLen = prompt != null ? prompt.length() : 0; + promptBuff = new CyclicStringBuffer(promptLen); + output = new LinkedList(); + } + + /** + * Parses content of process output. + *

+ * + * @param buff Buffer with incoming process standard output data. + * @param len Data length in process standard output buffer. + */ + protected void parse(final char[] buff, final short len) { + for (int pos = 0; pos < len; pos++) { + state = action(buff[pos]); + } + } + + /** + * Finish parsing when end of file was reached. + */ + protected void finish() { + endOfLine('\0'); + } + + /** + * Get content verification result. + *

+ * + * @return Content verification result. + */ + protected ProcessIOResult result() { + return result; + } + + /** + * Run parser action based on current state and character class. + *

+ * + * @param c Current character being processed from {@link Reader} buffer. + * @return Next state transition based on current state and character class. + */ + protected State action(final char c) { + Input cl = Input.value(c, content.getCurrentPrompt(), promptBuff); + switch (state) { + case START: + switch (cl) { + case STRING: + firstChar(c); + break; + case PROMPT: + firstChar(c); + case LF: + endOfLine(c); + } + break; + case LINE: + switch (cl) { + case STRING: + nextChar(c); + break; + case PROMPT: + nextChar(c); + case LF: + endOfLine(c); + } + break; + case CR: + switch (cl) { + case STRING: + nextCharWithCR(c); + break; + case PROMPT: + nextCharWithCR(c); + case LF: + endOfLine(c); + } + break; + } + return State.next(state, cl); + } + + /** + * Clear line content and append first character. + *

+ * + * @param c Current character from buffer. + */ + protected void firstChar(final char c) { + line.setLength(0); + line.append(c); + } + + /** + * Append next character. + *

+ * + * @param c Current character from buffer. + */ + protected void nextChar(final char c) { + line.append(c); + } + + /** + * Append next character after CR. + *

+ * + * @param c Current character from buffer. + */ + protected void nextCharWithCR(final char c) { + line.append('\r'); + line.append(c); + } + + /** + * Handle end of line. + *

+ * + * @param c Current character from buffer (not used). + */ + protected void endOfLine(final char c) { + if (line.length() > 0) { + output.addLast(line.toString()); + } + if (token != null) { + ProcessIOResult matchResult = ProcessIOResult.UNKNOWN; + for (int i = 0; i < line.length(); i++) { + if ((matchResult = token.match(line, i)) != ProcessIOResult.UNKNOWN) { + token = content.nextToken(); + String prompt = content.getCurrentPrompt(); + promptLen = prompt != null ? prompt.length() : 0; + promptBuff.resize(promptLen); + break; + } + } + switch (matchResult) { + case SUCCESS: + if (result == ProcessIOResult.UNKNOWN) { + result = matchResult; + } + break; + case ERROR: + if (result != ProcessIOResult.ERROR) { + result = matchResult; + } + break; + } + } + line.setLength(0); + } + + /** + * Build output string from stored process output lines. + *

+ * + * @return Process output string. + */ + protected String getOutputString() { + int len = 0; + boolean isElement = output.first(); + while (isElement) { + len += output.getCurrent().length(); + isElement = output.next(); + if (isElement) { + len += OsUtils.LINES_SEPARATOR.length(); + } + } + StringBuilder sb = new StringBuilder(len); + isElement = output.first(); + while (isElement) { + sb.append(output.getCurrent()); + isElement = output.next(); + if (isElement) { + sb.append(OsUtils.LINES_SEPARATOR); + } + } + return sb.toString(); + } + + } + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(ProcessIOParser.class); + + /** Internal IO buffer size. */ + private static final short BUFF_SIZE = 128; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Process standard input. */ + private final Writer stdIn; + + /** Process standard output. */ + private final Reader stdOut; + + /** Process standard output parser. */ + private final Parser outParser; + + /** Buffer for incoming process standard output data. */ + private final char[] outBuff; + + /** Data length in process standard output buffer. */ + private short outLen; + + /** Vas process output verification already done? */ + private boolean verifydone; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of process IO verification parser. + *

+ * + * @param stdIn Process standard input. + * @param stdOut Process standard output. + * @param ioContent Content to verify on server administration command execution IO. + */ + public ProcessIOParser(final Writer stdIn, final Reader stdOut, + final ProcessIOContent ioContent) { + this.stdIn = stdIn; + this.stdOut = stdOut; + outParser = new Parser(ioContent); + outBuff = new char[BUFF_SIZE]; + outLen = 0; + verifydone = false; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Verify process output streams against content verification data provided in constructor as + * ioContent argument. + *

+ * + * @return Process output streams verification result. + * @throws IOException When there is an issue with reading process output streams. + */ + public ProcessIOResult verify() throws IOException { + while (outLen >= 0) { + outLen = (short) stdOut.read(outBuff); + outParser.parse(outBuff, outLen); + } + outParser.finish(); + verifydone = true; + return outParser.result(); + } + + /** + * Return process output as {@link String}. + *

+ * + * @return Process output as {@link String}. + */ + public String getOutput() { + final String METHOD = "getOutput"; + if (!verifydone) { + throw new CommandException(LOGGER.excMsg(METHOD, "illegalState")); + } + return outParser.getOutputString(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOResult.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOResult.java new file mode 100644 index 00000000..508df669 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOResult.java @@ -0,0 +1,43 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * Response result. + *

+ * Order of values defines values priority. + *

+ * + * @author Tomas Kraus + */ +public enum ProcessIOResult { + + //////////////////////////////////////////////////////////////////////////// + // Enum values // + //////////////////////////////////////////////////////////////////////////// + + /** Unknown response. */ + UNKNOWN, + + /** Successful response. */ + SUCCESS, + + /** Error response. */ + ERROR +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Result.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Result.java new file mode 100644 index 00000000..03dd4459 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Result.java @@ -0,0 +1,106 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.sdk.TaskState; + +/** + * GlassFish administration command result. + *

+ * Stores administration command result values and command execution state. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public abstract class Result { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** State of GlassFish server administration command execution. */ + TaskState state; + + /** + * Authorization status. + *

+ * Value of true means that there was no authorization issue. Value of + * false means that authorization failed. + */ + boolean auth; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish administration command result. + */ + Result() { + this.state = null; + this.auth = true; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get state of GlassFish server administration command execution. + *

+ * + * @return State of GlassFish server administration command execution. + */ + public TaskState getState() { + return state; + } + + /** + * Get value returned by administration command execution. + *

+ * + * @return Value returned by administration command execution. + */ + public abstract T getValue(); + + /** + * Get administration command execution authorization status. + *

+ * + * @return Value of true means that there was no authorization issue. Value of + * false means that authorization failed. + */ + public boolean isAuth() { + return auth; + } + + /** + * Set administration command execution authorization status. + *

+ * Use only in administration command runners to set result value. + *

+ * + * @param auth Authorization status: Value of true means that there was no + * authorization issue. Value of false means that authorization failed. + */ + public void setAuth(final boolean auth) { + this.auth = auth; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultList.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultList.java new file mode 100644 index 00000000..d902863c --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultList.java @@ -0,0 +1,66 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.List; + +/** + * GlassFish Administration Command Result. + *

+ * Stores administration command result values and command execution state. Result value is + * List. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class ResultList extends Result> { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Value returned by administration command execution. */ + List value; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish administration command result for List result + * value. + */ + ResultList() { + super(); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get value returned by administration command execution. + * + * @return Value returned by administration command execution. + */ + @Override + public List getValue() { + return value; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultLog.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultLog.java new file mode 100644 index 00000000..2f774bfa --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultLog.java @@ -0,0 +1,68 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * GlassFish Administratio Command Result containing server log as List<String> + * values. + *

+ * Stores administration command result values and command execution state. Result value is + * List<String> with individual log lines. String with + * X-Text-Append-Next response URL parameters is also stored. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class ResultLog extends Result { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Server log value returned by admin command execution. */ + ValueLog value; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish admin command result for List<String> result + * value containing server log. + */ + ResultLog() { + super(); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get server log value returned by admin command execution. + *

+ * + * @return Server log value returned by admin command execution. + */ + @Override + public ValueLog getValue() { + return value; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultMap.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultMap.java new file mode 100644 index 00000000..36c6b1f8 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultMap.java @@ -0,0 +1,68 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.HashMap; +import java.util.Map; + +/** + * GlassFish administration command result. + *

+ * Stores administration command result values and command execution state. Result value is + * Map. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class ResultMap extends Result> { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Value returned by administration command execution. */ + HashMap value; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish administration command result for Map result + * value. + */ + ResultMap() { + super(); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get value returned by administration command execution. + * + * @return Value returned by administration command execution. + */ + @Override + public Map getValue() { + return value; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultProcess.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultProcess.java new file mode 100644 index 00000000..7f120464 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultProcess.java @@ -0,0 +1,66 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * GlassFish Admin Command Result containing process execution result values. + *

+ * Stores admin command result values and command execution state. Result value is set of values + * describing process execution. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class ResultProcess extends Result { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Value returned by admin command execution. */ + ValueProcess value; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish admin command result for ValueProcess result + * value. + */ + ResultProcess() { + super(); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get value returned by admin command execution. + *

+ * + * @return Value returned by admin command execution. + */ + @Override + public ValueProcess getValue() { + return value; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultString.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultString.java new file mode 100644 index 00000000..3ecfe5f2 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultString.java @@ -0,0 +1,66 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * GlassFish administration command result containing String value. + *

+ * Stores administration command result values and command execution state. Result value is + * String. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class ResultString extends Result { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Value returned by administration command execution. */ + String value; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish administration command result for String result + * value. + */ + ResultString() { + super(); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get value returned by administration command execution. + *

+ * + * @return Value returned by administration command execution. + */ + @Override + public String getValue() { + return value; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Runner.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Runner.java new file mode 100644 index 00000000..fcb8e41b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Runner.java @@ -0,0 +1,965 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import static fish.payara.eclipse.tools.server.sdk.TaskEvent.SUBMIT; +import static fish.payara.eclipse.tools.server.sdk.TaskState.READY; + +import java.io.IOException; +import java.io.InputStream; +import java.net.Authenticator; +import java.net.ConnectException; +import java.net.HttpURLConnection; +import java.net.InetAddress; +import java.net.MalformedURLException; +import java.net.ProtocolException; +import java.net.Proxy; +import java.net.URL; +import java.net.URLConnection; +import java.net.UnknownHostException; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.logging.Level; + +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.GlassFishToolsConfig; +import fish.payara.eclipse.tools.server.sdk.TaskEvent; +import fish.payara.eclipse.tools.server.sdk.TaskState; +import fish.payara.eclipse.tools.server.sdk.TaskStateListener; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.utils.ServerUtils; + +/** + * Abstract GlassFish server administration command execution. + *

+ * Abstract class implements common GlassFish server administration functionality + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public abstract class Runner implements Callable { + + //////////////////////////////////////////////////////////////////////////// + // Inner classes // + //////////////////////////////////////////////////////////////////////////// + + /** + * State change request data. + */ + protected static class StateChange { + + //////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////// + + /** GlassFish server administration command runner. */ + private final Runner runner; + + /** New task execution state. */ + private final TaskState taskState; + + /** Event related to execution state change. */ + private final TaskEvent taskEvent; + + /** Additional arguments. */ + private final String[] args; + + //////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of state change request data. + *

+ * + * @param runner GlassFish server administration command runner. + * @param taskState New task execution state. + * @param taskEvent Event related to execution state change. + * @param args Additional state change request arguments. + */ + protected StateChange(final Runner runner, final TaskState taskState, final TaskEvent taskEvent, + final String... args) { + this.runner = runner; + this.taskState = taskState; + this.taskEvent = taskEvent; + this.args = args; + } + + //////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////// + + /** + * Update task state value in Result object and notify all registered command execution + * state listeners about command execution state change. + *

+ * + * @return GlassFish administration command receiveResult with updated task execution state. + */ + protected Result handleStateChange() { + return runner.handleStateChange(taskState, taskEvent, args); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(Runner.class); + + /** Socket connection timeout (in miliseconds). */ + public static final int HTTP_CONNECTION_TIMEOUT = 3000; + + /** Delay before administration command execution will be retried. */ + public static final int HTTP_RETRY_DELAY = 3000; + + /** Character used to separate query string from list of parameters. */ + static final char QUERY_SEPARATOR = '?'; + + /** Character used to separate individual parameters. */ + static final char PARAM_SEPARATOR = '&'; + + /** Character used to separate individual items in parameters. */ + static final char ITEM_SEPARATOR = ':'; + + /** Character used to assign value to parameter. */ + static final char PARAM_ASSIGN_VALUE = '='; + + /** String value for true. */ + static final String TRUE_VALUE = "true"; + + /** String value for false. */ + static final String FALSE_VALUE = "false"; + + /** + * Executor used to serialize administration commands passed to GlassFish server. + */ + private static volatile ExecutorService executor; + + /* Global password authenticator for GlassFish servers. */ + private static volatile Authenticator authenticator; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Returns shared Executor instance to serialize administration commands passed to + * GlassFish server. + *

+ * Executor instance is handled internally. + *

+ * + * @return Shared Executor instance. + */ + static ExecutorService serializedExecutor() { + if (executor != null) { + return executor; + } + synchronized (Runner.class) { + if (executor == null) { + executor = Executors.newFixedThreadPool(1); + } + } + return executor; + } + + /** + * Allows to initialize this class to use external Authenticator. + *

+ * This method must be called before first usage of call() method. + *

+ * + * @param authenticator External authenticator for GlassFish servers to be supplied. + */ + public static void init(final Authenticator authenticator) { + synchronized (Runner.class) { + if (Runner.authenticator == null) { + Runner.authenticator = authenticator; + } else { + throw new IllegalStateException(); + } + } + } + + /** + * Get external Authenticator if set. + * + * @return External Authenticator for GlassFish servers or null if no + * external Authenticator was set. + */ + private static Authenticator getAuthenticator() { + return authenticator; + } + + /** + * Returns individual Executor instance to run administration commands passed to + * GlassFish server in parallel. + *

+ * + * @param size Thread pool size. + * @return Individual Executor instance. + */ + static ExecutorService parallelExecutor(final int size) { + return Executors.newFixedThreadPool(size); + } + + /** + * Convert boolean value to String constant. + *

+ * + * @param value boolean value to be converted. + * @return String constant. + */ + static String toString(final boolean value) { + return value ? TRUE_VALUE : FALSE_VALUE; + } + + /** + * Convert String constant representing boolean value to it's original + * boolean value. + *

+ * + * @param constant Constant representing boolean value. + * @return Original boolean value. + * @throws CommandException when constant representing boolean value is not recognized. + */ + static boolean toBoolean(final String constant) throws CommandException { + if (constant == null || constant.length() < 1) { + throw new CommandException(CommandException.INVALID_BOOLEAN_CONSTANT); + } + switch (constant.charAt(0)) { + case 'T': + case 't': + if (constant.regionMatches(true, 1, "rue", 1, 3)) { + return true; + } else { + throw new CommandException(CommandException.INVALID_BOOLEAN_CONSTANT); + } + case 'F': + case 'f': + if (constant.regionMatches(true, 1, "alse", 1, 4)) { + return false; + } else { + throw new CommandException(CommandException.INVALID_BOOLEAN_CONSTANT); + } + default: + throw new CommandException(CommandException.INVALID_BOOLEAN_CONSTANT); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Allow commands to fail without a big message. */ + protected boolean silentFailureAllowed = false; + + /** Server command path (e.g. "/__asadmin/"). */ + protected String path; + + /** + * Sometimes (e.g. during startup), the server does not accept commands. In such cases, it will + * block for 20 seconds and then return with the message "V3 cannot process this command at this + * time, please wait". + *

+ * In such cases, we set a flag and have the option to reissue the command. + */ + boolean retry = false; + + /** Authentication success or failure. */ + boolean auth = true; + + /** Holding GlassFish server for command execution. */ + protected PayaraServer server; + + /** Holding data for command execution. */ + final Command command; + + /** + * GlassFish administration command execution result. + *

+ * Result instance life cycle is started with submitting task into ExecutorService's + * queue. method call() is responsible for correct TaskState and + * receiveResult value handling. + */ + Result result; + + /** Query string for this command. */ + final String query; + + /** Listeners that want to know about command state. */ + protected TaskStateListener[] stateListeners; + + //////////////////////////////////////////////////////////////////////////// + // Abstract methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create Result object corresponding to command execution value to be returned. + */ + protected abstract Result createResult(); + + /** + * Send information to the server via HTTP POST. + *

+ * + * @return true if using HTTP POST to send to server or false otherwise + */ + public abstract boolean getDoOutput(); + + /** + * Inform whether this runner implementation accepts gzip format. + *

+ * + * @return true when gzip format is accepted, false otherwise. + */ + public abstract boolean acceptsGzip(); + + /** + * Template method to allow descendants to implement creation of command url. + *

+ * + * @return url to connect to + */ + protected abstract String constructCommandUrl() throws CommandException; + + /** + * Override to change the type of HTTP method used for this command. Default is GET. + *

+ * + * @return HTTP method (GET, POST, etc.) + */ + protected abstract String getRequestMethod(); + + /** + * Override this method to handle sending data to server. + *

+ * In some cases command has to send data to server. To do that, override this method. + *

+ * + * @param hconn + * @throws IOException + */ + protected abstract void handleSend(final HttpURLConnection hconn) throws IOException; + + /** + * Override this method to read response from provided input stream. + *

+ * Override to read the response data sent by the server. Do not close the stream parameter when + * finished. Caller will take care of that. + *

+ * + * @param in Stream to read data from. + * @return true if response was read correctly. + * @throws java.io.IOException in case of stream error. + */ + protected abstract boolean readResponse(final InputStream in, final HttpURLConnection hconn); + + /** + * Override to parse, validate, and/or format any data read from the server in readResponse() / + * readManifest(). + *

+ * + * @return true if data was processed correctly. + */ + protected abstract boolean processResponse(); + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish Server HTTP Administration Command Entity. + * @param path Server command path. + */ + Runner(final PayaraServer server, final Command command, final String path) { + this(server, command, path, null); + } + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish Server HTTP Administration Command Entity. + * @param path Server command path. + * @param query Query string for this command. + */ + Runner(final PayaraServer server, final Command command, final String path, final String query) { + this.server = server; + this.command = command; + this.path = path; + this.query = query; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Returns the query string for this command. Value is set in constructor. + *

+ * + * @return query string for this command. + */ + String getQuery() { + return query; + } + + /** + * Get GlassFish server administration command entity. + *

+ * + * @return GlassFish server administration command entity. + */ + Command getCommand() { + return command; + } + + /** + * Get command execution result after task is finished. + *

+ * + * @return GlassFish administration command execution result. + */ + public Result getResult() { + return result; + } + + /** + * Do we allow commands to fail without a big message? + *

+ * SDK Exception functional test. + *

+ * + * @return The silentFailureAllowed. + */ + protected boolean isSilentFailureAllowed() { + return silentFailureAllowed; + } + + /** + * Set whether we allow commands to fail without a big message. + *

+ * + * @param silentFailureAllowed The silentFailureAllowed to set. + */ + public void setSilentFailureAllowed(final boolean silentFailureAllowed) { + this.silentFailureAllowed = silentFailureAllowed; + } + + /** + * Set listeners to notify about task state changes. + *

+ * Listeners must be set before task is executed. + *

+ * + * @param listeners Listeners to notify about task state changes. + */ + public void setStateListeners(final TaskStateListener[] listeners) { + this.stateListeners = listeners; + } + + //////////////////////////////////////////////////////////////////////////// + // Fake getters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Override to set the content-type of information sent to the server. Default is null (not set). + *

+ * + * @return content-type of data sent to server via HTTP POST + */ + public String getContentType() { + return null; + } + + /** + * Construct string containing Command string with query parameters + * appended. + *

+ * + * @return Command string with query parameters appended. + */ + String getCommandWithQuery() { + String commandString = command.getCommand(); + if (query == null) { + return commandString; + } else { + StringBuilder sb = new StringBuilder(commandString.length() + 1 + query.length()); + sb.append(commandString); + sb.append(QUERY_SEPARATOR); + sb.append(query); + return sb.toString(); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Build arguments for operationStateChanged method listening for state changes. + *

+ * String arguments passed to state listener:

    + *
  • args[0] server name
  • + *
  • args[1] administration command
  • + *
  • args[2] exception message
  • + *
  • args[3] display message in GUI
  • + *
+ *

+ * + * @param exMessage Exception message. + * @param display Display this event in GUI (Transformed to String value containing + * "true" value when user should be notified or "true" or + * null otherwise. + * @return Arguments for operationStateChanged method listening for state changes. + */ + String[] stateChangeArgs(final String exMessage, final boolean display) { + return new String[] { server.getName(), command.getCommand(), exMessage, Boolean.toString(display) }; + } + + /** + * Build arguments for operationStateChanged method listening for state changes. + *

+ * Send false display argument to operationStateChanged method to not display GUI + * message about this event. + *

+ * + * @param exMessage Exception message. + * @return Arguments for operationStateChanged method listening for state changes. + */ + String[] stateChangeArgs(final String exMessage) { + return new String[] { server.getName(), command.getCommand(), exMessage, Boolean.toString(false) }; + } + + /** + * Update task state value in Result object and notify all registered command execution + * state listeners about command execution state change. + *

+ * This method is not responsible for setting receiveResult value returned by GlassFish. This method + * is used after task is submitted into ExecutorService's queue and Result object is + * initialized. + *

+ * + * @param newTaskState New task execution state. + * @param taskEvent Event related to execution state change. + * @param args Additional arguments. + * @return GlassFish administration command receiveResult with updated task execution state. + */ + Result handleStateChange(TaskState newTaskState, final TaskEvent taskEvent, final String... args) { + result.state = newTaskState; + if (stateListeners != null) { + for (TaskStateListener stateListener : stateListeners) { + if (stateListener != null) { + stateListener.operationStateChanged(newTaskState, taskEvent, args); + } + } + } + + return result; + } + + /** + * Used with external execution code to prepare initial task state before task is passed to + * executor. + */ + public void setReadyState() { + result = createResult(); + handleStateChange(READY, SUBMIT, stateChangeArgs(null)); + } + + /** + * Execute an arbitrary server command. + *

+ * + * @return Future object to retrieve receiveResult of asynchronous execution. + */ + Future execute() { + setReadyState(); + return serializedExecutor().submit(this); + } + + /** + * Execute an arbitrary server command using provided executor. + *

+ * + * @param executor {@link ExecutorService} instance used to run this task. + * @return Future object to retrieve receiveResult of asynchronous execution. + */ + Future execute(ExecutorService executor) { + setReadyState(); + return executor.submit(this); + } + + /** + * Prepare headers for HTTP connection. This handles all common headers for all implemented command + * interfaces (REST, HTTP, ...). + *

+ * + * @param conn Target HTTP connection. + * @throws CommandException if there is a problem with setting the headers. + */ + protected void prepareHttpConnection(final HttpURLConnection conn) throws CommandException { + final String METHOD = "prepareHttpConnection"; + // Set up standard connection characteristics + conn.setAllowUserInteraction(false); + conn.setDoInput(true); + conn.setUseCaches(false); + conn.setConnectTimeout(HTTP_CONNECTION_TIMEOUT); + String adminUser = server.getAdminUser(); + String adminPassword = server.getAdminPassword(); + LOGGER.log(Level.FINEST, METHOD, "setting", + new Object[] { new Integer(HTTP_CONNECTION_TIMEOUT), adminUser, adminPassword }); + try { + conn.setRequestMethod(getRequestMethod()); + } catch (ProtocolException pe) { + throw new CommandException(CommandException.RUNNER_HTTP_HEADERS, pe); + } + conn.setDoOutput(getDoOutput()); + String contentType = getContentType(); + if (contentType != null && contentType.length() > 0) { + conn.setRequestProperty("Content-Type", contentType); + conn.setChunkedStreamingMode(0); + } + if (adminPassword != null && adminPassword.length() > 0) { + String authString = ServerUtils.basicAuthCredentials(adminUser, adminPassword); + LOGGER.log(Level.FINEST, METHOD, "using"); + conn.setRequestProperty("Authorization", "Basic " + authString); + } + if (acceptsGzip()) { + conn.setRequestProperty("Accept-Encoding", "gzip"); + } + } + + protected void handleSecureConnection(final HttpsURLConnection conn) { + final String METHOD = "handleSecureConnection"; + // let's just trust any server that we connect to... + // we aren't send them money or secrets... + TrustManager[] tm = new TrustManager[] { new X509TrustManager() { + + @Override + public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { + } + + @Override + public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + } }; + + SSLContext context; + try { + context = SSLContext.getInstance("SSL"); + context.init(null, tm, null); + conn.setSSLSocketFactory(context.getSocketFactory()); + conn.setHostnameVerifier((string, ssls) -> true); + } catch (NoSuchAlgorithmException | KeyManagementException ex) { + // if there is an issue here... there will be another exception + // later which will take care of the user interaction... + LOGGER.log(Level.INFO, METHOD, "issue", conn.getURL()); + LOGGER.log(Level.INFO, METHOD, "exception", ex); + } + } + + protected boolean handleReceive(final HttpURLConnection hconn) throws IOException { + final String METHOD = "handleReceive"; + boolean receiveResult = false; + InputStream httpInputStream = hconn.getInputStream(); + try { + receiveResult = readResponse(httpInputStream, hconn); + } finally { + try { + httpInputStream.close(); + } catch (IOException ioe) { + LOGGER.log(Level.WARNING, METHOD, "exception", ioe); + } + } + return receiveResult; + } + + //////////////////////////////////////////////////////////////////////////// + // ExecutorService call() method attributes + // Do not use those attributes outside call() method execution context! // + //////////////////////////////////////////////////////////////////////////// + + /** GlassFish server administration interface URL. */ + private URL urlToConnectTo; + + /** GlassFish server administration interface URL connection. */ + private URLConnection conn; + + /** GlassFish server administration interface HTTP URL connection. */ + private HttpURLConnection hconn; + + //////////////////////////////////////////////////////////////////////////// + // ExecutorService call() method helpers // + // Do not use those methods outside call() method execution context! // + //////////////////////////////////////////////////////////////////////////// + + /** + * Initialize class instance attributes for call() method. + */ + private void initCallAttributes() { + urlToConnectTo = null; + conn = null; + hconn = null; + } + + /** + * Creates {@link URLConnection} instance that represents a connection to GlassFish server + * administration interface. + *

+ * Depending on GlassFisg Tooling Library configuration proxy usage for loopback addresses may be + * suppressed. + *

+ * + * @param urlToConnectTo GlassFish server administration interface URL. + * @return lassFish server administration interface URL connection. + * @throws IOException IOException if an I/O error occurs while opening the connection. + */ + private static URLConnection openURLConnection(final URL urlToConnectTo) throws IOException { + if (!GlassFishToolsConfig.getProxyForLoopback()) { + InetAddress addr; + try { + addr = InetAddress.getByName(urlToConnectTo.getHost()); + } catch (UnknownHostException ex) { + addr = null; + } + if (addr != null && addr.isLoopbackAddress()) { + return urlToConnectTo.openConnection(Proxy.NO_PROXY); + } + } + return urlToConnectTo.openConnection(); + } + + /** + * Handle HTTP connections to server. + *

+ * + * @return State change request when call() method should exit. + */ + private StateChange handleHTTPConnection() throws IOException { + final String METHOD = "handleHTTPConnection"; + URL oldUrlToConnectTo; + do { // deal with possible redirects from 3.1 + oldUrlToConnectTo = urlToConnectTo; + hconn = (HttpURLConnection) conn; + if (conn instanceof HttpsURLConnection) { + handleSecureConnection((HttpsURLConnection) conn); + } + prepareHttpConnection(hconn); + LOGGER.log(Level.FINEST, METHOD, "connect", + new Object[] { server.getHost(), Integer.toString(server.getAdminPort()) }); + // Use external Authenticator if supplied + Authenticator extAuth = Runner.getAuthenticator(); + if (extAuth != null) { + Authenticator.setDefault(extAuth); + } + // Connect to server. + hconn.connect(); + // Send data to server if necessary. + handleSend(hconn); + int respCode = hconn.getResponseCode(); + StateChange change = handleHTTPResponse(respCode); + if (change != null) { + return change; + } + } while (urlToConnectTo != oldUrlToConnectTo); + return null; + } + + /** + * Handle HTTP response from server. + *

+ * + * @param responseCode HTTP Response code. + * @return State change request when call() method should exit. + */ + private StateChange handleHTTPResponse(final int responseCode) throws IOException { + final String METHOD = "handleHTTPResponse"; + LOGGER.log(Level.FINE, METHOD, "response", responseCode); + if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED || responseCode == HttpURLConnection.HTTP_FORBIDDEN) { + result.auth = auth = false; + return new StateChange(this, TaskState.FAILED, TaskEvent.AUTH_FAILED_HTTP, stateChangeArgs(null, true)); + } else if (responseCode == HttpURLConnection.HTTP_BAD_GATEWAY) { + // signals proxy configuration problem + return new StateChange(this, TaskState.FAILED, TaskEvent.BAD_GATEWAY, stateChangeArgs(null, true)); + } else if (responseCode == HttpURLConnection.HTTP_MOVED_TEMP + || responseCode == HttpURLConnection.HTTP_MOVED_PERM) { + String newUrl = hconn.getHeaderField("Location"); + if (null == newUrl || "".equals(newUrl.trim())) { + LOGGER.log(Level.SEVERE, METHOD, "invalidRedirect", urlToConnectTo.toString()); + } else { + LOGGER.log(Level.FINE, METHOD, "locationMoved", newUrl); + urlToConnectTo = new URL(newUrl); + conn = openURLConnection(urlToConnectTo); + hconn.disconnect(); + } + } + return null; + } + + /** + * Log administration command failure. + *

+ * + * @param method Method component of log message key. + */ + private void logCommandFailure(final String method) { + LOGGER.log(Level.FINE, method, "failure", + new Object[] { hconn.toString(), hconn.getContentType(), hconn.getContentEncoding() }); + Map> ms2ls = hconn.getHeaderFields(); + LOGGER.log(Level.FINE, method, "headerFields"); + for (Map.Entry> e : ms2ls.entrySet()) { + StringBuilder sb = new StringBuilder(); + sb.append("["); + boolean first = true; + for (String v : e.getValue()) { + if (first) { + first = false; + } else { + sb.append(", "); + } + sb.append(v); + } + sb.append("]"); + LOGGER.log(Level.FINE, method, "headerField", new String[] { e.getKey(), sb.toString() }); + } + } + + //////////////////////////////////////////////////////////////////////////// + // ExecutorService call() method // + //////////////////////////////////////////////////////////////////////////// + + /** + * GlassFish server administration command execution call. This is an entry point from + * executor's serialization queue. + *

+ * + * @return Task execution state. + */ + @SuppressWarnings("SleepWhileInLoop") + @Override + public Result call() { + final String METHOD = "call"; + boolean httpSucceeded = false; + boolean commandSucceeded = false; + String commandUrl; + initCallAttributes(); + + handleStateChange(TaskState.RUNNING, TaskEvent.CMD_RUNNING, stateChangeArgs(null)); + try { + commandUrl = constructCommandUrl(); + } catch (CommandException ce) { + return handleStateChange(TaskState.FAILED, TaskEvent.CMD_EXCEPTION, + stateChangeArgs(ce.getLocalizedMessage())); + } + // disable ("version".equals(cmd) || "__locations".equals(cmd)) ? 1 : 3; + int retries = 1; + LOGGER.log(Level.FINEST, METHOD, "thread", new Object[] { commandUrl, Thread.currentThread().getName() }); + try { + urlToConnectTo = new URL(commandUrl); + while (!httpSucceeded && retries-- > 0) { + try { + conn = openURLConnection(urlToConnectTo); + if (conn instanceof HttpURLConnection) { + StateChange change = handleHTTPConnection(); + if (change != null) { + return change.handleStateChange(); + } + // Process the response message. + // In Glassfish v4 HTTP interface authentication failure + // can only be found in readResponse() method where + // response message contains + // "javax.security.auth.login.LoginException". + boolean receiveResult = handleReceive(hconn); + boolean processResult = processResponse(); + commandSucceeded = receiveResult && processResult; + if (!auth) { + return handleStateChange(TaskState.FAILED, TaskEvent.AUTH_FAILED, + stateChangeArgs(null, true)); + } else if (!commandSucceeded && !isSilentFailureAllowed() && LOGGER.isLoggable(Level.FINE)) { + logCommandFailure(METHOD); + } + httpSucceeded = true; + } else { + LOGGER.log(Level.INFO, METHOD, "unexpectedConnection", urlToConnectTo); + } + } catch (ProtocolException ex) { + handleStateChange(TaskState.FAILED, TaskEvent.EXCEPTION, + stateChangeArgs(ex.getLocalizedMessage(), true)); + retries = 0; + } catch (ConnectException ce) { + return handleStateChange(TaskState.FAILED, TaskEvent.EXCEPTION, + stateChangeArgs(ce.getLocalizedMessage())); + } catch (IOException ex) { + if (retries <= 0) { + return handleStateChange(TaskState.FAILED, TaskEvent.EXCEPTION, + stateChangeArgs(ex.getLocalizedMessage())); + } + } finally { + if (null != hconn) { + hconn.disconnect(); + } + } + + if (!httpSucceeded && retries > 0) { + try { + Thread.sleep(HTTP_RETRY_DELAY); + } catch (InterruptedException ie) { + LOGGER.log(Level.INFO, METHOD, "sleepInterrupted", ie); + } + } + } // while + } catch (MalformedURLException ex) { + LOGGER.log(Level.WARNING, METHOD, "malformedURLException", ex); + } + + if (commandSucceeded) { + return handleStateChange(TaskState.COMPLETED, TaskEvent.CMD_COMPLETED, stateChangeArgs(null)); + } else { + return handleStateChange(TaskState.FAILED, TaskEvent.CMD_FAILED, stateChangeArgs(null)); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadmin.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadmin.java new file mode 100644 index 00000000..9e8ee488 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadmin.java @@ -0,0 +1,328 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.io.Writer; +import java.net.HttpURLConnection; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.TaskEvent; +import fish.payara.eclipse.tools.server.sdk.TaskState; +import fish.payara.eclipse.tools.server.sdk.data.ToolConfig; +import fish.payara.eclipse.tools.server.sdk.data.ToolsConfig; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.utils.OsUtils; +import fish.payara.eclipse.tools.server.sdk.utils.ServerUtils; + +/** + * GlassFish server administration command execution using local asadmin interface. + *

+ * Class implements GlassFish server administration functionality command line asadmin interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public abstract class RunnerAsadmin extends RunnerJava { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(RunnerAsadmin.class); + + /** Specifies the administrator username. */ + private static final String USER_PARAM = "--user"; + + /** + * Specifies the name, including the full path, of a file that contains password entries. + */ + private static final String PASSWORD_FILE_PARAM = "--passwordfile"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Extracts asadmin JAR path from GlassFish server entity object. + *

+ * + * @param server GlassFish server entity object. + * @return Asadmin JAR path to execute. + */ + private static String extractPath(final PayaraServer server) { + final String METHOD = "extractPath"; + ToolsConfig toolsConfig = getServerConfig(server).getTools(); + if (toolsConfig == null) { + throw new CommandException(LOGGER.excMsg(METHOD, "noToolsConfig"), + server.getVersion()); + } + ToolConfig asadmin = toolsConfig.getAsadmin(); + if (asadmin == null) { + throw new CommandException(LOGGER.excMsg(METHOD, "noAsadminConfig"), + server.getVersion()); + } + String serverHome = server.getServerHome(); + String asadminJar = asadmin.getJar(); + StringBuilder sb = new StringBuilder(serverHome.length() + + OsUtils.FILE_SEPARATOR_LENGTH + asadminJar.length()); + sb.append(serverHome); + ServerUtils.addPathElement(sb, asadminJar); + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * GlassFish administration command result. + *

+ * Result instance life cycle is started with submitting task into ExecutorService's + * queue. Method call() is responsible for correct TaskState and + * receiveResult value handling. + */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + protected ResultString result; + + /** Asadmin JAR path (relative under GlassFish home). */ + private final String asadminJar; + + /** Process standard input. */ + protected Writer stdIn; + + /** Process standard output. */ + protected Reader stdOut; + + /** Process standard error output. */ + protected Reader stdErr; + + /** Process IO processing. */ + protected ProcessIOContent processIO; + + /** + * Support for asadmin --passwordfile file format. + */ + protected PasswordFile passwordFile; + + //////////////////////////////////////////////////////////////////////////// + // Abstract methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create internal ProcessIOContent object corresponding to command execution IO. + */ + protected abstract ProcessIOContent createProcessIOContent(); + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using command line asadmin interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + * @param query Query string for this command. + */ + public RunnerAsadmin(final PayaraServer server, final Command command, + final String query) { + super(server, command, query); + asadminJar = extractPath(server); + stdIn = null; + stdOut = null; + stdErr = null; + passwordFile = new PasswordFile(server); + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create ResultString object corresponding to Stringcommand execution + * value to be returned. + *

+ * + * @return Stringcommand execution value to be returned. + */ + @Override + protected Result createResult() { + return result = new ResultString(); + } + + /** + * Reads response from server and stores internally. + *

+ * + * @param in Stream to read data from. + * @return Always returns false. + * @throws CommandException in case of stream error. + */ + @Override + protected boolean readResponse(final InputStream in, + final HttpURLConnection hconn) { + return false; + } + + /** + * Extracts result value from internal storage. + *

+ * + * @return Always returns false. + */ + @Override + protected boolean processResponse() { + return false; + } + + //////////////////////////////////////////////////////////////////////////// + // ExecutorService call() method helpers // + //////////////////////////////////////////////////////////////////////////// + + /** + * Build process execution arguments. + *

+ * + * @return Process execution arguments. + */ + String buildProcessArgs() { + final String METHOD = "buildProcessArgs"; + String user = server.getAdminUser(); + String passwordFilePath = passwordFile.getFilePath(); + StringBuilder sb = new StringBuilder(JAR_PARAM.length() + 1 + + asadminJar.length() + 1 + USER_PARAM.length() + 1 + + user.length() + 1 + PASSWORD_FILE_PARAM.length() + 1 + + passwordFilePath.length() + 1 + + command.command.length() + 1 + + query.length()); + sb.append(JAR_PARAM); + sb.append(PARAM_ASSIGN_VALUE); + sb.append(asadminJar); + sb.append(PARAM_SEPARATOR); + sb.append(USER_PARAM); + sb.append(PARAM_ASSIGN_VALUE); + sb.append(user); + sb.append(PARAM_SEPARATOR); + sb.append(PASSWORD_FILE_PARAM); + sb.append(PARAM_ASSIGN_VALUE); + sb.append(passwordFilePath); + sb.append(PARAM_SEPARATOR); + sb.append(command.command); + sb.append(QUERY_SEPARATOR); + sb.append(query); + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Execute an arbitrary server command. + *

+ * + * @return Future object to retrieve receiveResult of asynchronous execution. + */ + @Override + Future execute() { + processIO = createProcessIOContent(); + return super.execute(); + } + + /** + * Execute an arbitrary server command using provided executor. + *

+ * + * @return Future object to retrieve receiveResult of asynchronous execution. + */ + @Override + Future execute(final ExecutorService executor) { + processIO = createProcessIOContent(); + return super.execute(executor); + } + + //////////////////////////////////////////////////////////////////////////// + // ExecutorService call() method // + //////////////////////////////////////////////////////////////////////////// + + /** + * GlassFish server administration command execution call. This is an entry point from + * executor's serialization queue. + *

+ * Attempts to start local GalssFish DAS directly using java executable. + *

+ * + * @return Task execution state. + */ + @Override + public Result call() { + if (!verifyJavaVM()) { + return handleStateChange(TaskState.FAILED, + TaskEvent.NO_JAVA_VM, command.getCommand(), + server.getName()); + } + passwordFile.write(); + Process process; + String[] args = OsUtils.parseParameters(javaVMExe, buildProcessArgs()); + ProcessBuilder pb = new ProcessBuilder(args); + pb.redirectErrorStream(true); + setProcessCurrentDir(pb); + setJavaEnvironment(pb.environment(), command); + try { + process = pb.start(); + } catch (IOException ex) { + return handleStateChange(TaskState.FAILED, + TaskEvent.JAVA_VM_EXEC_FAILED, command.getCommand(), + server.getName()); + } + ProcessIOParser parser = new ProcessIOParser( + new OutputStreamWriter(process.getOutputStream()), + new InputStreamReader(process.getInputStream()), + processIO); + ProcessIOResult verifyResult; + try { + verifyResult = parser.verify(); + result.value = parser.getOutput(); + } catch (IOException ex) { + return handleStateChange(TaskState.FAILED, + TaskEvent.EXCEPTION, command.getCommand(), + server.getName()); + } + switch (verifyResult) { + case SUCCESS: + return handleStateChange(TaskState.COMPLETED, + TaskEvent.CMD_COMPLETED, command.getCommand(), + server.getName()); + default: + return handleStateChange(TaskState.FAILED, + TaskEvent.CMD_FAILED, command.getCommand(), + server.getName()); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadminChangeAdminPassword.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadminChangeAdminPassword.java new file mode 100644 index 00000000..46219394 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadminChangeAdminPassword.java @@ -0,0 +1,124 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.utils.OsUtils; + +/** + * Change administrator password command execution using local asadmin interface. + *

+ * + * @author Tomas Kraus + */ +public class RunnerAsadminChangeAdminPassword extends RunnerAsadmin { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(RunnerAsadminChangeAdminPassword.class); + + /** Specifies the domain of the administrator user. */ + private static final String DOMAIN_NAME_PARAM = "--domain_name"; + + /** + * Specifies the parent directory of the domain specified in the --domain_name option. + */ + private static final String DOMAINDIR_PARAM = "--domaindir"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Builds change-admin-password command query string. + */ + private static String query(final PayaraServer server, + final Command command) { + final String METHOD = "query"; + String domainsFolder = OsUtils.escapeString(server.getDomainsFolder()); + String domainName = OsUtils.escapeString(server.getDomainName()); + if (domainName == null || domainsFolder == null) { + throw new CommandException(LOGGER.excMsg(METHOD, "nullValue")); + } + StringBuilder sb = new StringBuilder( + DOMAIN_NAME_PARAM.length() + 1 + domainName.length() + 1 + + DOMAINDIR_PARAM.length() + 1 + domainsFolder.length()); + sb.append(DOMAINDIR_PARAM); + sb.append(PARAM_ASSIGN_VALUE); + sb.append(domainsFolder); + sb.append(PARAM_SEPARATOR); + sb.append(DOMAIN_NAME_PARAM); + sb.append(PARAM_ASSIGN_VALUE); + sb.append(domainName); + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Holding data for command execution. */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + final CommandChangeAdminPassword command; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using command line asadmin interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerAsadminChangeAdminPassword(final PayaraServer server, + final Command command) { + super(server, command, query(server, command)); + final String METHOD = "init"; + if (command instanceof CommandChangeAdminPassword) { + this.command = (CommandChangeAdminPassword) command; + } else { + throw new CommandException( + LOGGER.excMsg(METHOD, "illegalInstance")); + } + passwordFile.setAdminNewPassword(this.command.password); + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create internal ProcessIOContent object corresponding to command execution IO. + */ + @Override + protected ProcessIOContent createProcessIOContent() { + ProcessIOContent processIOContent = new ProcessIOContent(); + processIOContent.addOutput( + new String[] { "Command", "executed successfully" }, + new String[] { "Command change-admin-password failed" }); + return processIOContent; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadminRestoreDomain.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadminRestoreDomain.java new file mode 100644 index 00000000..7b6c01b6 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadminRestoreDomain.java @@ -0,0 +1,134 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.utils.OsUtils; + +/** + * + * @author Peter Benedikovic + */ +public class RunnerAsadminRestoreDomain extends RunnerAsadmin { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(RunnerAsadminRestoreDomain.class); + + /** Specifies the domain dir. */ + private static final String DOMAIN_DIR_PARAM = "--domaindir"; + + /** Specifies the directory where the backup archive is stored. */ + private static final String BACKUP_DIR_PARAM = "--backupdir"; + + /** Specifies the name of the backup archive. */ + private static final String BACKUP_FILE_PARAM = "--filename"; + + /** Specifies the force param needed to restore from non-standard location. */ + private static final String FORCE_PARAM = "--force"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Builds change-admin-password command query string. + */ + private static String query(final PayaraServer server, + final Command command) { + final String METHOD = "query"; + CommandRestoreDomain restoreCommand; + String domainsFolder = OsUtils.escapeString(server.getDomainsFolder()); + String domainName = OsUtils.escapeString(server.getDomainName()); + if (domainName == null || domainsFolder == null) { + throw new CommandException(LOGGER.excMsg(METHOD, "nullValue")); + } + if (command instanceof CommandRestoreDomain) { + restoreCommand = (CommandRestoreDomain) command; + } else { + throw new CommandException( + LOGGER.excMsg(METHOD, "illegalInstance")); + } + StringBuilder sb = new StringBuilder(); + sb.append(DOMAIN_DIR_PARAM); + sb.append(PARAM_ASSIGN_VALUE); + sb.append(domainsFolder); + sb.append(PARAM_SEPARATOR); + sb.append(FORCE_PARAM); + sb.append(PARAM_SEPARATOR); + sb.append(BACKUP_FILE_PARAM); + sb.append(PARAM_ASSIGN_VALUE); + sb.append(restoreCommand.domainBackup.getAbsolutePath()); + sb.append(PARAM_SEPARATOR); + sb.append(domainName); + System.out.println("Restore command params: " + sb.toString()); + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Holding data for command execution. */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + final CommandRestoreDomain command; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using command line asadmin interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerAsadminRestoreDomain(final PayaraServer server, + final Command command) { + super(server, command, query(server, command)); + final String METHOD = "init"; + if (command instanceof CommandRestoreDomain) { + this.command = (CommandRestoreDomain) command; + } else { + throw new CommandException( + LOGGER.excMsg(METHOD, "illegalInstance")); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create internal ProcessIOContent object corresponding to command execution IO. + */ + @Override + protected ProcessIOContent createProcessIOContent() { + ProcessIOContent processIOContent = new ProcessIOContent(); + processIOContent.addOutput( + new String[] { "Command", "executed successfully" }, + new String[] { "Command restore-domain failed" }); + return processIOContent; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttp.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttp.java new file mode 100644 index 00000000..061fdf0c --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttp.java @@ -0,0 +1,546 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.net.ConnectException; +import java.net.HttpURLConnection; +import java.net.SocketException; +import java.net.SocketTimeoutException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URLDecoder; +import java.util.Locale; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.jar.Manifest; +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.utils.NetUtils; +import fish.payara.eclipse.tools.server.sdk.utils.ServerUtils; + +/** + * GlassFish server administration command execution using HTTP interface. + *

+ * Class implements GlassFish server administration functionality trough HTTP interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttp extends Runner { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Character used to separate individual items in libraries query parameter. + */ + static final char LIBRARY_SEPARATOR = ','; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Calculate properties length based on properties map. + *

+ * + * @param properties Properties to be added into query string. + * @param paramName Properties parameter name in query string. + * @return Size of properties query string to be added. + */ + static int queryPropertiesLength(final Map properties, + final String paramName) { + int propertyLength = 0; + if (null != properties && properties.size() > 0) { + Set> entrySet = properties.entrySet(); + boolean first = true; + propertyLength += paramName.length() + 2; + for (Map.Entry entry : entrySet) { + String key = entry.getKey(); + String val = entry.getValue(); + if (key == null) { + throw new CommandException( + CommandException.ILLEGAL_NULL_VALUE); + } + if (first) { + first = false; + } else { + propertyLength++; + } + propertyLength += key.length() + 1 + + (val != null ? val.length() : 0); + } + } + return propertyLength; + } + + /** + * Calculate libraries length based on libraries array. + *

+ * + * @param libraries Libraries to be added into query string. + * @param paramName Libraries parameter name in query string. + * @return Size of libraries query string to be added. + */ + static int queryLibrariesLength(final File[] libraries, + final String paramName) { + int propertyLength = 0; + if (null != libraries && libraries.length > 0) { + boolean first = true; + propertyLength += paramName.length() + 2; + for (File library : libraries) { + if (first) { + first = false; + } else { + propertyLength++; + } + propertyLength += library.getPath().length(); + } + } + return propertyLength; + } + + /** + * Append properties to existing query string stored in given StringBuilder. + *

+ * + * @param sb Target StringBuilder where to append properties. + * @param properties Properties to be added into query string. + * @param paramName Properties parameter name in query string. + * @param separator Prepend parameter separator if true + * @return Target StringBuilder with properties appended. + */ + static StringBuilder queryPropertiesAppend(StringBuilder sb, + final Map properties, final String paramName, + final boolean separator) { + if (null != properties && properties.size() > 0) { + Set> entrySet = properties.entrySet(); + boolean first = true; + if (separator) { + sb.append(PARAM_SEPARATOR); + } + sb.append(paramName).append(PARAM_ASSIGN_VALUE); + for (Map.Entry entry : entrySet) { + String key = entry.getKey(); + String val = entry.getValue(); + if (first) { + first = false; + } else { + sb.append(ITEM_SEPARATOR); + } + sb.append(key); + sb.append(PARAM_ASSIGN_VALUE); + if (val != null) { + sb.append(val); + } + } + } + return sb; + } + + /** + * Append libraries to existing query string stored in given StringBuilder. + *

+ * + * @param sb Target StringBuilder where to append properties. + * @param libraries Libraries to be added into query string. + * @param paramName Libraries parameter name in query string. + * @param separator Prepend parameter separator if true + * @return Target StringBuilder with libraries appended. + */ + static StringBuilder queryLibrariesAppend(StringBuilder sb, + final File[] libraries, final String paramName, + final boolean separator) { + if (null != libraries && libraries.length > 0) { + boolean first = true; + if (separator) { + sb.append(PARAM_SEPARATOR); + } + sb.append(paramName).append(PARAM_ASSIGN_VALUE); + for (File library : libraries) { + if (first) { + first = false; + } else { + sb.append(LIBRARY_SEPARATOR); + } + sb.append(library.getPath()); + } + } + return sb; + } + + /** + * Check Manifest exit-code attribute for result. Missing value or any value + * differed to< code>"FAILED" is considered as success. + *

+ * Response processing helper method. Manifest must contain valid data. + *

+ * + * @param manifest Manifest from server response. + * @return true for success and false for failure. + */ + private static boolean successExitCode(Manifest manifest) { + String exitCode = manifest.getMainAttributes().getValue("exit-code"); + return exitCode == null + || !"FAILURE".equals(exitCode.toUpperCase(Locale.ENGLISH)); + } + + private static String getHttpListenerProtocol(String hostname, int port, + String url) { + String retVal = "http"; // NOI18N + try { + if (NetUtils.isSecurePort(hostname, port)) { + retVal = "https"; // NOI18N + } + } catch (ConnectException ex) { + Logger.log(Level.INFO, hostname + ":" + port + "::" + url, ex); + } catch (SocketException ex) { + Logger.log(Level.FINE, hostname + ":" + port + "::" + url, ex); + } catch (SocketTimeoutException ex) { + Logger.log(Level.INFO, hostname + ":" + port + "::" + url, ex); + } catch (IOException ex) { + Logger.log(Level.INFO, hostname + ":" + port + "::" + url, ex); + } + return retVal; + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Manifest from server response. + *

+ * Manifest instance is internal server response holder. Manifest instance + * life cycle is started in readResponse method where manifest returned from server is + * read and stored internally. + */ + Manifest manifest; + + /** + * GlassFish administration command result. + *

+ * Result instance life cycle is started with submitting task into ExecutorService's + * queue. method call() is responsible for correct TaskState and + * receiveResult value handling. + */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + ResultString result; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttp(final PayaraServer server, final Command command) { + this(server, command, (String) null); + } + + /** + * Constructs an instance of administration command executor using HTTP interface. This constructor + * allows child classes to set their own path. + *

+ * For use in child classes only. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + * @param query Query string for this command. + */ + RunnerHttp(final PayaraServer server, final Command command, + final String query) { + this(server, command, "/__asadmin/", query); + } + + /** + * Constructs an instance of administration command executor using HTTP interface. This constructor + * allows child classes to set their own path. + *

+ * For use in child classes only. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + * @param path Server command path. + * @param query Query string for this command. + */ + protected RunnerHttp(final PayaraServer server, final Command command, + final String path, final String query) { + super(server, command, path, query); + silentFailureAllowed = false; + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create ResultString object corresponding to Stringcommand execution + * value to be returned. + *

+ * + * @return Stringcommand execution value to be returned. + */ + @Override + protected Result createResult() { + return result = new ResultString(); + } + + /** + * Do not send information to the server via HTTP POST by default. + *

+ * + * @return true if using HTTP POST to send to server or false otherwise + */ + @Override + public boolean getDoOutput() { + return false; + } + + /** + * Inform whether this runner implementation accepts gzip format. + *

+ * + * @return true when gzip format is accepted, false otherwise. + */ + @Override + public boolean acceptsGzip() { + return false; + } + + /** + * Build GlassFish HTTP command URL. + * + * @return String value containing command URL. + * @throws CommandException if there is a problem with building command URL. + */ + @Override + protected String constructCommandUrl() throws CommandException { + String host = server.getHost(); + boolean useAdminPort = !"false" + .equals(System.getProperty("glassfish.useadminport")); + int port = useAdminPort ? server.getAdminPort() : server.getPort(); + String protocol = "http"; + String url = server.getUrl(); + String domainsDir = server.getDomainsFolder(); + if (null == url) { + protocol = getHttpListenerProtocol(host, port, ":::" + + command.getCommand() + "?" + query); + } else if (!(url.contains("ee6wc"))) { + protocol = getHttpListenerProtocol(host, port, url + ":::" + + command.getCommand() + "?" + query); + } else if (url.contains("ee6wc") && (null == domainsDir + || "".equals(domainsDir))) { + protocol = "https"; + } + URI uri; + try { + uri = new URI(protocol, null, host, port, + path + command.getCommand(), query, null); + } catch (URISyntaxException use) { + throw new CommandException(CommandException.RUNNER_HTTP_URL, use); + } + // These characters don't get handled by GF correctly. Best I can tell. + return uri.toASCIIString().replace("+", "%2b"); + } + + /** + * Override to change the type of HTTP method used for this command. Default is GET. + * + * @return HTTP method (GET, POST, etc.) + */ + @Override + protected String getRequestMethod() { + return "GET"; + } + + /** + * Handle sending data to server using HTTP command interface. + *

+ * Does nothing by default. + */ + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + } + + /** + * Reads response from server and stores it into internal Manifest object. Value of + * exit-code attribute is verified to detect if command completed successfully. If not, + * message value is checked for "please wait" String to eventually set + * retry value to true. + *

+ * Override to read the response data sent by the server. Do not close the stream parameter when + * finished. Caller will take care of that. + *

+ * + * @param in Stream to read data from. + * @return true if response was read correctly. + * @throws CommandException in case of stream error. + */ + @Override + protected boolean readResponse(InputStream in, HttpURLConnection hconn) { + boolean readResult; + manifest = new Manifest(); + try { + Logger.log(Level.FINEST, "Reading response from {0}:{1}", + new Object[] { server.getHost(), + Integer.toString(server.getAdminPort()) }); + manifest.read(in); + } catch (IOException ioe) { + throw new CommandException(CommandException.HTTP_RESP_IO_EXCEPTION, + ioe); + } + if (successExitCode(manifest)) { + readResult = true; + } else { + readResult = false; + String message = getMessage(manifest); + if (message != null) { + if (message.contains("please wait")) { + retry = true; + } else if (message.contains( + "javax.security.auth.login.LoginException")) { + auth = false; + } + } + } + return readResult; + } + + /** + * Extracts result value from internal Manifest object. Value of message + * attribute in Manifest object is stored as value into + * ResultString result object. + *

+ * + * @return true if result was extracted correctly. null messagevalue is + * considered as failure. + */ + @Override + protected boolean processResponse() { + result.value = getMessage(manifest); + result.auth = auth; + Logger.log(Level.FINEST, "Manifest message: {0}", + new Object[] { result.value }); + return result.value != null; + } + + //////////////////////////////////////////////////////////////////////////// + // Fake Getters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Override to provide the lastModified date for data source whose inputstream is returned by + * getInputStream. Must not return null if getInputStream() does not return null; + * + * @return String format of long integer from lastModified date of source. + */ + public String getLastModified() { + return null; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Retrieve message from Manifest object. + *

+ * Response processing helper method. Manifest must contain valid data. Manifest + * instance is always created in readResponse method so no null check is + * required here. + *

+ * + * @param manifest Manifest from server response. + * @return Value of message attribute or null if no such attribute exists. + */ + private String getMessage(Manifest manifest) { + String message = null; + String tmp = manifest.getMainAttributes().getValue("message"); + if (null != tmp) { + try { + message = URLDecoder.decode( + ServerUtils.manifestDecode(tmp), "UTF-8"); + } catch (UnsupportedEncodingException uee) { + Logger.log(Level.WARNING, "Could not URL decode with UTF-8", uee); + } catch (IllegalArgumentException iae) { + Logger.log(Level.FINE, "Caught IllegalArgumentException", iae); + message = tmp; + } + } + return message; + } + + /** + * Get extra properties for ZIP entries. + *

+ * + * @return Extra properties for ZIP entries. + */ + byte[] getExtraProperties() { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + Properties props = new Properties(); + props.setProperty("data-request-type", "file-xfer"); + props.setProperty("last-modified", getLastModified()); + props.put("data-request-name", "DEFAULT"); + props.put("data-request-is-recursive", "true"); + props.put("Content-Type", "application/octet-stream"); + props.list(new java.io.PrintStream(baos)); + return baos.toByteArray(); + } + + /** + * Prepare headers for HTTP connection. + *

+ * + * @param conn Target HTTP connection. + * @throws CommandException if there is a problem with setting the headers. + */ + @Override + protected void prepareHttpConnection(HttpURLConnection conn) throws CommandException { + super.prepareHttpConnection(conn); + String contentType = getContentType(); + if (contentType == null || contentType.length() <= 0) { + // work around that helps prevent tickling the + // GF issue that is the root cause of 195384. + // + // GF doesn't expect to get image content, so it doesn't + // try to handle the content... which prevents the + // exception, according to Tim Quinn. + conn.setRequestProperty("Content-Type", "image/png"); + } + conn.setRequestProperty("User-Agent", "hk2-agent"); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpAddResources.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpAddResources.java new file mode 100644 index 00000000..975c96dd --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpAddResources.java @@ -0,0 +1,70 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Runner executes add-resources command via HTTP interface. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class RunnerHttpAddResources extends RunnerHttp { + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Builds add-resources query string for given command. + *

+ * + * @param command GlassFish server administration command entity. CommandAddResources + * instance is expected. + * @return Add-resources query string for given command. + */ + private static String query(Command command) { + CommandAddResources cmd = (CommandAddResources) command; + StringBuilder sb = new StringBuilder(); + sb.append("xml_file_name="); + sb.append(cmd.xmlResFile.getAbsolutePath()); + if (cmd.target != null) { + sb.append("&target="); + sb.append(cmd.target); + } + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpAddResources(final PayaraServer server, + final Command command) { + super(server, command, query(command)); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpClass.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpClass.java new file mode 100644 index 00000000..6f293eba --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpClass.java @@ -0,0 +1,47 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Annotation to select Payara server admin command runner for command entity. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@Retention(RUNTIME) +@Target(TYPE) +public @interface RunnerHttpClass { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Payara command runner class as named value. */ + Class runner() default RunnerHttp.class; + + /** Payara command string if differs from default one. */ + String command() default ""; + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateAdminObject.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateAdminObject.java new file mode 100644 index 00000000..e58dc8b3 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateAdminObject.java @@ -0,0 +1,147 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * GlassFish server create administered object administration command execution using HTTP + * interface. + *

+ * Contains code for create administered object command. Class implements GlassFish server + * administration functionality trough HTTP interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpCreateAdminObject extends RunnerHttp { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create JDBC connection pool command restype parameter name. + */ + private static final String RESOURCE_TYPE_PARAM = "restype"; + + /** + * Create JDBC connection pool command jndi_name parameter name. + */ + private static final String JNDI_NAME_PARAM = "jndi_name"; + + /** + * Create JDBC connection pool command raName parameter name. + */ + private static final String RA_NAME_PARAM = "raname"; + + /** + * Create JDBC connection pool command property parameter name. + */ + private static final String PROPERTY_PARAM = "property"; + + /** + * Create JDBC connection pool command enabled parameter name. + */ + private static final String ENABLED_PARAM = "enabled"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Builds create JDBC connection pool query string for given command. + *

+ * QUERY :: "jndi_name" '=' <jndiName>
+ *          ['&' "restype" '=' <restype> ]
+ *          ['&' "raname" '=' <raName> ]
+ *          ['&' "properties" '=' <pname> '=' <pvalue> + * { ':' <pname> '=' <pvalue>} ]
         + * ['&' "enabled" '=' true|false ]
+ *

+ * + * @param command GlassFish server administration command entity. + * CommandCreateAdminObject instance is expected. + * @return Create JDBC connection pool query string for given command. + */ + private static String query(final Command command) { + String jndiName; + String resType; + String raName; + boolean enabled; + if (command instanceof CommandCreateAdminObject) { + jndiName = ((CommandCreateAdminObject) command).jndiName; + resType = ((CommandCreateAdminObject) command).resType; + raName = ((CommandCreateAdminObject) command).raName; + enabled = ((CommandCreateAdminObject) command).enabled; + } else { + throw new CommandException( + CommandException.ILLEGAL_COMAND_INSTANCE); + } + boolean isResType = resType != null && resType.length() > 0; + boolean isRaname = raName != null && raName.length() > 0; + // Calculate StringBuilder initial length to avoid resizing + StringBuilder sb = new StringBuilder( + JNDI_NAME_PARAM.length() + 1 + jndiName.length() + + ENABLED_PARAM.length() + 1 + toString(enabled).length() + + (isResType + ? RESOURCE_TYPE_PARAM.length() + 1 + resType.length() + : 0) + + (isRaname + ? RA_NAME_PARAM.length() + 1 + raName.length() + : 0) + + queryPropertiesLength( + ((CommandCreateAdminObject) command).properties, + PROPERTY_PARAM)); + // Build query string + sb.append(JNDI_NAME_PARAM).append(PARAM_ASSIGN_VALUE); + sb.append(jndiName); + sb.append(PARAM_SEPARATOR).append(ENABLED_PARAM); + sb.append(PARAM_ASSIGN_VALUE).append(toString(enabled)); + if (isResType) { + sb.append(PARAM_SEPARATOR).append(RESOURCE_TYPE_PARAM); + sb.append(PARAM_ASSIGN_VALUE).append(resType); + } + if (isRaname) { + sb.append(PARAM_SEPARATOR).append(RA_NAME_PARAM); + sb.append(PARAM_ASSIGN_VALUE).append(raName); + } + queryPropertiesAppend(sb, + ((CommandCreateAdminObject) command).properties, + PROPERTY_PARAM, true); + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpCreateAdminObject(final PayaraServer server, + final Command command) { + super(server, command, query(command)); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateConnector.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateConnector.java new file mode 100644 index 00000000..6c6bac91 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateConnector.java @@ -0,0 +1,125 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * GlassFish server create connector resource administration command execution using HTTP interface. + *

+ * Contains code for create connector resource command. Class implements GlassFish server + * administration functionality trough HTTP interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpCreateConnector extends RunnerHttp { + + /** + * Create connector resource command jndi_name parameter name. + */ + private static final String JNDI_NAME_PARAM = "jndi_name"; + + /** + * Create connector resource command poolname parameter name. + */ + private static final String POOL_NAME_PARAM = "poolname"; + + /** + * Create connector resource command property parameter name. + */ + private static final String PROPERTY_PARAM = "property"; + + /** + * Create connector resource command enabled parameter name. + */ + private static final String ENABLED_PARAM = "enabled"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Builds create connector resource query string for given command. + *

+ * QUERY :: "jndi_name" '=' <jndiName>
+ *          ['&' "poolname" '=' <poolName> ]
+ *          ['&' "properties" '=' <pname> '=' <pvalue> + * { ':' <pname> '=' <pvalue>} ]
         + * ['&' "enabled" '=' true|false ]
+ *

+ * + * @param command GlassFish server administration command entity. + * CommandCreateConnector instance is expected. + * @return Create connector resource query string for given command. + */ + private static String query(final Command command) { + String jndiName; + String poolName; + boolean enabled; + if (command instanceof CommandCreateConnector) { + jndiName = ((CommandCreateConnector) command).jndiName; + poolName = ((CommandCreateConnector) command).poolName; + enabled = ((CommandCreateConnector) command).enabled; + } else { + throw new CommandException( + CommandException.ILLEGAL_COMAND_INSTANCE); + } + boolean isPoolName = poolName != null && poolName.length() > 0; + // Calculate StringBuilder initial length to avoid resizing + StringBuilder sb = new StringBuilder( + JNDI_NAME_PARAM.length() + 1 + jndiName.length() + + ENABLED_PARAM.length() + 1 + toString(enabled).length() + + (isPoolName + ? POOL_NAME_PARAM.length() + 1 + poolName.length() + : 0) + + queryPropertiesLength( + ((CommandCreateConnector) command).properties, + PROPERTY_PARAM)); + // Build query string + sb.append(JNDI_NAME_PARAM).append(PARAM_ASSIGN_VALUE); + sb.append(jndiName); + sb.append(PARAM_SEPARATOR).append(ENABLED_PARAM); + sb.append(PARAM_ASSIGN_VALUE).append(toString(enabled)); + if (isPoolName) { + sb.append(PARAM_SEPARATOR).append(POOL_NAME_PARAM); + sb.append(PARAM_ASSIGN_VALUE).append(poolName); + } + queryPropertiesAppend(sb, + ((CommandCreateConnector) command).properties, + PROPERTY_PARAM, true); + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpCreateConnector(final PayaraServer server, + final Command command) { + super(server, command, query(command)); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateConnectorConnectionPool.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateConnectorConnectionPool.java new file mode 100644 index 00000000..c733976b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateConnectorConnectionPool.java @@ -0,0 +1,135 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * GlassFish server create EIS connection pool administration command execution using HTTP + * interface. + *

+ * Contains code for create EIS connection pool command. Class implements GlassFish server + * administration functionality trough HTTP interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpCreateConnectorConnectionPool extends RunnerHttp { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create JDBC connection pool command poolname parameter name. + */ + private static final String POOL_NAME_PARAM = "poolname"; + + /** + * Create JDBC connection pool command raname parameter name. + */ + private static final String RA_NAME_PARAM = "raname"; + + /** + * Create JDBC connection pool command connectiondefinition parameter name. + */ + private static final String CONNECTION_DEFINITION_PARAM = "connectiondefinition"; + + /** + * Create JDBC connection pool command property parameter name. + */ + private static final String PROPERTY_PARAM = "property"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Builds create JDBC connection pool query string for given command. + *

+ * QUERY :: "poolname" '=' <poolname>
+ *          ['&' "restype" '=' <restype> ]
+ *          ['&' "raname" '=' <raName> ]
+ *          ['&' "connectiondefinition" '=' <connectionDefinition> ]
+ *          ['&' "properties" '=' <pname> '=' <pvalue> + * { ':' <pname> '=' <pvalue>} ]
+ *

+ * + * @param command GlassFish server administration command entity. + * CommandCreateAdminObject instance is expected. + * @return Create JDBC connection pool query string for given command. + */ + private static String query(final Command command) { + String poolName; + String raName; + String connectionDefinition; + if (command instanceof CommandCreateConnectorConnectionPool) { + poolName = ((CommandCreateConnectorConnectionPool) command).poolName; + raName = ((CommandCreateConnectorConnectionPool) command).raName; + connectionDefinition = ((CommandCreateConnectorConnectionPool) command).connectionDefinition; + } else { + throw new CommandException( + CommandException.ILLEGAL_COMAND_INSTANCE); + } + boolean isRaname = raName != null && raName.length() > 0; + boolean isConnectionDefinition = connectionDefinition != null + && connectionDefinition.length() > 0; + // Calculate StringBuilder initial length to avoid resizing + StringBuilder sb = new StringBuilder( + POOL_NAME_PARAM.length() + 1 + poolName.length() + + (isRaname + ? RA_NAME_PARAM.length() + 1 + raName.length() + : 0) + + (isConnectionDefinition + ? CONNECTION_DEFINITION_PARAM.length() + + 1 + connectionDefinition.length() + : 0) + + queryPropertiesLength( + ((CommandCreateConnectorConnectionPool) command).properties, PROPERTY_PARAM)); + if (isRaname) { + sb.append(PARAM_SEPARATOR).append(RA_NAME_PARAM); + sb.append(PARAM_ASSIGN_VALUE).append(raName); + } + if (isConnectionDefinition) { + sb.append(PARAM_SEPARATOR).append(RA_NAME_PARAM); + sb.append(PARAM_ASSIGN_VALUE).append(connectionDefinition); + } + queryPropertiesAppend(sb, + ((CommandCreateConnectorConnectionPool) command).properties, + PROPERTY_PARAM, true); + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpCreateConnectorConnectionPool(final PayaraServer server, + final Command command) { + super(server, command, query(command)); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateInstance.java new file mode 100644 index 00000000..b5ee9281 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateInstance.java @@ -0,0 +1,145 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.utils.Utils; + +/** + * GlassFish instance and cluster administration command with DEFAULT=<target> + * query execution using HTTP interface. + *

+ * Contains common code for commands that are called with DEFAULT=<target> query + * string. Individual child classes are not needed at this stage. Class implements GlassFish server + * administration functionality trough HTTP interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpCreateInstance extends RunnerHttp { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(RunnerHttpCreateInstance.class); + + /** Start/Stop command DEFAULT param name. */ + private static final String DEFAULT_PARAM = "DEFAULT"; + + /** Start/Stop command node param name. */ + private static final String NODE_PARAM = "node"; + + /** Start/Stop command cluster param name. */ + private static final String CLUSTER_PARAM = "cluster"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Builds enable/disable query string for given command. + *

+ * QUERY :: "DEFAULT" '=' <name> '&' "node" '=' <node> + * ['&' "cluster" '=' <cluster> ] + *

+ * + * @param command GlassFish Server Admin Command Entity. CommandDisable instance is + * expected. + * @return Enable/Disable query string for given command. + */ + private static String query(Command command) { + final String METHOD = "query"; + String name; + String cluster; + String node; + if (command instanceof CommandCreateInstance) { + cluster = Utils.sanitizeName( + ((CommandCreateInstance) command).target); + if (((CommandTargetName) command).name == null + || ((CommandCreateInstance) command).node == null) { + throw new CommandException(LOGGER.excMsg(METHOD, "nullValue")); + } + name = Utils.sanitizeName(((CommandCreateInstance) command).name); + node = Utils.sanitizeName(((CommandCreateInstance) command).node); + } else { + throw new CommandException( + LOGGER.excMsg(METHOD, "illegalInstance")); + } + StringBuilder sb = new StringBuilder( + DEFAULT_PARAM.length() + 1 + name.length() + + 1 + NODE_PARAM.length() + 1 + node.length() + (cluster != null + ? 1 + CLUSTER_PARAM.length() + 1 + cluster.length() + : 0)); + sb.append(DEFAULT_PARAM).append(PARAM_ASSIGN_VALUE).append(name); + sb.append(PARAM_SEPARATOR); + sb.append(NODE_PARAM).append(PARAM_ASSIGN_VALUE).append(node); + if (cluster != null) { + sb.append(PARAM_SEPARATOR); + sb.append(CLUSTER_PARAM).append(PARAM_ASSIGN_VALUE).append(cluster); + } + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpCreateInstance(final PayaraServer server, + final Command command) { + super(server, command, query(command)); + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Extracts result value from internal Manifest object. Value of message + * attribute in Manifest object is stored as value into + * ResultString result object. + *

+ * + * @return true if result was extracted correctly. null messagevalue is + * considered as failure. + */ + @Override + protected boolean processResponse() { + final String METHOD = "processResponse"; + try { + result.value = manifest.getMainAttributes().getValue("message"); + result.value = result.value.replace("%%%EOL%%%", "\n"); + } catch (IllegalArgumentException iae) { + LOGGER.log(Level.WARNING, METHOD, "illegalArgument", iae); + } + return result.value != null; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateJDBCConnectionPool.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateJDBCConnectionPool.java new file mode 100644 index 00000000..c3ad5ed5 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateJDBCConnectionPool.java @@ -0,0 +1,137 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * GlassFish server create JDBC connection pool administration command execution using HTTP + * interface. + *

+ * Contains code for create JDBC connection pool command. Class implements GlassFish server + * administration functionality trough HTTP interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpCreateJDBCConnectionPool extends RunnerHttp { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create JDBC connection pool command connectionpoolid parameter name. + */ + private static final String CONN_POOL_ID_PARAM = "jdbc_connection_pool_id"; + + /** + * Create JDBC connection pool command datasourceclassname parameter name. + */ + private static final String DS_CLASS_NAME_PARAM = "datasourceclassname"; + + /** + * Create JDBC connection pool command restype parameter name. + */ + private static final String RESOURCE_TYPE_PARAM = "restype"; + + /** + * Create JDBC connection pool command property parameter name. + */ + private static final String PROPERTY_PARAM = "property"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Builds create JDBC connection pool query string for given command. + *

+ * QUERY :: "jdbc_connection_pool_id" '=' <connectionPoolId>
+ *          ['&' "datasourceclassname" '=' <datasourceclassname> ]
+ *          ['&' "restype" '=' <restype> ]
+ *          ['&' "properties" '=' <pname> '=' <pvalue> + * { ':' <pname> '=' <pvalue>} ]
+ *

+ * + * @param command GlassFish server administration command entity. + * CommandCreateJDBCConnectionPool instance is expected. + * @return Create JDBC connection pool query string for given command. + */ + private static String query(final Command command) { + String connectionPoolId; + String dataSourceClassName; + String resType; + if (command instanceof CommandCreateJDBCConnectionPool) { + connectionPoolId = ((CommandCreateJDBCConnectionPool) command).connectionPoolId; + dataSourceClassName = ((CommandCreateJDBCConnectionPool) command).dataSourceClassName; + resType = ((CommandCreateJDBCConnectionPool) command).resType; + } else { + throw new CommandException( + CommandException.ILLEGAL_COMAND_INSTANCE); + } + boolean isDataSourceClassName = dataSourceClassName != null + && dataSourceClassName.length() > 0; + boolean isResType = resType != null && resType.length() > 0; + // Calculate StringBuilder initial length to avoid resizing + StringBuilder sb = new StringBuilder( + CONN_POOL_ID_PARAM.length() + 1 + connectionPoolId.length() + + (isDataSourceClassName + ? DS_CLASS_NAME_PARAM.length() + + 1 + dataSourceClassName.length() + : 0) + + (isResType + ? RESOURCE_TYPE_PARAM.length() + 1 + resType.length() + : 0) + + queryPropertiesLength( + ((CommandCreateJDBCConnectionPool) command).properties, + PROPERTY_PARAM)); + // Build query string + sb.append(CONN_POOL_ID_PARAM).append(PARAM_ASSIGN_VALUE); + sb.append(connectionPoolId); + if (isDataSourceClassName) { + sb.append(PARAM_SEPARATOR).append(DS_CLASS_NAME_PARAM); + sb.append(PARAM_ASSIGN_VALUE).append(dataSourceClassName); + } + if (isResType) { + sb.append(PARAM_SEPARATOR).append(RESOURCE_TYPE_PARAM); + sb.append(PARAM_ASSIGN_VALUE).append(resType); + } + queryPropertiesAppend(sb, + ((CommandCreateJDBCConnectionPool) command).properties, + PROPERTY_PARAM, true); + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpCreateJDBCConnectionPool(final PayaraServer server, + final Command command) { + super(server, command, query(command)); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateJDBCResource.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateJDBCResource.java new file mode 100644 index 00000000..edc820c3 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateJDBCResource.java @@ -0,0 +1,136 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * GlassFish server create JDBC resource administration command execution using HTTP interface. + *

+ * Contains code for create JDBC resource command. Class implements GlassFish server administration + * functionality trough HTTP interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpCreateJDBCResource extends RunnerHttp { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create JDBC connection pool command connectionpoolid parameter name. + */ + private static final String CONN_POOL_ID_PARAM = "connectionpoolid"; + + /** + * Create JDBC connection pool command jndi_name parameter name. + */ + private static final String JNDI_NAME_PARAM = "jndi_name"; + + /** + * Create JDBC connection pool command target parameter name. + */ + private static final String TARGET_PARAM = "target"; + + /** + * Create JDBC connection pool command property parameter name. + */ + private static final String PROPERTY_PARAM = "property"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Builds create JDBC resource query string for given command. + *

+ * QUERY :: "connectionpoolid" '=' <connectionPoolId>
+ *          ['&' "jndi_name" '=' <jndiName> ]
+ *          ['&' "target" '=' <target> ]
+ *          ['&' "properties" '=' <pname> '=' <pvalue> + * { ':' <pname> '=' <pvalue>} ]
+ *

+ * + * @param command GlassFish server administration command entity. + * CommandCreateJDBCResource instance is expected. + * @return Create JDBC connection pool query string for given command. + */ + private static String query(final Command command) { + String connectionPoolId; + String jndiName; + String target; + if (command instanceof CommandCreateJDBCResource) { + connectionPoolId = ((CommandCreateJDBCResource) command).connectionPoolId; + jndiName = ((CommandCreateJDBCResource) command).jndiName; + target = ((CommandCreateJDBCResource) command).target; + } else { + throw new CommandException( + CommandException.ILLEGAL_COMAND_INSTANCE); + } + boolean isJndiName = jndiName != null && jndiName.length() > 0; + boolean isTarget = target != null && target.length() > 0; + // Calculate StringBuilder initial length to avoid resizing + StringBuilder sb = new StringBuilder( + CONN_POOL_ID_PARAM.length() + 1 + connectionPoolId.length() + + (isJndiName + ? JNDI_NAME_PARAM.length() + + 1 + jndiName.length() + : 0) + + (isTarget + ? TARGET_PARAM.length() + 1 + target.length() + : 0) + + queryPropertiesLength( + ((CommandCreateJDBCResource) command).properties, + PROPERTY_PARAM)); + // Build query string + sb.append(CONN_POOL_ID_PARAM).append(PARAM_ASSIGN_VALUE); + sb.append(connectionPoolId); + if (isJndiName) { + sb.append(PARAM_SEPARATOR).append(JNDI_NAME_PARAM); + sb.append(PARAM_ASSIGN_VALUE).append(jndiName); + } + if (isTarget) { + sb.append(PARAM_SEPARATOR).append(TARGET_PARAM); + sb.append(PARAM_ASSIGN_VALUE).append(target); + } + queryPropertiesAppend(sb, + ((CommandCreateJDBCResource) command).properties, + PROPERTY_PARAM, true); + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpCreateJDBCResource(final PayaraServer server, + final Command command) { + super(server, command, query(command)); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeleteInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeleteInstance.java new file mode 100644 index 00000000..93b21005 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeleteInstance.java @@ -0,0 +1,79 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * GlassFish instance and cluster admin command with DEFAULT=<target> query + * execution using HTTP interface. + *

+ * Contains common code for commands that are called with DEFAULT=<target> query + * string. Individual child classes are not needed at this stage. Class implements GlassFish server + * administration functionality trough HTTP interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpDeleteInstance extends RunnerHttpTarget { + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpDeleteInstance(final PayaraServer server, + final Command command) { + super(server, command); + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Extracts result value from internal Manifest object. Value of message + * attribute in Manifest object is stored as value into + * ResultString result object. + *

+ * + * @return true if result was extracted correctly. null messagevalue is + * considered as failure. + */ + @Override + protected boolean processResponse() { + try { + result.value = manifest.getMainAttributes().getValue("message"); + result.value = result.value.replace("%%%EOL%%%", "\n"); + } catch (IllegalArgumentException iae) { + Logger.log(Level.WARNING, "Caught IllegalArgumentException", iae); + } + return result.value != null; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeleteResource.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeleteResource.java new file mode 100644 index 00000000..217ac61b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeleteResource.java @@ -0,0 +1,74 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * + * @author Peter Benedikovic, Tomas Kraus + */ +public class RunnerHttpDeleteResource extends RunnerHttp { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(RunnerHttpDeleteResource.class); + + /** Deploy command DEFAULT parameter name. */ + private static final String DEFAULT_PARAM = "DEFAULT"; + + /** + * Creates query string from command object properties. + *

+ * + * @param command GlassFish server administration command entity. + * @return Query string from command object properties. + */ + private static String query(CommandDeleteResource command) { + StringBuilder query = new StringBuilder(128); + query.append(DEFAULT_PARAM); + query.append('='); + query.append(command.name); + if (null != command.target) { + query.append(PARAM_SEPARATOR); + query.append("target="); + query.append(command.target); + } + return query.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpDeleteResource(final PayaraServer server, + final Command command) { + super(server, command, query((CommandDeleteResource) command)); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeploy.java new file mode 100644 index 00000000..f34bf432 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeploy.java @@ -0,0 +1,320 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2021 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.BufferedOutputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.util.logging.Level; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.utils.Utils; + +/** + * GlassFish Server deploy Administration Command Execution using HTTP interface. + *

+ * Class implements GlassFish server administration functionality trough HTTP interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpDeploy extends RunnerHttp { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(RunnerHttpDeploy.class); + + /** Deploy command DEFAULT parameter name. */ + private static final String DEFAULT_PARAM = "DEFAULT"; + + /** Deploy command target parameter name. */ + private static final String TARGET_PARAM = "target"; + + /** Deploy command name parameter name. */ + private static final String NAME_PARAM = "name"; + + /** Deploy command contextroot parameter name. */ + private static final String CTXROOT_PARAM = "contextroot"; + + /** Deploy command force parameter name. */ + private static final String FORCE_PARAM = "force"; + + /** Deploy command properties parameter name. */ + private static final String PROPERTIES_PARAM = "properties"; + + /** Deploy command libraries parameter name. */ + private static final String LIBRARIES_PARAM = "libraries"; + + /** Deploy command force parameter value. */ + private static final boolean FORCE_VALUE = true; + + /** Deploy command hotDeploy parameter name. */ + private static final String HOT_DEPLOY_PARAM = "hotDeploy"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Builds deploy query string for given command. + *

+ * QUERY :: "DEFAULT" '=' <path>
+ *          '&' "force" '=' true | false
+ *          ['&' "name" '=' <name> ]
+ *          ['&' "target" '=' <target> ]
+ *          ['&' "contextroot" '=' <contextRoot> ]
+ *          ['&' "properties" '=' <pname> '=' <pvalue> + * { ':' <pname> '=' <pvalue>} ]
+ *          ['&' "libraries" '=' <lname> '=' + * <lvalue> { ':' <lname> '=' <lvalue>} ]
+ *

+ * + * @param command GlassFish server administration deploy command entity. + * @return Deploy query string for given command. + */ + private static String query(final Command command) { + // Prepare values + String name; + String path; + String target; + String ctxRoot; + String force = Boolean.toString(FORCE_VALUE); + String hotDeploy; + CommandDeploy deploy; + if (command instanceof CommandDeploy) { + deploy = (CommandDeploy) command; + if (deploy.path == null) { + throw new CommandException(CommandException.ILLEGAL_NULL_VALUE); + } + name = Utils.sanitizeName(deploy.name); + path = deploy.path.getAbsolutePath(); + target = deploy.target; + ctxRoot = deploy.contextRoot; + hotDeploy = Boolean.toString(deploy.hotDeploy); + } else { + throw new CommandException( + CommandException.ILLEGAL_COMAND_INSTANCE); + } + // Calculate StringBuilder initial length to avoid resizing + StringBuilder sb = new StringBuilder( + DEFAULT_PARAM.length() + 1 + path.length() + + 1 + FORCE_PARAM.length() + 1 + force.length() + + queryPropertiesLength( + deploy.properties, PROPERTIES_PARAM) + + queryLibrariesLength( + deploy.libraries, LIBRARIES_PARAM) + + (name != null && name.length() > 0 + ? 1 + NAME_PARAM.length() + 1 + name.length() + : 0) + + (target != null + ? 1 + TARGET_PARAM.length() + 1 + target.length() + : 0) + + (ctxRoot != null && ctxRoot.length() > 0 + ? 1 + CTXROOT_PARAM.length() + 1 + ctxRoot.length() + : 0) + + (deploy.hotDeploy + ? HOT_DEPLOY_PARAM.length() + 1 + hotDeploy.length() + : 0)); + // Build query string + sb.append(DEFAULT_PARAM).append(PARAM_ASSIGN_VALUE).append(path); + sb.append(PARAM_SEPARATOR); + sb.append(FORCE_PARAM).append(PARAM_ASSIGN_VALUE).append(force); + if (name != null && name.length() > 0) { + sb.append(PARAM_SEPARATOR); + sb.append(NAME_PARAM).append(PARAM_ASSIGN_VALUE).append(name); + } + if (target != null) { + sb.append(PARAM_SEPARATOR); + sb.append(TARGET_PARAM).append(PARAM_ASSIGN_VALUE).append(target); + } + if (ctxRoot != null && ctxRoot.length() > 0) { + sb.append(PARAM_SEPARATOR); + sb.append(CTXROOT_PARAM).append(PARAM_ASSIGN_VALUE).append(ctxRoot); + } + if (deploy.hotDeploy) { + sb.append(PARAM_SEPARATOR); + sb.append(HOT_DEPLOY_PARAM); + sb.append(PARAM_ASSIGN_VALUE).append(hotDeploy); + } + // Add properties into query string. + queryPropertiesAppend(sb, deploy.properties, + PROPERTIES_PARAM, true); + queryLibrariesAppend(sb, deploy.libraries, + LIBRARIES_PARAM, true); + + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Holding data for command execution. */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + final CommandDeploy command; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpDeploy(final PayaraServer server, + final Command command) { + super(server, command, query(command)); + this.command = (CommandDeploy) command; + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Send deployed file to the server via HTTP POST when it's not a directory deployment. + *

+ * + * @return true if using HTTP POST to send to server or false otherwise + */ + @Override + public boolean getDoOutput() { + return !command.dirDeploy; + } + + /** + * HTTP request method used for this command is POST for file deployment and + * GET for directory deployment. + * + * @return HTTP request method used for this command. + */ + @Override + public String getRequestMethod() { + return command.dirDeploy ? super.getRequestMethod() : "POST"; + } + + /** + * Handle sending data to server using HTTP command interface. + *

+ * This is based on reading the code of CLIRemoteCommand.java from the server's code + * repository. Since some asadmin commands need to send multiple files, the server assumes the input + * is a ZIP stream. + */ + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + final String METHOD = "handleSend"; + InputStream istream = getInputStream(); + if (istream != null) { + ZipOutputStream ostream = null; + try { + ostream = new ZipOutputStream(new BufferedOutputStream( + hconn.getOutputStream(), 1024 * 1024)); + ZipEntry e = new ZipEntry(command.path.getName()); + e.setExtra(getExtraProperties()); + ostream.putNextEntry(e); + byte buffer[] = new byte[1024 * 1024]; + while (true) { + int n = istream.read(buffer); + if (n < 0) { + break; + } + ostream.write(buffer, 0, n); + } + ostream.closeEntry(); + ostream.flush(); + } finally { + try { + istream.close(); + } catch (IOException ex) { + LOGGER.log(Level.INFO, METHOD, "ioException", ex); + } + if (ostream != null) { + try { + ostream.close(); + } catch (IOException ex) { + LOGGER.log(Level.INFO, METHOD, "ioException", ex); + } + } + } + } else if ("POST".equalsIgnoreCase(getRequestMethod())) { + LOGGER.log(Level.INFO, METHOD, "noData"); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Fake Getters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Set the content-type of information sent to the server. Returns application/zip for + * file deployment and null (not set) for directory deployment. + * + * @return content-type of data sent to server via HTTP POST + */ + @Override + public String getContentType() { + return command.dirDeploy ? null : "application/zip"; + } + + /** + * Provide the lastModified date for data source whose InputStream is returned by + * getInputStream. + *

+ * + * @return String format of long integer from lastModified date of source. + */ + @Override + public String getLastModified() { + return Long.toString(command.path.lastModified()); + } + + /** + * Get InputStream object for deployed file. + *

+ * + * @return InputStream object for deployed file or null for directory + * deployment. + */ + public InputStream getInputStream() { + final String METHOD = "getInputStream"; + if (command.dirDeploy) { + return null; + } else { + try { + return new FileInputStream(command.path); + } catch (FileNotFoundException fnfe) { + LOGGER.log(Level.INFO, METHOD, "fileNotFound", fnfe); + return null; + } + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpEnableDisable.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpEnableDisable.java new file mode 100644 index 00000000..99063091 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpEnableDisable.java @@ -0,0 +1,106 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.utils.Utils; + +/** + * GlassFish Server enable and disable administration command execution + * using HTTP interface. + *

+ * Contains common code for enable and disable commands. Individual child classes are not needed at + * this stage. Class implements GlassFish server administration functionality trough HTTP interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpEnableDisable extends RunnerHttp { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Enable/Disable command DEFAULT param name. */ + private static final String DEFAULT_PARAM = "DEFAULT"; + + /** Enable/Disable command target param name. */ + private static final String TARGET_PARAM = "target"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Builds enable/disable query string for given command. + *

+ * QUERY :: "DEFAULT" '=' <name> + * ['&' "target" '=' <target> ] + *

+ * + * @param command GlassFish Server Admin Command Entity. CommandDisable instance is + * expected. + * @return Enable/Disable query string for given command. + */ + private static String query(final Command command) { + String target; + String name; + if (command instanceof CommandTargetName) { + target = Utils.sanitizeName(((CommandTargetName) command).target); + if (((CommandTargetName) command).name == null) { + throw new CommandException(CommandException.ILLEGAL_NULL_VALUE); + } + name = Utils.sanitizeName(((CommandTargetName) command).name); + } else { + throw new CommandException( + CommandException.ILLEGAL_COMAND_INSTANCE); + } + StringBuilder sb = new StringBuilder( + DEFAULT_PARAM.length() + 1 + name.length() + (target != null + ? 1 + TARGET_PARAM.length() + 1 + target.length() + : 0)); + sb.append(DEFAULT_PARAM); + sb.append(PARAM_ASSIGN_VALUE); + sb.append(name); + if (target != null) { + sb.append(PARAM_SEPARATOR); + sb.append(TARGET_PARAM); + sb.append(PARAM_ASSIGN_VALUE); + sb.append(target); + } + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of admin command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish Server Admin Command Entity. + */ + public RunnerHttpEnableDisable(final PayaraServer server, + final Command command) { + super(server, command, query(command)); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpGetProperty.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpGetProperty.java new file mode 100644 index 00000000..e932da0f --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpGetProperty.java @@ -0,0 +1,134 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.HashMap; +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * + * @author Peter Benedikovic, Tomas Kraus + */ +public class RunnerHttpGetProperty extends RunnerHttp { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(RunnerHttpGetProperty.class); + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Returned value is map where key-value pairs returned by server are stored. + */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + ResultMap result; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpGetProperty(final PayaraServer server, + final Command command) { + super(server, command, + "pattern=" + ((CommandGetProperty) command).propertyPattern); + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create ResultMap object corresponding to server get property command execution value + * to be returned. + */ + @Override + protected ResultMap createResult() { + return result = new ResultMap<>(); + } + + @Override + protected boolean processResponse() { + final String METHOD = "processResponse"; + if (manifest == null) { + LOGGER.log(Level.WARNING, METHOD, "manifestNull", query); + return false; + } + result.value = new HashMap<>(); + for (String encodedkey : manifest.getEntries().keySet()) { + String key = ""; + try { + if (null != encodedkey) { + key = encodedkey; + key = URLDecoder.decode(encodedkey, "UTF-8"); + } + } catch (UnsupportedEncodingException uee) { + LOGGER.log(Level.INFO, METHOD, + "unsupportedEncoding", encodedkey); + LOGGER.log(Level.INFO, METHOD, "exceptionDetails", uee); + } catch (IllegalArgumentException iae) { + // Ignore this for now + } + int equalsIndex = key.indexOf('='); + if (equalsIndex >= 0) { + String keyPart = key.substring(0, equalsIndex); + String valuePart = key.substring(equalsIndex + 1); + try { + // Around Sept. 2008... 3.x servers were double encoding their + // responces. It appears that has stopped + // (See http://netbeans.org/bugzilla/show_bug.cgi?id=195015) + // The open question is, "When did 3.x stop doing the double + // encode?" since we don't know... this strategy will work + // for us + // Belt and suspenders, like + result.value.put(keyPart, valuePart); // raw form + result.value.put(keyPart, URLDecoder.decode(valuePart, + "UTF-8")); // single decode + result.value.put(keyPart, URLDecoder.decode(result.value.get(keyPart), "UTF-8")); + } catch (UnsupportedEncodingException ex) { + LOGGER.log(Level.INFO, METHOD, + "unsupportedEncoding", result.value.get(keyPart)); + } catch (IllegalArgumentException iae) { + LOGGER.log(Level.INFO, METHOD, "illegalArgument", + new Object[] { valuePart, result.value.get(keyPart) }); + } + } else { + LOGGER.log(Level.WARNING, METHOD, "emptyString", key); + result.value.put(key, ""); + } + } + + return true; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListComponents.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListComponents.java new file mode 100644 index 00000000..8eeda192 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListComponents.java @@ -0,0 +1,113 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.HashMap; +import java.util.List; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.utils.JavaUtils; +import fish.payara.eclipse.tools.server.sdk.utils.ServerUtils; + +/** + * Command runner for retrieving list of components from server. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpListComponents extends RunnerHttpTarget { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * GlassFish administration command result containing server components. + *

+ * Result instance life cycle is started with submitting task into ExecutorService's + * queue. method call() is responsible for correct TaskState and + * receiveResult value handling. + */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + ResultMap> result; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpListComponents(final PayaraServer server, + final Command command) { + super(server, command); + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create ResultList object corresponding to server log command execution value to be + * returned. + */ + @Override + protected ResultMap> createResult() { + return result = new ResultMap<>(); + } + + /** + * Extracts result value from internal Manifest object. Value of message + * attribute in Manifest object is stored as value into + * ResultString result object. + *

+ * + * @return true if result was extracted correctly. null messagevalue is + * considered as failure. + */ + @Override + protected boolean processResponse() { + String resourcesAttr = manifest.getMainAttributes() + .getValue("children"); + String[] components = resourcesAttr != null + ? resourcesAttr.split(ServerUtils.MANIFEST_COMPONENTS_SEPARATOR) + : null; + result.value = new HashMap<>(); + if (components != null) { + for (String component : components) { + String decodedComponent; + try { + decodedComponent = URLDecoder.decode( + component, JavaUtils.UTF_8.name()); + } catch (UnsupportedEncodingException ex) { + decodedComponent = component; + } + ServerUtils.addComponentToMap(result.value, decodedComponent); + } + } + return true; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListResources.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListResources.java new file mode 100644 index 00000000..6bcd2609 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListResources.java @@ -0,0 +1,122 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.jar.Attributes; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.utils.ServerUtils; + +/** + * Command runner for retrieving resources from server. + *

+ *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpListResources extends RunnerHttpTarget { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * GlassFish administration command result containing server resources. + *

+ * Result instance life cycle is started with submitting task into ExecutorService's + * queue. method call() is responsible for correct TaskState and + * receiveResult value handling. + */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + ResultList result; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpListResources(final PayaraServer server, + final Command command) { + super(server, command); + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create ResultList object corresponding to server log command execution value to be + * returned. + */ + @Override + protected ResultList createResult() { + return result = new ResultList<>(); + } + + /** + * Extracts result value from internal Manifest object. Value of message + * attribute in Manifest object is stored as value into + * ResultString result object. + *

+ * + * @return true if result was extracted correctly. null messagevalue is + * considered as failure. + */ + @Override + protected boolean processResponse() { + String resourcesAttr = manifest.getMainAttributes() + .getValue("children"); + String[] resources = resourcesAttr != null + ? resourcesAttr.split(ServerUtils.MANIFEST_RESOURCES_SEPARATOR) + : null; + int resoucesCount = resources != null ? resources.length : 0; + result.value = new ArrayList<>(resoucesCount); + if (resources != null) { + for (String resource : resources) { + Attributes resourceAttr = manifest.getAttributes(resource); + String resourceMsg = resourceAttr.getValue("message"); + String name; + try { + if (resourceMsg != null) { + name = URLDecoder.decode(resourceMsg, "UTF-8"); + } else { + name = null; + } + if (name == null || name.length() <= 0) { + name = URLDecoder.decode(resource.trim(), "UTF-8"); + } + } catch (UnsupportedEncodingException uee) { + throw new CommandException( + CommandException.HTTP_RESP_UNS_ENC_EXCEPTION, uee); + } + result.value.add(name); + } + } + return true; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListWebServices.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListWebServices.java new file mode 100644 index 00000000..e829f765 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListWebServices.java @@ -0,0 +1,108 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Command runner for retrieving list of web services from server. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpListWebServices extends RunnerHttp { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * GlassFish administration command result containing server resources. + *

+ * Result instance life cycle is started with submitting task into ExecutorService's + * queue. method call() is responsible for correct TaskState and + * receiveResult value handling. + */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + ResultList result; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpListWebServices(final PayaraServer server, + final Command command) { + super(server, command); + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create ResultList object corresponding to server log command execution value to be + * returned. + */ + @Override + protected ResultList createResult() { + return result = new ResultList<>(); + } + + /** + * Extracts result value from internal Manifest object. Value of message + * attribute in Manifest object is stored as value into + * ResultString result object. + *

+ * + * @return true if result was extracted correctly. null messagevalue is + * considered as failure. + */ + @Override + protected boolean processResponse() { + if (manifest == null) { + return false; + } + result.value = new ArrayList<>(); + Map filter = new HashMap<>(); + for (String k : manifest.getEntries().keySet()) { + if (!k.contains("address:/") || k.contains("address:/wsat-wsat") || k.contains("address:/__wstx-services")) { + continue; + } + String a = k.replaceFirst(".* address:/", "").replaceFirst("\\. .*", ""); // NOI18N + if (filter.containsKey(a)) { + continue; + } + filter.put(a, a); + result.value.add(a); + } + return true; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpLocation.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpLocation.java new file mode 100644 index 00000000..9812025f --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpLocation.java @@ -0,0 +1,76 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.HashMap; +import java.util.jar.Attributes; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpLocation extends RunnerHttp { + + /** + * Returned value is map where locations are stored under keys specified in CommandLocation class. + */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + ResultMap result; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpLocation(final PayaraServer server, + final Command command) { + super(server, command); + } + + @Override + protected Result createResult() { + return result = new ResultMap<>(); + } + + @Override + protected boolean processResponse() { + if (manifest == null) { + return false; + } + + result.value = new HashMap<>(); + Attributes mainAttrs = manifest.getMainAttributes(); + if (mainAttrs != null) { + result.value.put("Base-Root_value", mainAttrs.getValue("Base-Root_value")); + result.value.put("Domain-Root_value", mainAttrs.getValue("Domain-Root_value")); + result.value.put("message", mainAttrs.getValue("message")); + } + + return true; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpRedeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpRedeploy.java new file mode 100644 index 00000000..d356c54d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpRedeploy.java @@ -0,0 +1,187 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2021 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.utils.Utils; + +/** + * GlassFish Server redeploy Admin Command Execution using HTTP interface. + *

+ * Class implements GlassFish server administration functionality trough HTTP interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpRedeploy extends RunnerHttp { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Deploy command target parameter name. */ + private static final String TARGET_PARAM = "target"; + + /** Deploy command name parameter name. */ + private static final String NAME_PARAM = "name"; + + /** Deploy command contextroot parameter name. */ + private static final String CTXROOT_PARAM = "contextroot"; + + /** Deploy command properties parameter name. */ + private static final String PROPERTIES_PARAM = "properties"; + + /** Deploy command libraries parameter name. */ + private static final String LIBRARIES_PARAM = "libraries"; + + /** Deploy command keepState parameter name. */ + private static final String KEEP_STATE_PARAM = "keepState"; + + /** Deploy command hotDeploy parameter name. */ + private static final String HOT_DEPLOY_PARAM = "hotDeploy"; + + /** Deploy command metadataChanged parameter name. */ + private static final String METADATA_CHANGED_PARAM = "metadataChanged"; + + /** Deploy command sourcesChanged parameter name. */ + private static final String SOURCES_CHANGED_PARAM = "sourcesChanged"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Builds redeploy query string for given command. + *

+ * QUERY :: "DEFAULT" '=' <path>
+ *          ['&' "name" '=' <name> ]
+ *          ['&' "target" '=' <target> ]
+ *          ['&' "contextroot" '=' <contextRoot> ]
+ *          ['&' "keepState" '=' true | false ]
+ *          ['&' "properties" '=' <pname> '=' <pvalue> + * { ':' <pname> '=' <pvalue>} ]
+ *          ['&' "libraries" '=' <lname> '=' + * <lvalue> { ':' <lname> '=' <lvalue>} ] + *

+ * + * @param command GlassFish server administration deploy command entity. + * @return Redeploy query string for given command. + */ + private static String query(final Command command) { + String name; + String target; + String ctxRoot; + String keepState; + String hotDeploy; + CommandRedeploy redeploy; + if (command instanceof CommandRedeploy) { + redeploy = (CommandRedeploy) command; + name = Utils.sanitizeName(redeploy.name); + target = redeploy.target; + ctxRoot = redeploy.contextRoot; + keepState = Boolean.toString(redeploy.keepState); + hotDeploy = Boolean.toString(redeploy.hotDeploy); + } else { + throw new CommandException( + CommandException.ILLEGAL_COMAND_INSTANCE); + } + + // Calculate StringBuilder initial length to avoid resizing + boolean first = true; + StringBuilder sb = new StringBuilder( + queryPropertiesLength( + redeploy.properties, PROPERTIES_PARAM) + + queryLibrariesLength( + redeploy.libraries, LIBRARIES_PARAM) + + (NAME_PARAM.length() + 1 + name.length()) + + (target != null + ? 1 + TARGET_PARAM.length() + 1 + target.length() + : 0) + + (ctxRoot != null && ctxRoot.length() > 0 + ? 1 + CTXROOT_PARAM.length() + 1 + ctxRoot.length() + : 0) + + (redeploy.keepState + ? KEEP_STATE_PARAM.length() + 1 + keepState.length() + : 0) + + (redeploy.hotDeploy + ? HOT_DEPLOY_PARAM.length() + 1 + hotDeploy.length() + : 0)); + sb.append(NAME_PARAM).append(PARAM_ASSIGN_VALUE).append(name); + if (target != null) { + sb.append(PARAM_SEPARATOR); + sb.append(TARGET_PARAM).append(PARAM_ASSIGN_VALUE).append(target); + } + if (ctxRoot != null && ctxRoot.length() > 0) { + sb.append(PARAM_SEPARATOR); + sb.append(CTXROOT_PARAM).append(PARAM_ASSIGN_VALUE).append(ctxRoot); + } + if (redeploy.keepState) { + sb.append(PARAM_SEPARATOR); + sb.append(KEEP_STATE_PARAM); + sb.append(PARAM_ASSIGN_VALUE).append(keepState); + } + if (redeploy.hotDeploy) { + sb.append(PARAM_SEPARATOR); + sb.append(HOT_DEPLOY_PARAM); + sb.append(PARAM_ASSIGN_VALUE).append(hotDeploy); + if (redeploy.metadataChanged) { + sb.append(PARAM_SEPARATOR); + sb.append(METADATA_CHANGED_PARAM); + sb.append(PARAM_ASSIGN_VALUE).append(redeploy.metadataChanged); + } + if (!redeploy.sourcesChanged.isEmpty()) { + sb.append(PARAM_SEPARATOR); + sb.append(SOURCES_CHANGED_PARAM); + sb.append(PARAM_ASSIGN_VALUE).append(String.join(",", redeploy.sourcesChanged)); + } + } + // Add properties into query string. + queryPropertiesAppend(sb, redeploy.properties, + PROPERTIES_PARAM, true); + queryLibrariesAppend(sb, redeploy.libraries, + LIBRARIES_PARAM, true); + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Holding data for command execution. */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + final CommandRedeploy command; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpRedeploy(final PayaraServer server, + final Command command) { + super(server, command, query(command)); + this.command = (CommandRedeploy) command; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpRestartDAS.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpRestartDAS.java new file mode 100644 index 00000000..0d0c4c51 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpRestartDAS.java @@ -0,0 +1,92 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * GlassFish restart DAS administration command with query execution using HTTP + * interface. + *

+ * Contains code for command that is called with + * debug=true|false&force=true|false&kill=true|false query string. + *

+ * Class implements GlassFish server administration functionality trough HTTP interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpRestartDAS extends RunnerHttp { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Restart DAS command debug parameter's name. */ + private static final String DEBUG_PARAM = "debug"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Builds restart DAS query string for given command. + *

+ * debug=true|false&force=true|false&kill=true|false + *

+ * + * @param command GlassFish Server Administration Command Entity. CommandRestartDAS + * instance is expected. + * @return Restart DAS query string for given command. + */ + static String query(final Command command) { + if (command instanceof CommandRestartDAS) { + boolean debug = ((CommandRestartDAS) command).debug; + int boolValSize = FALSE_VALUE.length() > TRUE_VALUE.length() + ? FALSE_VALUE.length() + : TRUE_VALUE.length(); + StringBuilder sb = new StringBuilder(DEBUG_PARAM.length() + + boolValSize + 1); + sb.append(DEBUG_PARAM); + sb.append(PARAM_ASSIGN_VALUE); + sb.append(debug ? TRUE_VALUE : FALSE_VALUE); + return sb.toString(); + } else { + throw new CommandException( + CommandException.ILLEGAL_COMAND_INSTANCE); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpRestartDAS(final PayaraServer server, + final Command command) { + super(server, command, query(command)); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpSetProperty.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpSetProperty.java new file mode 100644 index 00000000..a12e564b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpSetProperty.java @@ -0,0 +1,58 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.text.MessageFormat; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * + * @author Peter Benedikovic, Tomas Kraus + */ +public class RunnerHttpSetProperty extends RunnerHttp { + + /** + * Creates query string from command object properties. + *

+ * + * @param command GlassFish server administration command entity. + * @return Query string from command object properties. + */ + private static String query(CommandSetProperty command) { + return MessageFormat.format( + command.format, command.property, command.value); + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpSetProperty(final PayaraServer server, + final Command command) { + super(server, command, query((CommandSetProperty) command)); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpTarget.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpTarget.java new file mode 100644 index 00000000..56714911 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpTarget.java @@ -0,0 +1,94 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.utils.Utils; + +/** + * GlassFish instance and cluster administration command with DEFAULT=<target> + * query execution using HTTP interface. + *

+ * Contains common code for commands that are called with DEFAULT=<target> query + * string. Individual child classes are not needed at this stage. Class implements GlassFish server + * administration functionality trough HTTP interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpTarget extends RunnerHttp { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Start/Stop command DEFAULT parameter's name. */ + private static final String DEFAULT_PARAM = "DEFAULT"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Builds enable/disable query string for given command. + *

+ * QUERY :: "DEFAULT" '=' <target> + *

+ * + * @param command GlassFish Server Administration Command Entity. CommandDisable + * instance is expected. + * @return Enable/Disable query string for given command. + */ + static String query(Command command) { + String target; + if (command instanceof CommandTarget) { + target = Utils.sanitizeName(((CommandTarget) command).target); + } else { + throw new CommandException( + CommandException.ILLEGAL_COMAND_INSTANCE); + } + if (target == null) { + return null; + } else { + StringBuilder sb = new StringBuilder( + DEFAULT_PARAM.length() + 1 + target.length()); + sb.append(DEFAULT_PARAM); + sb.append(PARAM_ASSIGN_VALUE); + sb.append(target); + return sb.toString(); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpTarget(final PayaraServer server, + final Command command) { + super(server, command, query(command)); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpUndeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpUndeploy.java new file mode 100644 index 00000000..47cecdba --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpUndeploy.java @@ -0,0 +1,106 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.utils.Utils; + +/** + * GlassFish Server undeploy Admin Command Execution using HTTP interface. + *

+ * Contains common code for commands that are called with DEFAULT=<target> query + * string. Individual child classes are not needed at this stage. Class implements GlassFish server + * administration functionality trough HTTP interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpUndeploy extends RunnerHttp { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Enable/Disable command DEFAULT param name. */ + private static final String DEFAULT_PARAM = "DEFAULT"; + + /** Enable/Disable command target param name. */ + private static final String TARGET_PARAM = "target"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Builds enable/disable query string for given command. + *

+ * QUERY :: "DEFAULT" '=' <name> + * ['&' "target" '=' <target> ] + *

+ * + * @param command GlassFish Server Admin Command Entity. CommandDisable instance is + * expected. + * @return Enable/Disable query string for given command. + */ + private static String query(Command command) { + String target; + String name; + if (command instanceof CommandTargetName) { + target = Utils.sanitizeName(((CommandTargetName) command).target); + if (((CommandTargetName) command).name == null) { + throw new CommandException(CommandException.ILLEGAL_NULL_VALUE); + } + name = Utils.sanitizeName(((CommandTargetName) command).name); + } else { + throw new CommandException( + CommandException.ILLEGAL_COMAND_INSTANCE); + } + StringBuilder sb = new StringBuilder( + DEFAULT_PARAM.length() + 1 + name.length() + (target != null + ? 1 + TARGET_PARAM.length() + 1 + target.length() + : 0)); + sb.append(DEFAULT_PARAM); + sb.append(PARAM_ASSIGN_VALUE); + sb.append(name); + if (target != null) { + sb.append(PARAM_SEPARATOR); + sb.append(TARGET_PARAM); + sb.append(PARAM_ASSIGN_VALUE); + sb.append(target); + } + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpUndeploy(final PayaraServer server, + final Command command) { + super(server, command, query(command)); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerJava.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerJava.java new file mode 100644 index 00000000..49693d0b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerJava.java @@ -0,0 +1,321 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.File; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishConfig; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.server.config.ConfigBuilderProvider; +import fish.payara.eclipse.tools.server.sdk.server.config.GlassFishConfigManager; +import fish.payara.eclipse.tools.server.sdk.server.config.JavaSEPlatform; +import fish.payara.eclipse.tools.server.sdk.server.config.JavaSESet; +import fish.payara.eclipse.tools.server.sdk.utils.JavaUtils; +import fish.payara.eclipse.tools.server.sdk.utils.ServerUtils; + +/** + * GlassFish server administration command execution using local Java VM. + *

+ * + * @author Tomas Kraus + */ +abstract class RunnerJava extends Runner { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(RunnerJava.class); + + /** Specifies program encapsulated in a JAR file to execute. */ + static final String JAR_PARAM = "-jar"; + + /** Character used to separate query string from list of parameters. */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + static final char QUERY_SEPARATOR = ' '; + + /** Character used to separate individual parameters. */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + static final char PARAM_SEPARATOR = ' '; + + /** Character used to assign value to parameter. */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + static final char PARAM_ASSIGN_VALUE = ' '; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get {@link GlassFishConfig} instance for provided GlassFish server which shall not be + * null. + *

+ * {@link CommandException} is thrown when configuration object value is null. + *

+ * + * @param server GlassFish server entity object. + * @return GlassFish server features configuration which is not null. + */ + static GlassFishConfig getServerConfig(final PayaraServer server) { + final String METHOD = "getServerConfig"; + GlassFishConfig config = GlassFishConfigManager.getConfig( + ConfigBuilderProvider.getBuilderConfig( + server.getVersion())); + if (config == null) { + throw new CommandException(LOGGER.excMsg(METHOD, "noConfig"), + server.getVersion()); + } + return config; + } + + /** + * Get {@link JavaSESet} instance for provided GlassFish server features configuration. + *

+ * + * @param config GlassFish server features configuration. + * @return GlassFish JavaSE configuration which is not null. + */ + static JavaSESet getJavaSEConfig(final GlassFishConfig config) { + final String METHOD = "getJavaSEConfig"; + JavaSESet javaSEConfig = config.getJavaSE(); + if (javaSEConfig == null) { + throw new CommandException(LOGGER.excMsg(METHOD, "noJavaSEConfig")); + } + return javaSEConfig; + } + + /** + * Constructs path to Java VM executable and verifies if it exists. + *

+ * + * @param server GlassFish server entity object. + * @param command lassFish server administration command with local Java VM. + * @return Path to Java VM executable + */ + private static String getJavaVM(final PayaraServer server, + final CommandJava command) { + final String METHOD = "getJavaVM"; + String javaVmExe = JavaUtils.javaVmExecutableFullPath(command.javaHome); + File javaVmFile = new File(javaVmExe); + // Java VM executable should exist and should be executable. + if (!javaVmFile.canExecute()) { + LOGGER.log(Level.INFO, METHOD, "noJavaVMExe", javaVmExe); + return null; + } + return javaVmExe; + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Holding data for command execution. */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + final CommandJava command; + + /** Java VM executable. */ + final String javaVMExe; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using command line asadmin interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + * @param query Query string for this command. + */ + public RunnerJava(final PayaraServer server, final Command command, + final String query) { + super(server, command, null, query); + final String METHOD = "init"; + if (command instanceof CommandJava) { + this.command = (CommandJava) command; + } else { + throw new CommandException(LOGGER.excMsg(METHOD, "noCommandJava")); + } + javaVMExe = getJavaVM(server, this.command); + if (javaVMExe == null) { + throw new CommandException(LOGGER.excMsg(METHOD, "noJavaVMExe"), + new Object[] { this.command.javaHome, server.getName() }); + } + } + + /** + * Constructs an instance of administration command executor using command line asadmin interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerJava(final PayaraServer server, final Command command) { + this(server, command, null); + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Do not send information to the server via HTTP POST by default. + *

+ * + * @return true if using HTTP POST to send to server or false otherwise + */ + /** + * Do not send information to the server via HTTP POST by default. + *

+ * This method makes no sense for this runner. + *

+ * + * @return Always returns false. + */ + @Override + public boolean getDoOutput() { + return false; + } + + /** + * Inform whether this runner implementation accepts gzip format. + *

+ * This method makes no sense for this runner. + *

+ * + * @return Always returns false. + */ + @Override + public boolean acceptsGzip() { + return false; + } + + /** + * Build GlassFish administration interface command URL. + *

+ * This method makes no sense for this runner. + *

+ * + * @return Always returns null. + * @throws CommandException if there is a problem with building command URL. + */ + @Override + protected String constructCommandUrl() throws CommandException { + return null; + } + + /** + * The type of HTTP method used to access administration interface command. + *

+ * This method makes no sense for this runner. + *

+ * + * @return Always returns null. + */ + @Override + protected String getRequestMethod() { + return null; + } + + /** + * Handle sending data to server using HTTP administration command interface. + *

+ * Does nothing. This method makes no sense for this runner. + */ + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + } + + //////////////////////////////////////////////////////////////////////////// + // ExecutorService call() method helpers // + //////////////////////////////////////////////////////////////////////////// + + /** + * Verifies if Java VM version is supported by provided GlassFish server. + *

+ * + * @return Value of true when Java VM executable version is known and supported by + * provided GlassFish server or false otherwise. + */ + boolean verifyJavaVM() { + final String METHOD = "verifyJavaVM"; + // Java VM executable version must be known. + JavaUtils.JavaVersion javaVersion = JavaUtils.javaVmVersion(new File(javaVMExe)); + if (javaVersion == null) { + LOGGER.log(Level.INFO, METHOD, "unknown", javaVMExe); + return false; + } else { + LOGGER.log(Level.FINEST, METHOD, "info", + new Object[] { javaVMExe, javaVersion.toString() }); + } + // Java VM executable version must be supported by provided server. + Set platforms = getJavaSEConfig(getServerConfig(server)).platforms(); + if (!platforms.contains(javaVersion.toPlatform())) { + LOGGER.log(Level.INFO, METHOD, "unsupported", + new Object[] { javaVMExe, server.getName() }); + return false; + } + return true; + } + + /** + * Prepare Java VM environment for Glassfish server execution. + *

+ * + * @param env Process builder environment Map. + * @param command GlassFish Server Administration Command Entity. + */ + static void setJavaEnvironment(Map env, + CommandJava command) { + // Java VM home stored in AS environment variables JAVA_HOME and AS_JAVA + env.put(JavaUtils.JAVA_HOME_ENV, command.javaHome); + env.put(ServerUtils.AS_JAVA_ENV, command.javaHome); + } + + /** + * Set server process current directory to domain directory if exists. + *

+ * No current directory will be set when domain directory does not exist. + *

+ * + * @param pb Process builder object where to set current directory. + */ + void setProcessCurrentDir(ProcessBuilder pb) { + final String METHOD = "setProcessCurrentDir"; + String domainsFolder = server.getDomainsFolder(); + if (domainsFolder != null && domainsFolder.length() > 0) { + File currentDir = new File( + ServerUtils.getDomainConfigPath(domainsFolder)); + if (currentDir.exists()) { + LOGGER.log(Level.FINEST, METHOD, "dir", + new Object[] { server.getName(), currentDir }); + pb.directory(currentDir); + } + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerLocal.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerLocal.java new file mode 100644 index 00000000..358bdf9d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerLocal.java @@ -0,0 +1,256 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import static fish.payara.eclipse.tools.server.sdk.TaskEvent.CMD_COMPLETED; +import static fish.payara.eclipse.tools.server.sdk.TaskEvent.JAVA_VM_EXEC_FAILED; +import static fish.payara.eclipse.tools.server.sdk.TaskEvent.NO_JAVA_VM; +import static fish.payara.eclipse.tools.server.sdk.TaskState.COMPLETED; +import static fish.payara.eclipse.tools.server.sdk.TaskState.FAILED; +import static fish.payara.eclipse.tools.server.sdk.utils.JavaUtils.VM_CLASSPATH_OPTION; +import static fish.payara.eclipse.tools.server.sdk.utils.JavaUtils.javaVmExecutableFullPath; +import static fish.payara.eclipse.tools.server.sdk.utils.JavaUtils.javaVmVersion; +import static fish.payara.eclipse.tools.server.sdk.utils.OsUtils.parseParameters; +import static fish.payara.eclipse.tools.server.sdk.utils.ServerUtils.GFV3_JAR_MATCHER; +import static fish.payara.eclipse.tools.server.sdk.utils.ServerUtils.getDomainConfigPath; +import static fish.payara.eclipse.tools.server.sdk.utils.ServerUtils.getJarName; +import static fish.payara.eclipse.tools.server.sdk.utils.Utils.quote; +import static java.util.logging.Level.FINEST; +import static java.util.logging.Level.INFO; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.util.logging.Level; +import java.util.logging.Logger; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.utils.JavaUtils; + +/** + * GlassFish server administration command execution using local file access interface. + *

+ * Class implements GlassFish server administration functionality trough local file access + * interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerLocal extends RunnerJava { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** GlassFish main class to be started when using classpath. */ + private static final String MAIN_CLASS = "com.sun.enterprise.glassfish.bootstrap.ASMain"; + + private static final Logger LOGGER = Logger.getLogger(RunnerLocal.class.getName()); + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Holding data for command execution. */ + final CommandStartDAS command; + + /** + * GlassFish admin command result containing process information. + *

+ * Result instance life cycle is started with submitting task into ExecutorService's + * queue. method call() is responsible for correct TaskState and value + * handling. + */ + ResultProcess result; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using local file access interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish Server Administration Command Entity. + */ + public RunnerLocal(PayaraServer server, Command command) { + super(server, command); + this.command = (CommandStartDAS) command; + } + + //////////////////////////////////////////////////////////////////////////// + // ExecutorService call() method // + //////////////////////////////////////////////////////////////////////////// + + /** + * GlassFish server administration command execution call. This is an entry point from + * executor's serialization queue. + *

+ * Attempts to start local GalssFish DAS directly using java executable. + *

+ * + * @return Task execution state. + */ + @Override + public Result call() { + String javaVmExe = javaVmExecutableFullPath(command.javaHome); + File javaVmFile = new File(javaVmExe); + + // Java VM executable should exist. + if (!javaVmFile.exists()) { + LOGGER.log(INFO, "Java VM {0} executable for {1} was not found", + new Object[] { javaVmFile.getAbsolutePath(), server.getName() }); + + return handleStateChange(FAILED, NO_JAVA_VM, command.getCommand(), server.getName()); + } + + // Java VM should be 1.6.0_0 or greater. + checkJavaVersion(javaVmFile); + + String allArgs = buildJavaOptions(server, command); + LOGGER.log(FINEST, "Starting {0} using Java VM {1} and arguments {2}", + new Object[] { server.getName(), javaVmExe, allArgs }); + + ProcessBuilder processBuilder = new ProcessBuilder(parseParameters(javaVmExe, allArgs)); + processBuilder.redirectErrorStream(true); + setProcessCurrentDir(processBuilder); + setJavaEnvironment(processBuilder.environment(), command); + + try { + result.value = new ValueProcess(javaVmFile.getAbsolutePath(), allArgs, processBuilder.start()); + return handleStateChange(COMPLETED, CMD_COMPLETED, command.getCommand(), server.getName()); + + } catch (IOException ex) { + return handleStateChange(FAILED, JAVA_VM_EXEC_FAILED, command.getCommand(), server.getName()); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create ResultString object corresponding to Stringcommand execution + * value to be returned. + */ + @Override + protected Result createResult() { + return result = new ResultProcess(); + } + + /** + * Reads response from server and stores internally. + *

+ * + * @param in Stream to read data from. + * @return Always returns false. + * @throws CommandException in case of stream error. + */ + @Override + protected boolean readResponse(InputStream in, HttpURLConnection hconn) { + return false; + } + + /** + * Extracts result value from internal storage. + *

+ * + * @return Always returns false. + */ + @Override + protected boolean processResponse() { + return false; + } + + /** + * Prepare Java VM options for Glassfish server execution. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish Server Administration Command Entity. + * @return Java VM options for Glassfish server execution as String. + */ + private static String buildJavaOptions(PayaraServer server, CommandStartDAS command) { + // Java VM options + StringBuilder javaOptionsBuilder = new StringBuilder(); + + // Add classpath if exists. + javaOptionsBuilder.append(VM_CLASSPATH_OPTION).append(' '); + if (command.classPath != null && command.classPath.length() > 0) { + javaOptionsBuilder.append(command.classPath); + } else { + javaOptionsBuilder.append(quote(getJarName(server.getServerHome(), GFV3_JAR_MATCHER).getAbsolutePath())); + } + javaOptionsBuilder.append(' '); + + // Add Java VM options. + if (command.javaOpts != null && command.javaOpts.length() > 0) { + javaOptionsBuilder.append(command.javaOpts); + javaOptionsBuilder.append(' '); + } + + // Add startup main class or jar. + javaOptionsBuilder.append(MAIN_CLASS); + javaOptionsBuilder.append(' '); + + // Add Glassfish specific options. + if (command.glassfishArgs != null && command.glassfishArgs.length() > 0) { + javaOptionsBuilder.append(command.glassfishArgs); + } + + return javaOptionsBuilder.toString(); + } + + /** + * Set server process current directory to domain directory if exists. + *

+ * No current directory will be set when domain directory does not exist. + *

+ * + * @param processBuilder Process builder object where to set current directory. + */ + @Override + void setProcessCurrentDir(ProcessBuilder processBuilder) { + if (command.domainDir != null && command.domainDir.length() > 0) { + File currentDir = new File(getDomainConfigPath(command.domainDir)); + if (currentDir.exists()) { + LOGGER.log(FINEST, "Setting {0} process current directory to {1}", + new Object[] { server.getName(), command.domainDir }); + processBuilder.directory(currentDir); + } + } + } + + private void checkJavaVersion(File javaVmFile) { + JavaUtils.JavaVersion javaVersion = javaVmVersion(javaVmFile); + LOGGER.log(FINEST, "Java VM {0} executable version {1}", + new Object[] { javaVmFile.getAbsolutePath(), javaVersion != null ? javaVersion.toString() : "null" }); + + if (javaVersion == null || javaVersion.comapreTo(new JavaUtils.JavaVersion(1, 6, 0, 0)) == -1) { + // Display warning message but try to run server anyway. + LOGGER.log(Level.INFO, + "Java VM {0} executable version {1} can't be used with {2} " + "but trying to start server anyway.", + new Object[] { javaVmFile.getAbsolutePath(), javaVersion != null ? javaVersion.toString() : "null", + server.getName() }); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRest.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRest.java new file mode 100644 index 00000000..9e699651 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRest.java @@ -0,0 +1,314 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Map; +import java.util.Set; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.admin.response.ResponseContentType; +import fish.payara.eclipse.tools.server.sdk.admin.response.ResponseParserFactory; +import fish.payara.eclipse.tools.server.sdk.admin.response.RestActionReport; +import fish.payara.eclipse.tools.server.sdk.admin.response.RestResponseParser; +import fish.payara.eclipse.tools.server.sdk.utils.ServerUtils; + +/** + * GlassFish server administration command execution using REST interface. + *

+ * Class implements GlassFish server administration functionality trough REST interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRest extends Runner { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Parser for returned response. Default response is XML. */ + RestResponseParser parser = ResponseParserFactory.getRestParser(getResponseType()); + + /** Object representation of returned response. */ + RestActionReport report; + + /** + * GlassFish administration command result. + *

+ * Result instance life cycle is started with submitting task into ExecutorService's + * queue. method call() is responsible for correct TaskState and + * receiveResult value handling. + */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + protected ResultString result; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRest(final PayaraServer server, final Command command) { + this(server, command, null); + } + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + * @param query Query string for this command. + */ + public RunnerRest(final PayaraServer server, final Command command, + final String query) { + this(server, command, "/command/", query); + } + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + * @param path path which builds URL we speak to. + * @param query Query string for this command. + */ + public RunnerRest(final PayaraServer server, final Command command, + final String path, final String query) { + super(server, command, path, query); + silentFailureAllowed = false; + } + + /** + * Helper methods that appends java.util.Properties into POST request body. + * + * @param sb + * @param properties + * @param paramName + * @param separator + */ + protected void appendProperties(StringBuilder sb, + final Map properties, final String paramName, + final boolean separator) { + if (null != properties && properties.size() > 0) { + Set> entrySet = properties.entrySet(); + boolean first = true; + if (separator) { + sb.append(PARAM_SEPARATOR); + } + sb.append(paramName).append(PARAM_ASSIGN_VALUE); + for (Map.Entry entry : entrySet) { + String key = entry.getKey(); + String val = entry.getValue(); + if (first) { + first = false; + } else { + sb.append(ITEM_SEPARATOR); + } + sb.append(key); + sb.append(PARAM_ASSIGN_VALUE); + if (val != null) { + sb.append(val); + } + } + } + } + + protected void appendIfNotEmpty(StringBuilder sb, String paramName, String paramValue) { + if ((paramValue != null) && (!paramValue.isEmpty())) { + sb.append(paramName); + sb.append(PARAM_ASSIGN_VALUE); + sb.append(paramValue); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create ResultString object corresponding to Stringcommand execution + * value to be returned. + *

+ * + * @return Stringcommand execution value to be returned. + */ + @Override + protected Result createResult() { + return result = new ResultString(); + } + + /** + * Do not send information to the server via HTTP POST by default. + *

+ * + * @return true if using HTTP POST to send to server or false otherwise + */ + @Override + public boolean getDoOutput() { + return true; + } + + /** + * Inform whether this runner implementation accepts gzip format. + *

+ * + * @return true when gzip format is accepted, false otherwise. + */ + @Override + public boolean acceptsGzip() { + return false; + } + + /** + * Build Glassfish REST command URL. + *

+ * + * @return String value containing command URL. + * @throws CommandException if there is a problem with building command URL. + */ + @Override + protected String constructCommandUrl() throws CommandException { + String protocol = "http"; + URI uri; + try { + uri = new URI(protocol, null, server.getHost(), + server.getAdminPort(), path + command.getCommand(), + query, null); + } catch (URISyntaxException use) { + throw new CommandException(CommandException.RUNNER_HTTP_URL, use); + } + return uri.toASCIIString(); + } + + /** + * Override to change the type of HTTP method used for this command. Default is GET. + *

+ * + * @return HTTP method (GET, POST, etc.) + */ + @Override + protected String getRequestMethod() { + return "POST"; // NOI18N + } + + /* + * Handle sending data to server using REST command interface. + */ + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + // Do nothing. + } + + /** + * Override this method to read response from provided input stream. + *

+ * Override to read the response data sent by the server. Do not close the stream parameter when + * finished. Caller will take care of that. + *

+ *

+ * + * @param in Stream to read data from. + * @return true if response was read correctly. + * @throws java.io.IOException in case of stream error. + */ + @Override + protected boolean readResponse(InputStream in, HttpURLConnection hconn) { + report = parser.parse(in); + return isSuccess(); + } + + /** + * Override to parse, validate, and/or format any data read from the server in readResponse() / + * readManifest(). + *

+ * + * @return true if data was processed correctly. + */ + @Override + protected boolean processResponse() { + result.value = report.getMessage(); + return isSuccess(); + } + + /** + * Added to give descendants possibility to decide what report state has successful meaning. + *

+ * Default is to delegate decision to report itself. + *

+ * + * @return Does report state have successful meaning? + */ + protected boolean isSuccess() { + return report.isSuccess(); + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Prepare headers for HTTP connection. + *

+ * + * @param conn Target HTTP connection. + * @throws CommandException if there is a problem with setting the headers. + */ + @Override + protected void prepareHttpConnection(HttpURLConnection conn) + throws CommandException { + super.prepareHttpConnection(conn); + // from gf4 every command has to be authenticated + String adminUser = server.getAdminUser(); + String adminPassword = server.getAdminPassword(); + if (adminUser != null && adminUser.length() > 0) { + adminPassword = (adminPassword != null + && adminPassword.length() > 0) ? adminPassword : ""; + String authCredentials = ServerUtils.basicAuthCredentials( + adminUser, adminPassword); + conn.setRequestProperty( + "Authorization", "Basic " + authCredentials); + } + conn.setRequestProperty("Accept", getResponseType().toString()); + conn.addRequestProperty("X-Requested-By", + "GlassFish REST HTML interface"); + } + + /** + * Method returns content type in which the server is asked to return the response. + *

+ * + * @return ContentType that runner wants to get from server. + */ + protected ResponseContentType getResponseType() { + return ResponseContentType.APPLICATION_JSON; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestAddResources.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestAddResources.java new file mode 100644 index 00000000..7f25cc57 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestAddResources.java @@ -0,0 +1,59 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Runner executes add-resources commnad via REST interface. + * + * @author Peter Benedikovic, Tomas Kraus + */ +public class RunnerRestAddResources extends RunnerRest { + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestAddResources(final PayaraServer server, + final Command command) { + super(server, command); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + CommandAddResources cmd = (CommandAddResources) command; + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + StringBuilder data = new StringBuilder(); + data.append("xml_file_name=").append(cmd.xmlResFile.getAbsolutePath()); + if (cmd.target != null) { + data.append("&target=").append(cmd.target); + } + + wr.write(data.toString()); + wr.close(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestClass.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestClass.java new file mode 100644 index 00000000..6afb58f3 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestClass.java @@ -0,0 +1,46 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation to select Payara server admin command runner for command entity. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface RunnerRestClass { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Payara command runner class as named value. */ + Class runner() default RunnerRest.class; + + /** Override Payara command string if differs from default one. */ + String command() default ""; + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateCluster.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateCluster.java new file mode 100644 index 00000000..54ac3091 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateCluster.java @@ -0,0 +1,69 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; +import java.net.URI; +import java.net.URISyntaxException; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Command runner for creating a cluster. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestCreateCluster extends RunnerRest { + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestCreateCluster(final PayaraServer server, + final Command command) { + super(server, command, "/management/domain/clusters/cluster/", null); + } + + @Override + protected String constructCommandUrl() throws CommandException { + String protocol = "http"; + URI uri; + try { + uri = new URI(protocol, null, server.getHost(), server.getAdminPort(), path, query, null); + } catch (URISyntaxException use) { + throw new CommandException(CommandException.RUNNER_HTTP_URL, use); + } + return uri.toASCIIString(); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + wr.write("name=" + ((CommandTarget) command).target); + wr.flush(); + wr.close(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateConnector.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateConnector.java new file mode 100644 index 00000000..3335e6dd --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateConnector.java @@ -0,0 +1,68 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.admin.response.ActionReport.ExitCode; + +/** + * Runner for create connector command via REST interface. + * + * @author Peter Benedikovic, Tomas Kraus + */ +public class RunnerRestCreateConnector extends RunnerRest { + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestCreateConnector(final PayaraServer server, + final Command command) { + super(server, command); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + CommandCreateConnector cmd = (CommandCreateConnector) command; + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + StringBuilder data = new StringBuilder(); + data.append("jndi_name=").append(cmd.jndiName); + data.append("&enabled=").append(cmd.enabled); + appendIfNotEmpty(data, "&target", cmd.target); + appendIfNotEmpty(data, "&poolname", cmd.poolName); + appendProperties(data, cmd.properties, "property", true); + wr.write(data.toString()); + wr.close(); + } + + /** + * Overridden because server returns WARNING even when it creates the resource. + */ + @Override + protected boolean isSuccess() { + return report.isSuccess() || report.getExitCode().equals(ExitCode.WARNING); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateConnectorPool.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateConnectorPool.java new file mode 100644 index 00000000..cbd30ff2 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateConnectorPool.java @@ -0,0 +1,67 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.admin.response.ActionReport.ExitCode; + +/** + * Runner for create connector pool command via REST interface. + * + * @author Peter Benedikovic, Tomas Kraus + */ +public class RunnerRestCreateConnectorPool extends RunnerRest { + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestCreateConnectorPool(final PayaraServer server, + final Command command) { + super(server, command); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + CommandCreateConnectorConnectionPool cmd = (CommandCreateConnectorConnectionPool) command; + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + StringBuilder data = new StringBuilder(); + data.append("poolname=").append(cmd.poolName); + data.append("&raname=").append(cmd.raName); + data.append("&connectiondefinition=").append(cmd.connectionDefinition); + appendProperties(data, cmd.properties, "property", true); + wr.write(data.toString()); + wr.close(); + } + + /** + * Overridden because server returns WARNING even when it creates the resource. + */ + @Override + protected boolean isSuccess() { + return report.isSuccess() || report.getExitCode().equals(ExitCode.WARNING); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateInstance.java new file mode 100644 index 00000000..f18ebafc --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateInstance.java @@ -0,0 +1,63 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Command runner for creating an instance. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestCreateInstance extends RunnerRest { + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestCreateInstance(final PayaraServer server, + final Command command) { + super(server, command); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + CommandCreateInstance createCommand = (CommandCreateInstance) command; + StringBuilder data = new StringBuilder(); + data.append("instance_name=").append(createCommand.name); + data.append("&node=").append(createCommand.node); + if (createCommand.target != null) { + data.append("&cluster=").append(createCommand.target); + } + + wr.write(data.toString()); + wr.flush(); + wr.close(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateJDBCConnectionPool.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateJDBCConnectionPool.java new file mode 100644 index 00000000..ccbf08dd --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateJDBCConnectionPool.java @@ -0,0 +1,67 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.admin.response.ActionReport.ExitCode; + +/** + * Runner for create JDBC connection pool command via REST interface. + * + * @author Peter Benedikovic, Tomas Kraus + */ +public class RunnerRestCreateJDBCConnectionPool extends RunnerRest { + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestCreateJDBCConnectionPool(final PayaraServer server, + final Command command) { + super(server, command); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + CommandCreateJDBCConnectionPool cmd = (CommandCreateJDBCConnectionPool) command; + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + StringBuilder data = new StringBuilder(); + data.append("jdbc_connection_pool_id=").append(cmd.connectionPoolId); + data.append("&datasourceClassname=").append(cmd.dataSourceClassName); + data.append("&resType=").append(cmd.resType); + appendProperties(data, cmd.properties, "property", true); + wr.write(data.toString()); + wr.close(); + } + + /** + * Overridden because server returns WARNING even when it creates the resource. + */ + @Override + protected boolean isSuccess() { + return report.isSuccess() || report.getExitCode().equals(ExitCode.WARNING); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateJDBCResource.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateJDBCResource.java new file mode 100644 index 00000000..9d7a9262 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateJDBCResource.java @@ -0,0 +1,67 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.admin.response.ActionReport.ExitCode; + +/** + * Runner for create JDBC resource command via REST interface. + * + * @author Peter Benedikovic, Tomas Kraus + */ +public class RunnerRestCreateJDBCResource extends RunnerRest { + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestCreateJDBCResource(final PayaraServer server, + final Command command) { + super(server, command); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + CommandCreateJDBCResource cmd = (CommandCreateJDBCResource) command; + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + StringBuilder data = new StringBuilder(); + data.append("jndi_name=").append(cmd.jndiName); + data.append("&connectionpoolid=").append(cmd.connectionPoolId); + appendIfNotEmpty(data, "&target", cmd.target); + appendProperties(data, cmd.properties, "property", true); + wr.write(data.toString()); + wr.close(); + } + + /** + * Overridden because server returns WARNING even when it creates the resource. + */ + @Override + protected boolean isSuccess() { + return report.isSuccess() || report.getExitCode().equals(ExitCode.WARNING); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteCluster.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteCluster.java new file mode 100644 index 00000000..448663eb --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteCluster.java @@ -0,0 +1,54 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Command runner for command that deletes the cluster. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestDeleteCluster extends RunnerRest { + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestDeleteCluster(final PayaraServer server, + final Command command) { + super(server, command); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + wr.write("name=" + ((CommandTarget) command).target); + wr.flush(); + wr.close(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteInstance.java new file mode 100644 index 00000000..e8f8a191 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteInstance.java @@ -0,0 +1,58 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Command runner executes delete instance command. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestDeleteInstance extends RunnerRest { + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestDeleteInstance(final PayaraServer server, + final Command command) { + super(server, command); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + CommandDeleteInstance deleteCommand = (CommandDeleteInstance) command; + StringBuilder data = new StringBuilder(); + data.append("instance_name=").append(deleteCommand.target); + + wr.write(data.toString()); + wr.flush(); + wr.close(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteResource.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteResource.java new file mode 100644 index 00000000..e7e9ee98 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteResource.java @@ -0,0 +1,55 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Command runner for command that deletes the resource. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestDeleteResource extends RunnerRest { + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestDeleteResource(final PayaraServer server, + final Command command) { + super(server, command); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + CommandDeleteResource cmd = (CommandDeleteResource) command; + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + wr.write(cmd.cmdPropertyName + "=" + cmd.name); + wr.flush(); + wr.close(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeploy.java new file mode 100644 index 00000000..175c0ff2 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeploy.java @@ -0,0 +1,207 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * Command runner for deploying directory or file. + *

+ *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestDeploy extends RunnerRest { + + private static final String NEWLINE = "\r\n"; + + private String multipartBoundary = Long.toHexString(System.currentTimeMillis()); + + /** Holding data for command execution. */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + final CommandDeploy command; + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestDeploy(final PayaraServer server, + final Command command) { + super(server, command); + this.command = (CommandDeploy) command; + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + @Override + protected void prepareHttpConnection(HttpURLConnection conn) throws CommandException { + super.prepareHttpConnection(conn); + if (!command.dirDeploy) { + conn.setRequestProperty("Content-Type", + "multipart/form-data; boundary=" + multipartBoundary); + } + } + + /** + * Handle sending data to server using HTTP command interface. + *

+ * This is based on reading the code of CLIRemoteCommand.java from the server's code + * repository. Since some asadmin commands need to send multiple files, the server assumes the input + * is a ZIP stream. + */ + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + // InputStream istream = getInputStream(); + if (command.path == null) { + throw new PayaraIdeException("The path attribute of deploy command" + + " has to be non-empty!"); + } + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + if (!command.dirDeploy) { + writeParam(wr, "path", command.path.getAbsolutePath()); + if (command.name != null) { + writeParam(wr, "name", command.name); + } + if (command.contextRoot != null) { + writeParam(wr, "contextroot", command.contextRoot); + } + if (command.target != null) { + writeParam(wr, "target", command.target); + } + + writeBinaryFile(wr, hconn.getOutputStream(), command.path); + wr.append("--" + multipartBoundary + "--").append(NEWLINE); + } else { + wr.write("path=" + command.path.toString()); + if (command.name != null) { + wr.write("&"); + wr.write("name=" + command.name); + } + if (command.contextRoot != null) { + wr.write("&"); + wr.write("contextroot=" + command.name); + } + if (command.target != null) { + wr.write("&"); + wr.write("target=" + command.target); + } + } + + wr.close(); + } + + private void writeParam(OutputStreamWriter writer, String paramName, + String paramValue) throws IOException { + writer.append("--" + multipartBoundary).append(NEWLINE); + writer.append("Content-Disposition: form-data; name=\"").append( + paramName).append("\"").append(NEWLINE); + writer.append("Content-Type: text/plain;").append(NEWLINE); + writer.append(NEWLINE); + writer.append(paramValue).append(NEWLINE).flush(); + } + + private void writeBinaryFile(OutputStreamWriter writer, OutputStream output, File file) throws IOException { + writer.append("--" + multipartBoundary).append(NEWLINE); + // writer.append("Content-Disposition: form-data; name=\"warFile\"; filename=\"" + // + file.getAbsolutePath() + "\"").append(NEWLINE); + writer.append("Content-Type: application/octet-stream").append(NEWLINE); + writer.append("Content-Transfer-Encoding: binary").append(NEWLINE); + writer.append(NEWLINE).flush(); + + InputStream input = null; + try { + input = new FileInputStream(file); + byte[] buffer = new byte[1024 * 1024]; + for (int length; (length = input.read(buffer)) > 0;) { + output.write(buffer, 0, length); + } + output.flush(); // Important! Output cannot be closed. Close of writer will close output as well. + } finally { + if (input != null) { + try { + input.close(); + } catch (IOException ex) { + } + } + } + writer.append(NEWLINE).flush(); + } + //////////////////////////////////////////////////////////////////////////// + // Fake Getters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Set the content-type of information sent to the server. Returns application/zip for + * file deployment and null (not set) for directory deployment. + * + * @return content-type of data sent to server via HTTP POST + */ + @Override + public String getContentType() { + return command.dirDeploy ? null : "application/zip"; + } + + // /** + // * Provide the lastModified date for data source whose + // * InputStream is returned by getInputStream. + // *

+ // * @return String format of long integer from lastModified date of source. + // */ + // @Override + // public String getLastModified() { + // return Long.toString(command.path.lastModified()); + // } + /** + * Get InputStream object for deployed file. + *

+ * + * @return InputStream object for deployed file or null for directory + * deployment. + */ + public InputStream getInputStream() { + if (command.dirDeploy) { + return null; + } else { + try { + return new FileInputStream(command.path); + } catch (FileNotFoundException fnfe) { + Logger.log(Level.INFO, command.path.getPath(), fnfe); + return null; + } + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDisable.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDisable.java new file mode 100644 index 00000000..1b257f2c --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDisable.java @@ -0,0 +1,62 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Command runner for disabling the application. + *

+ *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestDisable extends RunnerRest { + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestDisable(final PayaraServer server, + final Command command) { + super(server, command); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + CommandTargetName commandApp = (CommandTargetName) command; + String target = commandApp.target; + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + StringBuilder data = new StringBuilder(); + data.append("name=").append(commandApp.name); + if (target != null) { + data.append("&target=").append(commandApp.target); + } + + wr.write(data.toString()); + wr.close(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestEnable.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestEnable.java new file mode 100644 index 00000000..5c299de4 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestEnable.java @@ -0,0 +1,62 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Command runner for enabling a disabling the application. + *

+ *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestEnable extends RunnerRest { + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestEnable(final PayaraServer server, + final Command command) { + super(server, command); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + CommandTargetName commandApp = (CommandTargetName) command; + String target = commandApp.target; + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + StringBuilder data = new StringBuilder(); + data.append("component=").append(commandApp.name); + if (target != null) { + data.append("&target=").append(commandApp.target); + } + + wr.write(data.toString()); + wr.close(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestFetchLogData.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestFetchLogData.java new file mode 100644 index 00000000..9f492759 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestFetchLogData.java @@ -0,0 +1,234 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.logging.Level; +import java.util.zip.GZIPInputStream; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.admin.response.ResponseContentType; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * GlassFish Server view-log Administration Command Execution using HTTP interface. + *

+ * Class implements GlassFish server administration functionality trough HTTP interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestFetchLogData extends RunnerRest { + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Extracts query string from passed View Log command entity. + * + * @param command View Log command entity. + * @return Query string for given command. + */ + private static String query(Command command) { + if (command instanceof CommandFetchLogData) { + return ((CommandFetchLogData) command).paramsAppendNext; + } else { + throw new CommandException( + CommandException.ILLEGAL_COMAND_INSTANCE); + } + + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * GlassFish log lines. + *

+ * List<String> lines instance is internal server response holder. Instance life + * cycle is started in readResponse method where log returned from server is read and + * stored internally. + */ + private List lines; + + /** + * Content of HTTP header X-Text-Append-Next. + *

+ * This header contains the entire URL to pass to the GET method to return the changes since the + * last call. You can use this header in client applications to get all log entries that were added + * in particular interval. + */ + private URL headerAppendNext; + + /** + * GlassFish administration command result containing server log. + *

+ * Result instance life cycle is started with submitting task into ExecutorService's + * queue. method call() is responsible for correct TaskState and + * receiveResult value handling. + */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + ResultLog result; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + // TODO: Make this "/management/domain/" command v3 only after + // NetBeans 7.3 release. + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestFetchLogData(final PayaraServer server, + final Command command) { + super(server, command, "/management/domain/", query(command)); + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create ResultLog object corresponding to server log command execution value to be + * returned. + */ + @Override + protected Result createResult() { + return result = new ResultLog(); + } + + @Override + public boolean getDoOutput() { + return false; + } + + @Override + protected String getRequestMethod() { + return "GET"; + } + + /** + * Inform whether this runner implementation accepts gzip format. + *

+ * + * @return true when gzip format is accepted, false otherwise. + */ + @Override + public boolean acceptsGzip() { + return false; + } + + /** + * Reads response from server and stores it into internal objects. + *

+ * Retrieved lines of server log are stored in internal lines List. + * Content of HTTP header X-Text-Append-Next is stored in internal + * headerAppendNext variable. + *

+ * It's not necessary close the stream parameter when finished. Caller will take care of that. But + * this method uses additional stream handlers for gzip compression and buffered + * reading so it should close them. + *

+ * + * @param in Stream to read data from. + * @return true if response X-Text-Append-Next HTTP header contains some + * parameters (e.g. ?start=<number>) or false otherwise. + * @throws CommandException in case of stream error. + */ + @Override + public boolean readResponse(InputStream in, HttpURLConnection hconn) { + lines = new LinkedList<>(); + String ce = hconn.getContentEncoding(); + BufferedReader br = null; + String line = null; + try { + InputStream cooked = null != ce && ce.contains("gzip") + ? new GZIPInputStream(in) + : in; + br = new BufferedReader(new java.io.InputStreamReader(cooked)); + while ((line = br.readLine()) != null) { + if (line != null) { + lines.add(line); + } + } + } catch (IOException ioe) { + throw new CommandException(CommandException.HTTP_RESP_IO_EXCEPTION, + ioe); + } finally { + try { + if (br != null) { + br.close(); + } + } catch (IOException ioe) { + Logger.log(Level.WARNING, ioe.getLocalizedMessage(), ioe); + } + } + + try { + headerAppendNext = new URL(hconn.getHeaderField("X-Text-Append-Next")); + } catch (MalformedURLException mue) { + Logger.log(Level.WARNING, mue.getLocalizedMessage(), mue); + headerAppendNext = null; + return false; + } + String queryAppendNext = headerAppendNext.getQuery(); + return queryAppendNext != null; + } + + /** + * Extracts result value from internal Manifest object. Value of message + * attribute in Manifest object is stored as value into + * ResultString result object. + *

+ * + * @return true if result was extracted correctly. null messagevalue is + * considered as failure. + */ + @Override + protected boolean processResponse() { + // Make ArrayList copy of stored lines. ArrayList allows better access + // to log values. + List logLines = new ArrayList(lines.size()); + for (String line : lines) { + logLines.add(line); + } + result.value = new ValueLog(logLines, headerAppendNext.getQuery()); + return true; + } + + @Override + protected ResponseContentType getResponseType() { + return ResponseContentType.TEXT_PLAIN; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestGetProperty.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestGetProperty.java new file mode 100644 index 00000000..a94ab88a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestGetProperty.java @@ -0,0 +1,139 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.URLDecoder; +import java.util.HashMap; +import java.util.List; +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.admin.response.MessagePart; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * Command runner that executes get property command. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestGetProperty extends RunnerRest { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(RunnerRestGetProperty.class); + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Result object - contains list of JDBC resources names. */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + ResultMap result; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestGetProperty(final PayaraServer server, + final Command command) { + super(server, command, "/command/", null); + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create ResultMap object corresponding to server get property command execution value + * to be returned. + */ + @Override + protected ResultMap createResult() { + return result = new ResultMap<>(); + } + + @Override + protected boolean processResponse() { + final String METHOD = "processResponse"; + List childMessages = report.getTopMessagePart().getChildren(); + if ((childMessages == null) || childMessages.isEmpty()) { + return false; + } + result.value = new HashMap<>(childMessages.size()); + + for (MessagePart msg : childMessages) { + String message = msg.getMessage(); + int equalsIndex = message.indexOf('='); + if (equalsIndex >= 0) { + String keyPart = message.substring(0, equalsIndex); + String valuePart = message.substring(equalsIndex + 1); + try { + // Around Sept. 2008... 3.x servers were double encoding their + // responces. It appears that has stopped + // (See http://netbeans.org/bugzilla/show_bug.cgi?id=195015) + // The open question is, "When did 3.x stop doing the double + // encode?" since we don't know... this strategy will work + // for us + // Belt and suspenders, like + result.value.put(keyPart, valuePart); // raw form + result.value.put(keyPart, URLDecoder.decode(valuePart, + "UTF-8")); // single decode + result.value.put(keyPart, URLDecoder.decode(result.value.get(keyPart), "UTF-8")); + } catch (UnsupportedEncodingException ex) { + LOGGER.log(Level.INFO, METHOD, + "unsupportedEncoding", result.value.get(keyPart)); + } catch (IllegalArgumentException iae) { + LOGGER.log(Level.INFO, METHOD, "illegalArgument", + new Object[] { valuePart, result.value.get(keyPart) }); + } + } else { + LOGGER.log(Level.INFO, METHOD, "emptyString", message); + result.value.put(message, ""); + } + } + return true; + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + CommandGetProperty gpCommand = (CommandGetProperty) command; + StringBuilder data = new StringBuilder(); + data.append("pattern=").append(gpCommand.propertyPattern); + wr.write(data.toString()); + wr.flush(); + wr.close(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestList.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestList.java new file mode 100644 index 00000000..6c71eca2 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestList.java @@ -0,0 +1,83 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.ArrayList; +import java.util.List; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.admin.response.MessagePart; + +/** + * Command runner for commands that retrieve some kind of list. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestList extends RunnerRest { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Result object - contains list of JDBC resources names. */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + ResultList result; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestList(final PayaraServer server, final Command command) { + super(server, command); + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create ResultList object corresponding to server log command execution value to be + * returned. + */ + @Override + protected ResultList createResult() { + return result = new ResultList<>(); + } + + @Override + protected boolean processResponse() { + List childMessages = report.getTopMessagePart().getChildren(); + if ((childMessages != null) && !childMessages.isEmpty()) { + result.value = new ArrayList<>(childMessages.size()); + for (MessagePart msg : childMessages) { + result.getValue().add(msg.getMessage()); + } + } + return true; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListApplications.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListApplications.java new file mode 100644 index 00000000..92d1db43 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListApplications.java @@ -0,0 +1,47 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Command runner for commands that retrieve list of applications deployed on server. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestListApplications extends RunnerRestList { + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestListApplications(final PayaraServer server, + final Command command) { + super(server, command); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListResources.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListResources.java new file mode 100644 index 00000000..10062973 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListResources.java @@ -0,0 +1,47 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Command runner for commands that retrieve list of resources of certain kind. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestListResources extends RunnerRestList { + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestListResources(final PayaraServer server, + final Command command) { + super(server, command); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListWebServices.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListWebServices.java new file mode 100644 index 00000000..53914a7e --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListWebServices.java @@ -0,0 +1,47 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Command runner for commands that retrieve list of web services deployed on server. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestListWebServices extends RunnerRestList { + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestListWebServices(final PayaraServer server, + final Command command) { + super(server, command); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestLocation.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestLocation.java new file mode 100644 index 00000000..2479b7c3 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestLocation.java @@ -0,0 +1,77 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.HashMap; +import java.util.Properties; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestLocation extends RunnerRest { + + /** Holding data for command execution. */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + final CommandLocation command; + + /** + * Returned value is map where locations are stored under keys specified in CommandLocation class. + */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + ResultMap result; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestLocation(final PayaraServer server, + final Command command) { + super(server, command); + this.command = (CommandLocation) command; + } + + @Override + protected Result createResult() { + return result = new ResultMap<>(); + } + + @Override + protected boolean processResponse() { + if (report == null) { + return false; + } + Properties props = report.getTopMessagePart().getProperties(); + result.value = new HashMap<>(props.size()); + for (String key : props.stringPropertyNames()) { + result.value.put(key, props.getProperty(key)); + } + return true; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestSetProperty.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestSetProperty.java new file mode 100644 index 00000000..35007c16 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestSetProperty.java @@ -0,0 +1,64 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Runner executes set property command via REST interface. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class RunnerRestSetProperty extends RunnerRest { + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestSetProperty(final PayaraServer server, + final Command command) { + super(server, command, "/command/", null); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + CommandSetProperty spCommand = (CommandSetProperty) command; + StringBuilder data = new StringBuilder(); + data.append("values="); + data.append(spCommand.property); + data.append("=\""); + data.append(spCommand.value); + data.append("\""); + wr.write(data.toString()); + wr.flush(); + wr.close(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStartCluster.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStartCluster.java new file mode 100644 index 00000000..6bd8fc7d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStartCluster.java @@ -0,0 +1,54 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Command runner executes start cluster command. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestStartCluster extends RunnerRest { + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestStartCluster(final PayaraServer server, + final Command command) { + super(server, command); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + wr.write("clusterName=" + ((CommandTarget) command).target); + wr.flush(); + wr.close(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStartInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStartInstance.java new file mode 100644 index 00000000..a2d01571 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStartInstance.java @@ -0,0 +1,58 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Command runner executes start instance command. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestStartInstance extends RunnerRest { + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestStartInstance(final PayaraServer server, + final Command command) { + super(server, command); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + CommandTarget cmd = (CommandTarget) command; + StringBuilder data = new StringBuilder(); + data.append("instance_name=").append(cmd.target); + + wr.write(data.toString()); + wr.flush(); + wr.close(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopCluster.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopCluster.java new file mode 100644 index 00000000..bdcceb4a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopCluster.java @@ -0,0 +1,54 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Command runner executes stop cluster command. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestStopCluster extends RunnerRest { + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestStopCluster(final PayaraServer server, + final Command command) { + super(server, command); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + wr.write("clusterName=" + ((CommandTarget) command).target); + wr.flush(); + wr.close(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopDAS.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopDAS.java new file mode 100644 index 00000000..9cb76ad2 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopDAS.java @@ -0,0 +1,62 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestStopDAS extends RunnerRest { + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestStopDAS(final PayaraServer server, + final Command command) { + super(server, command); + } + + // @Override + // protected String constructCommandUrl() throws CommandException { + // String protocol = "http"; + // URI uri; + // try { + // uri = new URI(protocol, null, server.getHost(), server.getAdminPort(), path + "stop", query, + // null); + // } catch (URISyntaxException use) { + // throw new CommandException(CommandException.RUNNER_HTTP_URL, use); + // } + // return uri.toASCIIString(); + // } + // + // @Override + // protected String getRequestMethod() { + // return "POST"; + // } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopInstance.java new file mode 100644 index 00000000..fa45905c --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopInstance.java @@ -0,0 +1,58 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * Command runner executes stop instance command. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestStopInstance extends RunnerRest { + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestStopInstance(final PayaraServer server, + final Command command) { + super(server, command); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + CommandTarget cmd = (CommandTarget) command; + StringBuilder data = new StringBuilder(); + data.append("instanceName=").append(cmd.target); + + wr.write(data.toString()); + wr.flush(); + wr.close(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestUndeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestUndeploy.java new file mode 100644 index 00000000..0d1820c5 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestUndeploy.java @@ -0,0 +1,61 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestUndeploy extends RunnerRest { + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestUndeploy(final PayaraServer server, + final Command command) { + super(server, command); + } + + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + CommandUndeploy cmd = (CommandUndeploy) command; + wr.write("name=" + cmd.name); + if (cmd.target != null) { + wr.write("&target=" + cmd.target); + } + wr.flush(); + wr.close(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ServerAdmin.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ServerAdmin.java new file mode 100644 index 00000000..e0533282 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ServerAdmin.java @@ -0,0 +1,192 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import static fish.payara.eclipse.tools.server.sdk.TaskState.COMPLETED; +import static java.util.concurrent.TimeUnit.SECONDS; + +import java.net.Authenticator; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.function.Consumer; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.TaskStateListener; + +/** + * Payara Administration Command API. + *

+ * Payara command facade allows remote and local server handling. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class ServerAdmin { + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Set global password authenticator for Payara servers. + *

+ * This method must be called before first usage of Runner.call() method. + *

+ * + * @param authenticator External authenticator for Payara servers to be supplied. + */ + public static void init(Authenticator authenticator) { + Runner.init(authenticator); + } + + /** + * Get individual executor pool for remote administration command execution. + *

+ * This allows to execute tasks in parallel using provided executor. + *

+ * + * @param size Thread pool size (how many tasks to execute in parallel).. + * @return Individual Executor instance. + */ + public static ExecutorService executor(final int size) { + return Runner.parallelExecutor(size); + } + + /** + * Execute remote administration command on GlassFish server. + *

+ * Execution of administration command is serialized using internal executor. + *

+ * + * @param payaraServer Target GlassFish server. + * @param command Server administration command to me executed. + */ + public static > Future exec(PayaraServer payaraServer, Command command) { + return (Future) AdminFactory.getInstance(payaraServer.getAdminInterface()) + .getRunner(payaraServer, command) + .execute(); + } + + public static CommandBuilder executeOn(PayaraServer server) { + return new CommandBuilder(server); + } + + public static class CommandBuilder { + + private final PayaraServer server; + + private Command cmd; + private long timeout = 300; + private TimeUnit timeUnit = SECONDS; + private Consumer onNotCompleted; + + public CommandBuilder(PayaraServer server) { + this.server = server; + } + + public CommandBuilder command(Command cmd) { + this.cmd = cmd; + return this; + } + + public CommandBuilder timeout(long timeout) { + this.timeout = timeout; + return this; + } + + public CommandBuilder timeOut(long timeout, TimeUnit timeUnit) { + this.timeout = timeout; + this.timeUnit = timeUnit; + return this; + } + + public CommandBuilder onNotCompleted(Consumer onNotCompleted) { + this.onNotCompleted = onNotCompleted; + return this; + } + + @SuppressWarnings("unchecked") + public T get() throws InterruptedException, ExecutionException, TimeoutException { + Future> future = ServerAdmin.exec(server, cmd); + Result result = future.get(timeout, timeUnit); + + if (onNotCompleted != null && result instanceof ResultString) { + + ResultString outcome = (ResultString) result; + + if (!COMPLETED.equals(outcome.getState())) { + onNotCompleted.accept(outcome); + } + } + + return (T) result; + } + + } + + /** + * Execute remote administration command on GlassFish server. + *

+ * Execution of administration command is serialized using internal executor. + *

+ * + * @param payaraServer Target GlassFish server. + * @param cmd Server administration command to me executed. + * @param listeners Listeners that are called when command execution status changes. + */ + public static Future exec(PayaraServer payaraServer, Command cmd, TaskStateListener... listeners) { + Runner runner = AdminFactory.getInstance(payaraServer.getAdminInterface()).getRunner(payaraServer, cmd); + runner.stateListeners = listeners; + return (Future) runner.execute(); + } + + /** + * Execute remote administration command on GlassFish server. + *

+ * This allows to execute tasks in parallel using provided executor. + *

+ * + * @param executor Executor service used to start task. + * @param payaraServer Target GlassFish server. + * @param cmd Server administration command to me executed. + */ + public static Future exec(ExecutorService executor, PayaraServer payaraServer, Command cmd) { + Runner runner = AdminFactory.getInstance(payaraServer.getAdminInterface()).getRunner(payaraServer, cmd); + return (Future) runner.execute(executor); + } + + /** + * Execute remote administration command on GlassFish server. + *

+ * + * @param executor Executor service used to start task. + * @param srv Target GlassFish server. + * @param cmd Server administration command to me executed. + * @param listeners Listeners that are called when command execution status changes. + */ + public static Future exec(ExecutorService executor, PayaraServer srv, Command cmd, TaskStateListener... listeners) { + Runner runner = AdminFactory.getInstance(srv.getAdminInterface()).getRunner(srv, cmd); + runner.stateListeners = listeners; + return (Future) runner.execute(executor); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ValueLog.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ValueLog.java new file mode 100644 index 00000000..96234101 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ValueLog.java @@ -0,0 +1,128 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +import java.util.List; + +import fish.payara.eclipse.tools.server.sdk.utils.Utils; + +/** + * GlassFish server log. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class ValueLog { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** GlassFish server log lines. */ + final List lines; + + /** + * URL parameters from HTTP header X-Text-Append-Next. + *

+ * X-Text-Append-Next header contains the entire URL to pass to the GET method to + * return the changes since the last call. You can use those URL parameters to construct URL to get + * all log entries that were added in particular interval starting from call that returned this + * result. + */ + final String paramsAppendNext; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of GlassFish server log entity. + *

+ * Entity is initialized with values stored in Runner internal attributes in + * processResponse method. + *

+ * + * @param lines GlassFish server log lines. + * @param paramsAppendNext URL parameters from HTTP header X-Text-Append-Next + */ + ValueLog(List lines, String paramsAppendNext) { + this.lines = lines; + this.paramsAppendNext = paramsAppendNext; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get GlassFish server log lines. + *

+ * + * @return GlassFish server log lines. + */ + public List getLines() { + return lines; + } + + /** + * Get URL parameters from HTTP header X-Text-Append-Next. + *

+ * + * @return URL parameters from HTTP header X-Text-Append-Next. + */ + public String getParamsAppendNext() { + return paramsAppendNext; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Convert stored server log lines to String. + *

+ * + * @return A String representation of the value of this object. + */ + @Override + public String toString() { + String lineSeparator = Utils.lineSeparator(); + int lineSeparatorLength = lineSeparator.length(); + if (lines != null) { + // Calculate total log length to avoid StringBuffer resizing. + int length = 0; + for (String line : lines) { + length += line != null + ? line.length() + lineSeparatorLength + : lineSeparatorLength; + } + StringBuilder sb = new StringBuilder(length); + for (String line : lines) { + if (line != null) { + sb.append(line); + } + sb.append(lineSeparator); + } + return sb.toString(); + } else { + return null; + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ValueProcess.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ValueProcess.java new file mode 100644 index 00000000..f91e49b0 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ValueProcess.java @@ -0,0 +1,120 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin; + +/** + * GlassFish server process. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class ValueProcess { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** The name of the executable to run. */ + private String processName; + + /** Arguments passed to the executable. */ + private String arguments; + + /** Process information. */ + private Process process; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of GlassFish server process entity. + *

+ * Entity is initialized in RunnerLocal method call. method. + *

+ * + * @param processName The name of the executable to run.. + * @param arguments Arguments passed to the executable. + */ + ValueProcess(String processName, String arguments, Process process) { + this.processName = processName; + this.arguments = arguments; + this.process = process; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get name of the executable to run. + *

+ * + * @return Name of the executable to run. + */ + public String getProcessName() { + return processName; + } + + /** + * Get arguments passed to the executable. + *

+ * + * @return Arguments passed to the executable. + */ + public String getArguments() { + return arguments; + } + + /** + * Get process information. + *

+ * + * @return Process information. + */ + public Process getProcess() { + return process; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Convert stored process information to String. + *

+ * + * @return A String representation of the value of this object. + */ + @Override + public String toString() { + int length = (processName != null ? processName.length() : 0) + + (arguments != null ? arguments.length() : 0) + 1; + StringBuilder sb = new StringBuilder(length); + if (processName != null) { + sb.append(processName); + } + sb.append(' '); + if (arguments != null) { + sb.append(arguments); + } + return sb.toString(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CloudTasks.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CloudTasks.java new file mode 100644 index 00000000..f2a5951f --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CloudTasks.java @@ -0,0 +1,60 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin.cloud; + +import java.io.File; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; +import fish.payara.eclipse.tools.server.sdk.TaskStateListener; +import fish.payara.eclipse.tools.server.sdk.admin.Command; +import fish.payara.eclipse.tools.server.sdk.admin.ResultString; +import fish.payara.eclipse.tools.server.sdk.admin.ServerAdmin; + +/** + * This class provides convenience methods for working with cloud (CPAS server). + * + * @author Tomas Kraus, Peter Benedikovic + */ +public class CloudTasks { + + /** + * Deploy task that deploys application on server. + * + * @param server - server to deploy on + * @param account - which account the application is deployed under + * @param application - File object representing archive or directory where the application is + * @param listener - listener, that listens to command execution events + * @return result object with task status and message + */ + public static ResultString deploy(final PayaraServer server, + final String account, final File application, + final TaskStateListener listener) { + Command command = new CommandCloudDeploy(account, application); + Future future = ServerAdmin.exec(server, command, listener); + try { + return future.get(); + } catch (InterruptedException | ExecutionException e) { + throw new PayaraIdeException( + "Instance or cluster stop failed.", e); + } + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CommandCloud.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CommandCloud.java new file mode 100644 index 00000000..20a882be --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CommandCloud.java @@ -0,0 +1,71 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin.cloud; + +import fish.payara.eclipse.tools.server.sdk.admin.Command; + +/** + * GlassFish cloud administration command entity. + *

+ * Holds common data for cloud administration command. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class CommandCloud extends Command { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Cloud account identifier. */ + final String account; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish cloud administration command entity with specified cloud + * account and command. + *

+ * + * @param command Cloud command represented by this object. + * @param account Cloud account identifier. + */ + CommandCloud(final String command, final String account) { + super(command); + this.account = account; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Returns cloud account identifier of this command. + *

+ * + * @return Cloud account identifier. + */ + public String getAccount() { + return account; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CommandCloudDeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CommandCloudDeploy.java new file mode 100644 index 00000000..008bb3e1 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CommandCloudDeploy.java @@ -0,0 +1,68 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin.cloud; + +import java.io.File; + +import fish.payara.eclipse.tools.server.sdk.admin.RunnerHttpClass; +import fish.payara.eclipse.tools.server.sdk.admin.RunnerRestClass; + +/** + * GlassFish cloud deploy command entity. + *

+ * Holds data for command. Objects of this class are created by API user. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +@RunnerHttpClass(runner = RunnerHttpCloud.class) +@RunnerRestClass(runner = RunnerRestCloudDeploy.class) +public class CommandCloudDeploy extends CommandCloud { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command string for deploy command. */ + private static final String COMMAND = "deploy"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** File to deploy. */ + final File path; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server deploy command entity. + *

+ * + * @param account Cloud account identifier. + * @param path File to deploy. + */ + public CommandCloudDeploy(final String account, final File path) { + super(COMMAND, account); + this.path = path; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerHttpCloud.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerHttpCloud.java new file mode 100644 index 00000000..d7c0a8d2 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerHttpCloud.java @@ -0,0 +1,83 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin.cloud; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.admin.Command; +import fish.payara.eclipse.tools.server.sdk.admin.RunnerHttp; + +/** + * GlassFish cloud administration command execution using HTTP interface. + *

+ * HTTP interface is not supported with cloud commands. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerHttpCloud extends RunnerHttp { + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * This constructor prototype is called from factory class and should remain public in all child + * classes. + *

+ * + * @param server GlassFish cloud entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerHttpCloud(final PayaraServer server, + final CommandCloud command) { + super(server, command, "/command/cloud/", null); + throw new UnsupportedOperationException( + "HTTP interface does not support cloud commands."); + } + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + * @param query Query string for this command. + */ + RunnerHttpCloud(final PayaraServer server, final Command command, + final String query) { + super(server, command, "/command/cloud/", query); + throw new UnsupportedOperationException( + "HTTP interface does not support cloud commands."); + } + + /** + * Constructs an instance of administration command executor using HTTP interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + * @param path Path which builds URL we speak to. + * @param query Query string for this command. + */ + RunnerHttpCloud(final PayaraServer server, final Command command, + final String path, final String query) { + super(server, command, path, query); + throw new UnsupportedOperationException( + "HTTP interface does not support cloud commands."); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerRestCloud.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerRestCloud.java new file mode 100644 index 00000000..0294e2e0 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerRestCloud.java @@ -0,0 +1,77 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin.cloud; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.admin.Command; +import fish.payara.eclipse.tools.server.sdk.admin.RunnerRest; + +/** + * GlassFish cloud administration command execution using REST interface. + *

+ * Class implements GlassFish cloud administration functionality trough REST interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +class RunnerRestCloud extends RunnerRest { + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * This constructor prototype is called from factory class and should remain public in all child + * classes. + *

+ * + * @param server GlassFish cloud entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestCloud(final PayaraServer server, + final Command command) { + super(server, command, "/command/cloud/", null); + } + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + * @param query Query string for this command. + */ + RunnerRestCloud(final PayaraServer server, final Command command, + final String query) { + super(server, command, "/command/cloud/", query); + } + + /** + * Constructs an instance of administration command executor using REST interface. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + * @param path Path which builds URL we speak to. + * @param query Query string for this command. + */ + RunnerRestCloud(final PayaraServer server, final Command command, + final String path, final String query) { + super(server, command, path, query); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerRestCloudDeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerRestCloudDeploy.java new file mode 100644 index 00000000..715cad85 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerRestCloudDeploy.java @@ -0,0 +1,130 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin.cloud; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; +import fish.payara.eclipse.tools.server.sdk.admin.Command; + +/** + * GlassFish cloud administration command execution using REST interface. + *

+ * Class implements GlassFish cloud administration functionality trough REST interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RunnerRestCloudDeploy extends RunnerRestCloud { + + private static final String NEWLINE = "\r\n"; + + private String multipartBoundary = Long.toHexString(System.currentTimeMillis()); + + /** Holding data for command execution. */ + @SuppressWarnings("FieldNameHidesFieldInSuperclass") + final CommandCloudDeploy command; + + /** + * Constructs an instance of administration command executor using REST interface for deploy + * command. + *

+ * + * @param server GlassFish server entity object. + * @param command GlassFish server administration command entity. + */ + public RunnerRestCloudDeploy(final PayaraServer server, + final Command command) { + super(server, command); + this.command = (CommandCloudDeploy) command; + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Handle sending data to server using HTTP command interface. + *

+ * This is based on reading the code of CLIRemoteCommand.java from the server's code + * repository. Since some asadmin commands need to send multiple files, the server assumes the input + * is a ZIP stream. + */ + @Override + protected void handleSend(HttpURLConnection hconn) throws IOException { + // InputStream istream = getInputStream(); + if (command.path == null) { + throw new PayaraIdeException("The path attribute of deploy command" + + " has to be non-empty!"); + } + OutputStreamWriter wr = new OutputStreamWriter(hconn.getOutputStream()); + writeParam(wr, "file", command.path.getAbsolutePath()); + if (command.account != null) { + writeParam(wr, "account", command.account); + } + writeBinaryFile(wr, hconn.getOutputStream(), command.path); + wr.append("--" + multipartBoundary + "--").append(NEWLINE); + wr.close(); + } + + private void writeParam(OutputStreamWriter writer, String paramName, + String paramValue) throws IOException { + writer.append("--" + multipartBoundary).append(NEWLINE); + writer.append("Content-Disposition: form-data; name=\"").append( + paramName).append("\"").append(NEWLINE); + writer.append("Content-Type: text/plain;").append(NEWLINE); + writer.append(NEWLINE); + writer.append(paramValue).append(NEWLINE).flush(); + } + + private void writeBinaryFile(OutputStreamWriter writer, OutputStream output, + File file) throws IOException { + writer.append("--" + multipartBoundary).append(NEWLINE); + writer.append("Content-Disposition: form-data; name=\"warFile\"; filename=\"" + + file.getAbsolutePath() + "\"").append(NEWLINE); + writer.append("Content-Type: application/octet-stream").append(NEWLINE); + writer.append("Content-Transfer-Encoding: binary").append(NEWLINE); + writer.append(NEWLINE).flush(); + + InputStream input = null; + try { + input = new FileInputStream(file); + byte[] buffer = new byte[1024 * 1024]; + for (int length = 0; (length = input.read(buffer)) > 0;) { + output.write(buffer, 0, length); + } + output.flush(); // Important! Output cannot be closed. Close of writer will close output as well. + } finally { + if (input != null) { + try { + input.close(); + } catch (IOException ex) { + } + } + } + writer.append(NEWLINE).flush(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ActionReport.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ActionReport.java new file mode 100644 index 00000000..1e09fc2d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ActionReport.java @@ -0,0 +1,61 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin.response; + +/** + * Represents response returned from server after command execution. + *

+ * Inspired by ActionReport class from module GF Admin Rest Service. In our case the interface + * allows just read-only access. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public interface ActionReport { + + /** Possible exit codes that are sent by server. */ + public enum ExitCode { + SUCCESS, WARNING, FAILURE, NA + } + + /** + * Get command execution exit code. + *

+ * + * @return exit code of the called operation + */ + public ExitCode getExitCode(); + + /** + * Getter for message included in server response. + *

+ * + * @return message + */ + public String getMessage(); + + /** + * Getter for command name (description). + *

+ * + * @return command name + */ + public String getCommand(); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/MessagePart.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/MessagePart.java new file mode 100644 index 00000000..a055b022 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/MessagePart.java @@ -0,0 +1,64 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin.response; + +import java.util.List; +import java.util.Properties; + +/** + * Class represents one part of REST server message. + *

+ * This part can be repeated in server response. It includes string message and can have other + * properties. It can be nesting also other message parts. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class MessagePart { + + /** Message properties. */ + Properties props; + + /** Message. */ + String message; + + /** Nested messages. */ + List children; + + public List getChildren() { + return children; + } + + public String getMessage() { + return message; + } + + public Properties getProperties() { + return props; + } + + public void setProperties(Properties props) { + this.props = props; + } + + void setMessage(String message) { + this.message = message; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseContentType.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseContentType.java new file mode 100644 index 00000000..09a522c2 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseContentType.java @@ -0,0 +1,41 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin.response; + +/** + * Enum that represents possible content types that runners accept responses in. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public enum ResponseContentType { + + APPLICATION_XML("application/xml"), APPLICATION_JSON("application/json"), TEXT_PLAIN("text/plain"); + + private String type; + + ResponseContentType(String type) { + this.type = type; + } + + @Override + public String toString() { + return type; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseParser.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseParser.java new file mode 100644 index 00000000..3c27bd35 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseParser.java @@ -0,0 +1,40 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin.response; + +import java.io.InputStream; + +/** + * Interface for various implementations of parsing response functionality. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public interface ResponseParser { + + /** + * Method parses the response and returns it's object representation - ActionReport. + *

+ * + * @param in - input stream object + * @return ActionReport object that represents the response. + */ + public ActionReport parse(InputStream in); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseParserFactory.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseParserFactory.java new file mode 100644 index 00000000..ad83ae55 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseParserFactory.java @@ -0,0 +1,57 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin.response; + +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * Factory that returns appropriate response parser implementation based on content type of the + * response. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class ResponseParserFactory { + + private static RestXMLResponseParser xmlParser; + + // private static RestJSONResponseParser jsonParser; + + public static synchronized RestResponseParser getRestParser(ResponseContentType contentType) { + switch (contentType) { + case APPLICATION_XML: + if (xmlParser == null) { + xmlParser = new RestXMLResponseParser(); + } + return xmlParser; + case APPLICATION_JSON: + // RestJSONResponseParser is not used in Eclipse Payara Tools and has dependency on + // com.googlecode.json-simple 1.1.1, which we don't want to bundle + // if (jsonParser == null) { + // jsonParser = new RestJSONResponseParser(); + // } + // return jsonParser; + case TEXT_PLAIN: + return null; + default: + throw new PayaraIdeException("Not supported content type. Cannot create response parser!"); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestActionReport.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestActionReport.java new file mode 100644 index 00000000..6834e36e --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestActionReport.java @@ -0,0 +1,80 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin.response; + +import java.util.ArrayList; +import java.util.List; + +/** + * Object representation of the response returned by REST administration service. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RestActionReport implements ActionReport { + + /** Top part of the message, can be the only one. */ + MessagePart topMessagePart = new MessagePart(); + /** Nested reports. */ + List subActions = new ArrayList<>(); + /** Exit code returned by server. */ + ExitCode exitCode = ActionReport.ExitCode.NA; + /** Description of command which is the report related to. */ + String actionDescription; + + public List getSubActionsReport() { + return subActions; + } + + @Override + public ExitCode getExitCode() { + return exitCode; + } + + @Override + public String getMessage() { + return topMessagePart.getMessage(); + } + + @Override + public String getCommand() { + return actionDescription; + } + + void setActionDescription(String actionDescription) { + this.actionDescription = actionDescription; + } + + void setExitCode(ExitCode exitCode) { + this.exitCode = exitCode; + } + + void setMessage(String message) { + topMessagePart.setMessage(message); + } + + public boolean isSuccess() { + return getExitCode().equals(ExitCode.SUCCESS); + } + + public MessagePart getTopMessagePart() { + return topMessagePart; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestResponseParser.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestResponseParser.java new file mode 100644 index 00000000..b4dc4a3f --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestResponseParser.java @@ -0,0 +1,34 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin.response; + +import java.io.InputStream; + +/** + * Base implementation for REST parsers. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +abstract public class RestResponseParser implements ResponseParser { + + @Override + public abstract RestActionReport parse(InputStream in); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestXMLResponseParser.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestXMLResponseParser.java new file mode 100644 index 00000000..a64e087a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestXMLResponseParser.java @@ -0,0 +1,216 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.admin.response; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.xml.stream.EventFilter; +import javax.xml.stream.XMLEventReader; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.events.Attribute; +import javax.xml.stream.events.StartElement; +import javax.xml.stream.events.XMLEvent; + +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * Response parser implementation that can parse XML responses returned by REST admin interface. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class RestXMLResponseParser extends RestResponseParser { + + private static final String ENTRY = "entry"; + private static final String MAP = "map"; + + private static final XMLInputFactory factory = XMLInputFactory.newInstance(); + private static final RestXMLResponseFilter filter = new RestXMLResponseFilter(); + + public RestXMLResponseParser() { + + } + + /** + * Parse implementation for XML REST response. + *

+ * This implementation is based on Stax parser. Currently REST admin service does not use any schema + * for XML responses so this implementation is based on the code that generates the response on + * server side. + *

+ * + * @param in {@link InputStream} with XML REST response. + * @return Response returned by REST administration service. + */ + @Override + public RestActionReport parse(InputStream in) { + // System.out.println("FACTORY: " + factory); + try { + XMLEventReader reader = factory.createFilteredReader(factory.createXMLEventReader(in), filter); + if (reader.hasNext() && MAP.equals(reader.nextEvent().asStartElement().getName().getLocalPart())) { + return parseReport(reader); + } else { + return null; + } + } catch (XMLStreamException ex) { + throw new PayaraIdeException("Unable to parse XML Rest response.", ex); + } + } + + private RestActionReport parseReport(XMLEventReader reader) throws XMLStreamException { + int level = 0; + RestActionReport report = new RestActionReport(); + while (reader.hasNext() && (level > -1)) { + XMLEvent event = reader.nextEvent(); + if (event.isStartElement()) { + + if (level++ == 0) { + StartElement element = event.asStartElement(); + String elementName = element.getName().getLocalPart(); + if (ENTRY.equals(elementName)) { + Map m = getMapEntry(element); + String key = m.get("key"); + String value = m.get("value"); + switch (key) { + case "message": + report.setMessage(value); + break; + case "exit_code": + report.setExitCode(ActionReport.ExitCode.valueOf(value)); + break; + case "command": + report.setActionDescription(value); + break; + case "children": + report.topMessagePart.children = parseChildrenMessages(reader); + level--; + break; + case "subReports": + report.subActions = parseSubReports(reader); + break; + } + } + } + + } + + if (event.isEndElement()) { + level--; + } + } + return report; + } + + private HashMap getMapEntry(StartElement entry) { + HashMap entryMap = new HashMap<>(); + Iterator iter = entry.getAttributes(); + while (iter.hasNext()) { + Attribute att = (Attribute) iter.next(); + entryMap.put(att.getName().getLocalPart(), att.getValue()); + } + return entryMap; + } + + private List parseChildrenMessages(XMLEventReader reader) throws XMLStreamException { + ArrayList messages = new ArrayList<>(); + int level = 0; + while (reader.hasNext() && (level > -1)) { + XMLEvent event = reader.nextEvent(); + if (event.isStartElement()) { + if (level++ == 1) { + StartElement element = event.asStartElement(); + String elementName = element.getName().getLocalPart(); + if (MAP.equals(elementName)) { + messages.add(parseChildMessage(reader)); + level--; + } + } + } else { + level--; + } + + } + return messages; + } + + private MessagePart parseChildMessage(XMLEventReader reader) throws XMLStreamException { + MessagePart msg = new MessagePart(); + int level = 0; + while (reader.hasNext() && (level > -1)) { + XMLEvent event = reader.nextEvent(); + if (event.isStartElement()) { + if (level++ == 0) { + StartElement element = event.asStartElement(); + String elementName = element.getName().getLocalPart(); + if (ENTRY.equals(elementName)) { + Map m = getMapEntry(element); + String key = m.get("key"); + String value = m.get("value"); + switch (key) { + case "message": + msg.setMessage(value); + break; + case "properties": + msg.props = parseProperties(reader); + break; + case "children": + msg.children = parseChildrenMessages(reader); + break; + } + } + } + } else { + level--; + } + } + return msg; + } + + private Properties parseProperties(XMLEventReader reader) { + Properties props = new Properties(); + // TODO parsing of properties + return props; + } + + private List parseSubReports(XMLEventReader reader) { + ArrayList subReports = new ArrayList<>(); + return subReports; + } + + static private class RestXMLResponseFilter implements EventFilter { + + @Override + public boolean accept(XMLEvent event) { + if (event.isStartElement() || event.isEndElement()) { + return true; + } else { + return false; + } + } + + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/DataException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/DataException.java new file mode 100644 index 00000000..e1117491 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/DataException.java @@ -0,0 +1,131 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data; + +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * GlassFish IDE SDK Exception related to server administration command package problems. + *

+ * All exceptions are logging themselves on WARNING level when created. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class DataException extends PayaraIdeException { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Exception message for invalid GlassFish administration interface type. + */ + static final String INVALID_ADMIN_INTERFACE = "Invalid GlassFish administration interface type"; + + /** Exception message for invalid GlassFish version. */ + static final String INVALID_CONTAINER = "Invalid GlassFish container"; + + /** + * Exception message for invalid GlassFish URL. Used in IDE URL entity class. + */ + public static final String INVALID_URL = "Invalid GlassFish URL"; + + /** Exception for GlassFish installation root directory null value. */ + static final String SERVER_ROOT_NULL = "GlassFish installation root directory is null"; + + /** Exception for GlassFish home directory null value. */ + static final String SERVER_HOME_NULL = "GlassFish home directory is null"; + + /** + * Exception for non existent GlassFish installation root directory. Requires 1 directory argument. + */ + static final String SERVER_ROOT_NONEXISTENT = "GlassFish installation root directory {0} does not exist"; + + /** + * Exception for non existent GlassFish home directory. Requires 1 directory argument. + */ + static final String SERVER_HOME_NONEXISTENT = "GlassFish home directory {0} does not exist"; + + /** + * Exception for unknown GlassFish version in GlassFish home directory. + */ + static final String SERVER_HOME_NO_VERSION = "Unknown GlassFish version in home directory {0}"; + + /** Exception for GlassFish URL null value. */ + static final String SERVER_URL_NULL = "GlassFish URL is null"; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of DataException without detail message. + */ + public DataException() { + super(); + } + + /** + * Constructs an instance of DataException with the specified detail message. + *

+ * + * @param msg The detail message. + */ + public DataException(final String msg) { + super(msg); + } + + /** + * Constructs an instance of DataException with the specified detail message and + * arguments. + *

+ * Uses {@link java.text.MessageFormat} to format message. + *

+ * + * @param msg The detail message. + * @param arguments Arguments to be inserted into message. + */ + public DataException(final String msg, final Object... arguments) { + super(msg, arguments); + } + + /** + * Constructs an instance of DataException with the specified detail message and cause. + * Exception is logged on WARN level. + *

+ * Note that the detail message associated with {@code cause} is not automatically + * incorporated in this runtime exception's detail message. + *

+ * + * @param msg the detail message (which is saved for later retrieval by the {@link #getMessage()} + * method). + * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A + * null value is permitted, and indicates that the cause is nonexistent or unknown.) + */ + public DataException(final String msg, final Throwable cause) { + super(msg, cause); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ExceptionMessages.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ExceptionMessages.properties new file mode 100644 index 00000000..3c6609c9 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ExceptionMessages.properties @@ -0,0 +1,8 @@ +################################################################################ +# Exception messages # +# Use .. notation for keys. # +################################################################################ + +# GlassFishStatusCheck class +GlassFishStatusCheck.toString.invalidStatusCheck=Invalid GlassFish server \ +status check type diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishAdminInterface.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishAdminInterface.java new file mode 100644 index 00000000..aa01ce48 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishAdminInterface.java @@ -0,0 +1,112 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data; + +import java.util.HashMap; +import java.util.Map; + +/** + * GlassFish Server Administration Interface. + *

+ * Local GlassFish server administration interface type used to mark proper administration interface + * for individual GlassFish servers. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public enum GlassFishAdminInterface { + //////////////////////////////////////////////////////////////////////////// + // Enum values // + //////////////////////////////////////////////////////////////////////////// + /** GlassFish server administration interface is REST. */ + REST, + /** GlassFish server administration interface is HTTP. */ + HTTP; + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** A String representation of REST value. */ + static final String REST_STR = "REST"; + + /** A String representation of HTTP value. */ + static final String HTTP_STR = "HTTP"; + + /** + * Stored String values for backward String conversion. + */ + private static final Map stringValuesMap = new HashMap(values().length); + + // Initialize backward String conversion Map. + static { + for (GlassFishAdminInterface adminInterface : GlassFishAdminInterface.values()) { + stringValuesMap.put( + adminInterface.toString().toUpperCase(), adminInterface); + } + } + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Returns a GlassFishAdminInterface with a value represented by the specified + * String. The GlassFishAdminInterface returned represents existing value + * only if specified String matches any String returned by + * toString method. Otherwise null value is returned. + *

+ * + * @param name Value containing GlassFishAdminInterface toString + * representation. + * @return GlassFishAdminInterface value represented by String or + * null if value was not recognized. + */ + public static GlassFishAdminInterface toValue(String name) { + if (name != null) { + return (stringValuesMap.get(name.toUpperCase())); + } else { + return null; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Convert GlassFishAdminInterface value to String. + *

+ * + * @return A String representation of the value of this object. + */ + @Override + public String toString() { + switch (this) { + case REST: + return REST_STR; + case HTTP: + return HTTP_STR; + // This is unrecheable. Being here means this class does not handle + // all possible values correctly. + default: + throw new DataException( + DataException.INVALID_ADMIN_INTERFACE); + } + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishConfig.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishConfig.java new file mode 100644 index 00000000..4453fda8 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishConfig.java @@ -0,0 +1,67 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data; + +import java.util.List; + +import fish.payara.eclipse.tools.server.sdk.server.config.JavaEESet; +import fish.payara.eclipse.tools.server.sdk.server.config.JavaSESet; +import fish.payara.eclipse.tools.server.sdk.server.config.LibraryNode; + +/** + * Payara configuration reader API interface. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public interface GlassFishConfig { + + /** + * Get Payara libraries configuration. + *

+ * + * @return Payara libraries configuration. + */ + public List getLibrary(); + + /** + * Get Payara Java EE configuration. + *

+ * + * @return Payara JavaEE configuration. + */ + public JavaEESet getJavaEE(); + + /** + * Get Payara Java SE configuration. + *

+ * + * @return Payara JavaSE configuration. + */ + public JavaSESet getJavaSE(); + + /** + * Get Payara tools configuration. + *

+ * + * @return Payara tools configuration. + */ + public ToolsConfig getTools(); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishContainer.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishContainer.java new file mode 100644 index 00000000..9479ca6b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishContainer.java @@ -0,0 +1,164 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data; + +import static fish.payara.eclipse.tools.server.sdk.data.DataException.INVALID_CONTAINER; + +import java.util.Comparator; +import java.util.HashMap; +import java.util.Map; + +/** + * GlassFish Server Containers. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public enum GlassFishContainer implements Comparator { + + //////////////////////////////////////////////////////////////////////////// + // Enum values // + //////////////////////////////////////////////////////////////////////////// + + /** EAR application. */ + EAR, + /** Web application. */ + WEB, + /** EJB application. */ + EJB, + /** Application client. */ + APPCLIENT, + /** Connector. */ + CONNECTOR, + /** Unknown application. */ + UNKNOWN; + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** A String representation of EAR value. */ + static final String EAR_STR = "ear"; + + /** A String representation of WEB value. */ + static final String WEB_STR = "web"; + + /** A String representation of EJB value. */ + static final String EJB_STR = "ejb"; + + /** A String representation of APPCLIENT value. */ + static final String APPCLIENT_STR = "appclient"; + + /** A String representation of CONNECTOR value. */ + static final String CONNECTOR_STR = "connector"; + + /** A String representation of UNKNOWN value. */ + static final String UNKNOWN_STR = "unknown"; + + /** Version elements separator character. */ + public static final char SEPARATOR = ','; + + /** + * Stored String values for backward String conversion. + */ + private static final Map stringValuesMap = new HashMap(2 * values().length); + + // Initialize backward String conversion Map. + static { + for (GlassFishContainer container : GlassFishContainer.values()) { + stringValuesMap.put(container.toString().toUpperCase(), container); + } + } + + /** + * Returns a GlassFishContainer with a value represented by the specified + * String. The GlassFishContainer returned represents existing value only + * if specified String matches any String returned by + * toString method. Otherwise null value is returned. + *

+ * + * @param containerStr Value containing container String representation. + * @return GlassFishContainer value represented by String or + * null if value was not recognized. + */ + public static GlassFishContainer toValue(String containerStr) { + if (containerStr != null) { + return (stringValuesMap.get(containerStr.toUpperCase())); + } else { + return null; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Convert GlassFishContainer value to String. + *

+ * + * @return A String representation of the value of this object. + */ + @Override + public String toString() { + switch (this) { + case EAR: + return EAR_STR; + case WEB: + return WEB_STR; + case EJB: + return EJB_STR; + case APPCLIENT: + return APPCLIENT_STR; + case CONNECTOR: + return CONNECTOR_STR; + case UNKNOWN: + return UNKNOWN_STR; + // This is unrecheable. Being here means this class does not handle + // all possible values correctly. + default: + throw new DataException(INVALID_CONTAINER); + } + } + + /** + * Compares its two arguments for order. + *

+ * Returns a negative integer, zero, or a positive integer as the first argument is less than, equal + * to, or greater than the second. + *

+ * + * @param container1 The first object to be compared. + * @param container2 The second object to be compared. + * @return A negative integer, zero, or a positive integer as the first argument is less than, equal + * to, or greater than the second. + */ + @Override + public int compare(GlassFishContainer container1, + GlassFishContainer container2) { + return container1 != null && container2 != null + ? container1.ordinal() - container2.ordinal() + : container1 != null + ? container2.ordinal() + : container2 != null + ? -container1.ordinal() + : 0; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishJavaEEConfig.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishJavaEEConfig.java new file mode 100644 index 00000000..4296f18d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishJavaEEConfig.java @@ -0,0 +1,103 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data; + +import java.io.File; +import java.util.Set; + +import fish.payara.eclipse.tools.server.sdk.server.config.JavaEEProfile; +import fish.payara.eclipse.tools.server.sdk.server.config.JavaEESet; +import fish.payara.eclipse.tools.server.sdk.server.config.ModuleType; + +/** + * GlassFish JavaEE configuration entity. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class GlassFishJavaEEConfig { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Supported module types. */ + private final Set modules; + + /** Supported JavaEE profiles. */ + private final Set profiles; + + /** Highest JavaEE specification version implemented. */ + private final String version; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of avaEE configuration entity using JavaEE set for GlassFish features + * configuration as source of instance content. + *

+ * + * @param javaEEconfig Container of GlassFish JavaEE features configuration. + * @param classpathHome Classpath search prefix. + */ + public GlassFishJavaEEConfig( + final JavaEESet javaEEconfig, final File classpathHome) { + modules = javaEEconfig.moduleTypes(classpathHome); + profiles = javaEEconfig.profiles(classpathHome); + version = javaEEconfig.getVersion(); + javaEEconfig.reset(); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get highest JavaEE specification version implemented. + *

+ * + * @return Highest JavaEE specification version implemented. + */ + public String getVersion() { + return version; + } + + /** + * Get supported JavaEE profiles. + *

+ * + * @return Supported JavaEE profiles. + */ + public Set getProfiles() { + return profiles; + } + + /** + * Get supported module types. + *

+ * + * @return Supported module types. + */ + public Set getModuleTypes() { + return modules; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishJavaSEConfig.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishJavaSEConfig.java new file mode 100644 index 00000000..100a994c --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishJavaSEConfig.java @@ -0,0 +1,84 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data; + +import java.util.Set; + +import fish.payara.eclipse.tools.server.sdk.server.config.JavaSEPlatform; +import fish.payara.eclipse.tools.server.sdk.server.config.JavaSESet; + +/** + * Container of GlassFish JavaSE features configuration. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class GlassFishJavaSEConfig { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Platforms retrieved from XML elements. */ + private final Set platforms; + + /** Highest JavaEE specification version implemented. */ + private final String version; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of avaEE configuration entity using JavaEE set for GlassFish features + * configuration as source of instance content. + *

+ * + * @param javaSEconfig Container of GlassFish JavaEE features configuration. + */ + public GlassFishJavaSEConfig(final JavaSESet javaSEconfig) { + platforms = javaSEconfig.platforms(); + version = javaSEconfig.getVersion(); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get highest JavaSE specification version implemented. + *

+ * + * @return Highest JavaSE specification version implemented. + */ + public String getVersion() { + return version; + } + + /** + * Get supported JavaSE platforms. + *

+ * + * @return Supported JavaSE platforms. + */ + public Set getPlatforms() { + return platforms; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishLibrary.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishLibrary.java new file mode 100644 index 00000000..3fd7a11d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishLibrary.java @@ -0,0 +1,177 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data; + +import java.net.URL; +import java.util.List; + +/** + * GlassFish library entity. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class GlassFishLibrary { + + /** + * Maven related information for JARs. + */ + public static class Maven { + + /** Maven Group ID. */ + private final String groupId; + + /** Maven Artifact ID. */ + private final String artifactId; + + /** Maven Version. */ + private final String version; + + /** + * Creates an instance of Maven related information. + *

+ * + * @param groupId Maven Group ID. + * @param artifactId Maven Artifact ID. + * @param version Maven Version. + */ + public Maven(final String groupId, + final String artifactId, final String version) { + this.groupId = groupId; + this.artifactId = artifactId; + this.version = version; + } + } + + /** Library name (unique identifier). */ + private final String libraryID; + + /** Library class path containing all JARs to be addedx to project. */ + private final List classpath; + + /** Library java doc. */ + private final List javadocs; + + /** Library java doc. */ + private final List javadocLookups; + + /** Library sources. */ + private final List sources; + + /** Maven artifact information. */ + private final List maven; + + /** + * Creates an instance of GlassFish library entity. + *

+ * + * @param libraryID Library name (unique identifier). + * @param classpath Library class path. + * @param javadocs Library java doc. + * @param sources Library sources. + */ + public GlassFishLibrary(final String libraryID, + final List classpath, final List javadocs, + List javadocLookups, + final List sources, final List maven) { + this.libraryID = libraryID; + this.classpath = classpath; + this.javadocs = javadocs; + this.javadocLookups = javadocLookups; + this.sources = sources; + this.maven = maven; + } + + /** + * Get library name (unique identifier). + *

+ * + * @return Library name (unique identifier). + */ + public String getLibraryID() { + return libraryID; + } + + /** + * Get library class path. + *

+ * + * @return Library class path. + */ + public List getClasspath() { + return classpath; + } + + /** + * Get library java doc. + *

+ * + * @return Library java doc. + */ + public List getJavadocs() { + return javadocs; + } + + /** + * Get library java doc lookups. + *

+ * + * @return Library java doc lookups. + */ + public List getJavadocLookups() { + return javadocLookups; + } + + /** + * get library sources. + *

+ * + * @return Library sources. + */ + public List getSources() { + return sources; + } + + /** + * Get Maven dependencies as <groupId> ':' <artifactId> ':' <version> ':jar' + * { ' ' <groupId> ':' <artifactId> ':' <version> ':jar' + * } {@link String}. + *

+ * @return Maven dependencies String. + */ + public String getMavenDeps() { + StringBuilder sb = new StringBuilder(); + boolean first = true; + for (Maven mvn : maven) { + if (first) { + first = false; + } else { + sb.append(' '); + } + sb.append(mvn.groupId); + sb.append(':'); + sb.append(mvn.artifactId); + sb.append(':'); + sb.append(mvn.version); + sb.append(":jar"); + } + return sb.toString(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishServerStatus.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishServerStatus.java new file mode 100644 index 00000000..0100949b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishServerStatus.java @@ -0,0 +1,54 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.GlassFishStatus; + +/** + * GlassFish server status interface. + *

+ * GlassFish Server entity interface allows to use foreign entity classes. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public interface GlassFishServerStatus { + + //////////////////////////////////////////////////////////////////////////// + // Interface Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get GlassFish server entity. + *

+ * + * @return GlassFish server entity. + */ + public PayaraServer getServer(); + + /** + * Get current GlassFish server status. + *

+ * + * @return Current GlassFish server status. + */ + public GlassFishStatus getStatus(); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusCheck.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusCheck.java new file mode 100644 index 00000000..b5438a8a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusCheck.java @@ -0,0 +1,130 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data; + +import java.util.HashMap; +import java.util.Map; + +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * Server status check type. + *

+ * + * @author Tomas Kraus + */ +public enum GlassFishStatusCheck { + + //////////////////////////////////////////////////////////////////////////// + // Enum values // + //////////////////////////////////////////////////////////////////////////// + + /** Administration port check. */ + PORT, + + /** Version command check. */ + VERSION, + + /** Locations command check. */ + LOCATIONS; + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(GlassFishStatusCheck.class); + + /** GlassFish version enumeration length. */ + public static final int length = GlassFishStatusCheck.values().length; + + /** A String representation of PORT value. */ + private static final String PORT_STR = "PORT"; + + /** A String representation of VERSION value. */ + private static final String VERSION_STR = "VERSION"; + + /** A String representation of LOCATIONS value. */ + private static final String LOCATIONS_STR = "LOCATIONS"; + + /** + * Stored String values for backward String conversion. + */ + private static final Map stringValuesMap = new HashMap(values().length); + static { + for (GlassFishStatusCheck state : GlassFishStatusCheck.values()) { + stringValuesMap.put(state.toString().toUpperCase(), state); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Returns a GlassFishStatusCheck with a value represented by the specified + * String. + *

+ * The GlassFishStatusCheck returned represents existing value only if specified + * String matches any String returned by toString method. + * Otherwise null value is returned. + *

+ * + * @param name Value containing GlassFishStatusCheck toString + * representation. + * @return GlassFishStatusCheck value represented by String or + * null if value was not recognized. + */ + public static GlassFishStatusCheck toValue(final String name) { + if (name != null) { + return (stringValuesMap.get(name.toUpperCase())); + } else { + return null; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Convert GlassFishStatusCheck value to String. + *

+ * + * @return A String representation of the value of this object. + */ + @Override + public String toString() { + final String METHOD = "toString"; + switch (this) { + case PORT: + return PORT_STR; + case VERSION: + return VERSION_STR; + case LOCATIONS: + return LOCATIONS_STR; + // This is unrecheable. Being here means this class does not handle + // all possible values correctly. + default: + throw new DataException( + LOGGER.excMsg(METHOD, "invalidStatusCheck")); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusCheckResult.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusCheckResult.java new file mode 100644 index 00000000..0af00bf1 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusCheckResult.java @@ -0,0 +1,137 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data; + +/** + * Individual server check status returned. + *

+ * There is also minimal algebra defined to support AND and OR. + *

+ * + * @author Tomas Kraus + */ +public enum GlassFishStatusCheckResult { + + /** Server status check passed. */ + SUCCESS, + + /** Server status check failed with FAILED result. */ + FAILED; + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Full AND operator state space. */ + private static final GlassFishStatusCheckResult[][] and = { + // SUCCESS FAILED + { SUCCESS, FAILED }, // SUCCESS + { FAILED, FAILED } // FAILED + }; + + /** Full OR operator state space. */ + private static final GlassFishStatusCheckResult[][] or = { + // SUCCESS FAILED + { SUCCESS, SUCCESS }, // SUCCESS + { SUCCESS, FAILED } // FAILED + }; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Compute logical AND of two status values. + *

+ * + * @param s1 First operand. + * @param s2 Second operand. + */ + public static GlassFishStatusCheckResult and( + final GlassFishStatusCheckResult s1, + final GlassFishStatusCheckResult s2) { + return and[s1.ordinal()][s2.ordinal()]; + } + + /** + * Compute logical OR of two status values. + *

+ * + * @param s1 First operand. + * @param s2 Second operand. + */ + public static GlassFishStatusCheckResult or( + final GlassFishStatusCheckResult s1, + final GlassFishStatusCheckResult s2) { + return or[s1.ordinal()][s2.ordinal()]; + } + + /** + * Compute logical AND of three status values. + *

+ * + * @param s1 First operand. + * @param s2 Second operand. + * @param s3 Third operand. + */ + public static GlassFishStatusCheckResult and( + final GlassFishStatusCheckResult s1, + final GlassFishStatusCheckResult s2, + final GlassFishStatusCheckResult s3) { + return and[s1.ordinal()][and[s2.ordinal()][s3.ordinal()].ordinal()]; + } + + /** + * Compute logical OR of three status values. + *

+ * + * @param s1 First operand. + * @param s2 Second operand. + * @param s3 Third operand. + */ + public static GlassFishStatusCheckResult or( + final GlassFishStatusCheckResult s1, + final GlassFishStatusCheckResult s2, + final GlassFishStatusCheckResult s3) { + return or[s1.ordinal()][or[s2.ordinal()][s3.ordinal()].ordinal()]; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Convert GlassFishStatusCheckResult value to String. + *

+ * + * @return A String representation of the value of this object. + */ + @Override + public String toString() { + switch (this) { + case SUCCESS: + return "SUCCESS"; + case FAILED: + return "FAILED"; + default: + throw new IllegalStateException("Unknown Status value"); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusTask.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusTask.java new file mode 100644 index 00000000..8d00a7ff --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusTask.java @@ -0,0 +1,57 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data; + +import fish.payara.eclipse.tools.server.sdk.TaskEvent; + +/** + * GlassFish server status check task details. + *

+ * Provides access to server status check task details in status listener callback methods. + *

+ * + * @author Tomas Kraus + */ +public interface GlassFishStatusTask { + + /** + * Get server status check type. + *

+ * + * @return Server status check type. + */ + public GlassFishStatusCheck getType(); + + /** + * Get last command task execution status. + *

+ * + * @return Last command task execution status. + */ + public GlassFishStatusCheckResult getStatus(); + + /** + * Get last command task execution status. + *

+ * + * @return Last command task execution status. + */ + public TaskEvent getEvent(); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/IdeContext.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/IdeContext.java new file mode 100644 index 00000000..711d9983 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/IdeContext.java @@ -0,0 +1,45 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data; + +/** + * IDE context containing interfaces to access IDE objects. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + * @deprecated IDE context support was removed. DO NOT USE! + */ +@Deprecated +public class IdeContext { + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs IDE context object and sets IDE accessors. + *

+ * + * @deprecated IDE context support was removed. DO NOT USE! + */ + @Deprecated + public IdeContext() { + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/LogMessages.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/LogMessages.properties new file mode 100644 index 00000000..2f3e224b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/LogMessages.properties @@ -0,0 +1,7 @@ +################################################################################ +# Log messages # +# Use .. notation for keys. # +################################################################################ + +# GlassFishVersion class +GlassFishVersion.matchMajorMinor.nfe=Strings are not version numbers: {0}, {1} \ No newline at end of file diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/StartupArgs.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/StartupArgs.java new file mode 100644 index 00000000..d547280a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/StartupArgs.java @@ -0,0 +1,39 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data; + +import java.util.List; +import java.util.Map; + +/** + * This interface provides IDE and user specific arguments for starting the server. + * + * @author Tomas Kraus, Peter Benedikovic + */ +public interface StartupArgs { + + public List getGlassfishArgs(); + + public List getJavaArgs(); + + public Map getEnvironmentVars(); + + public String getJavaHome(); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/StartupArgsEntity.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/StartupArgsEntity.java new file mode 100644 index 00000000..1cd182c0 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/StartupArgsEntity.java @@ -0,0 +1,165 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data; + +import java.util.List; +import java.util.Map; + +/** + * GlassFish Server Entity. + *

+ * Local GlassFish Server entity instance which is used when not defined in IDE. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class StartupArgsEntity implements StartupArgs { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Command line arguments passed to bootstrap jar. */ + private List glassfishArgs; + + /** Command line arguments passed to JVM. */ + private List javaArgs; + + /** Environment variables set before JVM execution. */ + private Map environmentVars; + + /** Installation home of Java SDK used to run GlassFish. */ + private String javaHome; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs empty class instance. No default values are set. + */ + public StartupArgsEntity() { + } + + /** + * Constructs class instance with all values supplied. + *

+ * + * @param glassfishArgs Command line arguments passed to bootstrap jar. + * @param javaArgs Command line arguments passed to JVM. + * @param environmentVars Environment variables set before JVM execution. + * @param javaHome Installation home of Java SDK used to run GlassFish. + */ + public StartupArgsEntity(List glassfishArgs, List javaArgs, + Map environmentVars, String javaHome) { + this.glassfishArgs = glassfishArgs; + this.javaArgs = javaArgs; + this.environmentVars = environmentVars; + this.javaHome = javaHome; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get command line arguments passed to bootstrap jar. + *

+ * + * @return Command line arguments passed to bootstrap jar. + */ + @Override + public List getGlassfishArgs() { + return glassfishArgs; + } + + /** + * Set command line arguments passed to bootstrap jar. + *

+ * + * @param glassfishArgs Command line arguments passed to bootstrap jar. + */ + public void setGlassfishArgs(List glassfishArgs) { + this.glassfishArgs = glassfishArgs; + } + + /** + * Get command line arguments passed to JVM. + *

+ * + * @return Command line arguments passed to JVM. + */ + @Override + public List getJavaArgs() { + return javaArgs; + } + + /** + * Set command line arguments passed to JVM. + *

+ * + * @param javaArgs Command line arguments passed to JVM. + */ + public void getJavaArgs(List javaArgs) { + this.javaArgs = javaArgs; + } + + /** + * Get environment variables set before JVM execution. + *

+ * + * @return Environment variables set before JVM execution. + */ + @Override + public Map getEnvironmentVars() { + return environmentVars; + } + + /** + * Set environment variables set before JVM execution. + *

+ * + * @param environmentVars Environment variables set before JVM execution. + */ + public void setEnvironmentVars(Map environmentVars) { + this.environmentVars = environmentVars; + } + + /** + * Get installation home of Java SDK used to run GlassFish. + *

+ * + * @return Installation home of Java SDK used to run GlassFish. + */ + @Override + public String getJavaHome() { + return javaHome; + } + + /** + * Set installation home of Java SDK used to run GlassFish. + *

+ * + * @param javaHome Installation home of Java SDK used to run GlassFish. + */ + public void getJavaHome(String javaHome) { + this.javaHome = javaHome; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ToolConfig.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ToolConfig.java new file mode 100644 index 00000000..7b532e5c --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ToolConfig.java @@ -0,0 +1,41 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data; + +/** + * GlassFish tool. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public interface ToolConfig { + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get tool JAR path (relative under GlassFish home). + *

+ * + * @return ToolConfig JAR path (relative under GlassFish home) + */ + public String getJar(); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ToolsConfig.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ToolsConfig.java new file mode 100644 index 00000000..b9984d6e --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ToolsConfig.java @@ -0,0 +1,41 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data; + +/** + * Payara tools. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public interface ToolsConfig { + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get asadmin tool. + *

+ * + * @return Asadmin tool. + */ + public ToolConfig getAsadmin(); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishAccount.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishAccount.java new file mode 100644 index 00000000..260ce4ba --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishAccount.java @@ -0,0 +1,81 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data.cloud; + +/** + * GlassFish Cloud User Account Entity. + *

+ * GlassFish Cloud User Account entity interface allows to use foreign entity classes. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public interface GlassFishAccount { + + /** + * Get GlassFish cloud user account name. + *

+ * This is display name given to the cluster. + *

+ * + * @return GlassFish cluster name. + */ + public String getName(); + + /** + * Get GlassFish cloud account name. + *

+ * + * @return GlassFish cloud account name. + */ + public String getAcount(); + + /** + * Get GlassFish cloud user name under account. + *

+ * + * @return GlassFish cloud user name under account. + */ + public String getUserName(); + + /** + * Get GlassFish cloud URL. + *

+ * + * @return Cloud URL. + */ + public String getUrl(); + + /** + * Get GlassFish cloud user password under account. + *

+ * + * @return GlassFish cloud user password under account. + */ + public String getUserPassword(); + + /** + * Get GlassFish cloud entity reference. + *

+ * + * @return GlassFish cloud entity reference. + */ + public GlassFishCloud getCloudEntity(); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishAccountEntity.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishAccountEntity.java new file mode 100644 index 00000000..80e23267 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishAccountEntity.java @@ -0,0 +1,243 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data.cloud; + +/** + * GlassFish Cloud User Account Entity Interface. + *

+ * GlassFish Cloud User Account entity instance which is used when not defined externally in IDE. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class GlassFishAccountEntity implements GlassFishAccount { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * GlassFish cloud user account name (display name in IDE). Used as key attribute. + */ + protected String name; + + /** GlassFish cloud server URL. Used as key attribute. */ + private String url; + + /** GlassFish cloud account name. */ + protected String account; + + /** GlassFish cloud account user name. */ + protected String userName; + + /** GlassFish cloud account user password. */ + protected String userPassword; + + /** GlassFish cloud entity reference. */ + protected GlassFishCloud cloudEntity; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs empty class instance. No default values are set. + */ + public GlassFishAccountEntity() { + } + + /** + * Constructs class instance with ALL values set. + *

+ * + * @param name GlassFish cloud account name to set. + * @param url GlassFish cloud server URL. + * @param account GlassFish cloud host to set. + * @param userName GlassFish cloud account user name to set. + * @param userPassword GlassFish cloud account user password to set. + * @param cloudEntity GlassFish cloud entity reference to set. + */ + public GlassFishAccountEntity(String name, String account, String userName, + String userPassword, String url, GlassFishCloud cloudEntity) { + this.name = name; + this.url = url; + this.account = account; + this.userName = userName; + this.userPassword = userPassword; + this.cloudEntity = cloudEntity; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get GlassFish cloud user account display name. + *

+ * Key attribute. + *

+ * This is display name given to the cloud user account. + *

+ * + * @return GlassFish cloud user account display name. + */ + @Override + public String getName() { + return name; + } + + /** + * Set GlassFish cloud user account display name. + *

+ * Key attribute. + *

+ * This is display name given to the cloud user account. + *

+ * + * @param name GlassFish cloud user account display name to set. + */ + public void setName(String name) { + this.name = name; + } + + /** + * Get GlassFish cloud URL. + *

+ * Key attribute. + *

+ * + * @return Cloud URL. + */ + @Override + public String getUrl() { + return url; + } + + /** + * Set GlassFish cloud URL. + *

+ * Key attribute. + *

+ * + * @param url Cloud URL to set. + */ + public void setUrl(String url) { + this.url = url; + } + + /** + * Get GlassFish cloud account name. + *

+ * + * @return GlassFish cloud account name. + */ + @Override + public String getAcount() { + return account; + } + + /** + * Set GlassFish cloud account name. + *

+ * + * @param account GlassFish cloud account name to set. + */ + public void setAcount(String account) { + this.account = account; + } + + /** + * Get GlassFish cloud user name under account. + *

+ * + * @return GlassFish cloud user name under account. + */ + @Override + public String getUserName() { + return userName; + } + + /** + * Set GlassFish cloud user name under account. + *

+ * + * @param userName GlassFish cloud user name under account to set. + */ + public void setUserName(String userName) { + this.userName = userName; + } + + /** + * Get GlassFish cloud user password under account. + *

+ * + * @return GlassFish cloud user password under account. + */ + @Override + public String getUserPassword() { + return userPassword; + } + + /** + * Set GlassFish cloud user password under account. + *

+ * + * @param userPassword GlassFish cloud user password under account to set. + */ + public void setUserPassword(String userPassword) { + this.userPassword = userPassword; + } + + /** + * Get GlassFish cloud entity reference. + *

+ * + * @return GlassFish cloud entity reference. + */ + @Override + public GlassFishCloud getCloudEntity() { + return cloudEntity; + } + + /** + * Set GlassFish cloud entity reference. + *

+ * + * @param cloudEntity GlassFish cloud entity reference to set. + */ + public void setCloudEntity(GlassFishCloud cloudEntity) { + this.cloudEntity = cloudEntity; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * String representation of this GlassFish cloud entity. + *

+ * + * @return String representation of this GlassFish cloud entity. + */ + @Override + public String toString() { + return name; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishCloud.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishCloud.java new file mode 100644 index 00000000..8f86e4d4 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishCloud.java @@ -0,0 +1,71 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data.cloud; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * GlassFish Cloud Entity Interface. + *

+ * GlassFish Cloud entity interface allows to use foreign entity classes. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public interface GlassFishCloud { + + //////////////////////////////////////////////////////////////////////////// + // Interface Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get GlassFish cloud name. + *

+ * This is display name given to the cloud. + *

+ * + * @return GlassFish cloud name. + */ + public String getName(); + + /** + * Get GlassFish cloud (CPAS) host. + *

+ * + * @return GlassFish cloud (CPAS) host. + */ + public String getHost(); + + /** + * Get GlassFish cloud port. + *

+ * + * @return GlassFish cloud port. + */ + public int getPort(); + + /** + * Get GlassFish cloud local server. + *

+ * + * @return GlassFish cloud local server. + */ + public PayaraServer getLocalServer(); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishCloudEntity.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishCloudEntity.java new file mode 100644 index 00000000..b63dd2d3 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishCloudEntity.java @@ -0,0 +1,179 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.data.cloud; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * GlassFish Cloud Entity. + *

+ * GlassFish cloud entity instance which is used when not defined externally in IDE. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class GlassFishCloudEntity implements GlassFishCloud { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** GlassFish cloud name (display name in IDE). */ + protected String name; + + /** GlassFish cloud host. */ + protected String host; + + /** GlassFish cloud port. */ + protected int port; + + /** GlassFish cloud local server. */ + protected PayaraServer localServer; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs empty class instance. No default values are set. + */ + public GlassFishCloudEntity() { + } + + /** + * Constructs class instance with ALL values set. + *

+ * + * @param name GlassFish cloud name to set. + * @param host GlassFish cloud host to set. + * @param port GlassFish server port to set. + * @param localServer GlassFish cloud local server to set. + */ + public GlassFishCloudEntity(String name, String host, int port, + PayaraServer localServer) { + this.name = name; + this.host = host; + this.port = port; + this.localServer = localServer; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get GlassFish cloud name (display name in IDE). + *

+ * + * @return GlassFish cloud name (display name in IDE). + */ + @Override + public String getName() { + return name; + } + + /** + * Set GlassFish cloud name (display name in IDE). + *

+ * + * @param name GlassFish cloud name to set (display name in IDE). + */ + public void setName(String name) { + this.name = name; + } + + /** + * Get GlassFish cloud host. + *

+ * + * @return GlassFish cloud host. + */ + @Override + public String getHost() { + return host; + } + + /** + * Set GlassFish cloud host. + *

+ * + * @param host GlassFish cloud host to set. + */ + public void setHost(String host) { + this.host = host; + } + + /** + * Get GlassFish server port. + *

+ * + * @return GlassFish server port. + */ + @Override + public int getPort() { + return port; + } + + /** + * Set GlassFish server port. + *

+ * + * @param port GlassFish server port to set. + */ + public void setPort(int port) { + this.port = port; + } + + /** + * Get GlassFish cloud local server. + *

+ * + * @return GlassFish cloud local server. + */ + @Override + public PayaraServer getLocalServer() { + return localServer; + } + + /** + * Set GlassFish cloud local server. + *

+ * + * @param localServer GlassFish cloud local server to set. + */ + public void setLocalServer(PayaraServer localServer) { + this.localServer = localServer; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * String representation of this GlassFish cloud entity. + *

+ * + * @return String representation of this GlassFish cloud entity. + */ + @Override + public String toString() { + return name; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/logging/Logger.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/logging/Logger.java new file mode 100644 index 00000000..09caacf6 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/logging/Logger.java @@ -0,0 +1,392 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.logging; + +import java.io.IOException; +import java.net.URL; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.sdk.utils.JavaUtils; + +/** + * GlassFish IDE SDK Logger. + *

+ * Facade to access IDE Logger methods. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class Logger { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** GlassFish IDE SDK logger name. Deprecated. */ + private static final String LOGGER_NAME = "org.glassfish.tools.ide"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Find or create a logger for GlassFish IDE SDK. If a logger has already been created with the + * given name it is returned. Otherwise a new logger is created. + *

+ * If a new logger is created its log level will be configured based on the LogManager configuration + * and it will configured to also send logging output to its parent's Handlers. It will be + * registered in the LogManager global name space. + *

+ * + * @return GlassFish IDE SDK Logger + * @deprecated Instantiate Logger class! + */ + @Deprecated + public static java.util.logging.Logger getLogger() { + return java.util.logging.Logger.getLogger(LOGGER_NAME); + } + + /** + * Log a message, with associated Throwable information. + *

+ * If the logger is currently enabled for the given message level then the given arguments are + * stored in a LogRecord which is forwarded to all registered output handlers. + *

+ * Note that the thrown argument is stored in the LogRecord thrown property, rather than the + * LogRecord parameters property. Thus is it processed specially by output Formatters and is not + * treated as a formatting parameter to the LogRecord message property. + *

+ * + * @param level One of the message level identifiers, e.g., SEVERE. + * @param msg The string message (or a key in the message catalog). + * @param thrown Throwable associated with log message. + * @deprecated Instantiate Logger class! + */ + @Deprecated + public static void log(Level level, String msg, Throwable thrown) { + getLogger().log(level, msg, thrown); + } + + /** + * Log a message, with an array of object arguments. + *

+ * If the logger is currently enabled for the given message level then a corresponding LogRecord is + * created and forwarded to all the registered output Handler objects. + *

+ * + * @param level One of the message level identifiers, e.g. SEVERE. + * @param msg The string message (or a key in the message catalog). + * @param params Array of parameters to the message. + * @deprecated Instantiate Logger class! + */ + @Deprecated + public static void log(Level level, String msg, Object params[]) { + getLogger().log(level, msg, params); + } + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Properties file containing log messages. */ + static final String MESSAGES_FILE = "LogMessages"; + + /** Properties file containing exception messages. */ + static final String EXCEPTIONS_FILE = "ExceptionMessages"; + + /** Properties file suffix. */ + static final String PROPERTIES_FILE_SUFFIX = ".properties"; + + /** Message key elements separator. */ + private static final char KEY_SEPARATOR = '.'; + + /** Log messages cache for individual packages. */ + private static final Map logProps = new HashMap<>(); + + /** Exception messages cache for individual packages. */ + private static final Map excProps = new HashMap<>(); + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Build properties file name with suffix. + *

+ * + * @param file Messages catalog file name. + * @param locales Add locale suffix when true or do not add it when false. + * @return Messages catalog file name with properties file suffix. + */ + private static String buildPropertiesFileName(final String file, + final boolean locales) { + StringBuilder sb = new StringBuilder( + file.length() + PROPERTIES_FILE_SUFFIX.length()); + sb.append(file); + sb.append(PROPERTIES_FILE_SUFFIX); + return sb.toString(); + } + + /** + * Return message from package properties catalog map with given key. + *

+ * Properties catalog for package of provided class will be loaded from provided file when missing. + *

+ * + * @param file Messages catalog file name. + * @param propsMap Package to properties catalog mapping. + * @param c Class to determine properties file package. + * @param key Exception message properties key. + * @return Message from package properties catalog map with given key. + */ + private static String message(final String file, + final Map propsMap, final Class c, + final String key) { + Package pkg = c.getPackage(); + Properties props; + synchronized (propsMap) { + props = propsMap.get(pkg); + if (props == null) { + props = new Properties(); + URL url = JavaUtils.getPropertiesURL( + c, buildPropertiesFileName(file, false)); + if (url != null) { + try { + url.openStream(); + props.load(url.openStream()); + // Initialize properties as empty and send log message + // on IOException + } catch (IOException ioe) { + props = new Properties(); + // Logger.log(Level.INFO, "Error reading {0} from {1}", + // new String[] {file, pkg.getName()}); + } + } + propsMap.put(pkg, props); + } + } + String property = props.getProperty(key); + return property != null ? property : key; + } + + /** + * Return message from log messages properties file with given key. + *

+ * + * @param c Class to determine properties file package. + * @param key Exception message properties key. + * @return Message from log messages properties file with given key. + */ + public static String logMsg(Class c, String key) { + return message(MESSAGES_FILE, logProps, c, key); + } + + /** + * Return message from exception messages properties file with given key. + *

+ * + * @param c Class to determine properties file package. + * @param key Exception message properties key. + * @return Message from exception messages properties file with given key. + */ + public static String excMsg(Class c, String key) { + return message(EXCEPTIONS_FILE, excProps, c, key); + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger name (derived from full class name including package). */ + private final String name; + + /** Logger package (derived from class package). */ + private final Class clazz; + + /** {@link java.util.logging.Logger} instance. */ + private final java.util.logging.Logger logger; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of library internal logger. + *

+ * + * @param c Class where logger instance was created. + */ + public Logger(Class clazz) { + this.clazz = clazz; + name = clazz.getName(); + logger = java.util.logging.Logger.getLogger(name); + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Builds message key as <class_name>.<method_name>.<key>. + *

+ * + * @param method The message string method key. + * @param key The message string key. + * @return Message key as <class_name>.<method_name>.<key>. + */ + public String buildKey(String method, String key) { + if (method == null || key == null) { + throw new IllegalArgumentException("Key value shall not be null."); + } + + String className = clazz.getSimpleName(); + + return new StringBuilder(className.length() + method.length() + key.length() + 2) + .append(className) + .append(KEY_SEPARATOR) + .append(method) + .append(KEY_SEPARATOR) + .append(key) + .toString(); + } + + /** + * Return message from exception messages properties file with given key. + *

+ * + * @param method The message string method key. + * @param key The message string key. + * @return Message from exception messages properties file with given key. + */ + public String excMsg(final String method, final String key) { + return message(EXCEPTIONS_FILE, excProps, clazz, buildKey(method, key)); + } + + /** + * Return message from exception messages properties file with given key and attributes. + *

+ * + * @param method The message string method key. + * @param key The message string key. + * @param attrs Message attributes. + * @return Message from exception messages properties file with given key and attributes. + */ + public String excMsg(String method, String key, String... attrs) { + return MessageFormat.format( + message(EXCEPTIONS_FILE, excProps, clazz, buildKey(method, key)), (Object[]) attrs); + } + + /** + * Check if a message of the given level would actually be logged by this logger. This check is + * based on the Loggers effective level, which may be inherited from its parent. + *

+ * + * @param level A message logging level. + * @return true if the given message level is currently being logged or + * false otherwise. + */ + public boolean isLoggable(Level level) { + return logger.isLoggable(level); + } + + /** + * Log a message, with no arguments from log messages catalog. + *

+ * If the logger is currently enabled for the given message level then the given message is + * forwarded to all the registered output Handler objects. + *

+ * + * @param level One of the message level identifiers, e.g., SEVERE. + * @param method The message string method key. + * @param key The message string key. + */ + public void log(Level level, final String method, final String key) { + logger.log(level, logMsg(clazz, buildKey(method, key))); + } + + /** + * Log a message, with associated Throwable information from log messages catalog. + *

+ * If the logger is currently enabled for the given message level then the given arguments are + * stored in a LogRecord which is forwarded to all registered output handlers. + *

+ * Note that the thrown argument is stored in the LogRecord thrown property, rather than the + * LogRecord parameters property. Thus is it processed specially by output Formatters and is not + * treated as a formatting parameter to the LogRecord message property. + *

+ * + * @param level One of the message level identifiers, e.g., SEVERE. + * @param method The message string method key. + * @param key The message string key. + * @param thrown Throwable associated with log message. + */ + public void log(final Level level, final String method, final String key, + final Throwable thrown) { + logger.log(level, logMsg(clazz, buildKey(method, key)), thrown); + } + + /** + * Log a message with one object parameter from log messages catalog. + *

+ * If the logger is currently enabled for the given message level then a corresponding LogRecord is + * created and forwarded to all the registered output Handler objects. + *

+ * + * @param level One of the message level identifiers, e.g. SEVERE. + * @param method The message string method key. + * @param key The message string key. + * @param param Parameter to the message. + */ + public void log(final Level level, final String method, final String key, + final Object param) { + logger.log(level, logMsg(clazz, buildKey(method, key)), param); + } + + /** + * Log a message with an array of object arguments from log messages catalog. + *

+ * If the logger is currently enabled for the given message level then a corresponding LogRecord is + * created and forwarded to all the registered output Handler objects. + *

+ * + * @param level One of the message level identifiers, e.g. SEVERE. + * @param method The message string method key. + * @param key The message string key. + * @param params Array of parameters to the message. + */ + public void log(final Level level, final String method, final String key, + final Object params[]) { + logger.log(level, logMsg(clazz, buildKey(method, key)), params); + } + + /** + * Log an exception message as is. + * + * @param level One of the message level identifiers, e.g. SEVERE. + * @param message The message to be logged as is. + */ + public void exception(final Level level, String message) { + logger.log(level, message); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ExceptionMessages.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ExceptionMessages.properties new file mode 100644 index 00000000..9fd98cd2 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ExceptionMessages.properties @@ -0,0 +1,20 @@ +################################################################################ +# Exception messages # +# Use .. notation for keys. # +################################################################################ + +# FetchLogLocal class +FetchLogLocal.initInputFile.cantInit=Cannot initialize input stream + +# FetchLogPiped class +FetchLogPiped.init.cantInit=Cannot initialize output stream +FetchLogPiped.addListener.listenerNull=Listener parameter shall not be null +FetchLogPiped.removeListener.listenerNull=Listener parameter shall not be null +FetchLogPiped.stop.interrupted=Reader task was interrupted +FetchLogPiped.stop.exception=Reader task thrown an exception +FetchLogPiped.stop.cancelled=Reader task was canceled + +# ServerTasks class +ServerTasks.startServer.readXMLerror=Unable to read jvm configuration from {0}. +ServerTasks.startServer.noBootstrapJar=Unable to find bootstrap jar. +ServerTasks.startServer.failed=DAS start failed: \ No newline at end of file diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLog.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLog.java new file mode 100644 index 00000000..88646dd9 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLog.java @@ -0,0 +1,140 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server; + +import java.io.IOException; +import java.io.InputStream; +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * Fetch GlassFish log from server. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public abstract class FetchLog { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(FetchLog.class); + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** GlassFish server for fetching server log. */ + PayaraServer server; + + /** Input stream which will provide access to log retrieved from server. */ + final InputStream in; + + /** Request to skip to the end of log. */ + final boolean skip; + + //////////////////////////////////////////////////////////////////////////// + // Abstract methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructor callback which will initialize log InputStream. + *

+ * + * @return InputStream where log lines received from server will be available to read. + */ + abstract InputStream initInputStream(); + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an empty instance of GlassFish server log fetcher using provided input stream. + *

+ * InputStream is set using constructor argument. Child class + * initInputStream method is ignored. + *

+ * + * @param in Input stream used to read server log. + * @param skip Skip to the end of the log file. + */ + FetchLog(InputStream in, boolean skip) { + this.server = null; + this.in = in; + this.skip = skip; + } + + /** + * Constructs an instance of GlassFish server log fetcher. + *

+ * InputStream is set using child initInputStream method. + *

+ * + * @param server GlassFish server for fetching server log. + * @param skip Skip to the end of the log file. + */ + @SuppressWarnings("OverridableMethodCallInConstructor") + FetchLog(PayaraServer server, boolean skip) { + this.server = server; + this.in = initInputStream(); + this.skip = skip; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get input stream for reading lines from server log file. + *

+ * + * @return Input stream for reading lines from server log file. + */ + public InputStream getInputStream() { + return this.in; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Close input stream used to access log lines received from server. + *

+ * This should be overridden in child classes to handle all streams and threads properly. + */ + public void close() { + final String METHOD = "close"; + if (this.in != null) { + try { + this.in.close(); + } catch (IOException ioe) { + LOGGER.log(Level.INFO, METHOD, "cantClose", ioe); + } + } else { + LOGGER.log(Level.INFO, METHOD, "isNull"); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogEvent.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogEvent.java new file mode 100644 index 00000000..7781f228 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogEvent.java @@ -0,0 +1,66 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server; + +import fish.payara.eclipse.tools.server.sdk.TaskState; + +/** + * Events in GlassFish log fetcher. + *

+ * + * @author Tomas Kraus + */ +public class FetchLogEvent { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Current log fetcher task state. */ + private TaskState state; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of event in GlassFish log fetcher. + *

+ * + * @param state Current log fetcher task state. + */ + FetchLogEvent(TaskState state) { + this.state = state; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get current log fetcher task state. + *

+ * + * @return Current log fetcher task state. + */ + public TaskState getState() { + return state; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogEventListener.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogEventListener.java new file mode 100644 index 00000000..01e46566 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogEventListener.java @@ -0,0 +1,37 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server; + +/** + * Listens for events in GlassFish log fetcher. + *

+ * + * @author Tomas Kraus + */ +public interface FetchLogEventListener { + + /** + * Notification method called when log fetcher state was changed. + *

+ * + * @param event GlassFish log fetcher state change event. + */ + public void stateChanged(final FetchLogEvent event); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogException.java new file mode 100644 index 00000000..17e8af5a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogException.java @@ -0,0 +1,76 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server; + +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * GlassFish IDE SDK Exception related to reading logs from server. + *

+ * All exceptions are logging themselves on WARNING level when created. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class FetchLogException extends PayaraIdeException { + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Constructs an instance of FetchLogException without detail message. + */ + public FetchLogException() { + super(); + } + + /** + * Constructs an instance of FetchLogException with the specified detail message. + *

+ * + * @param msg The detail message. + */ + public FetchLogException(String msg) { + super(msg); + } + + /** + * Constructs an instance of FetchLogException with the specified detail message and + * cause. Exception is logged on WARN level. + *

+ * Note that the detail message associated with {@code cause} is not automatically + * incorporated in this runtime exception's detail message. + *

+ * + * @param msg the detail message (which is saved for later retrieval by the {@link #getMessage()} + * method). + * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A + * null value is permitted, and indicates that the cause is nonexistent or unknown.) + */ + public FetchLogException(String msg, Throwable cause) { + super(msg, cause); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogLocal.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogLocal.java new file mode 100644 index 00000000..38ed01d1 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogLocal.java @@ -0,0 +1,216 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InterruptedIOException; +import java.util.concurrent.ExecutorService; +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.TaskState; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.utils.ServerUtils; + +/** + * Fetch GlassFish log from local server. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class FetchLogLocal extends FetchLogPiped { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(FetchLogLocal.class); + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish local server log fetcher. + *

+ * Super class constructor will call initInputStream method which initializes + * InputStream as FileInputStream before this constructor code is being + * executed. + *

+ * + * @param server GlassFish server for fetching local server log. Both getDomainsFolder + * and getDomainName should not return null. + * @param skip Skip to the end of the log file. + */ + FetchLogLocal(final PayaraServer server, final boolean skip) { + super(server, skip); + } + + /** + * Constructs an instance of GlassFish local server log fetcher with external + * {@link ExecutorService}. + *

+ * Super class constructor will call initInputStream method which initializes + * InputStream as FileInputStream before this constructor code is being + * executed. + *

+ * + * @param executor Executor service used to start task. + * @param server GlassFish server for fetching local server log. Both getDomainsFolder + * and getDomainName should not return null. + * @param skip Skip to the end of the log file. + */ + FetchLogLocal(final ExecutorService executor, final PayaraServer server, + final boolean skip) { + super(executor, server, skip); + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Initializes active log file InputStream as FileInputStream sending data + * from local server log file. + *

+ * + * @return FileInputStream where log lines from server active log file will be + * available to read. + */ + private InputStream initInputFile() { + final String METHOD = "initInputFile"; + File logFile = ServerUtils.getServerLogFile(server); + InputStream log; + try { + log = new FileInputStream(logFile); + } catch (FileNotFoundException fnfe) { + LOGGER.log(Level.INFO, METHOD, + "fileNotFound", logFile.getAbsolutePath()); + return null; + } + if (skip) { + int count; + try { + while ((count = log.available()) > 0) { + log.skip(count); + } + } catch (IOException ioe) { + try { + log.close(); + } catch (IOException ioec) { + LOGGER.log(Level.INFO, METHOD, "cantClose", ioec); + } + throw new FetchLogException( + LOGGER.excMsg(METHOD, "cantInit"), ioe); + } + } + return log; + } + + //////////////////////////////////////////////////////////////////////////// + // Runnable call() Method // + //////////////////////////////////////////////////////////////////////////// + + /** + * Remote server log lines reading task. + *

+ * Reads new log lines from server using GlassFish remote administration API and sends them into + * pipe (PipedInputStream). + *

+ * + * @return TaskState.COMPLETED when remote administration API stopped responding or + * TaskState.FAILED when exception was caught. + */ + @SuppressWarnings("SleepWhileInLoop") + @Override + public TaskState call() { + final String METHOD = "call"; + notifyListeners(TaskState.RUNNING); + InputStream fIn = initInputFile(); + byte[] buff = new byte[PIPE_BUFFER_SIZE]; + File logFile = ServerUtils.getServerLogFile(server); + int inCount; + long lastModified; + if (fIn == null) { + return notifyListeners(TaskState.FAILED); + } + while (taksExecute) { + try { + inCount = fIn.available(); + lastModified = logFile.lastModified(); + // Nothing to read. Check log rotation after delay. + if (inCount <= 0) { + Thread.sleep(LOG_REFRESH_DELAY); + inCount = fIn.available(); + if (inCount <= 0 && logFile.lastModified() > lastModified) { + LOGGER.log(Level.FINER, METHOD, "rotation"); + fIn.close(); + out.flush(); + + fIn = initInputFile(); + } + } + if (inCount > 0) { + while (inCount > 0) { + int count = fIn.read(buff); + LOGGER.log(Level.FINEST, METHOD, "read", + new Object[] { new Integer(count) }); + if (count > 0) { + out.write(buff, 0, count); + inCount -= count; + } else { + // Return -1: If log file is rotated, the original file handle is no longer valid + break; + } + if (inCount <= 0) { + inCount = fIn.available(); + } + } + out.flush(); + } + } catch (InterruptedException ie) { + LOGGER.log(Level.INFO, METHOD, "interrupted", ie.getMessage()); + Thread.currentThread().interrupt(); + return notifyListeners(TaskState.COMPLETED); + } catch (InterruptedIOException ie) { + LOGGER.log(Level.INFO, METHOD, + "interruptedIO", ie.getMessage()); + Thread.currentThread().interrupt(); + return notifyListeners(TaskState.COMPLETED); + } catch (IOException ioe) { + if (taksExecute) { + LOGGER.log(Level.INFO, METHOD, "ioException", ioe); + return notifyListeners(TaskState.FAILED); + } else { + LOGGER.log(Level.INFO, METHOD, + "ioExceptionMsg", ioe.getMessage()); + return notifyListeners(TaskState.COMPLETED); + } + } + + } + return notifyListeners(TaskState.COMPLETED); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogPiped.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogPiped.java new file mode 100644 index 00000000..7610b62b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogPiped.java @@ -0,0 +1,411 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server; + +import java.io.IOException; +import java.io.InputStream; +import java.io.PipedInputStream; +import java.io.PipedOutputStream; +import java.util.concurrent.Callable; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.TaskState; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.utils.LinkedList; +import fish.payara.eclipse.tools.server.sdk.utils.NetUtils; + +/** + * Fetch GlassFish log from local or remote server. + *

+ * Data are fetched in service thread and passed into PipedOutputStream. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public abstract class FetchLogPiped + extends FetchLog implements Callable { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(FetchLogPiped.class); + + /** Size of internal buffer in pipe input stream. */ + static final int PIPE_BUFFER_SIZE = 8192; + + /** Log refresh delay in miliseconds. */ + static final int LOG_REFRESH_DELAY = 1000; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server log fetcher depending on server being remote or local. + *

+ * Decision if server is local or remote depends on domains folder and domain name attributes stored + * in PayaraServer object. + *

+ * + * @param server GlassFish server for fetching server log. + * @param skip Skip to the end of the log file. + * @return Newly created FetchLog instance. + */ + public static FetchLogPiped create(final PayaraServer server, + final boolean skip) { + boolean isLocal = NetUtils.isLocahost(server.getHost()); + FetchLogPiped fetchLog = isLocal + ? new FetchLogLocal(server, skip) + : new FetchLogRemote(server, skip); + fetchLog.start(); + return fetchLog; + } + + /** + * Constructs an instance of GlassFish server log fetcher depending on server being remote or local. + *

+ * Decision if server is local or remote depends on domains folder and domain name attributes stored + * in PayaraServer object. Log file is passed whole as is without skipping to the + * end. + *

+ * + * @param server GlassFish server for fetching server log. + * @return Newly created FetchLog instance. + */ + public static FetchLogPiped create(final PayaraServer server) { + return create(server, false); + } + + /** + * Constructs an instance of GlassFish server log fetcher depending on server being remote or local + * with external {@link ExecutorService}. + *

+ * Decision if server is local or remote depends on domains folder and domain name attributes stored + * in PayaraServer object. + *

+ * + * @param executor Executor service used to start task. + * @param server GlassFish server for fetching server log. + * @param skip Skip to the end of the log file. + * @return Newly created FetchLog instance. + */ + public static FetchLogPiped create(final ExecutorService executor, + final PayaraServer server, final boolean skip) { + boolean isLocal = NetUtils.isLocahost(server.getHost()); + FetchLogPiped fetchLog = isLocal + ? new FetchLogLocal(executor, server, skip) + : new FetchLogRemote(executor, server, skip); + fetchLog.start(); + return fetchLog; + } + + /** + * Constructs an instance of GlassFish server log fetcher depending on server being remote or local + * with external {@link ExecutorService}. + *

+ * Decision if server is local or remote depends on domains folder and domain name attributes stored + * in PayaraServer object. Log file is passed whole as is without skipping to the + * end. + *

+ * + * @param executor Executor service used to start task. + * @param server GlassFish server for fetching server log. + * @return Newly created FetchLog instance. + */ + public static FetchLogPiped create(final ExecutorService executor, + final PayaraServer server) { + return create(executor, server, false); + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Output stream where to write retrieved remote server log. */ + final PipedOutputStream out; + + /** Running task that reads log lines from remote server. */ + Future task; + + /** ExecutorService used to run read remote server log tasks. */ + private ExecutorService executor; + + /** Internal ExecutorService was used. */ + private final boolean internalExecutor; + + /** Indicate whether log lines reading task should continue or exit. */ + volatile boolean taksExecute; + + /** Listeners for state change events in GlassFish log fetcher. */ + private final LinkedList eventListeners; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish remote server log fetcher. + *

+ * Super class constructor will call initInputStream method which initializes + * InputStream as PipedInputStream before this constructor code is being + * executed. Here we can simply connect already initialized PipedInputStream with newly + * created PipedInputStream. + *

+ * + * @param server GlassFish server for fetching server log. + * @param skip Skip to the end of the log file. + */ + FetchLogPiped(final PayaraServer server, boolean skip) { + super(server, skip); + final String METHOD = "init"; + this.eventListeners = new LinkedList(); + try { + out = new PipedOutputStream((PipedInputStream) this.in); + } catch (IOException ioe) { + super.close(); + throw new FetchLogException(LOGGER.excMsg(METHOD, "cantInit"), ioe); + } + taksExecute = true; + // Create internal executor to run log reader task. + executor = new ThreadPoolExecutor(0, 1, 0L, TimeUnit.MILLISECONDS, + new LinkedBlockingQueue(), (ThreadFactory) r -> { + Thread t = new Thread(r, FetchLogPiped.class.getName() + + server.getUrl() != null ? " (Localhost)" : server.getUrl()); + t.setDaemon(true); + return t; + }); + internalExecutor = true; + } + + /** + * Constructs an instance of GlassFish remote server log fetcher with external + * {@link ExecutorService}. + *

+ * Super class constructor will call initInputStream method which initializes + * InputStream as PipedInputStream before this constructor code is being + * executed. Here we can simply connect already initialized PipedInputStream with newly + * created PipedInputStream. + *

+ * + * @param executor Executor service used to start task. + * @param server GlassFish server for fetching server log. + * @param skip Skip to the end of the log file. + */ + @SuppressWarnings("LeakingThisInConstructor") + FetchLogPiped(final ExecutorService executor, final PayaraServer server, + boolean skip) { + super(server, skip); + final String METHOD = "init"; + this.eventListeners = new LinkedList(); + try { + out = new PipedOutputStream((PipedInputStream) this.in); + } catch (IOException ioe) { + super.close(); + throw new FetchLogException(LOGGER.excMsg(METHOD, "cantInit"), ioe); + } + taksExecute = true; + // Use external executor to run log reader task. + this.executor = executor; + internalExecutor = false; + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructor callback which initializes log InputStream as + * PipedInputStream sending data from remote server log reader. + *

+ * This initialization is called form FetchLog super class constructor. It already + * exists when FetchLogRemote constructor is running so it may be used as argument for + * local PipedOutputStream initialization. + *

+ * + * @return PipedInputStream where log lines received from server will be available to + * read. + */ + @Override + InputStream initInputStream() { + return new PipedInputStream(PIPE_BUFFER_SIZE); + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Add GlassFish log fetcher state change listener at the end of listeners list. + *

+ * + * @param listener Listener for state change events in GlassFish log fetcher to be added. Value + * shall not be null. + * @throws FetchLogException When listener parameter is null. + */ + public final void addListener(final FetchLogEventListener listener) + throws FetchLogException { + final String METHOD = "addListener"; + if (listener == null) { + throw new FetchLogException(LOGGER.excMsg(METHOD, "listenerNull")); + } + synchronized (eventListeners) { + eventListeners.addLast(listener); + } + } + + /** + * Remove all occurrences of log fetcher state change listener from listeners list. + *

+ * + * @param listener Listener for state change events in GlassFish log fetcher to be removed. Value + * shall not be null. + * @return Value of true when at least one listener was removed or false + * otherwise. + * @throws FetchLogException When listener parameter is null. + */ + public final boolean removeListener(final FetchLogEventListener listener) + throws FetchLogException { + final String METHOD = "removeListener"; + if (listener == null) { + throw new FetchLogException(LOGGER.excMsg(METHOD, "listenerNull")); + } + boolean removed = false; + synchronized (eventListeners) { + boolean isElement = !eventListeners.isEmpty(); + eventListeners.first(); + while (isElement) { + if (listener.equals(eventListeners.getCurrent())) { + isElement = eventListeners.isNext(); + eventListeners.removeAndNextOrPrevious(); + removed = true; + } else { + isElement = eventListeners.next(); + } + } + } + return removed; + } + + /** + * Notify all GlassFish log fetcher state change listeners about state change event. + *

+ * + * @param state Current GlassFish log fetcher state. + * @return Current GlassFish log fetcher state. + */ + final TaskState notifyListeners(final TaskState state) { + if (!eventListeners.isEmpty()) { + synchronized (eventListeners) { + boolean isElement = !eventListeners.isEmpty(); + if (isElement) { + FetchLogEvent event = new FetchLogEvent(state); + eventListeners.first(); + while (isElement) { + eventListeners.getCurrent().stateChanged(event); + isElement = eventListeners.next(); + } + } + } + } + return state; + } + + /** + * Start task. + */ + private void start() { + task = executor.submit(this); + notifyListeners(TaskState.READY); + } + + /** + * Stop running task if it's still running. + *

+ * + * @return Task execution result. + */ + private TaskState stop() { + final String METHOD = "stop"; + taksExecute = false; + if (this.out != null) { + try { + this.out.close(); + } catch (IOException ioe) { + LOGGER.log(Level.INFO, METHOD, "cantClose", ioe); + } + } else { + LOGGER.log(Level.INFO, METHOD, "isNull"); + } + TaskState result; + try { + result = task.get(); + } catch (InterruptedException ie) { + throw new FetchLogException( + LOGGER.excMsg(METHOD, "interrupted"), ie); + } catch (ExecutionException ee) { + throw new FetchLogException( + LOGGER.excMsg(METHOD, "exception"), ee); + } catch (CancellationException ce) { + throw new FetchLogException( + LOGGER.excMsg(METHOD, "cancelled"), ce); + } + return result; + } + + /** + * Stop log lines reading task and close input and output streams used to access log lines received + * from server. + */ + @Override + public void close() { + final String METHOD = "close"; + TaskState result = stop(); + super.close(); + // Clean up internal executor. + if (internalExecutor) { + executor.shutdownNow(); + } + // We may possibly change this to throw an exception when needed. + // But streams must be cleaned up first. + if (result != TaskState.COMPLETED) { + LOGGER.log(Level.INFO, METHOD, "failed"); + } + } + + /** + * Check if log lines reading task is running. + *

+ * + * @return Returns true when task is still running or false> otherwise. + */ + public boolean isRunning() { + return !task.isDone(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogRemote.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogRemote.java new file mode 100644 index 00000000..6e5829a3 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogRemote.java @@ -0,0 +1,166 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server; + +import java.io.IOException; +import java.io.InterruptedIOException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.TaskState; +import fish.payara.eclipse.tools.server.sdk.admin.CommandFetchLogData; +import fish.payara.eclipse.tools.server.sdk.admin.ResultLog; +import fish.payara.eclipse.tools.server.sdk.admin.ServerAdmin; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.utils.OsUtils; + +/** + * Fetch GlassFish log from remote server. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class FetchLogRemote extends FetchLogPiped { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(FetchLogPiped.class); + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish remote server log fetcher. + *

+ * Super class constructor will call initInputStream method which initializes + * InputStream as PipedInputStream before this constructor code is being + * executed. Here we can simply connect already initialized PipedInputStream with newly + * created PipedInputStream. + *

+ * + * @param server GlassFish server for fetching server log. + * @param skip Skip to the end of the log file. + */ + FetchLogRemote(final PayaraServer server, final boolean skip) { + super(server, skip); + } + + /** + * Constructs an instance of GlassFish remote server log fetcher with external + * {@link ExecutorService}. + *

+ * Super class constructor will call initInputStream method which initializes + * InputStream as PipedInputStream before this constructor code is being + * executed. Here we can simply connect already initialized PipedInputStream with newly + * created PipedInputStream. + *

+ * + * @param executor Executor service used to start task. + * @param server GlassFish server for fetching server log. + * @param skip Skip to the end of the log file. + */ + FetchLogRemote(final ExecutorService executor, final PayaraServer server, + final boolean skip) { + super(executor, server, skip); + } + + //////////////////////////////////////////////////////////////////////////// + // Runnable call() Method // + //////////////////////////////////////////////////////////////////////////// + + /** + * Remote server log lines reading task. + *

+ * Reads new log lines from server using GlassFish remote administration API and sends them into + * pipe (PipedInputStream). + *

+ * + * @return TaskState.COMPLETED when remote administration API stopped responding or + * TaskState.FAILED when exception was caught. + */ + @SuppressWarnings("SleepWhileInLoop") + @Override + public TaskState call() { + final String METHOD = "call"; + notifyListeners(TaskState.RUNNING); + String paramsAppendNext = null; + Future future = ServerAdmin.exec(server, + new CommandFetchLogData()); + try { + ResultLog result = future.get(); + if (!skip && result.getState() == TaskState.COMPLETED) { + paramsAppendNext = result.getValue().getParamsAppendNext(); + for (String line : result.getValue().getLines()) { + out.write(line.getBytes()); + out.write(OsUtils.LINES_SEPARATOR.getBytes()); + } + out.flush(); + } + byte[] lineSeparatorOut = OsUtils.LINES_SEPARATOR.getBytes(); + while (taksExecute && result.getState() == TaskState.COMPLETED) { + future = ServerAdmin.exec(server, + new CommandFetchLogData( + paramsAppendNext)); + result = future.get(); + if (result.getState() == TaskState.COMPLETED) { + paramsAppendNext = result.getValue().getParamsAppendNext(); + for (String line : result.getValue().getLines()) { + byte[] lineOut = line.getBytes(); + LOGGER.log(Level.FINEST, METHOD, "read", new Object[] { + new Integer(lineOut.length + + lineSeparatorOut.length) }); + out.write(lineOut); + out.write(lineSeparatorOut); + } + out.flush(); + } + Thread.sleep(LOG_REFRESH_DELAY); + } + } catch (InterruptedException ie) { + LOGGER.log(Level.INFO, METHOD, "interrupted", ie.getMessage()); + Thread.currentThread().interrupt(); + return notifyListeners(TaskState.COMPLETED); + } catch (ExecutionException ee) { + LOGGER.log(Level.INFO, METHOD, "exception", ee); + return notifyListeners(TaskState.FAILED); + } catch (InterruptedIOException ie) { + LOGGER.log(Level.INFO, METHOD, "interruptedIO", ie.getMessage()); + Thread.currentThread().interrupt(); + return notifyListeners(TaskState.COMPLETED); + } catch (IOException ioe) { + if (taksExecute) { + LOGGER.log(Level.INFO, METHOD, "ioException", ioe); + return notifyListeners(TaskState.FAILED); + } else { + LOGGER.log(Level.INFO, METHOD, + "ioExceptionMsg", ioe.getMessage()); + return notifyListeners(TaskState.COMPLETED); + } + } + return notifyListeners(TaskState.COMPLETED); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogSimple.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogSimple.java new file mode 100644 index 00000000..e0fa28fb --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogSimple.java @@ -0,0 +1,68 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server; + +import java.io.InputStream; + +/** + * Fetch GlassFish log from provided stream. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class FetchLogSimple extends FetchLog { + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of Payara server log fetcher using provided stream. + *

+ * Super class constructor will not call initInputStream method so this method should + * be ignored. Old log lines are never skipped so whole log is always available in + * InputStream + *

+ * + * @param in Input stream to access server log. + */ + public FetchLogSimple(InputStream in) { + super(in, false); + } + + //////////////////////////////////////////////////////////////////////////// + // Implemented Abstract Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructor callback makes no sense in this child class. + *

+ * This method throws an exception when called. + *

+ * + * @return FileInputStream where log lines received from server will be available to + * read. + */ + @Override + InputStream initInputStream() { + throw new UnsupportedOperationException( + "Method initInputStream should not be called in " + + "FetchLogSimple class!"); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/JDK.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/JDK.java new file mode 100644 index 00000000..ee02d9e6 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/JDK.java @@ -0,0 +1,366 @@ +/****************************************************************************** + * Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server; + +import java.util.Optional; + +/** + * A simple class that fills a hole in the JDK. It parses out the version + * numbers of the JDK we are running. + * + *

+ * Example:
+ * + * 1.6.0_u14 == major = 1 minor = 6, subminor = 0, update = 14 + * + * @author bnevins + */ +public final class JDK { + + /** + * See if the current JDK is legal for running Payara + * + * @return true if the JDK is >= 1.6.0 + */ + public static boolean ok() { + return major == 1 && minor >= 6; + } + + public static int getMajor() { + return major; + } + + public static int getMinor() { + return minor; + } + + public static int getSubMinor() { + return subminor; + } + + public static int getUpdate() { + return update; + } + + public static String getVendor() { + return vendor; + } + + public static class Version { + + private final int major; + private final Optional minor; + private final Optional subminor; + private final Optional update; + private final Optional vendor; + + private Version(String version, String vendor) { + int[] versions = parseVersions(version); + this.major = versions[MAJOR_INDEX]; + this.minor = Optional.ofNullable(versions[MINOR_INDEX]); + this.subminor = Optional.ofNullable(versions[SUBMINOR_INDEX]); + this.update = Optional.ofNullable(versions[UPDATE_INDEX]); + this.vendor = Optional.ofNullable(vendor); + } + + Version(int major, int minor, int subminor, int update, String vendor) { + this.major = major; + this.minor = Optional.ofNullable(minor); + this.subminor = Optional.ofNullable(subminor); + this.update = Optional.ofNullable(update); + this.vendor = Optional.ofNullable(vendor); + } + + public boolean newerThan(Version version) { + if (major > version.major) { + return true; + } + + if (major == version.major) { + if (greaterThan(minor, version.minor)) { + return true; + } + + if (equals(minor, version.minor)) { + if (greaterThan(subminor, version.subminor)) { + return true; + } + + if (equals(subminor, version.subminor)) { + if (greaterThan(update, version.update)) { + return true; + } + } + } + } + + return false; + } + + public boolean olderThan(Version version) { + if (major < version.major) { + return true; + } else if (major == version.major) { + if (lessThan(minor, version.minor)) { + return true; + } else if (equals(minor, version.minor)) { + if (lessThan(subminor, version.subminor)) { + return true; + } else if (equals(subminor, version.subminor)) { + if (lessThan(update, version.update)) { + return true; + } + } + } + } + + return false; + } + + private static boolean greaterThan(Optional leftHandSide, Optional rightHandSide) { + return leftHandSide.orElse(0) > rightHandSide.orElse(0); + } + + private static boolean lessThan(Optional leftHandSide, Optional rightHandSide) { + return leftHandSide.orElse(0) < rightHandSide.orElse(0); + } + + /** + * if either left-hand-side or right-hand-side is empty, it is equals + * + * @param leftHandSide + * @param rightHandSide + * @return true if equals, otherwise false + */ + private static boolean equals(Optional leftHandSide, Optional rightHandSide) { + if (!leftHandSide.isPresent() || !rightHandSide.isPresent()) { + return true; + } + return leftHandSide.orElse(0).equals(rightHandSide.orElse(0)); + } + + @Override + public int hashCode() { + int hash = 3; + hash = 61 * hash + this.major; + hash = 61 * hash + this.minor.orElse(0); + hash = 61 * hash + this.subminor.orElse(0); + hash = 61 * hash + this.update.orElse(0); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if ((obj == null) || (getClass() != obj.getClass())) { + return false; + } + final Version other = (Version) obj; + if (this.major != other.major) { + return false; + } + if (!equals(this.minor, other.minor)) { + return false; + } + if (!equals(this.subminor, other.subminor)) { + return false; + } + if (!equals(this.update, other.update)) { + return false; + } + return true; + } + + public boolean newerOrEquals(Version version) { + return newerThan(version) || equals(version); + } + + public boolean olderOrEquals(Version version) { + return olderThan(version) || equals(version); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(10); + sb.append(major); + if (minor.isPresent()) { + sb.append('.').append(minor.get()); + } + if (subminor.isPresent()) { + sb.append('.').append(subminor.get()); + } + if (update.isPresent()) { + sb.append('.').append(update.get()); + } + return sb.toString(); + } + } + + public static Version getVersion(String string) { + return getVersion(string, null); + } + + public static Version getVersion(String version, String vendor) { + if (version != null && version.matches(VERSION_MATCHER)) { + // Make sure the string is a valid JDK version, i.e. + // 1.8.0_162 or something that is returned by "java -version" + return new Version(version, vendor); + } + + return null; + } + + public static Version getVersion() { + return new Version(major, minor, subminor, update, vendor); + } + + public static boolean isCorrectJDK(Optional minVersion, Optional maxVersion) { + return isCorrectJDK(JDK_VERSION, Optional.empty(), minVersion, maxVersion); + } + + public static boolean isCorrectJDK(Version version, Optional vendor, Optional minVersion, Optional maxVersion) { + boolean correctJDK = true; + + if (vendor.isPresent()) { + if (version.vendor.isPresent()) { + correctJDK = version.vendor.get().contains(vendor.get()); + } else { + correctJDK = false; + } + } + if (correctJDK && minVersion.isPresent()) { + correctJDK = version.newerOrEquals(minVersion.get()); + } + if (correctJDK && maxVersion.isPresent()) { + correctJDK = version.olderOrEquals(maxVersion.get()); + } + + return correctJDK; + } + + /** + * No instances are allowed so it is pointless to override toString + * + * @return Parsed version numbers + */ + public static String toStringStatic() { + return "major: " + JDK.getMajor() + + "\nminor: " + JDK.getMinor() + + "\nsubminor: " + JDK.getSubMinor() + + "\nupdate: " + JDK.getUpdate() + + "\nOK ==>" + JDK.ok(); + } + + static { + initialize(); + } + + // DO NOT initialize these variables. You'll be sorry if you do! + private static int major; + private static int minor; + private static int subminor; + private static int update; + private static String vendor; + + // DO initialize these variables. You'll be sorry if you don't! + private final static int MAJOR_INDEX = 0; + private final static int MINOR_INDEX = 1; + private final static int SUBMINOR_INDEX = 2; + private final static int UPDATE_INDEX = 3; + + // DO NOT initialize this variable. You'll again be sorry if you do! + public static Version JDK_VERSION; + + private static final String VERSION_MATCHER = "(\\d+(\\.\\d+)*)([_u\\-]+[\\S]+)*"; + + private static void initialize() { + + // Silently fall back to ridiculous defaults if something is crazily wrong... + major = 1; + minor = subminor = update = 0; + + String javaVersion = System.getProperty("java.version"); + vendor = System.getProperty("java.vendor"); + /*In JEP 223 java.specification.version will be a single number versioning , not a dotted versioning . So if we get a single + integer as versioning we know that the JDK is post JEP 223 + For JDK 8: + java.specification.version 1.8 + java.version 1.8.0_122 + For JDK 9: + java.specification.version 9 + java.version 9.1.2 + */ + int[] versions = parseVersions(javaVersion); + + major = versions[MAJOR_INDEX]; + minor = versions[MINOR_INDEX]; + subminor = versions[SUBMINOR_INDEX]; + update = versions[UPDATE_INDEX]; + + JDK_VERSION = new Version( + major, + minor, + subminor, + update, + vendor + ); + } + + /** + * + * @param javaVersion the Java Version e.g 1.8.0u222, + * 1.8.0_232-ea-8u232-b09-0ubuntu1-b09, 11.0.5 + * @return + */ + static int[] parseVersions(String javaVersion) { + + int[] versions = {1, 0, 0, 0}; + if (javaVersion == null || javaVersion.length() <= 0) { + return versions; // not likely!! + } + String[] javaVersionSplit = javaVersion.split("-"); + String[] split = javaVersionSplit[0].split("\\."); + + if (split.length > 0) { + if (split.length > 0) { + versions[MAJOR_INDEX] = Short.parseShort(split[0]); + } + if (split.length > 1) { + versions[MINOR_INDEX] = Short.parseShort(split[1]); + } + if (split.length > 2) { + split = split[2].split("[_u]"); + versions[SUBMINOR_INDEX] = Short.parseShort(split[0]); + if (split.length > 1) { + versions[UPDATE_INDEX] = Short.parseShort(split[1]); + } + } + } + return versions; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/JpaSupport.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/JpaSupport.java new file mode 100644 index 00000000..ee7bfabe --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/JpaSupport.java @@ -0,0 +1,144 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server; + +import fish.payara.eclipse.tools.server.utils.Version; + +/** + * GlassFish server JPA support matrix. + *

+ * + * @author Tomas Kraus + */ +public class JpaSupport { + + //////////////////////////////////////////////////////////////////////////// + // Inner classes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Individual JPA specifications support. + */ + public static class ApiVersion { + + //////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////// + + /** JPA 1.0 supported. */ + final boolean _1_0; + + /** JPA 1.0 supported. */ + final boolean _2_0; + + /** JPA 2.1 supported. */ + final boolean _2_1; + + /** JPA provider class. */ + final String provider; + + //////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of individual JPA specifications support class. + *

+ * + * @param jpa_1_0 JPA 1.0 supported. + * @param jpa_2_0 JPA 1.0 supported. + * @param jpa_2_1 JPA 2.1 supported. + * @param provider JPA provider class. + */ + ApiVersion(boolean jpa_1_0, boolean jpa_2_0, boolean jpa_2_1, String provider) { + this._1_0 = jpa_1_0; + this._2_0 = jpa_2_0; + this._2_1 = jpa_2_1; + this.provider = provider; + } + + //////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////// + + /** + * Is JPA 1.0 supported. + *

+ * + * @return Value of true when JPA 1.0 supported or false otherwise. + */ + public boolean is10() { + return _1_0; + } + + /** + * Is JPA 2.0 supported. + *

+ * + * @return Value of true when JPA 2.0 supported or false otherwise. + */ + public boolean is20() { + return _2_0; + } + + /** + * Is JPA 2.1 supported. + *

+ * + * @return Value of true when JPA 2.1 supported or false otherwise. + */ + public boolean is21() { + return _2_1; + } + + /** + * Get JPA provider class. + *

+ * + * @return JPA provider class name. + */ + public String getProvider() { + return provider; + } + + } + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** GlassFish server JPA provider class since V3. */ + private static final String JPA_PROVIDER_SINCE_V3 = "org.eclipse.persistence.jpa.PersistenceProvider"; + + /** + * Get GlassFish JPA support information for given GlassFish version. + *

+ * + * @param version GlassFish version to get JPA support information for. + * @return GlassFish JPA support information for given GlassFish version. + */ + public static ApiVersion getApiVersion(Version version) { + if (version.matches("[4")) { + return new ApiVersion(true, true, true, JPA_PROVIDER_SINCE_V3); + } + + return new ApiVersion(true, true, false, JPA_PROVIDER_SINCE_V3); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/LogMessages.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/LogMessages.properties new file mode 100644 index 00000000..ced70e17 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/LogMessages.properties @@ -0,0 +1,48 @@ +################################################################################ +# Log messages # +# Use .. notation for keys. # +################################################################################ + +# FetchLog class +FetchLog.close.cantClose=Cannot close input stream: +FetchLog.close.isNull=Input stream is null. + +# FetchLogLocal class +FetchLogLocal.initInputFile.fileNotFound=Server log file {0} was not found. +FetchLogLocal.initInputFile.cantClose=Cannot close input stream: +FetchLogLocal.call.rotation=Log rotation dedected, switching stream. +FetchLogLocal.call.read=Read {0} bytes from local log file. +FetchLogLocal.call.interrupted=Caught InterruptedException: {0} +FetchLogLocal.call.interruptedIO=Caught InterruptedIOException: {0} +FetchLogLocal.call.ioException=Caught IOException: +FetchLogLocal.call.ioExceptionMsg=Caught IOException: {0} + +# FetchLogPiped class +FetchLogPiped.stop.cantClose=Cannot close output stream: +FetchLogPiped.stop.isNull=Output stream is null. +FetchLogPiped.close.failed=Log lines reading task execution failed. + +# FetchLogRemote class +FetchLogRemote.call.read=Read {0} bytes from remote log file. +FetchLogRemote.call.interrupted=Caught InterruptedException: {0} +FetchLogRemote.call.interruptedIO=Caught InterruptedIOException: {0} +FetchLogRemote.call.exception=Caught ExecutionException: +FetchLogRemote.call.ioException=Caught IOException: +FetchLogRemote.call.ioExceptionMsg=Caught IOException: {0} + +# ServerStatus class +AdminPortTask.handleIOException.messageTm=[{0}] {1} +AdminPortTask.handleIOException.message={0} +AdminPortTask.check.success=[{0} {1}] Port status check succeeded. +LocationsTask.start.started=[{0}] Locations task started. +LocationsTask.logExceptionOnJoin.failed=[{0}] Locations task failed: {1} {2} +LocationsTask.join.completed=[{0}] Locations task completed. +VersionTask.start.started=[{0}] Version task started. +VersionTask.logExceptionOnJoin..failed=[{0}] Version task failed: {1} {2} +VersionTask.join.completed=[{0}] Version task completed. + +# ServerTasks class +ServerTasks.computeClassPath.cpError=Unable to read main class path \ +from glassfish main jar when building launch classpath. +ServerTasks.appendOptions.jvmOptVal=DOMAIN.XML: jvm opt: {0} = {1} +ServerTasks.appendOptions.jvmOpt=DOMAIN.XML: jvm opt: {0} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ServerStatus.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ServerStatus.java new file mode 100644 index 00000000..611a827f --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ServerStatus.java @@ -0,0 +1,1199 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server; + +import java.io.Closeable; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.text.MessageFormat; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.logging.Level; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.TaskEvent; +import fish.payara.eclipse.tools.server.sdk.TaskState; +import fish.payara.eclipse.tools.server.sdk.TaskStateListener; +import fish.payara.eclipse.tools.server.sdk.admin.CommandLocation; +import fish.payara.eclipse.tools.server.sdk.admin.CommandVersion; +import fish.payara.eclipse.tools.server.sdk.admin.ResultMap; +import fish.payara.eclipse.tools.server.sdk.admin.ResultString; +import fish.payara.eclipse.tools.server.sdk.admin.ServerAdmin; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.utils.Version; + +/** + * Check server status using administration commands __locations and + * version and also verify if server is at least listening on its administration port. + *

+ * Administration commands and port check are run in parallel to reduce delay. + *

+ * + * @author Tomas Kraus + */ +public class ServerStatus implements Closeable { + + //////////////////////////////////////////////////////////////////////////// + // Inner classes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Individual server check status returned. + */ + public static enum Status { + /** Server status check passed. */ + SUCCESS, + + /** Server status check failed with FAILED result. */ + FAILED, + + /** Server status check failed on timeout. */ + TIMEOUT, + + /** Server status check failed on IO Exception. */ + EXCEPTION, + + /** Server status check failed because of invalid arguments. */ + INVALID, + + /** Server status check failed because of unexpected fatal issue. */ + FATAL; + + //////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////// + + /** + * Convert Status value to String. + *

+ * + * @return A String representation of the value of this object. + */ + @Override + public String toString() { + switch (this) { + case SUCCESS: + return "SUCCESS"; + case FAILED: + return "FAILED"; + case TIMEOUT: + return "TIMEOUT"; + case EXCEPTION: + return "EXCEPTION"; + case INVALID: + return "INVALID"; + case FATAL: + return "FATAL"; + default: + throw new IllegalStateException("Unknown Status value"); + } + } + + } + + /** + * Individual server status result including additional information. + */ + public static class Result { + + //////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////// + + /** Individual server status returned. */ + final Status status; + + /** IO Exception caught. */ + private final IOException ioe; + + /** Fatal issue Exception caught. */ + private final Exception ex; + + /** Task failure event. */ + private final TaskEvent failureEvent; + + /** Server name. */ + private final String serverName; + + /** Exception message. */ + private final String exceptionMeasage; + + //////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of individual server status result. + *

+ * IO Exception caught in asynchronous task is stored. + *

+ * + * @param status Individual server status returned. + * @param ioe IO Exception caught in asynchronous task. + * @param failureEvent Failure cause. + * @param serverName Target GlassFish server name. + * @param exceptionMeasage Exception message from command task. + */ + Result(final Status status, final IOException ioe, + final TaskEvent failureEvent, final String serverName, + final String exceptionMeasage) { + this.status = status; + this.ioe = ioe; + this.ex = null; + this.failureEvent = failureEvent; + this.serverName = serverName; + this.exceptionMeasage = exceptionMeasage; + } + + /** + * Creates an instance of individual server status result. + *

+ * Common Exception caught is stored. + *

+ * + * @param status Individual server status returned. + * @param ex Common Exception caught. + * @param failureEvent Failure cause. + * @param serverName Target GlassFish server name. + * @param exceptionMeasage Exception message from command task. + */ + Result(final Status status, final Exception ex, + final TaskEvent failureEvent, final String serverName, + final String exceptionMeasage) { + this.status = status; + this.ioe = null; + this.ex = ex; + this.failureEvent = failureEvent; + this.serverName = serverName; + this.exceptionMeasage = exceptionMeasage; + } + + /** + * Creates an instance of individual server status result. + *

+ * No additional value except result is stored. + *

+ * + * @param status Individual server status returned. + * @param failureEvent Failure cause. + * @param serverName Target GlassFish server name. + * @param exceptionMeasage Exception message from command task. + */ + Result(final Status status, final TaskEvent failureEvent, + final String serverName, final String exceptionMeasage) { + this.status = status; + this.ioe = null; + this.ex = null; + this.failureEvent = failureEvent; + this.serverName = serverName; + this.exceptionMeasage = exceptionMeasage; + } + + /** + * Creates an instance of individual server status result. + *

+ * IO Exception caught in asynchronous task is stored. + *

+ * + * @param status Individual server status returned. + * @param ioe IO Exception caught in asynchronous task. + */ + Result(final Status status, final IOException ioe) { + this(status, ioe, null, null, null); + } + + /** + * Creates an instance of individual server status result. + *

+ * Common Exception caught is stored. + *

+ * + * @param status Individual server status returned. + * @param ex Common Exception caught. + */ + Result(final Status status, final Exception ex) { + this(status, ex, null, null, null); + } + + /** + * Creates an instance of individual server status result. + *

+ * No additional value except result is stored. + *

+ * + * @param status Individual server status returned. + */ + Result(final Status status) { + this(status, null, null, null); + } + + //////////////////////////////////////////////////////////////////////// + // Getters // + //////////////////////////////////////////////////////////////////////// + + /** + * Get individual check task status. + *

+ * + * @return Individual check task status. + */ + public Status getStatus() { + return status; + } + + /** + * Get task failure event. + *

+ * + * @return Task failure event. + */ + public TaskEvent getFailureEvent() { + return failureEvent; + } + + /** + * Get server name. + *

+ * + * @return Server name. + */ + public String getServerName() { + return serverName; + } + + /** + * Get exception message. + *

+ * + * @return Exception message. + */ + public String getExceptionMeasage() { + return exceptionMeasage; + } + } + + /** + * Server status task execution result for __locations command including additional + * information. + *

+ * This class stores task execution result only. Value SUCCESS means that Locations + * command task execution finished successfully but it does not mean that administration command + * itself returned with COMPLETED status. When SUCCESS status is set, + * stored result value shall be examined too to see real administration command + * execution result. + */ + public static class ResultLocations extends Result { + + //////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////// + + /** Command __locations execution result. */ + final ResultMap result; + + //////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of individual server status result for __locations command. + *

+ * Command __locations result is stored. + *

+ * + * @param status Individual server status returned. + * @param failureEvent Failure cause. + * @param serverName Target GlassFish server name. + * @param exceptionMeasage Exception message from command task. + */ + ResultLocations(final ResultMap result, + final Status status, final TaskEvent failureEvent, + final String serverName, final String exceptionMeasage) { + super(status, failureEvent, serverName, exceptionMeasage); + this.result = result; + } + + /** + * Creates an instance of individual server status result for __locations command. + *

+ * Common Exception caught is stored. + *

+ * + * @param status Individual server status returned. + * @param ex Common Exception caught. + * @param failureEvent Failure cause. + * @param serverName Target GlassFish server name. + * @param exceptionMeasage Exception message from command task. + */ + ResultLocations(final Status status, final Exception ex, + final TaskEvent failureEvent, final String serverName, + final String exceptionMeasage) { + super(status, ex, failureEvent, serverName, exceptionMeasage); + this.result = null; + } + + /** + * Creates an instance of individual server status result for __locations command. + *

+ * No additional value except result is stored. + *

+ * + * @param status Individual server status returned. + * @param failureEvent Failure cause. + * @param serverName Target GlassFish server name. + * @param exceptionMeasage Exception message from command task. + */ + ResultLocations(final Status status, final TaskEvent failureEvent, + final String serverName, final String exceptionMeasage) { + super(status, failureEvent, serverName, exceptionMeasage); + this.result = null; + } + + //////////////////////////////////////////////////////////////////////// + // Getters // + //////////////////////////////////////////////////////////////////////// + + /** + * Get __locations command execution result. + *

+ * + * @return __locations command execution result. + */ + public ResultMap getResult() { + return result; + } + + } + + /** + * Individual server status result for version command including additional + * information. + *

+ * This class stores task execution result only. Value SUCCESS means that Locations + * command task execution finished successfully but it does not mean that administration command + * itself returned with COMPLETED status. When SUCCESS status is set, + * stored result value shall be examined too to see real administration command + * execution result. + */ + public static class ResultVersion extends Result { + + //////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////// + + /** Command version execution result. */ + final ResultString result; + + //////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of individual server status result for version command. + *

+ * Command version result is stored. + *

+ * + * @param status Individual server status returned. + * @param failureEvent Failure cause. + * @param serverName Target GlassFish server name. + * @param exceptionMeasage Exception message from command task. + */ + ResultVersion(final ResultString result, final Status status, + final TaskEvent failureEvent, final String serverName, + final String exceptionMeasage) { + super(status, failureEvent, serverName, exceptionMeasage); + this.result = result; + } + + /** + * Creates an instance of individual server status result for version command. + *

+ * Common Exception caught is stored. + *

+ * + * @param status Individual server status returned. + * @param ex Common Exception caught. + * @param failureEvent Failure cause. + * @param serverName Target GlassFish server name. + * @param exceptionMeasage Exception message from command task. + */ + ResultVersion(final Status status, final Exception ex, + final TaskEvent failureEvent, final String serverName, + final String exceptionMeasage) { + super(status, ex, failureEvent, serverName, exceptionMeasage); + this.result = null; + } + + /** + * Creates an instance of individual server status result for version command. + *

+ * No additional value except result is stored. + *

+ * + * @param status Individual server status returned. + * @param failureEvent Failure cause. + * @param serverName Target GlassFish server name. + * @param exceptionMeasage Exception message from command task. + */ + ResultVersion(final Status status, final TaskEvent failureEvent, + final String serverName, final String exceptionMeasage) { + super(status, failureEvent, serverName, exceptionMeasage); + this.result = null; + } + + //////////////////////////////////////////////////////////////////////// + // Getters // + //////////////////////////////////////////////////////////////////////// + + /** + * Get version command execution result. + *

+ * + * @return version command execution result. + */ + public ResultString getResult() { + return result; + } + + } + + /** + * Common individual server status check task. + */ + private static abstract class Task implements TaskStateListener { + + //////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////// + + /** + * Format time value in miliseconds to be printed as value in seconds and miliseconds + * s.ms. + *

+ * + * @param tm Time value in miliseconds + * @return Time string formated as econds and miliseconds s.ms. + */ + static String tm(final long tm) { + StringBuilder sb = new StringBuilder(8); + sb.append(Long.toString(tm / 1000)); + sb.append('.'); + sb.append(Long.toString(tm % 1000)); + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////// + + /** GlassFish server to be tested. */ + final PayaraServer server; + + /** + * Task start time. Used for logging purposes. Value of -1 means that start time was + * not set. + */ + long tmStart; + + /** Task failure event filled by last state change. */ + TaskEvent failureEvent; + + /** Server name filled by last state change. */ + String serverName; + + /** Exception message filled by last state change. */ + String exceptionMeasage; + + //////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of common individual server status check. + *

+ * + * @param server GlassFish server to be checked. + */ + Task(final PayaraServer server) { + this.server = server; + this.tmStart = -1; + } + + //////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////// + + /** + * Compute task result waiting timeout based on task start time, actual time and minimal timeout + * limit. + *

+ * + * @param startup Startup mode to select longer timeout. + * @return Task result waiting timeout. + */ + long timeout(final boolean startup) { + long timeout = (startup ? COMAND_STARTUP_TIMEOUT : COMAND_TIMEOUT) + - System.currentTimeMillis() + tmStart; + if (timeout > COMAND_TIMEOUT_MIN) { + return timeout; + } else { + return COMAND_TIMEOUT_MIN; + } + } + + /** + * Store event that caused task failure. + *

+ * + * @param newState Current task state. + * @param event Event that caused task change. + * @param args Unused interface parameter. + */ + @Override + public void operationStateChanged( + final TaskState newState, final TaskEvent event, + final String[] args) { + if (args != null && args.length >= 3) { + serverName = args[0]; + exceptionMeasage = args[2]; + } else { + serverName = exceptionMeasage = null; + } + switch (newState) { + case FAILED: + failureEvent = event; + } + } + + } + + /** + * Individual server status check task to verify if server administration port is alive. + *

+ * This task does not run in a separate thread but uses existing main thread instead. + */ + private static class AdminPortTask extends Task { + + //////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(AdminPortTask.class); + + //////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////// + + /** Server administration interface host. */ + String host; + + /** Server administration interface port. */ + int port; + + /** Socked connecting timeout [ms]. */ + int timeout; + + /** Server administration port status check result. */ + private Result result; + + //////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of administration port status check. + *

+ * + * @param server GlassFish server to be checked. + * @param timeout Socked connecting timeout. + */ + AdminPortTask(final PayaraServer server, final int timeout) { + super(server); + this.host = server.getHost(); + this.port = server.getAdminPort(); + this.timeout = timeout; + } + + //////////////////////////////////////////////////////////////////////// + // Getters // + //////////////////////////////////////////////////////////////////////// + + /** + * Get server administration port status check result. + *

+ * + * @return Server administration port status check result. + */ + Result getResult() { + return result; + } + + //////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////// + + /** + * Close socket and handle IOException that could be thrown. + *

+ * + * @param socket Socket to be closed. + */ + private void closeSocket(final Socket socket) { + try { + socket.close(); + } catch (IOException ioe) { + handleIOException(ioe, host, port, + "Socket closing failed when connecting to {0}:{1}: {2}"); + } + } + + /** + * Handle IO Exception caught in server administration port verification task. + *

+ * + * @param ioe IOException caught. + * @param host Server administration host. + * @param port Server administration port. + * @param message Message to be logged. Shall not be null. + */ + private void handleIOException(final IOException ioe, + final String host, final int port, final String message) { + final String METHOD = "handleIOException"; + String logMsg = MessageFormat.format(message, new Object[] { + server.getName(), host, Integer.toString(port), + ioe.getMessage() }); + if (tmStart >= 0 && LOGGER.isLoggable(Level.FINE)) { + long tm = System.currentTimeMillis() - tmStart; + LOGGER.log(Level.FINE, METHOD, "messageTm", + new Object[] { logMsg, tm(tm) }); + + } else { + LOGGER.log(Level.INFO, METHOD, "message", logMsg); + } + } + + // Based on original code from + // org.netbeans.modules.glassfish.common.CommonServerSupport.isRunning(...) + /** + * Parent thread task to verify if server administration port is alive. + *

+ * + * @return Returns true when server administration port is alive or false + * otherwise. + */ + Result check() { + final String METHOD = "check"; + if (port < 0 || host == null) { + result = new Result(Status.INVALID); + return result; + } + this.tmStart = System.currentTimeMillis(); + InetSocketAddress sa = new InetSocketAddress(host, port); + Socket socket = new Socket(); + try { + socket.connect(sa, timeout); + socket.setSoTimeout(timeout); + } catch (java.net.ConnectException ce) { + handleIOException(ce, host, port, + "[{0}] Port check could not connect to {1}:{2}: {3}"); + result = new Result(Status.FAILED, ce); + return result; + } catch (java.net.SocketTimeoutException ste) { + handleIOException(ste, host, port, + "[{0}] Port check timeout when connecting to {1}:{2}: {3}"); + result = new Result(Status.TIMEOUT, ste); + return result; + } catch (IOException ioe) { + handleIOException(ioe, host, port, + "[{0}] Port check caught IO exception when connecting to {1}:{2}: {3}"); + result = new Result(Status.EXCEPTION, ioe); + return result; + } finally { + closeSocket(socket); + } + if (tmStart >= 0 && LOGGER.isLoggable(Level.FINE)) { + long tm = System.currentTimeMillis() - tmStart; + LOGGER.log(Level.FINE, METHOD, "success", + new Object[] { tm(tm), server.getName() }); + } + result = new Result(Status.SUCCESS); + return result; + } + + } + + /** + * Individual server status check task with __locations administration command + * execution. + */ + private static class LocationsTask extends Task { + + //////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(LocationsTask.class); + + //////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////// + + /** Locations command. */ + private final CommandLocation command; + + /** Locations command execution result; */ + private Future> future; + + /** Locations command result; */ + ResultMap taskResult; + + /** Locations command status check result. */ + private ResultLocations result; + + /** + * Startup mode. Triggers longer administration commands execution timeouts when true. + */ + private final boolean startup; + + //////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of __locations server status check. + *

+ * + * @param server GlassFish server to be checked. + * @param startup Trigger startup mode. Triggers longer administration commands execution timeouts + * when true. + */ + LocationsTask(final PayaraServer server, final boolean startup) { + super(server); + this.command = new CommandLocation(); + this.startup = startup; + } + + //////////////////////////////////////////////////////////////////////// + // Getters // + //////////////////////////////////////////////////////////////////////// + + /** + * Get __locations command status check result. + *

+ * + * @return __locations command status check result. + */ + ResultLocations getResult() { + return result; + } + + //////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////// + + /** + * Start server Location task. + */ + void start(final ExecutorService executor) { + final String METHOD = "start"; + this.tmStart = System.currentTimeMillis(); + future = ServerAdmin.>exec(executor, server, command, this); + if (tmStart >= 0 && LOGGER.isLoggable(Level.FINE)) { + long tm = System.currentTimeMillis() - tmStart; + LOGGER.log(Level.FINE, METHOD, "started", tm(tm)); + } + } + + /** + * Log Exception caught on task join. + *

+ * + * @param ex Exception caught. + */ + private void logExceptionOnJoin(final Exception ex) { + final String METHOD = "logExceptionOnJoin"; + LOGGER.log(Level.FINE, METHOD, "failed", + new Object[] { tm(System.currentTimeMillis() - tmStart), + ex.getClass().getName(), + ex.getMessage() != null ? ex.getMessage() : "" }); + } + + /** + * Wait for server Location task to finish. + */ + void join() { + final String METHOD = "join"; + try { + taskResult = future.get( + timeout(startup), TimeUnit.MILLISECONDS); + result = new ResultLocations(taskResult, Status.SUCCESS, + failureEvent, serverName, exceptionMeasage); + LOGGER.log(Level.FINE, METHOD, "completed", + tm(System.currentTimeMillis() - tmStart)); + // This means administration port is not responding. + } catch (TimeoutException te) { + result = new ResultLocations(Status.TIMEOUT, + failureEvent, serverName, exceptionMeasage); + logExceptionOnJoin(te); + // Expected exceptions are handled in call() method so this + // is something serious. + } catch (ExecutionException ee) { + result = new ResultLocations(Status.FATAL, ee, + failureEvent, serverName, exceptionMeasage); + logExceptionOnJoin(ee); + // Interrupted after administration port check failed. + } catch (InterruptedException ie) { + result = new ResultLocations(Status.FAILED, ie, + failureEvent, serverName, exceptionMeasage); + logExceptionOnJoin(ie); + // Cancelled after administration port check failed. + } catch (CancellationException ce) { + result = new ResultLocations(Status.FAILED, ce, + failureEvent, serverName, exceptionMeasage); + logExceptionOnJoin(ce); + } + } + + /** + * Attempt to cancel execution of this task. + */ + void cancel() { + if (!future.isDone()) { + future.cancel(true); + } + } + + } + + /** + * Individual server status check task with version administration command execution. + */ + private static class VersionTask extends Task { + + //////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(VersionTask.class); + + //////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////// + + /** Version command. */ + private final CommandVersion command; + + /** Version command execution result; */ + private Future future; + + /** Version command result; */ + ResultString taskResult; + + /** Version command status check result. */ + private ResultVersion result; + + /** + * Startup mode. Triggers longer administration commands execution timeouts when true. + */ + private final boolean startup; + + //////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of version server status check. + *

+ * + * @param server GlassFish server to be checked. + * @param startup Trigger startup mode. Triggers longer administration commands execution timeouts + * when true. + */ + VersionTask(final PayaraServer server, final boolean startup) { + super(server); + this.command = new CommandVersion(); + this.startup = startup; + } + + //////////////////////////////////////////////////////////////////////// + // Getters // + //////////////////////////////////////////////////////////////////////// + + /** + * Get version command status check result. + *

+ * + * @return version command status check result. + */ + ResultVersion getResult() { + return result; + } + + //////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////// + + /** + * Start server Version task. + */ + void start(final ExecutorService executor) { + final String METHOD = "start"; + this.tmStart = System.currentTimeMillis(); + future = ServerAdmin.exec(executor, server, command, this); + if (tmStart >= 0 && LOGGER.isLoggable(Level.FINE)) { + long tm = System.currentTimeMillis() - tmStart; + LOGGER.log(Level.FINE, METHOD, "started", tm(tm)); + } + } + + /** + * Log Exception caught on task join. + *

+ * + * @param ex Exception caught. + */ + private void logExceptionOnJoin(final Exception ex) { + final String METHOD = "logExceptionOnJoin"; + LOGGER.log(Level.FINE, METHOD, "failed", + new Object[] { tm(System.currentTimeMillis() - tmStart), + ex.getClass().getName(), + ex.getMessage() != null ? ex.getMessage() : "" }); + } + + /** + * Wait for server Version task to finish. + */ + void join() { + final String METHOD = "join"; + try { + taskResult = future.get( + timeout(startup), TimeUnit.MILLISECONDS); + result = new ResultVersion(taskResult, Status.SUCCESS, + failureEvent, serverName, exceptionMeasage); + LOGGER.log(Level.FINE, "completed", + tm(System.currentTimeMillis() - tmStart)); + // This means administration port is not responding. + } catch (TimeoutException te) { + result = new ResultVersion(Status.TIMEOUT, + failureEvent, serverName, exceptionMeasage); + logExceptionOnJoin(te); + // Expected exceptions are handled in call() method so this + // is something serious. + } catch (ExecutionException ee) { + result = new ResultVersion(Status.FATAL, ee, + failureEvent, serverName, exceptionMeasage); + logExceptionOnJoin(ee); + // Interrupted after administration port check failed. + } catch (InterruptedException ie) { + result = new ResultVersion(Status.FAILED, ie, + failureEvent, serverName, exceptionMeasage); + logExceptionOnJoin(ie); + // Cancelled after administration port check failed. + } catch (CancellationException ce) { + result = new ResultVersion(Status.FAILED, ce, + failureEvent, serverName, exceptionMeasage); + logExceptionOnJoin(ce); + } + } + + /** + * Attempt to cancel execution of this task. + */ + void cancel() { + if (!future.isDone()) { + future.cancel(true); + } + } + } + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(ServerStatus.class); + + /** Executor thread pool size (amount of threads to run in parallel). */ + private static final int EXECUTOR_POOL_SIZE = 2; + + /** Administration port connect timeout [ms]. */ + private static final int CONNECT_TIMEOUT = 15000; + + /** Minimal administration command execution timeout [ms]. */ + private static final int COMAND_TIMEOUT_MIN = 100; + + /** Administration command execution timeout [ms]. */ + private static final int COMAND_TIMEOUT = 30000; + + /** Administration command execution timeout [ms] in startup mode. */ + private static final int COMAND_STARTUP_TIMEOUT = 600000; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Executor used to run asynchronous server status checks in parallel. */ + private final ExecutorService executor; + + /** + * Server status check task to verify if server administration port is alive. + */ + private final AdminPortTask adminPortTask; + + /** + * Server status check task with version administration command. + */ + private final VersionTask versionTask; + + /** + * Server status check task with __locations administration command. + */ + private final LocationsTask locationsTask; + + /** + * Asynchronous server status checks start time. Used for logging purposes. Value of -1 + * means that start time was not set. + */ + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of server status check. + *

+ * Method {@link #close()} must be called at the end to release system resources. + *

+ * + * @param server GlassFish server to be checked. + * @param startup Trigger startup mode. Triggers longer administration commands execution timeouts + * when true. + */ + public ServerStatus(final PayaraServer server, final boolean startup) { + this.executor = ServerAdmin.executor(EXECUTOR_POOL_SIZE); + this.adminPortTask = new AdminPortTask(server, CONNECT_TIMEOUT); + this.versionTask = new VersionTask(server, startup); + this.locationsTask = new LocationsTask(server, startup); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get server administration port status check result. + *

+ * + * @return Server administration port status check result. + */ + public Result getAdminPortResult() { + return adminPortTask.result; + } + + /** + * Get version command status check result. + *

+ * + * @return version command status check result. + */ + public ResultVersion getVersionResult() { + return versionTask.result; + } + + /** + * Get __locations command status check result. + *

+ * + * @return __locations command status check result. + */ + public ResultLocations getLocationsResult() { + return locationsTask.result; + } + + /** + * Retrieve GlassFish version from version string retrieved from version command. + *

+ * + * @return Version string retrieved from version command. + */ + public Version getVersion() { + String versionStr = versionTask.result != null + && versionTask.result.result != null + ? versionTask.result.result.getValue() + : null; + if (versionStr != null) { + Pattern p = Pattern.compile("[0-9]+(\\.[0-9]+){1,3}"); + Matcher m = p.matcher(versionStr); + if (m.find()) { + String versionToken = versionStr.substring(m.start(), m.end()); + return new Version(versionToken); + } + } + return null; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Run asynchronous server status checks. + *

+ * Server administration port status check is run in parent thread. When administration port has not + * been available, remaining command tasks are canceled. + */ + public void check() { + versionTask.start(executor); + locationsTask.start(executor); + Result result = adminPortTask.check(); + if (result.status != Status.SUCCESS) { + versionTask.cancel(); + locationsTask.cancel(); + } + versionTask.join(); + locationsTask.join(); + } + + /** + * Clean up all resources. + *

+ * Removes internal thread pool. + * + */ + @Override + public void close() { + executor.shutdownNow(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ServerTasks.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ServerTasks.java new file mode 100644 index 00000000..cbfa5f68 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ServerTasks.java @@ -0,0 +1,494 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server; + +import static fish.payara.eclipse.tools.server.sdk.server.JDK.JDK_VERSION; +import static fish.payara.eclipse.tools.server.sdk.server.JDK.isCorrectJDK; +import static fish.payara.eclipse.tools.server.sdk.server.ServerTasks.StartMode.DEBUG; +import static fish.payara.eclipse.tools.server.sdk.server.parser.TreeParser.readXml; +import static fish.payara.eclipse.tools.server.sdk.utils.JavaUtils.javaVmExecutableFullPath; +import static fish.payara.eclipse.tools.server.sdk.utils.JavaUtils.javaVmVersion; +import static fish.payara.eclipse.tools.server.sdk.utils.ServerUtils.GFV3_JAR_MATCHER; +import static fish.payara.eclipse.tools.server.sdk.utils.ServerUtils.GF_DERBY_ROOT_PROPERTY; +import static fish.payara.eclipse.tools.server.sdk.utils.ServerUtils.GF_DOMAIN_ROOT_PROPERTY; +import static fish.payara.eclipse.tools.server.sdk.utils.ServerUtils.GF_HOME_PROPERTY; +import static fish.payara.eclipse.tools.server.sdk.utils.ServerUtils.GF_JAVA_ROOT_PROPERTY; +import static fish.payara.eclipse.tools.server.sdk.utils.ServerUtils.getDerbyRoot; +import static fish.payara.eclipse.tools.server.sdk.utils.ServerUtils.getDomainPath; +import static fish.payara.eclipse.tools.server.sdk.utils.ServerUtils.getJarName; +import static java.io.File.separator; +import static java.util.Arrays.asList; +import static java.util.stream.Collectors.toList; + +import java.io.File; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.logging.Level; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; +import fish.payara.eclipse.tools.server.sdk.admin.CommandStartDAS; +import fish.payara.eclipse.tools.server.sdk.admin.ResultProcess; +import fish.payara.eclipse.tools.server.sdk.admin.ServerAdmin; +import fish.payara.eclipse.tools.server.sdk.data.StartupArgs; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.server.parser.JvmConfigReader; +import fish.payara.eclipse.tools.server.sdk.server.parser.JvmConfigReader.JvmOption; +import fish.payara.eclipse.tools.server.sdk.utils.JavaUtils; +import fish.payara.eclipse.tools.server.sdk.utils.JavaUtils.JavaVersion; +import fish.payara.eclipse.tools.server.sdk.utils.OsUtils; +import fish.payara.eclipse.tools.server.sdk.utils.Utils; + +/** + * This class should contain task methods for GF server. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class ServerTasks { + + //////////////////////////////////////////////////////////////////////////// + // Inner classes // + //////////////////////////////////////////////////////////////////////////// + + public enum StartMode { + /** Regular server start. */ + START, + /** Start server in debug mode. */ + DEBUG, + /** Start server in profiling mode. */ + PROFILE; + } + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(ServerTasks.class); + + /** Default name of the DAS server. */ + private static final String DAS_NAME = "server"; + + private static Pattern debugPortPattern = Pattern.compile("-\\S+jdwp[:=]\\S*address=([0-9]+)"); + private static Pattern debugSuspendPattern = Pattern.compile("-\\S+jdwp[:=]\\S*suspend=([n]+)"); + + private static final Set MULTI_VALUE_OPTIONS = new HashSet<>(Arrays.asList( + "--add-exports", + "--add-modules", + "--add-opens", + "--add-reads", + "--limit-modules", + "--patch-module" + )); + + /** + * Convenient method to start Payara in START mode. + *

+ * + * @param server Payara server entity. + * @param args Startup arguments provided by caller. + * @return ResultProcess returned by CommandStartDAS to give caller opportunity to monitor the start + * process. + * @throws PayaraIdeException + */ + public static ResultProcess startServer(PayaraServer server, StartupArgs args) throws PayaraIdeException { + return startServer(server, args, StartMode.START, false); + } + + /** + * Starts local Payara server. + *

+ * The own start is done by calling CommandStartDAS. This method prepares command-line arguments + * that need to be provided for the command. The parameters come from domain.xml and from parameter + * args provided by the caller. + *

+ * + * @param server Payara server entity. + * @param args Startup arguments provided by caller. + * @param mode Mode which we are starting GF in. + * @return ResultProcess returned by CommandStartDAS to give caller opportunity to monitor the start + * process. + * @throws PayaraIdeException + */ + public static ResultProcess startServer(PayaraServer server, StartupArgs args, StartMode mode, boolean suspendOnStart) throws PayaraIdeException { + String METHOD = "startServer"; + + // Reading jvm config section from domain.xml + JvmConfigReader jvmConfigReader = new JvmConfigReader(DAS_NAME); + String domainAbsolutePath = server.getDomainsFolder() + separator + server.getDomainName(); + String domainXmlPath = domainAbsolutePath + separator + "config" + separator + "domain.xml"; + if (!readXml(new File(domainXmlPath), jvmConfigReader)) { + throw new PayaraIdeException(LOGGER.excMsg(METHOD, "readXMLerror"), domainXmlPath); + } + + JDK.Version jdkVersion = getJavaVersion(args); + JDK.Version targetJDKVersion = jdkVersion != null ? jdkVersion : JDK_VERSION; + + // Filter out all options that are not applicable + List optList + = jvmConfigReader.getJvmOptions() + .stream() + .filter(fullOption -> isCorrectJDK(targetJDKVersion, fullOption.vendor, fullOption.minVersion, fullOption.maxVersion)) + .map(fullOption -> fullOption.option) + .collect(toList()); + + Map propMap = jvmConfigReader.getPropMap(); + addJavaAgent(server, jvmConfigReader); + + // Try to find bootstraping jar - usually glassfish.jar + File bootstrapJar = getJarName(server.getServerHome(), GFV3_JAR_MATCHER); + if (bootstrapJar == null) { + throw new PayaraIdeException(LOGGER.excMsg(METHOD, "noBootstrapJar")); + } + + // Compute classpath using properties from jvm-config element of domain.xml + String classPath = computeClassPath(propMap, new File(domainAbsolutePath), bootstrapJar); + + StringBuilder javaOpts = new StringBuilder(1024); + StringBuilder glassfishArgs = new StringBuilder(256); + + // Preparing variables to replace placeholders in options + Map varMap = varMap(server, args.getJavaHome()); + + // Add debug parameters read from domain.xml. + // It's important to add them before java options specified by user + // in case users specified it themselves + if (mode.equals(DEBUG)) { + String debugOptions = propMap.get("debug-options"); + + // Set suspend to "y" if it's "n" + if (suspendOnStart) { + Matcher debugSuspendMatcher = debugSuspendPattern.matcher(debugOptions); + StringBuffer buf = new StringBuffer(); + while (debugSuspendMatcher.find()) { + debugSuspendMatcher.appendReplacement(buf, + debugOptions.substring(debugSuspendMatcher.start(), debugSuspendMatcher.start(1)) + + "y" + + debugOptions.substring(debugSuspendMatcher.end(1), debugSuspendMatcher.end())); + } + + debugOptions = debugSuspendMatcher.appendTail(buf).toString(); + } + + optList.addAll(asList(debugOptions.split("\\s+(?=-)"))); + } + + // Appending IDE specified options after the ones got from domain.xml + // IDE specified are taking precedence this way + if (args.getJavaArgs() != null) { + optList.addAll(args.getJavaArgs()); + } + appendOptions(javaOpts, optList, varMap); + appendVarMap(javaOpts, varMap); + if (args.getGlassfishArgs() != null) { + appendGlassfishArgs(glassfishArgs, args.getGlassfishArgs()); + } + + // Starting the server using command + + try { + return ServerAdmin.exec(server, + new CommandStartDAS( + args.getJavaHome(), + classPath, + javaOpts.toString(), + glassfishArgs.toString(), + domainAbsolutePath)) + .get(); + } catch (InterruptedException | ExecutionException e) { + throw new PayaraIdeException(LOGGER.excMsg(METHOD, "failed"), e); + } + } + + private static JDK.Version getJavaVersion(StartupArgs args) { + String javaHome = System.getProperty("java.home"); + Path defaultPath = Paths.get(javaHome); + Path selectedPath = Paths.get(args.getJavaHome()); + + if (selectedPath.equals(defaultPath) + || (javaHome.endsWith("jre") && selectedPath.equals(defaultPath.getParent()))) { + return JDK_VERSION; + } + + String[] versions = JavaUtils.getJavaVersionString(args.getJavaHome()).split(":"); + JDK.Version targetJDKVersion = null; + + if (versions.length > 0) { + targetJDKVersion = JDK.getVersion(versions[0], System.getProperty("java.vendor")); + } + + return targetJDKVersion; + } + + public static Integer getDebugPort(ResultProcess process) { + Matcher debugPortMatcher = debugPortPattern.matcher(process.getValue().getArguments()); + if (debugPortMatcher.find()) { + return Integer.parseInt(debugPortMatcher.group(1)); + } + + throw new IllegalArgumentException("Debug port not found in process args!"); + } + + /** + * Build server variables map. + *

+ * + * @param server GlassFish server entity + * @param javaHome Java SE JDK home used to run Glassfish. + */ + private static Map varMap(PayaraServer server, String javaHome) { + HashMap varMap = new HashMap<>(); + + varMap.put(GF_HOME_PROPERTY, server.getServerHome()); + varMap.put(GF_DOMAIN_ROOT_PROPERTY, getDomainPath(server)); + varMap.put(GF_JAVA_ROOT_PROPERTY, javaHome); + varMap.put(GF_DERBY_ROOT_PROPERTY, getDerbyRoot(server)); + + return varMap; + } + + /** + * Add java agents into server options. + *

+ * + * @param server GlassFish server entity. + * @param jvmConfigReader Contains jvm-options from domain.xwl. + */ + private static void addJavaAgent(PayaraServer server, JvmConfigReader jvmConfigReader) { + List optList = jvmConfigReader.getJvmOptions(); + File serverHome = new File(server.getServerHome()); + File btrace = new File(serverHome, "lib/monitor/btrace-agent.jar"); + File flight = new File(serverHome, "lib/monitor/flashlight-agent.jar"); + if (jvmConfigReader.isMonitoringEnabled()) { + if (btrace.exists()) { + optList.add(new JvmOption("-javaagent:" + Utils.quote(btrace.getAbsolutePath()) + "=unsafe=true,noServer=true")); // NOI18N + } else if (flight.exists()) { + optList.add(new JvmOption("-javaagent:" + Utils.quote(flight.getAbsolutePath()))); + } + } + } + + /** + * Adds server variables from variables map into Java VM options for server startup. + *

+ * + * @param javaOpts Java VM options {@link StringBuilder} instance. + * @param varMap Server variables map. + */ + private static void appendVarMap(StringBuilder javaOpts, Map varMap) { + for (Map.Entry entry : varMap.entrySet()) { + javaOpts.append(' '); + JavaUtils.systemProperty(javaOpts, entry.getKey(), entry.getValue()); + } + } + + private static JavaVersion getJavaVersion(String javaHome) { + return javaVmVersion(new File(javaVmExecutableFullPath(javaHome))); + } + + /** + * Computing class path for -cp option of java. + *

+ * + * @param propMap Attributes of jvm-config element of domain.xml. + * @param domainDir Relative paths will be added to this directory. + * @param bootstrapJar Bootstrap jar will be also added to class path. + * @return Class path for -cp option of java. + */ + private static String computeClassPath(Map propMap, File domainDir, File bootstrapJar) { + final String METHOD = "computeClassPath"; + String result = null; + List prefixCP = Utils.classPathToFileList(propMap.get("classpath-prefix"), domainDir); + List suffixCP = Utils.classPathToFileList(propMap.get("classpath-suffix"), domainDir); + boolean useEnvCP = "false".equals(propMap.get("env-classpath-ignored")); + List envCP = Utils.classPathToFileList(useEnvCP ? System.getenv("CLASSPATH") : null, domainDir); + List systemCP = Utils.classPathToFileList(propMap.get("system-classpath"), domainDir); + + if (prefixCP.size() > 0 || suffixCP.size() > 0 || envCP.size() > 0 || systemCP.size() > 0) { + List mainCP = Utils.classPathToFileList(bootstrapJar.getAbsolutePath(), null); + + if (mainCP.size() > 0) { + List completeCP = new ArrayList<>(32); + completeCP.addAll(prefixCP); + completeCP.addAll(mainCP); + completeCP.addAll(systemCP); + completeCP.addAll(envCP); + completeCP.addAll(suffixCP); + + // Build classpath in proper order - prefix / main / system + // / environment / suffix + // Note that completeCP should always have at least 2 elements + // at this point (1 from mainCP and 1 from some other CP + // modifier) + StringBuilder classPath = new StringBuilder(1024); + Iterator iter = completeCP.iterator(); + classPath.append(Utils.quote(iter.next().getPath())); + while (iter.hasNext()) { + classPath.append(File.pathSeparatorChar); + classPath.append(Utils.quote(iter.next().getPath())); + } + result = classPath.toString(); + } else { + LOGGER.log(Level.WARNING, METHOD, "cpError"); + } + } + return result; + } + + /** + * Takes an list of java options and produces a valid string that can be put on command line. + *

+ * There are two kinds of options that can be found in option list: key=value and + * simple options not containing =. In the list there are both options from domain.xml + * and users options. Thus some of them can be there more than once. For key=value ones + * we can detect it and only the latest one in list will be appended to command-line. For simple + * once maybe some duplicate detection will be added in the future. + *

+ * + * @param argumentBuf Returned string. + * @param optList List of java options. + * @param varMap Map to be used for replacing place holders, Contains place holder - place + * holder value pairs. + */ + private static void appendOptions(StringBuilder argumentBuf, + List optList, Map varMap) { + final String METHOD = "appendOptions"; + List moduleOptions = new ArrayList<>(); + Map keyValueArgs = new HashMap<>(); + List keyOrder = new LinkedList<>(); + String name, value; + + // First process optList acquired from domain.xml + for (String opt : optList) { + // do placeholder substitution + opt = Utils.doSub(opt.trim(), varMap); + + int splitIndex = opt.indexOf('='); + + // && !opt.startsWith("-agentpath:") is a temporary hack to + // not touch already quoted -agentpath. Later we should handle it + // in a better way. + if (splitIndex != -1 && !opt.startsWith("-agentpath:")) { + + // key=value type of option + + name = opt.substring(0, splitIndex); + value = Utils.quote(opt.substring(splitIndex + 1)); + LOGGER.log(Level.FINER, METHOD, + "jvmOptVal", new Object[] { name, value }); + + } else if (opt.startsWith("-Xbootclasspath")) { + + // -Xbootclasspath: or -Xbootclasspath/p: or -Xbootclasspath/a: + + name = opt; + value = null; + + int colonIndex = opt.indexOf(':'); + if (colonIndex != -1) { + String optionName = opt.substring(0, colonIndex); + String optonValue = Utils.quote(opt.substring(colonIndex + 1)); + + name = optionName + ":" + optonValue; + } + } else { + name = opt; + value = null; + LOGGER.log(Level.FINER, METHOD, "jvmOpt", name); + } + + // seperate modules options + if (MULTI_VALUE_OPTIONS.contains(name)) { + moduleOptions.add(opt); + } else { + if (!keyValueArgs.containsKey(name)) { + keyOrder.add(name); + } + keyValueArgs.put(name, value); + } + } + + // Override the values that are found in the domain.xml file. + // this is totally a copy/paste from StartTomcat... + final String[] PROXY_PROPS = { + "http.proxyHost", + "http.proxyPort", + "http.nonProxyHosts", + "https.proxyHost", + "https.proxyPort", + }; + boolean isWindows = OsUtils.isWin(); + for (String prop : PROXY_PROPS) { + value = System.getProperty(prop); + if (value != null && value.trim().length() > 0) { + if (isWindows && "http.nonProxyHosts".equals(prop)) { + // enclose in double quotes to escape the pipes separating + // the hosts on windows + value = "\"" + value + "\""; + } + keyValueArgs.put(JavaUtils.systemPropertyName(prop), value); + } + } + // appending module options --add-modules --add-opens --add-exports + argumentBuf.append(String.join(" ", moduleOptions)); + + // Appending key=value options to the command line argument + // using the same order as they came in argument - important! + for (String key : keyOrder) { + argumentBuf.append(' '); + argumentBuf.append(key); + if (keyValueArgs.get(key) != null) { + argumentBuf.append("="); + argumentBuf.append(keyValueArgs.get(key)); + } + } + } + + /** + * Append GlassFish startup arguments to given {@link StringBuilder}. + *

+ * + * @param glassfishArgs Target {@link StringBuilder} to append arguments. + * @param glassfishArgsList Arguments to be appended. + */ + private static void appendGlassfishArgs(StringBuilder glassfishArgs, List glassfishArgsList) { + for (String arg : glassfishArgsList) { + glassfishArgs.append(' '); + glassfishArgs.append(arg); + } + + // Remove the first space + if (glassfishArgs.length() > 0) { + glassfishArgs.deleteCharAt(0); + } + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/AsadminTool.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/AsadminTool.java new file mode 100644 index 00000000..aa6345e8 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/AsadminTool.java @@ -0,0 +1,70 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.config; + +import fish.payara.eclipse.tools.server.sdk.data.ToolConfig; +import fish.payara.eclipse.tools.server.sdk.utils.OsUtils; + +/** + * GlassFish asadmin tool. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class AsadminTool extends GlassFishTool implements ToolConfig { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Asadmin tool JAR path (relative under GlassFish home). */ + private final String jar; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of GlassFish asadmin tool. + *

+ * + * @param lib Tools library directory (relative under GlassFish home). + * @param jar Asadmin tool JAR (relative under tools library directory). + */ + public AsadminTool(final String lib, final String jar) { + super(lib); + this.jar = OsUtils.joinPaths(lib, jar); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get asadmin tool JAR path (relative under GlassFish home) + *

+ * + * @return Asadmin tool JAR path (relative under GlassFish home) + */ + @Override + public String getJar() { + return jar; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigBuilder.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigBuilder.java new file mode 100644 index 00000000..0c7e59d6 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigBuilder.java @@ -0,0 +1,299 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.config; + +import java.io.File; +import java.io.FileNotFoundException; +import java.net.URL; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishConfig; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishJavaEEConfig; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishJavaSEConfig; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishLibrary; +import fish.payara.eclipse.tools.server.utils.Version; + +/** + * Provides GlassFish library information from XML configuration files. + *

+ * Instance of library builder for single version of GlassFish server. Version of GlassFish server + * is supplied with first configuration getter call. Each subsequent configuration getter call on + * the same instance must be used with the same GlassFish version. + *

+ * XML configuration file is read just once with first configuration getter call. Returned values + * are cached for subsequent getter calls which are very fast. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class ConfigBuilder { + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Build List of GlassFishLibrary objects representing libraries found in + * particular GlassFish server installation. + *

+ * + * @param libConfigs List of libraries configuration nodes. + * @param classpathHome Directory tree to search for class path elements. + * @param javadocsHome Directory tree to search for java doc. + * @param srcHome Directory tree to search for source files. + * @return List of GlassFishLibrary objects representing libraries found + * in particular GlassFish server installation. + */ + private static List getLibraries( + final List libConfigs, final File classpathHome, + final File javadocsHome, final File srcHome) { + + List result = new LinkedList<>(); + + try { + for (LibraryNode libConfig : libConfigs) { + + List classpath = ConfigUtils.processFileset( + libConfig.classpath, classpathHome.getAbsolutePath()); + List javadocs = ConfigUtils.processFileset( + libConfig.javadocs, javadocsHome.getAbsolutePath()); + List javadocUrls = ConfigUtils.processLinks(libConfig.javadocs); + List sources = ConfigUtils.processFileset( + libConfig.sources, srcHome.getAbsolutePath()); + result.add(new GlassFishLibrary(libConfig.libraryID, + buildUrls(classpath), + buildUrls(javadocs, javadocUrls), + libConfig.javadocs.getLookups(), + buildUrls(sources), + ConfigUtils.processClassPath(classpath))); + } + } catch (FileNotFoundException e) { + throw new PayaraIdeException( + "Some files required by configuration were not found.", e); + } + return result; + } + + /** + * Converts provided list of files to URL objects and appends supplied URL + * objects to this list. + *

+ * + * @param files List of files to convert to URL objects. + * @param urls URL objects to append to this list. + * @return List of URL objects containing content of both supplied lists. + */ + private static List buildUrls( + final List files, final List urls) { + List result = buildUrls(files); + result.addAll(urls); + return result; + } + + /** + * Converts provided list of files to URL objects. + *

+ * + * @param files List of files to convert to URL objects. + * @return List of URL objects containing files from supplied list. + */ + private static List buildUrls(final List files) { + ArrayList result = new ArrayList<>(files.size()); + for (File file : files) { + URL url = ConfigUtils.fileToURL(file); + if (url != null) { + result.add(url); + } + } + return result; + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Classpath search prefix. */ + private final File classpathHome; + + /** Javadoc search prefix. */ + private final File javadocsHome; + + /** Source code search prefix. */ + private final File srcHome; + + /** Stores information whether lassFish configuration was already read. */ + private volatile boolean fetchDone; + + /** Libraries cache. */ + private List libraryCache; + + /** GlassFish JavaEE configuration cache. */ + private GlassFishJavaEEConfig javaEEConfigCache; + + /** GlassFish JavaSE configuration cache. */ + private GlassFishJavaSEConfig javaSEConfigCache; + + /** Version check. */ + private Version version; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of GlassFish library builder. + *

+ * Stores provided GlassFish version to configuration file mapping. + *

+ * + * @param config Library builder configuration. Should not be null. + * @param classpathHome Classpath search prefix. + * @param javadocsHome Javadoc search prefix. + * @param srcHome Source code search prefix. + */ + ConfigBuilder(final String classpathHome, + final String javadocsHome, final String srcHome) { + this.classpathHome = new File(classpathHome); + this.javadocsHome = new File(javadocsHome); + this.srcHome = new File(srcHome); + this.fetchDone = false; + } + + /** + * Creates an instance of GlassFish library builder. + *

+ * Stores provided GlassFish version to configuration file mapping. + *

+ * + * @param config Library builder configuration. Should not be null. + * @param classpathHome Classpath search prefix. + * @param javadocsHome Javadoc search prefix. + * @param srcHome Source code search prefix. + */ + ConfigBuilder(final File classpathHome, + File javadocsHome, File srcHome) { + this.classpathHome = classpathHome; + this.javadocsHome = javadocsHome; + this.srcHome = srcHome; + this.fetchDone = false; + } + + /** + * Internal version check to avoid usage of a single builder instance for multiple GlassFish + * versions. + *

+ * + * @param version GlassFish version being checked. + * @throws ServerConfigException when builder is used with multiple GlassFish versions. + */ + private void versionCheck(final Version version) + throws ServerConfigException { + if (this.version == null) { + this.version = version; + } else if (this.version != version) { + throw new ServerConfigException( + "Library builder was already used for GlassFish " + + this.version + " use new instance for GlassFish" + + version); + } + } + + private void fetch(final Version version) { + synchronized (this) { + if (!fetchDone) { + GlassFishConfig configAdapter = GlassFishConfigManager.getConfig( + ConfigBuilderProvider.getBuilderConfig(version)); + List libConfigs = configAdapter.getLibrary(); + libraryCache = getLibraries( + libConfigs, classpathHome, javadocsHome, srcHome); + javaEEConfigCache = new GlassFishJavaEEConfig( + configAdapter.getJavaEE(), classpathHome); + javaSEConfigCache = new GlassFishJavaSEConfig( + configAdapter.getJavaSE()); + + fetchDone = true; + } + } + + } + + /** + * Get GlassFish libraries configured for provided GlassFish version. + *

+ * This method shall not be used with multiple GlassFish versions for the same instance of + * {@link ConfigBuilder} class. + *

+ * + * @param version GlassFish version. + * @return List of libraries configured for GlassFish of given version. + * @throws ServerConfigException when builder instance is used with multiple GlassFish versions. + */ + public List getLibraries( + final Version version) throws ServerConfigException { + versionCheck(version); + if (!fetchDone) { + fetch(version); + } + return libraryCache; + } + + /** + * Get GlassFish JavaEE configuration for provided GlassFish version. + *

+ * This method shall not be used with multiple GlassFish versions for the same instance of + * {@link ConfigBuilder} class. + *

+ * + * @param version GlassFish version. + * @return GlassFish JavaEE configuration for provided GlassFish of given version. + * @throws ServerConfigException when builder instance is used with multiple GlassFish versions. + */ + public GlassFishJavaEEConfig getJavaEEConfig( + final Version version) throws ServerConfigException { + versionCheck(version); + if (!fetchDone) { + fetch(version); + } + return javaEEConfigCache; + } + + /** + * Get GlassFish JavaSE configuration for provided GlassFish version. + *

+ * This method shall not be used with multiple GlassFish versions for the same instance of + * {@link ConfigBuilder} class. + *

+ * + * @param version GlassFish version. + * @return GlassFish JavaSE configuration for provided GlassFish of given version. + * @throws ServerConfigException when builder instance is used with multiple GlassFish versions. + */ + public GlassFishJavaSEConfig getJavaSEConfig( + final Version version) throws ServerConfigException { + versionCheck(version); + if (!fetchDone) { + fetch(version); + } + return javaSEConfigCache; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigBuilderProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigBuilderProvider.java new file mode 100644 index 00000000..2a897222 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigBuilderProvider.java @@ -0,0 +1,116 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.config; + +import java.net.URL; +import java.util.HashMap; +import java.util.Map; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.utils.Version; + +/** + * Configuration builder provider. + *

+ * This class is responsible for handling providers for individual server instances. Because + * {@link ConfigBuilder} class instance shall not be used for multiple GlassFish server versions + * there must be one configuration class instance for every single GlassFish server version. Also + * every single server instance has it's own directory structure which is used to search for + * modules. Because of that every single GlassFish server instance must have it's own configuration + * builder. Configuration builder is created with first request for given server version and reused + * for every subsequent request. + *

+ * + * @author Tomas Kraus + */ +public class ConfigBuilderProvider { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Builders array for each server instance. */ + private static final Map builders = new HashMap<>(); + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get library builder configuration for given GlassFish server version. + *

+ * + * @param version GlassFish server version. + * @return Library builder configuration for given GlassFish server version. + */ + public static URL getBuilderConfig(final Version version) { + if (version.matches("[4")) { + return ConfigBuilderProvider.class.getResource("GlassFishV4.xml"); + } else { + return ConfigBuilderProvider.class.getResource("GlassFishV3.xml"); + } + } + + /** + * Get configuration builder instance for given GlassFish server entity instance. + *

+ * + * @param server GlassFish server entity for which builder is returned. + *

+ * @return Configuration builder for given GlassFish server entity. + * @throws ServerConfigException when there is no version ser in GlassFish server entity object or + * this object is null. + */ + public static ConfigBuilder getBuilder(final PayaraServer server) { + if (server == null) { + throw new ServerConfigException( + "GlassFish server entity shall not be null"); + } + ConfigBuilder builder; + synchronized (builders) { + builder = builders.get(server); + if (builder != null) { + return builder; + } + String serverHome = server.getServerHome(); + builders.put(server, builder = new ConfigBuilder(serverHome, serverHome, serverHome)); + } + return builder; + } + + /** + * Remove configuration builder instance for given GlassFish server entity instance. + *

+ * Allows to free resources when configuration builder instance will no more be needed (e.g. + * GlassFish server entity is being destroyed). + *

+ * + * @param server GlassFish server entity for which builder is destroyed. + */ + public static void destroyBuilder(final PayaraServer server) { + if (server == null) { + throw new ServerConfigException( + "GlassFish server entity shall not be null"); + } + synchronized (builders) { + builders.remove(server); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigUtils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigUtils.java new file mode 100644 index 00000000..25579ffe --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigUtils.java @@ -0,0 +1,252 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.config; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Enumeration; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.logging.Level; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.zip.ZipEntry; +import java.util.zip.ZipException; +import java.util.zip.ZipFile; + +import fish.payara.eclipse.tools.server.sdk.data.GlassFishLibrary; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * + * @author Peter Benedikovic, Tomas Kraus + */ +public class ConfigUtils { + + /** Maven Group ID property name. */ + private static final String MVN_PROP_GROUP_ID = "groupId"; + + /** Maven Artifact ID property name. */ + private static final String MVN_PROP_ARTIFACT_ID = "artifactId"; + + /** Maven Version property name. */ + private static final String MVN_PROP_VERSION = "version"; + + /** */ + private static final Pattern MVN_PROPS_PATTERN = Pattern.compile("META-INF/maven/[^/]+/[^/]+/pom.properties"); + + /** + * Convert {@link File} to {@link URL}. + *

+ * + * @param file {@link File} to be converted to {@link URL}. + */ + static URL fileToURL(File file) { + try { + return file != null ? file.toURI().normalize().toURL() : null; + } catch (MalformedURLException ex) { + Logger.log(Level.WARNING, "Unable to convert file " + + file.getAbsolutePath() + " to URL", ex); + return null; + } + } + + /** + * Process List of links from library node and convert them to List of + * {@link URL}s. + *

+ * + * @param fileset Library node. + * @return List of {@link URL}s from library node. + */ + static List processLinks(FileSet fileset) { + List links = fileset.getLinks(); + ArrayList result = new ArrayList<>(links.size()); + for (String urlString : links) { + try { + result.add(new URL(urlString)); + } catch (MalformedURLException mue) { + Logger.log(Level.WARNING, "Cannot process URL: " + urlString + + ".", mue); + } + } + return result; + } + + /** + * Process List of links from library node and convert them of List of + * {@link File}s. + *

+ * + * @param fileset Library node. + * @param rootDir File system search root. + * @return List of {@link File}s from library node. + * @throws FileNotFoundException When file from paths element was not found. + */ + static List processFileset(FileSet fileset, String rootDir) + throws FileNotFoundException { + Map> filesets = fileset.getFilesets(); + List paths = fileset.getPaths(); + ArrayList result = new ArrayList<>(); + + for (String dir : filesets.keySet()) { + File d = new File(dir); + String dirPrefix; + if (!d.isAbsolute()) { + dirPrefix = new File(rootDir, d.getPath()).getAbsolutePath(); + } else { + dirPrefix = d.getAbsolutePath(); + } + + List patterns = compilePatterns(filesets.get(dir)); + File[] fileArray = new File(dirPrefix).listFiles(createFilter( + patterns)); + if (fileArray != null) { + Collections.addAll(result, fileArray); + } + } + + for (String path : paths) { + File f = new File(path); + if (!f.isAbsolute()) { + f = new File(rootDir, f.getPath()); + } + if (!f.exists()) { + throw new FileNotFoundException("File with name " + + path + " does not exist."); + } + result.add(f); + } + + return result; + } + + /** + * Search class path for Maven information. + *

+ * + * @param classpath List of class path JAR files. + * @return List of Maven information + */ + static List processClassPath(List classpath) { + List mvnList = new LinkedList<>(); + for (File jar : classpath) { + ZipFile zip = null; + try { + zip = new ZipFile(jar); + Enumeration entries = zip.entries(); + while (entries.hasMoreElements()) { + ZipEntry entry = entries.nextElement(); + Matcher matcher = MVN_PROPS_PATTERN.matcher(entry.getName()); + if (matcher.matches()) { + GlassFishLibrary.Maven mvnInfo = getMvnInfoFromProperties(zip.getInputStream( + entry)); + if (mvnInfo != null) { + mvnList.add(mvnInfo); + break; + } + } + } + } catch (ZipException ze) { + Logger.log(Level.WARNING, "Cannot open JAR file " + + jar.getAbsolutePath() + ":", ze); + } catch (IOException ioe) { + Logger.log(Level.WARNING, "Cannot process JAR file " + + jar.getAbsolutePath() + ":", ioe); + } catch (IllegalStateException ise) { + Logger.log(Level.WARNING, "Cannot process JAR file " + + jar.getAbsolutePath() + ":", ise); + } finally { + if (zip != null) { + try { + zip.close(); + } catch (IOException ioe) { + Logger.log(Level.WARNING, "Cannot close JAR file " + + jar.getAbsolutePath() + ":", ioe); + } + } + } + + } + return mvnList; + } + + /** + * Process pom.properties content to retrieve Maven information from JAR. + *

+ * + * @param propStream Input stream to read pom.properties file from JAR. + */ + private static GlassFishLibrary.Maven getMvnInfoFromProperties( + InputStream propStream) throws IOException { + Properties props = new Properties(); + props.load(propStream); + String groupId = props.getProperty(MVN_PROP_GROUP_ID); + String artifactId = props.getProperty(MVN_PROP_ARTIFACT_ID); + String version = props.getProperty(MVN_PROP_VERSION); + if (groupId != null && artifactId != null && version != null) { + return new GlassFishLibrary.Maven(groupId, artifactId, version); + } else { + return null; + } + } + + /** + * Creates file name filter from List of Patterns. + *

+ * + * @param patterns List of Patterns. + * @return File name filter. + */ + private static FilenameFilter createFilter(final List patterns) { + return (dir, name) -> { + for (Pattern p : patterns) { + if (p.matcher(name).matches()) { + return true; + } + } + return false; + }; + } + + /** + * Compile pattern Strings. + *

+ * + * @param names List of pattern Strings. + * @return List of compiled Patterns. + */ + private static List compilePatterns(List names) { + ArrayList patterns = new ArrayList<>(names.size()); + for (String name : names) { + patterns.add(Pattern.compile(name)); + } + return patterns; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/FileSet.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/FileSet.java new file mode 100644 index 00000000..cdf54997 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/FileSet.java @@ -0,0 +1,128 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.config; + +import java.util.List; +import java.util.Map; + +/** + * Library content set for library content for GlassFish features configuration. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class FileSet { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Paths retrieved from XML elements. */ + private final List paths; + + /** Links retrieved from XML elements. */ + private final List links; + + /** File sets retrieved from XML elements. */ + private final Map> filesets; + + /** Links retrieved from XML elements. */ + private final List lookups; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of Library content for GlassFish libraries configuration. + *

+ * + * @param paths Paths retrieved from XML elements. + * @param links Links retrieved from XML elements. + * @param filesets File sets retrieved from XML elements. + * @param lookups Lookups retrieved from XML elements. + */ + public FileSet(final List paths, final List links, + final Map> filesets, + final List lookups) { + this.paths = paths; + this.links = links; + this.filesets = filesets; + this.lookups = lookups; + } + + /** + * Creates an instance of Library content for GlassFish libraries configuration. + *

+ * Content of links and lookups is set to null. + *

+ * + * @param paths Paths retrieved from XML elements. + * @param filesets File sets retrieved from XML elements. + */ + public FileSet(final List paths, + final Map> filesets) { + this(paths, null, filesets, null); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get paths retrieved from XML elements. + *

+ * + * @return Paths sets retrieved from XML elements. + */ + public List getPaths() { + return paths; + } + + /** + * Get links retrieved from XML elements. + *

+ * + * @return Links sets retrieved from XML elements. + */ + public List getLinks() { + return links; + } + + /** + * Get file sets retrieved from XML elements. + *

+ * + * @return File sets retrieved from XML elements. + */ + public Map> getFilesets() { + return filesets; + } + + /** + * Get lookups retrieved from XML elements. + *

+ * + * @return Links sets retrieved from XML elements. + */ + public List getLookups() { + return lookups; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishConfigManager.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishConfigManager.java new file mode 100644 index 00000000..ae9724c9 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishConfigManager.java @@ -0,0 +1,43 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.config; + +import java.net.URL; + +import fish.payara.eclipse.tools.server.sdk.data.GlassFishConfig; + +/** + * GlassFish configuration manager. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class GlassFishConfigManager { + + /** + * Get GlassFish configuration access object. + *

+ * + * @param configFile GlassFish configuration XML file. + * @return GlassFish configuration API. + */ + public static GlassFishConfig getConfig(URL configFile) { + return new GlassFishConfigXMLImpl(configFile); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishConfigXMLImpl.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishConfigXMLImpl.java new file mode 100644 index 00000000..480dda7a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishConfigXMLImpl.java @@ -0,0 +1,143 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.config; + +import java.net.URL; +import java.util.List; + +import fish.payara.eclipse.tools.server.sdk.data.GlassFishConfig; +import fish.payara.eclipse.tools.server.sdk.server.parser.ConfigReaderServer; +import fish.payara.eclipse.tools.server.sdk.server.parser.TreeParser; + +/** + * Payara configuration reader API. + *

+ * Allows to access Payara server features and libraries configuration XML file using configuration + * XML file parser. + *

+ * XML configuration file reader is called only once. Any subsequent configuration values access + * will return values cached from first attempt. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class GlassFishConfigXMLImpl implements GlassFishConfig { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** GlassFish configuration XML file. */ + private final URL configFile; + + /** GlassFish configuration XML file reader. */ + private final ConfigReaderServer reader = new ConfigReaderServer(); + + /** + * Stores information whether GlassFish configuration XML file was already read and processed + */ + private volatile boolean readDone; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of Payara configuration API. + *

+ * + * @param configFile Payara configuration XML file. + */ + public GlassFishConfigXMLImpl(final URL configFile) { + this.configFile = configFile; + readDone = false; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get Payara libraries configuration. + *

+ * + * @return Payara libraries configuration. + */ + @Override + public List getLibrary() { + readXml(); + return reader.getLibraries(); + } + + /** + * Get Payara JavaEE configuration. + *

+ * + * @return Payara JavaEE configuration. + */ + @Override + public JavaEESet getJavaEE() { + readXml(); + return reader.getJavaEE(); + } + + /** + * Get Payara JavaSE configuration. + *

+ * + * @return Payara JavaSE configuration. + */ + @Override + public JavaSESet getJavaSE() { + readXml(); + return reader.getJavaSE(); + } + + /** + * Get Payara tools configuration. + *

+ * + * @return Payara tools configuration. + */ + @Override + public Tools getTools() { + readXml(); + return reader.getTools(); + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Make sure Payara configuration XML file was read and processed. + */ + private void readXml() { + if (readDone) { + return; + } + synchronized (reader) { + if (!readDone) { + TreeParser.readXml(configFile, reader); + readDone = true; + } + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishTool.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishTool.java new file mode 100644 index 00000000..13072cab --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishTool.java @@ -0,0 +1,64 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.config; + +/** + * GlassFish tool. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public abstract class GlassFishTool { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Tools library directory (relative under GlassFish home). */ + private final String lib; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of GlassFish tool. + *

+ * + * @param lib Tools library directory (relative under GlassFish home). + */ + public GlassFishTool(final String lib) { + this.lib = lib; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get tools library directory (relative under GlassFish home). + *

+ * + * @return Tools library directory (relative under GlassFish home). + */ + public String getLib() { + return lib; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishV3.xml b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishV3.xml new file mode 100644 index 00000000..6a04d653 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishV3.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishV4.xml b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishV4.xml new file mode 100644 index 00000000..d805f550 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishV4.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaEEProfile.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaEEProfile.java new file mode 100644 index 00000000..bc90e9ce --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaEEProfile.java @@ -0,0 +1,305 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.config; + +import java.util.HashMap; +import java.util.Map; + +/** + * JavaEE profiles supported by Glassfish. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public enum JavaEEProfile { + + //////////////////////////////////////////////////////////////////////////// + // Enum values // + //////////////////////////////////////////////////////////////////////////// + + /** JavaEE 1.2. */ + v1_2(Version.v1_2, Type.FULL, "1.2"), + + /** JavaEE 1.3. */ + v1_3(Version.v1_3, Type.FULL, "1.3"), + + /** JavaEE 1.4. */ + v1_4(Version.v1_4, Type.FULL, "1.4"), + + /** JavaEE 1.5. */ + v1_5(Version.v1_5, Type.FULL, "1.5"), + + /** JavaEE 1.6 web profile. */ + v1_6_web(Version.v1_6, Type.WEB, "1.6-web"), + + /** JavaEE 1.6 full profile. */ + v1_6(Version.v1_6, Type.FULL, "1.6"), + + /** JavaEE 1.7 web profile. */ + v1_7_web(Version.v1_7, Type.WEB, "1.7-web"), + + /** JavaEE 1.7 full profile. */ + v1_7(Version.v1_7, Type.FULL, "1.7"); + + //////////////////////////////////////////////////////////////////////////// + // Inner enums // + //////////////////////////////////////////////////////////////////////////// + + /** JavaEE profile type. */ + public enum Type { + /** Web profile. */ + WEB("web"), + /** Full profile. */ + FULL("full"); + + /** JavaEE profile type name. */ + private final String name; + + /** + * Creates an instance of JavaEE profile type. + *

+ * + * @param name JavaEE profile type name. + */ + private Type(final String name) { + this.name = name; + } + + /** + * Converts JavaEE profile type value to String. + *

+ * + * @return A String representation of the value of this object. + */ + @Override + public String toString() { + return this.name; + } + } + + /** JavaEE version. */ + public enum Version { + /** JavaEE 1.2. */ + v1_2("1.2"), + /** JavaEE 1.3. */ + v1_3("1.3"), + /** JavaEE 1.4. */ + v1_4("1.4"), + /** JavaEE 1.5. */ + v1_5("1.5"), + /** JavaEE 1.6. */ + v1_6("1.6"), + /** JavaEE 1.7. */ + v1_7("1.7"); + + /** JavaEE profile type name. */ + private final String name; + + /** + * Creates an instance of JavaEE profile type. + *

+ * + * @param name JavaEE profile type name. + */ + private Version(final String name) { + this.name = name; + } + + /** + * Converts JavaEE profile type value to String. + *

+ * + * @return A String representation of the value of this object. + */ + @Override + public String toString() { + return this.name; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** GlassFish JavaEE profile enumeration length. */ + public static final int length = JavaEEProfile.values().length; + + /** JavaEE profile type element separator character. */ + public static final char TYPE_SEPARATOR = '-'; + + /** + * Stored String values for backward String conversion. + */ + private static final Map stringValuesMap = new HashMap<>(values().length); + + // Initialize backward String conversion Map. + static { + for (JavaEEProfile profile : JavaEEProfile.values()) { + String[] names = createNames(profile); + for (String name : names) { + stringValuesMap.put(name.toUpperCase(), profile); + } + } + } + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Create JavaEE profile names to be recognized. + *

+ * + * @param profile JavaEE profile. + * @return Array of names. + * @throws ServerConfigException when JavaEE profile type is not recognized. + */ + private static String[] createNames(final JavaEEProfile profile) + throws ServerConfigException { + String[] names; + StringBuilder sb = new StringBuilder(profile.version.toString().length() + + 1 + profile.type.toString().length()); + sb.append(profile.version.toString()); + sb.append(TYPE_SEPARATOR); + sb.append(profile.type.toString()); + switch (profile.type) { + // Full profile should recognize version base name and full name. + case FULL: + names = new String[2]; + names[0] = profile.version.toString(); + names[1] = sb.toString(); + break; + // Web profile should regognize full name only . + case WEB: + names = new String[1]; + names[0] = sb.toString(); + break; + // This is unrechable in regular conditions. + default: + throw new ServerConfigException( + ServerConfigException.INVALID_EE_PLATFORM_TYPE); + } + return names; + } + + /** + * Returns a JavaEEProfile with a value represented by the specified + * String. The JavaEEProfile returned represents existing value only if + * specified String matches any String returned by toString + * method. Otherwise null value is returned. + *

+ * + * @param name Value containing JavaEEProfile toString representation. + * @return JavaEEProfile value represented by String or null + * if value was not recognized. + */ + public static JavaEEProfile toValue(final String name) { + if (name != null) { + return (stringValuesMap.get(name.toUpperCase())); + } else { + return null; + } + } + + /** + * Returns a JavaEEProfile with a value represented by the specified + * version and type Strings. The JavaEEProfile + * returned represents existing value only if specified String matches any + * String returned by toString method. Otherwise null value + * is returned. + *

+ * + * @param version Value containing JavaEEProfile version toString + * representation. + * @param type Value containing JavaEEProfile type toString + * representation. + * @return JavaEEProfile value represented by code>version and type + * String or null if value was not recognized. + */ + public static JavaEEProfile toValue( + final String version, final String type) { + if (version != null && type != null) { + StringBuilder sb = new StringBuilder(version.length() + 1 + type.length()); + sb.append(version); + sb.append(TYPE_SEPARATOR); + sb.append(type); + return (stringValuesMap.get(sb.toString().toUpperCase())); + } else { + return null; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** JavaEE profile version. */ + private final Version version; + + /** JavaEE profile type. */ + private final Type type; + + /** Name of JavaEE profile value. */ + private final String name; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of JavaEE profiles supported by Glassfish. + *

+ * + * @param version JavaEE profile version. + * @param type JavaEE profile type. + * @param name Name of JavaEE profile value. + */ + private JavaEEProfile( + final Version version, final Type type, final String name) { + this.version = version; + this.type = type; + this.name = name; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Converts JavaEE profile version value to String. + *

+ * + * @return A String representation of the value of this object. + */ + @Override + public String toString() { + return this.name; + } + + /** + * Get profile type. + *

+ * + * @return Profile type. + */ + public Type getType() { + return type; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaEESet.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaEESet.java new file mode 100644 index 00000000..2aa11f83 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaEESet.java @@ -0,0 +1,198 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.config; + +import java.io.File; +import java.util.Collections; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import fish.payara.eclipse.tools.server.sdk.server.parser.JavaEEModuleReader; +import fish.payara.eclipse.tools.server.sdk.server.parser.JavaEEProfileCheckReader; +import fish.payara.eclipse.tools.server.sdk.server.parser.JavaEEProfileReader; +import fish.payara.eclipse.tools.server.sdk.utils.ServerUtils; + +/** + * Container of GlassFish JavaEE features configuration. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class JavaEESet extends JavaSet { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Modules retrieved from XML elements. */ + private final List modules; + + /** Profiles retrieved from XML elements. */ + private final List profiles; + + /** Java EE platform checks retrieved from XML elements. */ + private final Map> checks; + + /** Java EE platform check results cache. */ + private final Map checkResults; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of container of GlassFish JavaEE features configuration. + *

+ * + * @param modules Modules retrieved from XML elements. + * @param profiles Profiles retrieved from XML elements. + * @param version Highest JavaEE specification version implemented. + */ + public JavaEESet(final List modules, + final List profiles, + final List checks, + final String version) { + super(version); + this.modules = Collections.unmodifiableList(modules); + this.profiles = Collections.unmodifiableList(profiles); + Map> checksMap = new HashMap<>(checks.size()); + for (JavaEEProfileCheckReader.Check check : checks) { + checksMap.put(check.getName(), check.getFiles()); + } + this.checks = Collections.unmodifiableMap(checksMap); + this.checkResults = new HashMap<>(checks.size()); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get modules retrieved from XML elements. + *

+ * + * @return Modules retrieved from XML elements. + */ + public List getModules() { + return modules; + } + + /** + * Get profiles retrieved from XML elements. + *

+ * + * @return Profiles retrieved from XML elements. + */ + public List getProfiles() { + return profiles; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get existing cached check result or run a new check if no such cached check result exists. + *

+ * Cached check results depends on provided classpathHome and they should be reset + * before classpathHome will be changed. + *

+ * + * @param name Name of check to be run. + * @param classpathHome Classpath search prefix. + */ + private boolean check(final String name, final File classpathHome) { + // No name given means check passed. + if (name == null) { + return true; + } + Boolean result = checkResults.get(name); + if (result != null) { + return result.booleanValue(); + } + List files = checks.get(name); + boolean resultValue = true; + if (files != null && !files.isEmpty()) { + for (String fileName : files) { + File file = ServerUtils.getJarName( + classpathHome.getAbsolutePath(), fileName); + if (file == null || !file.exists()) { + resultValue = false; + } + } + } + checkResults.put(name, Boolean.valueOf(resultValue)); + return resultValue; + } + + /** + * Reset cached check results before using another class path search prefix. + */ + public void reset() { + checkResults.clear(); + } + + /** + * Build {@link Set} of {@link ModuleType} for known module types retrieved from XML elements. + *

+ * + * @param classpathHome Classpath search prefix. + * @return {@link Set} of {@link ModuleType} for known module types. + */ + public Set moduleTypes(final File classpathHome) { + int size = modules != null ? modules.size() : 0; + EnumSet typesSet = EnumSet.noneOf(ModuleType.class); + if (size > 0) { + for (JavaEEModuleReader.Module module : modules) { + ModuleType type = ModuleType.toValue(module.getType()); + if (type != null && check(module.getCheck(), classpathHome)) { + typesSet.add(type); + } + } + } + return typesSet; + } + + /** + * Build {@link Set} of {@link JavaEEProfile} for known JavaEE profiles retrieved from XML elements. + *

+ * + * @param classpathHome Classpath search prefix. + * @return {@link Set} of {@link ModuleType} for known profiles. + */ + public Set profiles(final File classpathHome) { + int size = profiles != null ? profiles.size() : 0; + EnumSet profilesSet = EnumSet.noneOf(JavaEEProfile.class); + if (size > 0) { + for (JavaEEProfileReader.Profile profileFromXML : profiles) { + JavaEEProfile profile = JavaEEProfile.toValue( + profileFromXML.getVersion(), profileFromXML.getType()); + if (profile != null + && check(profileFromXML.getCheck(), classpathHome)) { + profilesSet.add(profile); + } + } + } + return profilesSet; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSEPlatform.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSEPlatform.java new file mode 100644 index 00000000..3d9e6f4e --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSEPlatform.java @@ -0,0 +1,159 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.config; + +import java.util.HashMap; +import java.util.Map; + +/** + * JavaSE platforms supported by Glassfish. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public enum JavaSEPlatform { + + //////////////////////////////////////////////////////////////////////////// + // Enum values // + //////////////////////////////////////////////////////////////////////////// + + /** JavaSE 1.1. */ + v1_1, + /** JavaSE 1.2. */ + v1_2, + /** JavaSE 1.3. */ + v1_3, + /** JavaSE 1.4. */ + v1_4, + /** JavaSE 1.5. */ + v1_5, + /** JavaSE 1.6. */ + v1_6, + /** JavaEE 1.7. */ + v1_7, + /** JavaEE 1.8. */ + v1_8; + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** GlassFish JavaEE platform enumeration length. */ + public static final int length = JavaSEPlatform.values().length; + + /** JavaEE platform version elements separator character. */ + public static final char SEPARATOR = '.'; + + /** A String representation of v1_1 value. */ + static final String V1_1_STR = "1.1"; + + /** A String representation of v1_2 value. */ + static final String V1_2_STR = "1.2"; + + /** A String representation of v1_3 value. */ + static final String V1_3_STR = "1.3"; + + /** A String representation of v1_4 value. */ + static final String V1_4_STR = "1.4"; + + /** A String representation of v1_5 value. */ + static final String V1_5_STR = "1.5"; + + /** A String representation of v1_6 value. */ + static final String V1_6_STR = "1.6"; + + /** A String representation of v1_7 value. */ + static final String V1_7_STR = "1.7"; + + /** A String representation of v1_8 value. */ + static final String V1_8_STR = "1.8"; + + /** + * Stored String values for backward String conversion. + */ + private static final Map stringValuesMap = new HashMap<>(values().length); + + // Initialize backward String conversion Map. + static { + for (JavaSEPlatform platform : JavaSEPlatform.values()) { + stringValuesMap.put(platform.toString().toUpperCase(), platform); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Returns a JavaSEPlatform with a value represented by the specified + * String. The JavaSEPlatform returned represents existing value only if + * specified String matches any String returned by toString + * method. Otherwise null value is returned. + *

+ * + * @param platformName Value containing JavaSEPlatform toString + * representation. + * @return JavaSEPlatform value represented by String or null + * if value was not recognized. + */ + public static JavaSEPlatform toValue(final String platformName) { + if (platformName != null) { + return (stringValuesMap.get(platformName.toUpperCase())); + } else { + return null; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Convert JavaEE platform version value to String. + *

+ * + * @return A String representation of the value of this object. + */ + @Override + public String toString() { + switch (this) { + case v1_1: + return V1_1_STR; + case v1_2: + return V1_2_STR; + case v1_3: + return V1_3_STR; + case v1_4: + return V1_4_STR; + case v1_5: + return V1_5_STR; + case v1_6: + return V1_6_STR; + case v1_7: + return V1_7_STR; + case v1_8: + return V1_8_STR; + // This is unrecheable. Being here means this class does not handle + // all possible values correctly. + default: + throw new ServerConfigException( + ServerConfigException.INVALID_SE_PLATFORM_VERSION); + } + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSESet.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSESet.java new file mode 100644 index 00000000..869912d0 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSESet.java @@ -0,0 +1,94 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.config; + +import java.util.EnumSet; +import java.util.List; +import java.util.Set; + +/** + * Container of GlassFish JavaSE features configuration. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class JavaSESet extends JavaSet { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Platforms retrieved from XML elements. */ + private final List platforms; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of container of GlassFish JavaSE features configuration. + *

+ * + * @param platforms Platforms retrieved from XML elements. + * @param version Highest JavaSE specification version implemented. + */ + public JavaSESet(final List platforms, final String version) { + super(version); + this.platforms = platforms; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get platforms retrieved from XML elements. + *

+ * + * @return Platforms retrieved from XML elements. + */ + public List getPlatforms() { + return platforms; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Build {@link Set} of {@link JavaSEPlatform} for known platforms retrieved from XML elements. + *

+ * + * @return {@link Set} of {@link JavaSEPlatform} for known platforms. + */ + public Set platforms() { + int size = platforms != null ? platforms.size() : 0; + EnumSet platformsSet = EnumSet.noneOf(JavaSEPlatform.class); + if (size > 0) { + for (String name : platforms) { + JavaSEPlatform type = JavaSEPlatform.toValue(name); + if (type != null) { + platformsSet.add(type); + } + } + } + return platformsSet; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSet.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSet.java new file mode 100644 index 00000000..024eb0e9 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSet.java @@ -0,0 +1,64 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.config; + +/** + * Abstract Container of GlassFish Java features configuration. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public abstract class JavaSet { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Highest Java specification version implemented. */ + private final String version; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of container of GlassFish Java features configuration. + *

+ * + * @param version Highest JavaEE specification version implemented. + */ + public JavaSet(final String version) { + this.version = version; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get highest JavaEE specification version implemented. + *

+ * + * @return Highest JavaEE specification version implemented. + */ + public String getVersion() { + return version; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/LibraryNode.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/LibraryNode.java new file mode 100644 index 00000000..94a1f7fb --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/LibraryNode.java @@ -0,0 +1,66 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.config; + +/** + * Internal library node element. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class LibraryNode { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Library ID. */ + final String libraryID; + + /** Class path file set. */ + final FileSet classpath; + + /** Java doc file set. */ + final FileSet javadocs; + + /** Java sources file set. */ + final FileSet sources; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of internal library node element. + *

+ * + * @param libraryID Library ID. + * @param classpath Class path file set + * @param javadocs Java doc file set. + * @param sources Java sources file set. + */ + public LibraryNode(final String libraryID, final FileSet classpath, + final FileSet javadocs, final FileSet sources) { + this.libraryID = libraryID; + this.classpath = classpath; + this.javadocs = javadocs; + this.sources = sources; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ModuleType.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ModuleType.java new file mode 100644 index 00000000..04fba0ed --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ModuleType.java @@ -0,0 +1,134 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.config; + +import java.util.HashMap; +import java.util.Map; + +/** + * JavaEE modules supported by Glassfish. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public enum ModuleType { + + //////////////////////////////////////////////////////////////////////////// + // Enum values // + //////////////////////////////////////////////////////////////////////////// + + /** The module is an EAR archive. */ + EAR, + /** The module is an Enterprise Java Bean archive. */ + EJB, + /** The module is an Client Application archive. */ + CAR, + /** The module is an Connector archive. */ + RAR, + /** The module is an Web Application archive. */ + WAR; + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** GlassFish JavaEE profile enumeration length. */ + public static final int length = ModuleType.values().length; + + /** A String representation of EAR value. */ + static final String EAR_STR = "ear"; + + /** A String representation of EJB value. */ + static final String EJB_STR = "ejb"; + + /** A String representation of CAR value. */ + static final String CAR_STR = "car"; + + /** A String representation of RAR value. */ + static final String RAR_STR = "rar"; + + /** A String representation of WAR value. */ + static final String WAR_STR = "war"; + + /** + * Stored String values for backward String conversion. + */ + private static final Map stringValuesMap = new HashMap<>(2 * values().length); + + // Initialize backward String conversion Map. + static { + for (ModuleType profile : ModuleType.values()) { + stringValuesMap.put(profile.toString().toUpperCase(), profile); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Returns a ModuleType with a value represented by the specified String. + * The ModuleType returned represents existing value only if specified + * String matches any String returned by toString method. + * Otherwise null value is returned. + *

+ * + * @param stateStr Value containing ModuleType toString representation. + * @return ModuleType value represented by String or null if + * value was not recognized. + */ + public static ModuleType toValue(final String stateStr) { + if (stateStr != null) { + return (stringValuesMap.get(stateStr.toUpperCase())); + } else { + return null; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Convert module type name to String. + *

+ * + * @return A String representation of the value of this object. + */ + @Override + public String toString() { + switch (this) { + case EAR: + return EAR_STR; + case EJB: + return EJB_STR; + case CAR: + return CAR_STR; + case RAR: + return RAR_STR; + case WAR: + return WAR_STR; + // This is unrecheable. Being here means this class does not handle + // all possible values correctly. + default: + throw new ServerConfigException( + ServerConfigException.INVALID_MODULE_TYPE_NAME); + } + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ServerConfigException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ServerConfigException.java new file mode 100644 index 00000000..224563a6 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ServerConfigException.java @@ -0,0 +1,101 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.config; + +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * GlassFish IDE SDK Exception related to server configuration problems. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class ServerConfigException extends PayaraIdeException { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Exception message for invalid GlassFish JavaSE profile version. */ + static final String INVALID_SE_PLATFORM_VERSION = "Invalid GlassFish JavaSE version"; + + /** Exception message for invalid GlassFish JavaEE profile type. */ + static final String INVALID_EE_PLATFORM_TYPE = "Invalid GlassFish JavaEE profile type"; + + /** Exception message for invalid GlassFish module type name. */ + static final String INVALID_MODULE_TYPE_NAME = "Invalid GlassFish module type name"; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of ServerConfigException without detail message. + */ + public ServerConfigException() { + super(); + } + + /** + * Constructs an instance of ServerConfigException with the specified detail message. + *

+ * + * @param msg The detail message. + */ + public ServerConfigException(final String msg) { + super(msg); + } + + /** + * Constructs an instance of ServerConfigException with the specified detail message + * and arguments. + *

+ * Uses {@link java.text.MessageFormat} to format message. + *

+ * + * @param msg The detail message. + * @param arguments Arguments to be inserted into message. + */ + public ServerConfigException(final String msg, final Object... arguments) { + super(msg, arguments); + } + + /** + * Constructs an instance of ServerConfigException with the specified detail message + * and cause. Exception is logged on WARN level. + *

+ * Note that the detail message associated with {@code cause} is not automatically + * incorporated in this runtime exception's detail message. + *

+ * + * @param msg the detail message (which is saved for later retrieval by the {@link #getMessage()} + * method). + * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A + * null value is permitted, and indicates that the cause is nonexistent or unknown.) + */ + public ServerConfigException(final String msg, final Throwable cause) { + super(msg, cause); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/Tools.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/Tools.java new file mode 100644 index 00000000..88a8726c --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/Tools.java @@ -0,0 +1,67 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.config; + +import fish.payara.eclipse.tools.server.sdk.data.ToolsConfig; + +/** + * Payara tools. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class Tools implements ToolsConfig { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Asadmin tool. */ + private final AsadminTool asadmin; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of Payara tools. + *

+ * + * @param asadmin Payara asadmin tool. + */ + public Tools(AsadminTool asadmin) { + this.asadmin = asadmin; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get asadmin tool. + *

+ * + * @return Asadmin tool. + */ + @Override + public AsadminTool getAsadmin() { + return asadmin; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/AbstractReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/AbstractReader.java new file mode 100644 index 00000000..c111b16f --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/AbstractReader.java @@ -0,0 +1,73 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +/** + * Abstract XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public abstract class AbstractReader extends TreeParser.NodeListener { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Tree parser element path. */ + final String path; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of Java EE platform check configuration XML element reader. + *

+ * + * @param pathPrefix Tree parser path prefix to be prepended before current XML element. + * @param node XML element name. + */ + AbstractReader(final String pathPrefix, final String node) { + StringBuilder sb = new StringBuilder( + (pathPrefix != null ? pathPrefix.length() : 0) + + TreeParser.PATH_SEPARATOR.length() + node.length()); + if (pathPrefix != null) { + sb.append(pathPrefix); + } + sb.append(TreeParser.PATH_SEPARATOR); + sb.append(node); + path = sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get current element tree parser path. + *

+ * + * @return Current element tree parser path. + */ + String getPath() { + return path; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReader.java new file mode 100644 index 00000000..1ab9e8e0 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReader.java @@ -0,0 +1,77 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.List; +import java.util.Map; + +/** + * Common library configuration XML elements reader. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public abstract class ConfigReader implements XMLReader { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** fileset XML element reader. */ + final FilesetReader filesetReader = new FilesetReader(); + + /** file XML element reader. */ + final PathReader pathReader = new PathReader("/server/library/classpath"); + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get file sets retrieved from XML elements. + *

+ * + * @return File sets retrieved from XML elements. + */ + Map> getFilesets() { + return filesetReader.getFilesets(); + } + + /** + * Get paths retrieved from XML elements. + *

+ * + * @return Paths sets retrieved from XML elements. + */ + List getPaths() { + return pathReader.getPaths(); + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Reset this XML element reader. + */ + void reset() { + filesetReader.reset(); + pathReader.reset(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderClasspath.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderClasspath.java new file mode 100644 index 00000000..1e6e60b8 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderClasspath.java @@ -0,0 +1,54 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.LinkedList; +import java.util.List; + +import fish.payara.eclipse.tools.server.sdk.server.parser.TreeParser.Path; + +/** + * classpath library configuration XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class ConfigReaderClasspath extends ConfigReader { + + //////////////////////////////////////////////////////////////////////////// + // XML reader methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Provide paths to listen on. + *

+ * Sets readers for internal javadocs elements. + *

+ * + * @return Paths that the reader listens to. + */ + @Override + public List getPathsToListen() { + LinkedList paths = new LinkedList<>(); + paths.add(new Path("/server/library/classpath/file", pathReader)); + paths.add(new Path("/server/library/classpath/fileset", filesetReader)); + return paths; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJava.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJava.java new file mode 100644 index 00000000..9b5eddc2 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJava.java @@ -0,0 +1,106 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * Abstract Java configuration XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public abstract class ConfigReaderJava + extends AbstractReader implements XMLReader { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** version XML element attribute name. */ + private static final String VERSION_ATTR = "version"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Highest JavaEE specification version implemented. */ + private String version; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of Java EE configuration XML element reader. + *

+ * + * @param pathPrefix Tree parser path prefix to be prepended before current XML element. + * @param node XML element name. + */ + ConfigReaderJava(final String pathPrefix, String node) { + super(pathPrefix, node); + version = null; + } + + //////////////////////////////////////////////////////////////////////////// + // Tree parser methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Process attributes from current XML element. + *

+ * + * @param qname Not used. + * @param attributes List of XML attributes. + * @throws SAXException When any problem occurs. + */ + @Override + public void readAttributes(final String qname, final Attributes attributes) + throws SAXException { + version = attributes.getValue(VERSION_ATTR); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get highest JavaEE specification version implemented. + *

+ * + * @return Highest JavaEE specification version implemented. + */ + String getVersion() { + return version; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Reset this XML element reader. + */ + void reset() { + version = null; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavaEE.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavaEE.java new file mode 100644 index 00000000..4241beb9 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavaEE.java @@ -0,0 +1,184 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.LinkedList; +import java.util.List; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +import fish.payara.eclipse.tools.server.sdk.server.config.JavaEESet; +import fish.payara.eclipse.tools.server.sdk.server.config.ServerConfigException; + +/** + * Java EE configuration XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class ConfigReaderJavaEE extends ConfigReaderJava { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** javaee XML element name. */ + static final String NODE = "javaee"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** profile XML element reader. */ + private final JavaEEProfileReader profileReader; + + /** module XML element reader. */ + private final JavaEEModuleReader moduleReader; + + /** check XML element reader. */ + private final JavaEEProfileCheckReader checkReader; + + /** JavaEE set for GlassFish features configuration read from XML. */ + JavaEESet javaEE; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of Java EE configuration XML element reader. + *

+ * + * @param pathPrefix Tree parser path prefix to be prepended before current XML element. + */ + ConfigReaderJavaEE(final String pathPrefix) { + super(pathPrefix, NODE); + profileReader = new JavaEEProfileReader(path); + moduleReader = new JavaEEModuleReader(path); + checkReader = new JavaEEProfileCheckReader(path); + javaEE = null; + } + + //////////////////////////////////////////////////////////////////////////// + // XML reader methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Provide paths to listen on. + *

+ * Sets readers for javaee element and it's content. + *

+ * + * @return Paths that the reader listens to. + */ + @Override + public List getPathsToListen() { + LinkedList paths = new LinkedList<>(); + paths.add(new TreeParser.Path(path, this)); + paths.add(new TreeParser.Path(profileReader.getPath(), profileReader)); + paths.add(new TreeParser.Path(moduleReader.getPath(), moduleReader)); + paths.addAll(checkReader.getPathsToListen()); + return paths; + } + + /** + * Process attributes from current XML element. + *

+ * + * @param qname Not used. + * @param attributes List of XML attributes. + * @throws SAXException When any problem occurs. + */ + @Override + public void readAttributes(final String qname, final Attributes attributes) + throws SAXException { + super.readAttributes(qname, attributes); + } + + /** + * Finish javaee element processing. + *

+ * + * @param qname Current XML element name. + * @throws ServerConfigException when more than one javaee XML elements were found. + */ + @Override + public void endNode(final String qname) throws SAXException { + if (NODE.equals(qname)) { + if (javaEE != null) { + throw new SAXException( + "Multiple " + NODE + " XML element is not allowed."); + } + javaEE = new JavaEESet( + getModules(), getProfiles(), getChecks(), getVersion()); + reset(); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get profiles retrieved from XML elements. + *

+ * + * @return Profiles retrieved from XML elements. + */ + private List getProfiles() { + return profileReader.getProfiles(); + } + + /** + * Get modules retrieved from XML elements. + *

+ * + * @return Modules sets retrieved from XML elements. + */ + private List getModules() { + return moduleReader.getModules(); + } + + /** + * Get Java EE platform checks retrieved from XML elements. + *

+ * + * @return Java EE platform checks retrieved from XML elements. + */ + private List getChecks() { + return checkReader.getChecks(); + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Reset this XML element reader. + */ + @Override + void reset() { + super.reset(); + profileReader.reset(); + moduleReader.reset(); + checkReader.reset(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavaSE.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavaSE.java new file mode 100644 index 00000000..2c4ecc33 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavaSE.java @@ -0,0 +1,156 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.LinkedList; +import java.util.List; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +import fish.payara.eclipse.tools.server.sdk.server.config.JavaSESet; +import fish.payara.eclipse.tools.server.sdk.server.config.ServerConfigException; + +/** + * Java SE configuration XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class ConfigReaderJavaSE extends ConfigReaderJava { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** java XML element name. */ + static final String NODE = "java"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** platform XML element reader. */ + private final JavaSEPlatformReader platformReader; + + /** JavaSE set for GlassFish features configuration read from XML. */ + JavaSESet javaSE; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of Java EE configuration XML element reader. + *

+ * + * @param pathPrefix Tree parser path prefix to be prepended before current XML element. + */ + ConfigReaderJavaSE(final String pathPrefix) { + super(pathPrefix, NODE); + platformReader = new JavaSEPlatformReader(path); + javaSE = null; + } + + //////////////////////////////////////////////////////////////////////////// + // XML reader methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Provide paths to listen on. + *

+ * Sets readers for java element and it's content. + *

+ * + * @return Paths that the reader listens to. + */ + @Override + public List getPathsToListen() { + LinkedList paths = new LinkedList<>(); + paths.add(new TreeParser.Path(path, this)); + paths.add(new TreeParser.Path( + platformReader.getPath(), platformReader)); + return paths; + } + + //////////////////////////////////////////////////////////////////////////// + // Tree parser methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Process attributes from current XML element. + *

+ * + * @param qname Not used. + * @param attributes List of XML attributes. + * @throws SAXException When any problem occurs. + */ + @Override + public void readAttributes(final String qname, final Attributes attributes) + throws SAXException { + super.readAttributes(qname, attributes); + } + + /** + * Finish java element processing. + *

+ * + * @param qname Current XML element name. + * @throws ServerConfigException when more than one java XML elements were found. + */ + @Override + public void endNode(final String qname) throws SAXException { + if (NODE.equals(qname)) { + if (javaSE != null) { + throw new SAXException( + "Multiple " + NODE + " XML element is not allowed."); + } + javaSE = new JavaSESet(getPlatforms(), getVersion()); + reset(); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get platforms retrieved from XML elements. + *

+ * + * @return Platforms retrieved from XML elements. + */ + private List getPlatforms() { + return platformReader.getPlatforms(); + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Reset this XML element reader. + */ + @Override + void reset() { + super.reset(); + platformReader.reset(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavadocs.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavadocs.java new file mode 100644 index 00000000..32be4836 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavadocs.java @@ -0,0 +1,104 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.LinkedList; +import java.util.List; + +import fish.payara.eclipse.tools.server.sdk.server.parser.TreeParser.Path; + +/** + * javadocs library configuration XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class ConfigReaderJavadocs extends ConfigReader { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** link XML element reader. */ + private final LinkReader linkReader = new LinkReader(); + + /** lookup XML element reader. */ + private final LookupReader lookupReader = new LookupReader(); + + //////////////////////////////////////////////////////////////////////////// + // XML reader methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Provide paths to listen on. + *

+ * Sets readers for internal javadocs elements. + *

+ * + * @return Paths that the reader listens to. + */ + @Override + public List getPathsToListen() { + LinkedList paths = new LinkedList<>(); + paths.add(new Path("/server/library/javadocs/file", pathReader)); + paths.add(new Path("/server/library/javadocs/fileset", filesetReader)); + paths.add(new Path("/server/library/javadocs/link", linkReader)); + paths.add(new Path("/server/library/javadocs/lookup", lookupReader)); + return paths; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get links retrieved from XML elements. + *

+ * + * @return Links sets retrieved from XML elements. + */ + List getLinks() { + return linkReader.getLinks(); + } + + /** + * Get lookups retrieved from XML elements. + *

+ * + * @return Links sets retrieved from XML elements. + */ + List getLookups() { + return lookupReader.getLookups(); + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Reset this XML element reader. + */ + @Override + void reset() { + super.reset(); + linkReader.reset(); + lookupReader.reset(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderServer.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderServer.java new file mode 100644 index 00000000..1f2e46da --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderServer.java @@ -0,0 +1,185 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +import fish.payara.eclipse.tools.server.sdk.server.config.FileSet; +import fish.payara.eclipse.tools.server.sdk.server.config.JavaEESet; +import fish.payara.eclipse.tools.server.sdk.server.config.JavaSESet; +import fish.payara.eclipse.tools.server.sdk.server.config.LibraryNode; +import fish.payara.eclipse.tools.server.sdk.server.config.ServerConfigException; +import fish.payara.eclipse.tools.server.sdk.server.config.Tools; +import fish.payara.eclipse.tools.server.sdk.server.parser.TreeParser.Path; + +/** + * Whole server configuration XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class ConfigReaderServer extends TreeParser.NodeListener implements + XMLReader { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** classpath library configuration XML element reader. */ + private ConfigReaderClasspath classpathReader = new ConfigReaderClasspath(); + + /** javadocs library configuration XML element reader. */ + private ConfigReaderJavadocs javadocsReader = new ConfigReaderJavadocs(); + + /** sources library configuration XML element reader. */ + private ConfigReaderSources sourcesReader = new ConfigReaderSources(); + + /** Java SE configuration XML element reader. */ + private ConfigReaderJavaSE javaSEReader = new ConfigReaderJavaSE("/server"); + + /** Java EE configuration XML element reader. */ + private ConfigReaderJavaEE javaEEReader = new ConfigReaderJavaEE("/server"); + + /** Tools configuration XML element reader. */ + private ConfigReaderTools configReaderTools = new ConfigReaderTools("/server"); + + /** Libraries read from XML file. */ + private List libraries = new LinkedList<>(); + + /** Library ID. */ + private String actualLibID; + + //////////////////////////////////////////////////////////////////////////// + // XML reader methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Provide paths to listen on. + *

+ * Sets readers for server element and it's content. + *

+ * + * @return Paths that the reader listens to. + */ + @Override + public List getPathsToListen() { + ArrayList paths = new ArrayList<>(14); + paths.add(new Path("/server/library", this)); + paths.addAll(classpathReader.getPathsToListen()); + paths.addAll(javadocsReader.getPathsToListen()); + paths.addAll(sourcesReader.getPathsToListen()); + paths.addAll(javaSEReader.getPathsToListen()); + paths.addAll(javaEEReader.getPathsToListen()); + paths.addAll(configReaderTools.getPathsToListen()); + return paths; + } + + /** + * Process attributes from current XML element. + *

+ * + * @param qname Not used. + * @param attributes List of XML attributes. + * @throws SAXException When any problem occurs. + */ + @Override + public void readAttributes(final String qname, + final Attributes attributes) throws SAXException { + actualLibID = attributes.getValue("id"); + } + + /** + * Finish javaee element processing. + *

+ * + * @param qname Current XML element name. + * @throws ServerConfigException when more than one javaee XML elements were found. + */ + @Override + public void endNode(final String qname) throws SAXException { + if ("library".equals(qname)) { + FileSet classpath = new FileSet(classpathReader.getPaths(), + classpathReader.getFilesets()); + FileSet javadocs = new FileSet(javadocsReader.getPaths(), + javadocsReader.getLinks(), + javadocsReader.getFilesets(), + javadocsReader.getLookups()); + FileSet sources = new FileSet(sourcesReader.getPaths(), + sourcesReader.getFilesets()); + LibraryNode config = new LibraryNode(actualLibID, classpath, + javadocs, + sources); + libraries.add(config); + actualLibID = null; + classpathReader.reset(); + javadocsReader.reset(); + sourcesReader.reset(); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get libraries read from XML file. + *

+ * + * @return Libraries read from XML file. + */ + public List getLibraries() { + return libraries; + } + + /** + * Get JavaEE set for Payara features configuration read from XML. + *

+ * + * @return JavaEE set for Payara features configuration read from XML. + */ + public JavaEESet getJavaEE() { + return javaEEReader.javaEE; + } + + /** + * Get JavaSE set for Payara features configuration read from XML. + *

+ * + * @return JavaSE set for Payara features configuration read from XML. + */ + public JavaSESet getJavaSE() { + return javaSEReader.javaSE; + } + + /** + * Get Payara tools configuration read from XML. + *

+ * + * @return Payara tools configuration read from XML. + */ + public Tools getTools() { + return configReaderTools.tools; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderSources.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderSources.java new file mode 100644 index 00000000..63ac2407 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderSources.java @@ -0,0 +1,52 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.LinkedList; +import java.util.List; + +/** + * sources library configuration XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class ConfigReaderSources extends ConfigReader { + + //////////////////////////////////////////////////////////////////////////// + // XML reader methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Provide paths to listen on. + *

+ * Sets readers for internal javadocs elements. + *

+ * + * @return Paths that the reader listens to. + */ + @Override + public List getPathsToListen() { + LinkedList paths = new LinkedList<>(); + paths.add(new TreeParser.Path("/server/library/sources/file", pathReader)); + paths.add(new TreeParser.Path("/server/library/sources/fileset", filesetReader)); + return paths; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderTools.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderTools.java new file mode 100644 index 00000000..9e9966d9 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderTools.java @@ -0,0 +1,173 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.LinkedList; +import java.util.List; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +import fish.payara.eclipse.tools.server.sdk.server.config.AsadminTool; +import fish.payara.eclipse.tools.server.sdk.server.config.ServerConfigException; +import fish.payara.eclipse.tools.server.sdk.server.config.Tools; + +/** + * Tools configuration XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class ConfigReaderTools extends AbstractReader implements XMLReader { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** tools XML element name. */ + static final String NODE = "tools"; + + /** lib XML element attribute name. */ + private static final String LIB_ATTR = "lib"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Tools library directory (relative under GlassFish home). */ + private String lib; + + /** asadmin XML element reader. */ + private final ToolsAsadminReader toolsAsadminReader; + + /** Tools configuration read from XML. */ + Tools tools; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of tools configuration XML element reader. + *

+ * + * @param pathPrefix Tree parser path prefix to be prepended before current XML element. + */ + ConfigReaderTools(final String pathPrefix) { + super(pathPrefix, NODE); + toolsAsadminReader = new ToolsAsadminReader(path); + lib = null; + tools = null; + } + + //////////////////////////////////////////////////////////////////////////// + // XML reader methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Provide paths to listen on. + *

+ * Sets readers for tools element and it's content. + *

+ * + * @return Paths that the reader listens to. + */ + @Override + public List getPathsToListen() { + LinkedList paths = new LinkedList<>(); + paths.add(new TreeParser.Path(path, this)); + paths.add(new TreeParser.Path( + toolsAsadminReader.getPath(), toolsAsadminReader)); + return paths; + } + + //////////////////////////////////////////////////////////////////////////// + // Tree parser methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Process attributes from current XML element. + *

+ * + * @param qname Not used. + * @param attributes List of XML attributes. + * @throws SAXException When any problem occurs. + */ + @Override + public void readAttributes(final String qname, final Attributes attributes) + throws SAXException { + lib = attributes.getValue(LIB_ATTR); + } + + /** + * Finish tools element processing. + *

+ * + * @param qname Current XML element name. + * @throws ServerConfigException when more than one tools XML elements were found. + */ + @Override + public void endNode(final String qname) throws SAXException { + if (NODE.equals(qname)) { + if (tools != null) { + throw new SAXException( + "Multiple " + NODE + " XML element is not allowed."); + } + tools = new Tools(new AsadminTool(getLib(), getJar())); + reset(); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get tools library directory (relative under GlassFish home). + *

+ * + * @return Tools library directory (relative under GlassFish home). + */ + String getLib() { + return lib; + } + + /** + * Get asadmin tool JAR. + *

+ * + * @return Asadmin tool JAR. + */ + String getJar() { + return toolsAsadminReader.getJar(); + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Reset this XML element reader. + */ + void reset() { + lib = null; + toolsAsadminReader.reset(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/FilesetReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/FilesetReader.java new file mode 100644 index 00000000..adc00f09 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/FilesetReader.java @@ -0,0 +1,109 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * fileset library configuration XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class FilesetReader extends TreeParser.NodeListener { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** File sets retrieved from XML elements. */ + private Map> filesets = new HashMap<>(); + + /** File set being actually processed. */ + private List actualFileset = null; + + //////////////////////////////////////////////////////////////////////////// + // Tree parser methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Process attributes from current XML element. + *

+ * + * @param qname Not used. + * @param attributes List of XML attributes. + * @throws SAXException When any problem occurs. + */ + @Override + public void readAttributes(final String qname, final Attributes attributes) + throws SAXException { + String dirName = attributes.getValue("dir"); + if ((actualFileset = filesets.get(dirName)) == null) { + actualFileset = new ArrayList<>(); + filesets.put(dirName, actualFileset); + } + } + + /** + * Process child elements from current XML element. + *

+ * + * @param qname Not used. + * @param attributes List of XML attributes. + * @throws SAXException When any problem occurs. + */ + @Override + public void readChildren(final String qname, final Attributes attributes) + throws SAXException { + actualFileset.add(attributes.getValue("name")); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get file sets retrieved from XML elements. + *

+ * + * @return File sets retrieved from XML elements. + */ + public Map> getFilesets() { + return filesets; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Reset this XML element reader. + */ + public void reset() { + filesets = new HashMap<>(); + actualFileset = null; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/HttpData.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/HttpData.java new file mode 100644 index 00000000..75d9daab --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/HttpData.java @@ -0,0 +1,55 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +/** + * Data holder for port informations from domain.xml. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class HttpData { + + private final String id; + private final int port; + private final boolean secure; + + public HttpData(String id, int port, boolean secure) { + this.id = id; + this.port = port; + this.secure = secure; + } + + public String getId() { + return id; + } + + public int getPort() { + return port; + } + + public boolean isSecure() { + return secure; + } + + @Override + public String toString() { + return "{ " + id + ", " + port + ", " + secure + " }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/HttpListenerReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/HttpListenerReader.java new file mode 100644 index 00000000..055aae18 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/HttpListenerReader.java @@ -0,0 +1,109 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.server.parser.TreeParser.Path; + +/** + * Reads configuration of http listeners from domain.xml. For each http listener returns one + * {@link HttpData} object that contains name of listener, port number and information whether this + * listener is secured. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class HttpListenerReader extends TargetConfigReader implements XMLReader { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(HttpListenerReader.class); + + public static final String DEFAULT_PATH = "/domain/configs/config/http-service/http-listener"; + + private String path; + + private Map result; + + public HttpListenerReader(String targetConfigName) { + this(DEFAULT_PATH, targetConfigName); + } + + public HttpListenerReader(String path, String targetConfigName) { + super(targetConfigName); + this.path = path; + this.result = new HashMap<>(); + } + + @Override + public void readAttributes(String qname, Attributes attributes) throws SAXException { + final String METHOD = "readAttributes"; + // + if (readData) { + try { + String id = attributes.getValue("id"); + if (id != null && id.length() > 0) { + int port = Integer.parseInt(attributes.getValue("port")); + boolean secure = Boolean.TRUE.toString().equals(attributes.getValue("security-enabled")); + boolean enabled = !Boolean.FALSE.toString().equals(attributes.getValue("enabled")); + LOGGER.log(Level.INFO, METHOD, "port", new Object[] { + Integer.toString(port), Boolean.toString(enabled), + Boolean.toString(secure) }); + if (enabled) { + HttpData data = new HttpData(id, port, secure); + LOGGER.log(Level.INFO, METHOD, "add", data); + result.put(id, data); + } + } else { + LOGGER.log(Level.INFO, METHOD, "noName"); + } + } catch (NumberFormatException ex) { + LOGGER.log(Level.SEVERE, METHOD, "numberFormat", ex); + } + } + } + + @Override + public List getPathsToListen() { + LinkedList paths = new LinkedList<>(); + paths.add(new Path(path, this)); + paths.add(new Path(CONFIG_PATH, new TargetConfigMarker())); + return paths; + } + + public Map getResult() { + return result; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEModuleReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEModuleReader.java new file mode 100644 index 00000000..dc61fe91 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEModuleReader.java @@ -0,0 +1,162 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.LinkedList; +import java.util.List; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +import fish.payara.eclipse.tools.server.sdk.server.config.ServerConfigException; + +/** + * module Java EE configuration XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class JavaEEModuleReader extends AbstractReader { + + //////////////////////////////////////////////////////////////////////////// + // Inner classes // + //////////////////////////////////////////////////////////////////////////// + + /** Java EE module values from XML element. */ + public class Module { + + /** Java EE module type. */ + final String type; + + /** Java EE module check reference. */ + final String check; + + /** + * Creates an instance of Java EE module values from XML element. + *

+ * + * @param type Java EE module type. + * @param check Java EE module check reference. + */ + Module(final String type, final String check) { + this.type = type; + this.check = check; + } + + /** + * Get Java EE module type. + *

+ * + * @return Java EE module type. + */ + public String getType() { + return type; + } + + /** + * Get Java EE module check reference. + *

+ * + * @return Java EE module check reference. + */ + public String getCheck() { + return check; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** javaee XML element name. */ + private static final String NODE = "module"; + + /** type XML element attribute name. */ + private static final String TYPE_ATTR = "type"; + + /** check XML element attribute name. */ + private static final String CHECK_ATTR = "check"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Modules retrieved from XML elements. */ + private List modules; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of module Java EE configuration XML element reader. + *

+ * + * @param pathPrefix Tree parser path prefix to be prepended before current XML element. + */ + JavaEEModuleReader(final String pathPrefix) throws ServerConfigException { + super(pathPrefix, NODE); + modules = new LinkedList<>(); + } + + //////////////////////////////////////////////////////////////////////////// + // Tree parser methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Process attributes from current XML element. + *

+ * + * @param qname Not used. + * @param attributes List of XML attributes. + * @throws SAXException When any problem occurs. + */ + @Override + public void readAttributes(final String qname, final Attributes attributes) + throws SAXException { + modules.add(new Module(attributes.getValue(TYPE_ATTR), + attributes.getValue(CHECK_ATTR))); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get modules retrieved from XML elements. + *

+ * + * @return Modules retrieved from XML elements. + */ + public List getModules() { + return modules; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Reset this XML element reader. + */ + public void reset() { + modules = new LinkedList<>(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEProfileCheckReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEProfileCheckReader.java new file mode 100644 index 00000000..2ea5911b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEProfileCheckReader.java @@ -0,0 +1,218 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.LinkedList; +import java.util.List; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +import fish.payara.eclipse.tools.server.sdk.server.config.ServerConfigException; + +/** + * Java EE platform check configuration XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class JavaEEProfileCheckReader + extends AbstractReader implements XMLReader { + + //////////////////////////////////////////////////////////////////////////// + // Inner classes // + //////////////////////////////////////////////////////////////////////////// + + /** Java EE platform check values from XML element. */ + public class Check { + + /** Java EE platform check name (unique ID). */ + final String name; + + /** Java EE platform check files. */ + List files; + + /** + * Creates an instance of Java EE platform check values from XML element. + *

+ * Internal file list to check is initialized as an empty list. + *

+ * + * @param name Java EE platform check name (unique ID). + */ + Check(final String name) { + this.name = name; + this.files = null; + } + + /** + * Set Java EE platform check files. + *

+ * + * @param files Java EE platform check files. + */ + void setFiles(final List files) { + this.files = files; + } + + /** + * Get Java EE platform check name (unique ID). + *

+ * + * @return Java EE platform check name (unique ID). + */ + public String getName() { + return name; + } + + /** + * Get Java EE platform check files. + *

+ * + * @return Java EE platform check files. + */ + public List getFiles() { + return files; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** check XML element name. */ + static final String NODE = "check"; + + /** name XML element attribute name. */ + private static final String NAME_ATTR = "name"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Java EE platform check value from XML element. */ + Check currentCheck; + + /** All Java EE platform check values from XML elements on this level. */ + List checks; + + /** file XML element reader. */ + final PathReader pathReader; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of Java EE platform check configuration XML element reader. + *

+ * + * @param pathPrefix Tree parser path prefix to be prepended before current XML element. + */ + JavaEEProfileCheckReader(final String pathPrefix) { + super(pathPrefix, NODE); + pathReader = new PathReader(path); + checks = new LinkedList<>(); + currentCheck = null; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get all Java EE platform check values from XML elements on this level. + *

+ * + * @return All Java EE platform check values from XML elements on this level. + */ + List getChecks() { + return checks; + } + + //////////////////////////////////////////////////////////////////////////// + // XML reader methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Provide paths to listen on. + *

+ * Sets readers for javaee element and it's content. + *

+ * + * @return Paths that the reader listens to. + */ + @Override + public List getPathsToListen() { + LinkedList paths = new LinkedList<>(); + paths.add(new TreeParser.Path(path, this)); + paths.add(new TreeParser.Path(pathReader.getPath(), pathReader)); + return paths; + } + + /** + * Process attributes from current XML element. + *

+ * + * @param qname Not used. + * @param attributes List of XML attributes. + * @throws SAXException When any problem occurs. + */ + @Override + public void readAttributes(final String qname, final Attributes attributes) + throws SAXException { + currentCheck = new Check(attributes.getValue(NAME_ATTR)); + } + + /** + * Finish javaee element processing. + *

+ * + * @param qname Current XML element name. + * @throws ServerConfigException when more than one javaee XML elements were found. + */ + @Override + public void endNode(final String qname) throws SAXException { + if (NODE.equals(qname)) { + currentCheck.setFiles(pathReader.getPaths()); + checks.add(currentCheck); + localReset(); + } + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Reset this XML element reader to allow reading of next element on the same level. + */ + private void localReset() { + currentCheck = null; + pathReader.reset(); + } + + /** + * Full reset of XML element reader. + */ + public void reset() { + localReset(); + checks = new LinkedList<>(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEProfileReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEProfileReader.java new file mode 100644 index 00000000..6ccd222a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEProfileReader.java @@ -0,0 +1,181 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.LinkedList; +import java.util.List; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +import fish.payara.eclipse.tools.server.sdk.server.config.ServerConfigException; + +/** + * profile Java EE configuration XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class JavaEEProfileReader extends AbstractReader { + + //////////////////////////////////////////////////////////////////////////// + // Inner classes // + //////////////////////////////////////////////////////////////////////////// + + /** Java EE profile values from XML element. */ + public class Profile { + + /** Java EE profile version. */ + final String version; + + /** Java EE profile type. */ + final String type; + + /** Java EE profile check reference. */ + final String check; + + /** + * Creates an instance of Java EE profile values from XML element. + *

+ * + * @param version Java EE profile version. + * @param type Java EE profile type. + * @param check Java EE profile check reference. + */ + Profile(final String version, final String type, final String check) { + this.version = version; + this.type = type; + this.check = check; + } + + /** + * Get Java EE profile version. + *

+ * + * @return Java EE profile version. + */ + public String getVersion() { + return version; + } + + /** + * Get Java EE profile type. + *

+ * + * @return Java EE profile type. + */ + public String getType() { + return type; + } + + /** + * Get Java EE profile check reference. + *

+ * + * @return Java EE profile check reference. + */ + public String getCheck() { + return check; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** javaee XML element name. */ + private static final String NODE = "profile"; + + /** version XML element attribute name. */ + private static final String VERSION_ATTR = "version"; + + /** type XML element attribute name. */ + private static final String TYPE_ATTR = "type"; + + /** check XML element attribute name. */ + private static final String CHECK_ATTR = "check"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Profiles retrieved from XML elements. */ + private List profiles; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of profile Java EE configuration XML element reader. + *

+ * + * @param pathPrefix Tree parser path prefix to be prepended before current XML element. + */ + JavaEEProfileReader(final String pathPrefix) throws ServerConfigException { + super(pathPrefix, NODE); + profiles = new LinkedList<>(); + } + + //////////////////////////////////////////////////////////////////////////// + // Tree parser methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Process attributes from current XML element. + *

+ * + * @param qname Not used. + * @param attributes List of XML attributes. + * @throws SAXException When any problem occurs. + */ + @Override + public void readAttributes(final String qname, final Attributes attributes) + throws SAXException { + profiles.add(new Profile(attributes.getValue(VERSION_ATTR), + attributes.getValue(TYPE_ATTR), + attributes.getValue(CHECK_ATTR))); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get profiles retrieved from XML elements. + *

+ * + * @return Profiles retrieved from XML elements. + */ + public List getProfiles() { + return profiles; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Reset this XML element reader. + */ + public void reset() { + profiles = new LinkedList<>(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaSEPlatformReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaSEPlatformReader.java new file mode 100644 index 00000000..665e07e1 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaSEPlatformReader.java @@ -0,0 +1,112 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.LinkedList; +import java.util.List; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +import fish.payara.eclipse.tools.server.sdk.server.config.ServerConfigException; + +/** + * platform Java SE configuration XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class JavaSEPlatformReader extends AbstractReader { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** platform XML element name. */ + private static final String NODE = "platform"; + + /** type XML element attribute name. */ + private static final String VERSION_ATTR = "version"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Platforms retrieved from XML elements. */ + private List platforms; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of platform Java EE configuration XML element reader. + *

+ * + * @param pathPrefix Tree parser path prefix to be prepended before current XML element. + */ + JavaSEPlatformReader(final String pathPrefix) throws ServerConfigException { + super(pathPrefix, NODE); + platforms = new LinkedList<>(); + } + + //////////////////////////////////////////////////////////////////////////// + // Tree parser methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Process attributes from current XML element. + *

+ * + * @param qname Not used. + * @param attributes List of XML attributes. + * @throws SAXException When any problem occurs. + */ + @Override + public void readAttributes(final String qname, final Attributes attributes) + throws SAXException { + platforms.add(attributes.getValue(VERSION_ATTR)); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get platforms retrieved from XML elements. + *

+ * + * @return Platforms retrieved from XML elements. + */ + public List getPlatforms() { + return platforms; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Reset this XML element reader. + */ + public void reset() { + platforms = new LinkedList<>(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JmxConnectorReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JmxConnectorReader.java new file mode 100644 index 00000000..845c9f9b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JmxConnectorReader.java @@ -0,0 +1,93 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.LinkedList; +import java.util.List; +import java.util.logging.Level; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.server.parser.TreeParser.Path; + +/** + * Reader for jmx connector port number as string from domain.xml. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class JmxConnectorReader extends TargetConfigReader implements XMLReader { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(JmxConnectorReader.class); + + public static final String DEFAULT_PATH = "/domain/configs/config/admin-service/jmx-connector"; + + private String path; + + private String result; + + public JmxConnectorReader(String path, String targetConfigName) { + super(targetConfigName); + this.path = path; + } + + public JmxConnectorReader(String targetConfigName) { + this(DEFAULT_PATH, targetConfigName); + } + + @Override + public void readAttributes(String qname, Attributes attributes) + throws SAXException { + final String METHOD = "getServerConfig"; + /* + * + */ + if (readData) { + String jmxAttr = attributes.getValue("port"); + try { + int port = Integer.parseInt(jmxAttr); + result = "" + port; //$NON-NLS-1$ + LOGGER.log(Level.INFO, METHOD, "port", result); + } catch (NumberFormatException ex) { + LOGGER.log(Level.SEVERE, METHOD, "error", ex); + } + } + + } + + @Override + public List getPathsToListen() { + LinkedList paths = new LinkedList<>(); + paths.add(new Path(path, this)); + paths.add(new Path(CONFIG_PATH, new TargetConfigMarker())); + return paths; + } + + public String getResult() { + return result; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JvmConfigReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JvmConfigReader.java new file mode 100644 index 00000000..c9959944 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JvmConfigReader.java @@ -0,0 +1,286 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +import fish.payara.eclipse.tools.server.sdk.server.JDK; +import fish.payara.eclipse.tools.server.sdk.server.parser.TreeParser.NodeListener; +import fish.payara.eclipse.tools.server.sdk.server.parser.TreeParser.Path; + +public class JvmConfigReader extends NodeListener implements XMLReader { + + private static String JVM_OPTIONS_TAG = "jvm-options"; + + private String serverName; + /** + * Holds all values found in tags + */ + private List jvmOptions = new ArrayList<>(); + /** + * Holds all key-value pairs representing attributes of jvm-config tag. These are used for computing + * the classpath. + */ + private HashMap propMap = new HashMap<>(); + private boolean isMonitoringEnabled = false; + private String serverConfigName; + private boolean readConfig = false; + private StringBuilder b = new StringBuilder(); + + public JvmConfigReader(String serverName) { + this.serverName = serverName; + } + + public TreeParser.NodeListener getServerFinder() { + return new TreeParser.NodeListener() { + + @Override + public void readAttributes(String qname, Attributes attributes) throws SAXException { + // + if (serverConfigName == null || serverConfigName.length() == 0) { + if (serverName.equals(attributes.getValue("name"))) { // NOI18N + serverConfigName = attributes.getValue("config-ref"); // NOI18N + // Logger.getLogger("glassfish").finer("DOMAIN.XML: Server profile defined by " + serverConfigName); + // // NOI18N + } + } + } + }; + } + + public TreeParser.NodeListener getConfigFinder() { + return new TreeParser.NodeListener() { + + @Override + public void readAttributes(String qname, Attributes attributes) throws SAXException { + // + if (serverConfigName != null && serverConfigName.equals(attributes.getValue("name"))) { // NOI18N + readConfig = true; + // Logger.getLogger("glassfish").finer("DOMAIN.XML: Reading JVM options from server profile " + + // serverConfigName); // NOI18N + } + } + + @Override + public void endNode(String qname) throws SAXException { + if ("config".equals(qname)) { + readConfig = false; + } + } + }; + } + + @Override + public void readAttributes(String qname, Attributes attributes) throws SAXException { + // + if (readConfig) { + int attrLen = attributes.getLength(); + for (int i = 0; i < attrLen; i++) { + String name = attributes.getLocalName(i); + // seems that sometimes from uknown reasons + // getLocalName returns empty string... + if ((name == null) || name.isEmpty()) { + name = attributes.getQName(i); + } + String value = attributes.getValue(i); + if (name != null && name.length() > 0 && value != null && value.length() > 0) { + propMap.put(name, value); + } + } + } + } + + @Override + public void readCData(String qname, char[] ch, int start, int length) throws SAXException { + // -client + // -Djava.endorsed.dirs=${com.sun.aas.installRoot}/lib/endorsed + if (readConfig && JVM_OPTIONS_TAG.equals(qname)) { + b.append(ch, start, length); + } + } + + @Override + public void endNode(String qname) throws SAXException { + if (readConfig && JVM_OPTIONS_TAG.equals(qname)) { + jvmOptions.add(new JvmOption(b.toString())); + b.delete(0, b.length()); + } + } + + public TreeParser.NodeListener getMonitoringFinder() { + return new TreeParser.NodeListener() { + + @Override + public void readAttributes(String qname, Attributes attributes) throws SAXException { + // getPathsToListen() { + LinkedList paths = new LinkedList<>(); + paths.add(new Path("/domain/servers/server", getServerFinder())); + paths.add(new Path("/domain/configs/config", getConfigFinder())); + paths.add(new Path("/domain/configs/config/java-config", this)); + paths.add(new Path("/domain/configs/config/monitoring-service", getMonitoringFinder())); + return paths; + } + + public List getJvmOptions() { + return jvmOptions; + } + + public Map getPropMap() { + return propMap; + } + + public boolean isMonitoringEnabled() { + return isMonitoringEnabled; + } + + public static class JvmOption { + + public final String option; + public final Optional vendor; + public final Optional minVersion; + public final Optional maxVersion; + + // splits the versioned JVM option pattern into three groups: + // Gr1 Gr2 Gr3 + // <> <> <------------> + // Ex: [1.7|1.8]-XX:MyJvmOption (both min and max version present) + // Below examples have missing verisions, with is also OK + // Ex: [|1.8]-XX:MyJvmOption (only max version present) + // Ex: [1.7|]-XX:MyJvmOption (only min version present) + // Gr1 or Gr2 can be null (optional) + private static final Pattern PATTERN = Pattern.compile("^\\[(.*)\\|(.*)\\](.*)"); + + public JvmOption(String option) { + Matcher matcher = PATTERN.matcher(option); + if (matcher.matches()) { + if (matcher.group(1).contains("-") + && Character.isLetter(matcher.group(1).charAt(0))) { + String[] parts = matcher.group(1).split("-"); + this.vendor = Optional.ofNullable(parts[0]); + this.minVersion = Optional.ofNullable(JDK.getVersion(parts[1])); + } else { + this.vendor = Optional.empty(); + this.minVersion = Optional.ofNullable(JDK.getVersion(matcher.group(1))); + } + this.maxVersion = Optional.ofNullable(JDK.getVersion(matcher.group(2))); + this.option = matcher.group(3); + } else { + this.option = option; + this.vendor = Optional.empty(); + this.minVersion = Optional.empty(); + this.maxVersion = Optional.empty(); + } + } + + public JvmOption(String option, String minVersion, String maxVersion) { + this.option = option; + this.vendor = Optional.empty(); + this.minVersion = Optional.ofNullable(JDK.getVersion(minVersion)); + this.maxVersion = Optional.ofNullable(JDK.getVersion(maxVersion)); + } + + public static boolean hasVersionPattern(String option) { + return PATTERN.matcher(option).matches(); + } + + @Override + public int hashCode() { + int hash = 7; + hash = 79 * hash + Objects.hashCode(this.option); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if ((obj == null) || (getClass() != obj.getClass())) { + return false; + } + final JvmOption other = (JvmOption) obj; + if (!Objects.equals(this.option, other.option)) { + return false; + } + return true; + } + + @Override + public String toString() { + if (!minVersion.isPresent() && !maxVersion.isPresent()) { + return option; + } + return String.format("[%s|%s]%s", minVersion.isPresent() ? minVersion.get() : "", maxVersion.isPresent() ? maxVersion.get() : "", option); + } + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LinkReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LinkReader.java new file mode 100644 index 00000000..1f72df3a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LinkReader.java @@ -0,0 +1,85 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.LinkedList; +import java.util.List; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * link library configuration XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class LinkReader extends TreeParser.NodeListener { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Links retrieved from XML elements. */ + private List links = new LinkedList<>(); + + //////////////////////////////////////////////////////////////////////////// + // Tree parser methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Process attributes from current XML element. + *

+ * + * @param qname Not used. + * @param attributes List of XML attributes. + * @throws SAXException When any problem occurs. + */ + @Override + public void readAttributes(final String qname, final Attributes attributes) + throws SAXException { + links.add(attributes.getValue("url")); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get links retrieved from XML elements. + *

+ * + * @return Links sets retrieved from XML elements. + */ + public List getLinks() { + return links; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Reset this XML element reader. + */ + public void reset() { + links = new LinkedList<>(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LogMessages.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LogMessages.properties new file mode 100644 index 00000000..eaf93e35 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LogMessages.properties @@ -0,0 +1,41 @@ +################################################################################ +# Log messages # +# Use .. notation for keys. # +################################################################################ + +# HttpListenerReader class +HttpListenerReader.readAttributes.port=HTTP listener port {0} enabled {1} \ +secure-enabled {2}. +HttpListenerReader.readAttributes.add=Adding {0}. +HttpListenerReader.readAttributes.noName=HTTP listener found with no name. +HttpListenerReader.readAttributes.numberFormat=Error reading HTTP listener: + +# JmxConnectorReader class +JmxConnectorReader.getServerConfig.port=JMX port {0} +JmxConnectorReader.getServerConfig.error=Error reading JMX port: + +# NetworkListenerReader class +NetworkListenerReader.readAttributes.port=Network listener port {0} \ +enabled {1} secure-enabled {2}. +NetworkListenerReader.readAttributes.add=Adding {0}. +NetworkListenerReader.readAttributes.noName=Network listener found with no name. +NetworkListenerReader.readAttributes..numberFormat=Error reading network \ +listener: + +# TreeParser class +TreeParser.readXml.cantClose=Cannot close XML file input stream: +TreeParser.startElement.skipReading=Skip reading {0}. +TreeParser.startElement.skipDescend=Skip descend, depth is {0}, qn is {1}. +TreeParser.startElement.roverDescend=Rover descend to {0}. +TreeParser.startElement.roverEnter=Rover enter and read node {0}. +TreeParser.startElement.skipStart=Skip start, depth is {0}, qn is {1}. +TreeParser.endElement.doesNotMatch=Skip {0} does not match {1} at depth {2}. +TreeParser.endElement.skipAscend=Skip ascend, depth is {0}. +TreeParser.endElement.roverEnter=Rover exit and read node {0}. +TreeParser.endElement.roverAscend=Rover ascend to {0}. +TreeParser.buildTree.invalidNoParts=Invalid entry, no parts, skipping {0}. +TreeParser.buildTree.invalidNullRoot=Invalid entry, null root, skipping {0}. +TreeParser.buildTree.createdRootNode=Created root node {0}. +TreeParser.buildTree.existing=Existing node {0} at level {1}. +TreeParser.buildTree.add=Adding node {0} at level {1}. +TreeParser.buildTree.broken=Broken parts found in {0} at level {1}. diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LookupReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LookupReader.java new file mode 100644 index 00000000..e5aa09ab --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LookupReader.java @@ -0,0 +1,85 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.LinkedList; +import java.util.List; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * lookup library configuration XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class LookupReader extends TreeParser.NodeListener { + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Lookups retrieved from XML elements. */ + private List lookups = new LinkedList<>(); + + //////////////////////////////////////////////////////////////////////////// + // Tree parser methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Process attributes from current XML element. + *

+ * + * @param qname Not used. + * @param attributes List of XML attributes. + * @throws SAXException When any problem occurs. + */ + @Override + public void readAttributes(final String qname, final Attributes attributes) + throws SAXException { + lookups.add(attributes.getValue("path")); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get lookups retrieved from XML elements. + *

+ * + * @return Links sets retrieved from XML elements. + */ + public List getLookups() { + return lookups; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Reset this XML element reader. + */ + public void reset() { + lookups = new LinkedList<>(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/NetworkListenerReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/NetworkListenerReader.java new file mode 100644 index 00000000..2ad5d2cc --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/NetworkListenerReader.java @@ -0,0 +1,120 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.server.parser.TreeParser.Path; + +/** + * Reads configuration of network listeners. For each listener returns one {@link HttpData} object + * that contains port number, protocol and information whether this protocol is secured. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class NetworkListenerReader extends TargetConfigReader implements + XMLReader { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(NetworkListenerReader.class); + + public static final String DEFAULT_PATH = "/domain/configs/config/network-config/network-listeners/network-listener"; + + private String path; + + private Map result; + + public NetworkListenerReader(String targetConfigName) { + this(DEFAULT_PATH, targetConfigName); + } + + public NetworkListenerReader(String path, String targetConfigName) { + super(targetConfigName); + this.path = path; + this.result = new HashMap<>(); + } + + @Override + public void readAttributes(String qname, Attributes attributes) throws SAXException { + final String METHOD = "readAttributes"; + /* + * + */ + if (readData) { + try { + String id = attributes.getValue("name"); + if (id != null && id.length() > 0) { + + if (attributes.getValue("port").startsWith("$")) { // GlassFish v3.1 : ignore these template entries + return; + } + int port = Integer.parseInt(attributes.getValue("port")); + boolean secure = "true".equals(attributes.getValue( + "security-enabled")); + boolean enabled = !"false".equals(attributes.getValue( + "enabled")); + LOGGER.log(Level.INFO, METHOD, "port", new Object[] { + Integer.toString(port), Boolean.toString(enabled), + Boolean.toString(secure) }); + if (enabled) { + HttpData data = new HttpData(id, port, secure); + LOGGER.log(Level.INFO, METHOD, "add", data); + result.put(id, data); + } + } else { + LOGGER.log(Level.INFO, METHOD, "noName"); + } + } catch (NumberFormatException ex) { + LOGGER.log(Level.SEVERE, METHOD, "numberFormat", ex); + } + } + } + + @Override + public List getPathsToListen() { + LinkedList paths = new LinkedList<>(); + paths.add(new Path(path, this)); + paths.add(new Path(CONFIG_PATH, new TargetConfigMarker())); + return paths; + } + + public Map getResult() { + return result; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/PathReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/PathReader.java new file mode 100644 index 00000000..cb509ae8 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/PathReader.java @@ -0,0 +1,106 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.LinkedList; +import java.util.List; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +/** + * file library configuration XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class PathReader extends AbstractReader { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** file XML element name. */ + static final String NODE = "file"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Paths retrieved from XML elements. */ + private List paths = new LinkedList<>(); + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of Java EE platform check configuration XML element reader. + *

+ * + * @param pathPrefix Tree parser path prefix to be prepended before current XML element. + */ + PathReader(final String pathPrefix) { + super(pathPrefix, NODE); + } + + //////////////////////////////////////////////////////////////////////////// + // Tree parser methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Process attributes from current XML element. + *

+ * + * @param qname Not used. + * @param attributes List of XML attributes. + * @throws SAXException When any problem occurs. + */ + @Override + public void readAttributes(final String qname, final Attributes attributes) + throws SAXException { + paths.add(attributes.getValue("path")); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get paths retrieved from XML elements. + *

+ * + * @return Paths sets retrieved from XML elements. + */ + public List getPaths() { + return paths; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Reset this XML element reader. + */ + public void reset() { + paths = new LinkedList<>(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ResourcesReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ResourcesReader.java new file mode 100644 index 00000000..3e290ac8 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ResourcesReader.java @@ -0,0 +1,126 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +import fish.payara.eclipse.tools.server.sdk.server.parser.TreeParser.NodeListener; +import fish.payara.eclipse.tools.server.sdk.server.parser.TreeParser.Path; + +/** + * Reads resources from domain.xml. User has to specify an {@link ResourceType} which specifies path + * and name of attribute value of which will be the key in returned map. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class ResourcesReader extends NodeListener implements + XMLReader { + + /** + * Paths and key names for various resource types. + */ + public enum ResourceType { + + JDBC_RESOURCE("/resources/jdbc-resource", "jndi-name"), JDBC_CONNECTION_POOL("/resources/jdbc-connection-pool", "name"), JAVA_MAIL( + "/resources/mail-resource", "jndi-name"), CONNECTOR_RESOURCE("/resources/connector-resource", "jndi-name"), CONNECTOR_POOL( + "/resources/connector-connection-pool", + "name"), ADMIN_OBJECT_RESOURCE("/resources/admin-object-resource", "jndi-name"); + + private String defaultKeyName; + + private String defaultPath; + + private ResourceType(String defaultPath, String defaultKeyName) { + this.defaultPath = defaultPath; + this.defaultKeyName = defaultKeyName; + } + + public String getDefaultPath() { + return defaultPath; + } + + public String getDefaultKeyName() { + return defaultKeyName; + } + } + + private String path; + + private String keyName; + + private Map properties = null; + + private Map> resourceData = new HashMap<>(); + + public ResourcesReader(ResourceType type) { + this(type.getDefaultPath(), type.getDefaultKeyName()); + } + + public ResourcesReader(String path, String keyName) { + this.path = path; + this.keyName = keyName; + } + + @Override + public void readAttributes(String qname, Attributes attributes) throws SAXException { + properties = new HashMap<>(); + + String resourceName = attributes.getValue(keyName); + properties.put(keyName, resourceName); + + int attrLen = attributes.getLength(); + for (int i = 0; i < attrLen; i++) { + String name = attributes.getQName(i); + String value = attributes.getValue(i); + if (name != null && name.length() > 0 && value != null && value.length() > 0) { + properties.put(name, value); + } + } + } + + @Override + public void readChildren(String qname, Attributes attributes) throws SAXException { + String propName = qname + "." + attributes.getValue("name"); //$NON-NLS-1$ //$NON-NLS-2$ + properties.put(propName, attributes.getValue("value")); //$NON-NLS-1$ + } + + @Override + public void endNode(String qname) throws SAXException { + String poolName = properties.get(keyName); + resourceData.put(poolName, properties); + } + + @Override + public List getPathsToListen() { + LinkedList paths = new LinkedList<>(); + paths.add(new Path(path, this)); + return paths; + } + + public Map> getResourceData() { + return resourceData; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TargetConfigNameReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TargetConfigNameReader.java new file mode 100644 index 00000000..bd42314d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TargetConfigNameReader.java @@ -0,0 +1,71 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.LinkedList; +import java.util.List; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +import fish.payara.eclipse.tools.server.sdk.server.parser.TreeParser.Path; + +/** + * Reads the name of the configuration for given target (server or cluster). TODO now it reads only + * servers and not clusters... + * + * @author Peter Benedikovic, Tomas Kraus + */ +public class TargetConfigNameReader extends TreeParser.NodeListener implements + XMLReader { + + public static final String SERVER_PATH = "/domain/servers/server"; + + public static final String DEFAULT_TARGET = "server"; + + private String targetConfigName = null; + + private String targetName; + + public TargetConfigNameReader() { + this(DEFAULT_TARGET); + } + + public TargetConfigNameReader(String targetName) { + this.targetName = targetName; + } + + public String getTargetConfigName() { + return targetConfigName; + } + + @Override + public void readAttributes(String qname, Attributes attributes) throws SAXException { + if (attributes.getValue("name").equalsIgnoreCase(targetName)) { + targetConfigName = attributes.getValue("config-ref"); + } + } + + @Override + public List getPathsToListen() { + LinkedList paths = new LinkedList<>(); + paths.add(new Path(SERVER_PATH, this)); + return paths; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TargetConfigReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TargetConfigReader.java new file mode 100644 index 00000000..daf4c35d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TargetConfigReader.java @@ -0,0 +1,67 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +import fish.payara.eclipse.tools.server.sdk.server.parser.TreeParser.NodeListener; + +/** + * Marks that the xml parser is currently inside config element with give name. This information is + * used by descendants of this class. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +class TargetConfigReader extends NodeListener { + + public static final String CONFIG_PATH = "/domain/configs/config"; + + public static final String DEFAULT_TARGET = "server"; + + protected static boolean readData = false; + + private String targetConfigName = null; + + public TargetConfigReader(String targetConfigName) { + this.targetConfigName = targetConfigName; + // TODO all parsing has to be rewritten at some point + TargetConfigReader.readData = false; + } + + class TargetConfigMarker extends NodeListener { + + @Override + public void readAttributes(String qname, Attributes attributes) throws SAXException { + if ((targetConfigName != null) && attributes.getValue("name").equalsIgnoreCase(targetConfigName)) { + readData = true; + } + } + + @Override + public void endNode(String qname) throws SAXException { + if ("config".equals(qname)) { + readData = false; + } + } + + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ToolsAsadminReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ToolsAsadminReader.java new file mode 100644 index 00000000..10809c64 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ToolsAsadminReader.java @@ -0,0 +1,109 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; + +import fish.payara.eclipse.tools.server.sdk.server.config.ServerConfigException; + +/** + * asadmin tool configuration XML element reader. + *

+ * + * @author Peter Benedikovic, Tomas Kraus + */ +public class ToolsAsadminReader extends AbstractReader { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** asadmin XML element name. */ + private static final String NODE = "asadmin"; + + /** type XML element attribute name. */ + private static final String JAR_ATTR = "jar"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Platforms retrieved from XML elements. */ + private String jar; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of asadmin tool configuration XML element reader. + *

+ * + * @param pathPrefix Tree parser path prefix to be prepended before current XML element. + */ + ToolsAsadminReader(final String pathPrefix) throws ServerConfigException { + super(pathPrefix, NODE); + jar = null; + } + + //////////////////////////////////////////////////////////////////////////// + // Tree parser methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Process attributes from current XML element. + *

+ * + * @param qname Not used. + * @param attributes List of XML attributes. + * @throws SAXException When any problem occurs. + */ + @Override + public void readAttributes(final String qname, final Attributes attributes) + throws SAXException { + jar = attributes.getValue(JAR_ATTR); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get asadmin tool JAR. + *

+ * + * @return Asadmin tool JAR. + */ + String getJar() { + return jar; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Reset this XML element reader. + */ + void reset() { + jar = null; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TreeParser.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TreeParser.java new file mode 100644 index 00000000..1925e6f7 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TreeParser.java @@ -0,0 +1,460 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringReader; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.xml.sax.Attributes; +import org.xml.sax.EntityResolver; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * SAX parser that invokes a user defined node reader(s) on a list of xpath designated nodes. + *

+ * + * @author Peter Williams + */ +public final class TreeParser extends DefaultHandler { + + /** XML elements path items separator. */ + static final String PATH_SEPARATOR = "/"; + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(TreeParser.class); + + private static final boolean isFinestLoggable = LOGGER.isLoggable( + Level.FINEST); + + private static final boolean isFinerLoggable = LOGGER.isLoggable(Level.FINER); + + /** + * Stops SAX parser from accessing remote DTDs or schemas. + */ + private static final EntityResolver DUMMY_RESOLVER = (string, string1) -> new InputSource(new StringReader("")); + + public static boolean readXml(File xmlFile, XMLReader... pathList) + throws IllegalStateException { + final String METHOD = "readXml"; + boolean result = false; + InputStream is = null; + try { + // !PW FIXME what to do about entity resolvers? Timed out when + // looking up doctype for sun-resources.xml earlier today (Jul 10) + SAXParserFactory factory = SAXParserFactory.newInstance(); + // !PW If namespace-aware is enabled, make sure localpart and + // qname are treated correctly in the handler code. + // + factory.setNamespaceAware(false); + SAXParser saxParser = factory.newSAXParser(); + org.xml.sax.XMLReader reader = saxParser.getXMLReader(); + + reader.setEntityResolver(DUMMY_RESOLVER); + DefaultHandler handler = new TreeParser(pathList); + reader.setContentHandler(handler); + is = new BufferedInputStream(new FileInputStream(xmlFile)); + reader.parse(new InputSource(is)); + result = true; + } catch (ParserConfigurationException | SAXException | IOException ex) { + throw new IllegalStateException(ex); + } finally { + if (is != null) { + try { + is.close(); + } catch (IOException ex) { + LOGGER.log(Level.INFO, METHOD, "cantClose", ex); + } + } + } + return result; + } + + public static boolean readXml(URL xmlFile, XMLReader... pathList) + throws IllegalStateException { + final String METHOD = "readXml"; + boolean result = false; + InputStream is = null; + try { + // !PW FIXME what to do about entity resolvers? Timed out when + // looking up doctype for sun-resources.xml earlier today (Jul 10) + SAXParserFactory factory = SAXParserFactory.newInstance(); + // !PW If namespace-aware is enabled, make sure localpart and + // qname are treated correctly in the handler code. + // + factory.setNamespaceAware(false); + SAXParser saxParser = factory.newSAXParser(); + DefaultHandler handler = new TreeParser(pathList); + is = new BufferedInputStream(xmlFile.openStream()); + saxParser.parse(new InputSource(is), handler); + result = true; + } catch (ParserConfigurationException | SAXException | IOException ex) { + throw new IllegalStateException(ex); + } finally { + if (is != null) { + try { + is.close(); + } catch (IOException ex) { + LOGGER.log(Level.INFO, METHOD, "cantClose", ex); + } + } + } + return result; + } + + // Parser internal state + private final TreeParser.Node root; + + private TreeParser.Node rover; + + // For skipping node blocks + private String skipping; + + private int depth; + + private TreeParser.NodeListener childNodeReader; + + private TreeParser(XMLReader[] readers) { + ArrayList pathList = new ArrayList<>(); + for (XMLReader r : readers) { + pathList.addAll(r.getPathsToListen()); + } + root = buildTree(pathList); + } + + @Override + public void characters(char[] ch, int start, int length) throws SAXException { + if (childNodeReader != null) { + childNodeReader.readCData(skipping, ch, start, length); + } + } + + @Override + public void startElement(String uri, String localname, String qname, + Attributes attributes) throws SAXException { + final String METHOD = "startElement"; + if (skipping != null) { + depth++; + if (childNodeReader != null) { + if (isFinerLoggable) { + LOGGER.log(Level.FINER, METHOD, "skipReading", qname); + } + childNodeReader.readChildren(qname, attributes); + } + if (isFinestLoggable) { + LOGGER.log(Level.FINEST, METHOD, + "skipDescend", new Object[] { depth, qname }); + } + } else { + TreeParser.Node child = rover.findChild(qname); + if (child != null) { + rover = child; + if (isFinerLoggable) { + LOGGER.log(Level.FINER, METHOD, "roverDescend", rover); + } + + TreeParser.NodeListener reader = rover.getReader(); + if (reader != null) { + if (isFinerLoggable) { + LOGGER.log(Level.FINER, METHOD, "roverEnter", qname); + } + reader.readAttributes(qname, attributes); + } + } else { + skipping = qname; + depth = 1; + childNodeReader = rover.getReader(); + if (childNodeReader != null) { + if (isFinerLoggable) { + LOGGER.log(Level.FINER, METHOD, "skipReading", qname); + } + childNodeReader.readChildren(qname, attributes); + } + if (isFinestLoggable) { + LOGGER.log(Level.FINEST, METHOD, + "skipStart", new Object[] { depth, qname }); + } + } + } + } + + @Override + public void endElement(String uri, String localname, String qname) + throws SAXException { + final String METHOD = "endElement"; + if (skipping != null) { + if (childNodeReader != null) { + childNodeReader.endNode(qname); + } + if (--depth == 0) { + if (!skipping.equals(qname)) { + LOGGER.log(Level.WARNING, METHOD, "doesNotMatch", + new Object[] { skipping, qname, depth }); + } + skipping = null; + childNodeReader = null; + } + LOGGER.log(Level.FINER, METHOD, "skipAscend", depth); + } else { + TreeParser.NodeListener reader = rover.getReader(); + if (reader != null) { + if (isFinerLoggable) { + LOGGER.log(Level.FINER, METHOD, "roverEnter", qname); + } + reader.endNode(qname); + } + rover = rover.getParent(); + if (isFinerLoggable) { + LOGGER.log(Level.FINER, METHOD, "roverAscend", rover); + } + } + } + + @Override + public void startDocument() throws SAXException { + rover = root; + skipping = null; + depth = 0; + } + + @Override + public void endDocument() throws SAXException { + } + + @Override + public InputSource resolveEntity(String string, String string1) throws IOException, + SAXException { + return super.resolveEntity(string, string1); + } + + public static abstract class NodeListener { + + public void readAttributes(String qname, Attributes attributes) throws SAXException { + } + + public void readChildren(String qname, Attributes attributes) throws SAXException { + } + + public void readCData(String qname, char[] ch, int start, int length) + throws SAXException { + } + + public void endNode(String qname) throws SAXException { + } + } + + public static class Path { + + private final String path; + + private final TreeParser.NodeListener reader; + + public Path(String path) { + this(path, null); + } + + public Path(String path, TreeParser.NodeListener reader) { + this.path = path; + this.reader = reader; + } + + public String getPath() { + return path; + } + + public TreeParser.NodeListener getReader() { + return reader; + } + + @Override + public String toString() { + return path; + } + } + + private static TreeParser.Node buildTree(List paths) { + final String METHOD = "buildTree"; + TreeParser.Node root = null; + for (TreeParser.Path path : paths) { + String[] parts = path.getPath().split("/"); + if (parts == null || parts.length == 0) { + LOGGER.log(Level.WARNING, METHOD, "invalidNoParts", path); + continue; + } + if (parts[0] == null) { + LOGGER.log(Level.WARNING, METHOD, "invalidNullRoot", path); + continue; + } + if (root == null) { + if (isFinerLoggable) { + LOGGER.log(Level.FINER, METHOD, + "createdRootNode", parts[0]); + } + root = new TreeParser.Node(parts[0]); + } + TreeParser.Node rover = root; + for (int i = 1; i < parts.length; i++) { + if (parts[i] != null && parts[i].length() > 0) { + TreeParser.Node existing = rover.findChild(parts[i]); + if (existing != null) { + if (isFinerLoggable) { + LOGGER.log(Level.FINER, METHOD, "existing", + new Object[] { parts[i], + Integer.toString(i) }); + } + rover = existing; + } else { + if (isFinerLoggable) { + LOGGER.log(Level.FINER, METHOD, "add", + new Object[] { parts[i], + Integer.toString(i) }); + } + rover = rover.addChild(parts[i]); + } + } else { + LOGGER.log(Level.WARNING, METHOD, "broken", + new Object[] { path, Integer.toString(i) }); + } + } + if (rover != null) { + rover.setReader(path.getReader()); + } + } + return root; + } + + private static class Node implements Comparable { + + private final String element; + + private final Map children; + + private TreeParser.Node parent; + + private TreeParser.NodeListener reader; + + public Node(String element) { + this(element, null); + } + + private Node(String element, TreeParser.Node parent) { + this.element = element; + this.children = new HashMap<>(); + this.parent = parent; + } + + public TreeParser.Node addChild(String tag) { + TreeParser.Node child = new TreeParser.Node(tag, this); + children.put(tag, child); + return child; + } + + public TreeParser.Node findChild(String tag) { + return children.get(tag); + } + + public TreeParser.Node getParent() { + return parent; + } + + public TreeParser.NodeListener getReader() { + return reader; + } + + public void setReader(TreeParser.NodeListener reader) { + this.reader = reader; + } + + @Override + public int compareTo(TreeParser.Node o) { + return element.compareTo(o.element); + } + + @Override + public boolean equals(Object obj) { + if ((obj == null) || (getClass() != obj.getClass())) { + return false; + } + final TreeParser.Node other = (TreeParser.Node) obj; + if (this.element != other.element + && (this.element == null + || !this.element.equals(other.element))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 41 * hash + (this.element != null + ? this.element.hashCode() + : 0); + return hash; + } + + @Override + public String toString() { + boolean comma = false; + StringBuilder buf = new StringBuilder(500); + buf.append("{ "); + if (element != null && element.length() > 0) { + buf.append(element); + comma = true; + } + if (parent == null) { + if (comma) { + buf.append(", "); + } + buf.append("root"); + comma = true; + } + if (children.size() > 0) { + if (comma) { + buf.append(", "); + } + buf.append(children.size()); + buf.append(" sub(s)"); + } + buf.append(" }"); + return buf.toString(); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/XMLReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/XMLReader.java new file mode 100644 index 00000000..e4e026f1 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/XMLReader.java @@ -0,0 +1,39 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.parser; + +import java.util.List; + +/** + * Interface for various implementations that read data from domain config (domain.xml). + * + * + * @author Peter Benedikovic, Tomas Kraus + */ +public interface XMLReader { + + /** + * Every implementation needs to provide path objects. Path represents the xpath on which the reader + * wants to be notified. + * + * @return paths that the reader listens to + */ + public List getPathsToListen(); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/AbstractTask.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/AbstractTask.java new file mode 100644 index 00000000..2e7668b3 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/AbstractTask.java @@ -0,0 +1,118 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.state; + +import fish.payara.eclipse.tools.server.sdk.TaskEvent; +import fish.payara.eclipse.tools.server.sdk.TaskState; +import fish.payara.eclipse.tools.server.sdk.TaskStateListener; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishStatusCheck; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * Abstract task for server status verification. + *

+ * + * @author Tomas Kraus + */ +public abstract class AbstractTask implements Runnable { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(AbstractTask.class); + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Server status check job internal data. */ + final StatusJob job; + + /** Individual status check task data. */ + final StatusJob.Task task; + + /** Internal job status when this task was created. */ + final StatusJobState jobState; + + /** Server status check type. */ + final GlassFishStatusCheck type; + + /** Listeners that want to know about command state. */ + final TaskStateListener[] stateListeners; + + /** Cancellation notification. */ + boolean cancelled; + + /** + * Creates an instance of abstract task for server status verification. + *

+ * + * @param job Server status check job internal data. + * @param task Individual status check task data. + * @param type Server status check type. + */ + AbstractTask(final StatusJob job, final StatusJob.Task task, + final GlassFishStatusCheck type) { + this.job = job; + this.task = task; + this.jobState = job.getState(); + this.type = type; + this.stateListeners = task.getListeners(); + this.cancelled = false; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Mark this task as canceled. + *

+ * Listeners won't be notified about server status verification task state change after task was + * canceled. + */ + void cancel() { + cancelled = true; + } + + /** + * Notify all registered task state listeners server status verification task state change. + *

+ * This method should be used after task is submitted into ExecutorService. + *

+ * + * @param taskState New task execution state. + * @param taskEvent Event related to execution state change. + * @param args Additional arguments. + */ + void handleStateChange(final TaskState taskState, + final TaskEvent taskEvent, final String... args) { + if (stateListeners != null && !cancelled) { + for (TaskStateListener stateListener : stateListeners) { + if (stateListener != null) { + stateListener.operationStateChanged(taskState, + taskEvent, args); + } + } + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/AdminPortTask.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/AdminPortTask.java new file mode 100644 index 00000000..79f77cf1 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/AdminPortTask.java @@ -0,0 +1,248 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.state; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.sdk.TaskEvent; +import fish.payara.eclipse.tools.server.sdk.TaskState; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishStatusCheck; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishStatusCheckResult; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * Individual server status check task to verify if server administration port is alive. + *

+ * + * @author Tomas Kraus + */ +class AdminPortTask extends AbstractTask { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(AdminPortTask.class); + + /** Log message identifier suffix when using message with timestamp. */ + private final String TM_SUFFIX = "Tm"; + + /** Task name for logging purposes. */ + private final String TASK_NAME = "port-check"; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Format time value in miliseconds to be printed as value in seconds and miliseconds + * s.ms. + *

+ * + * @param tm Time value in miliseconds + * @return Time string formated as econds and miliseconds s.ms. + */ + static String tm(final long tm) { + StringBuilder sb = new StringBuilder(8); + sb.append(Long.toString(tm / 1000)); + sb.append('.'); + sb.append(Long.toString(tm % 1000)); + return sb.toString(); + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Socked connecting timeout [ms]. */ + int timeout; + + /** Server administration port status check result. */ + private StatusResult result; + + /** + * Task start time. Used for logging purposes. Value of -1 means that start time was + * not set. + */ + private long tmStart; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of administration port status check. + *

+ * + * @param job Server status check job internal data. + * @param task Individual status check task data. + * @param timeout Socked connecting timeout. + */ + AdminPortTask(final StatusJob job, final StatusJob.Task task, + final int timeout) { + super(job, task, GlassFishStatusCheck.PORT); + this.timeout = timeout; + this.result = null; + this.tmStart = -1; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get last command task execution result. + *

+ * + * @return Last command task execution result. + */ + StatusResult getResult() { + return result; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Build arguments for operationStateChanged method listening for state changes. + *

+ * Send false display argument to operationStateChanged method to not display GUI + * message about this event. + *

+ * + * @param exMessage Exception message. + * @return Arguments for operationStateChanged method listening for state changes. + */ + String[] stateChangeArgs(final String exMessage) { + return new String[] { + job.getStatus().getServer().getHost(), TASK_NAME, + exMessage, Boolean.toString(false) + }; + } + + /** + * Close socket and handle IOException that could be thrown. + *

+ * + * @param socket Socket to be closed. + */ + private void closeSocket(final Socket socket) { + final String METHOD = "closeSocket"; + try { + socket.close(); + } catch (IOException ioe) { + handleIOException(ioe, job.getStatus().getServer().getHost(), + job.getStatus().getServer().getAdminPort(), + METHOD, "failed"); + } + } + + /** + * Handle IO Exception caught in server administration port verification task. + *

+ * Set task result and call registered listeners. + *

+ * + * @param ioe IOException caught. + * @param host Server administration host. + * @param port Server administration port. + * @param message Message to be logged. Shall not be null. + */ + private void handleIOException(final IOException ioe, + final String host, final int port, + final String method, final String message) { + if (tmStart >= 0 && LOGGER.isLoggable(Level.FINEST)) { + StringBuilder sb = new StringBuilder( + message.length() + TM_SUFFIX.length()); + sb.append(message).append(TM_SUFFIX); + long tm = System.currentTimeMillis() - tmStart; + LOGGER.log(Level.FINEST, method, sb.toString(), new Object[] { + tm(tm), host, Integer.toString(port), ioe.getMessage() }); + + } else { + LOGGER.log(Level.FINEST, method, message, new Object[] { + host, Integer.toString(port), ioe.getMessage() }); + } + result = new StatusResult( + GlassFishStatusCheckResult.FAILED, TaskEvent.EXCEPTION); + handleStateChange(TaskState.FAILED, TaskEvent.EXCEPTION, + stateChangeArgs(ioe.getLocalizedMessage())); + } + + //////////////////////////////////////////////////////////////////////////// + // Runnable run() method // + //////////////////////////////////////////////////////////////////////////// + + /** + * Thread main method to be executed. + *

+ * Runs administration port check. + */ + @Override + public void run() { + final String METHOD = "run"; + if (cancelled) { + LOGGER.log(Level.FINER, METHOD, "cancelled"); + throw new IllegalStateException(LOGGER.excMsg(METHOD, "cancelled")); + } + LOGGER.log(Level.FINER, METHOD, "started", new String[] { + job.getStatus().getServer().getName(), jobState.toString() }); + String host = job.getStatus().getServer().getHost(); + int port = job.getStatus().getServer().getAdminPort(); + if (port < 0 || host == null) { + result = new StatusResult(GlassFishStatusCheckResult.FAILED); + handleStateChange(TaskState.FAILED, + TaskEvent.CMD_FAILED, stateChangeArgs(null)); + } + this.tmStart = System.currentTimeMillis(); + InetSocketAddress sa = new InetSocketAddress(host, port); + Socket socket = new Socket(); + try { + socket.connect(sa, timeout); + socket.setSoTimeout(timeout); + } catch (java.net.ConnectException ce) { + handleIOException(ce, host, port, METHOD, "connect"); + return; + } catch (java.net.SocketTimeoutException ste) { + handleIOException(ste, host, port, METHOD, "timeout"); + return; + } catch (IOException ioe) { + handleIOException(ioe, host, port, METHOD, "ioException"); + return; + } finally { + closeSocket(socket); + } + if (tmStart >= 0 && LOGGER.isLoggable(Level.FINEST)) { + long tm = System.currentTimeMillis() - tmStart; + LOGGER.log(Level.FINEST, METHOD, "success", + new Object[] { tm(tm), jobState.toString(), + host, Integer.toString(port) }); + } + result = new StatusResult( + GlassFishStatusCheckResult.SUCCESS, TaskEvent.CMD_COMPLETED); + handleStateChange(TaskState.COMPLETED, TaskEvent.CMD_COMPLETED, + stateChangeArgs(null)); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/ExceptionMessages.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/ExceptionMessages.properties new file mode 100644 index 00000000..425f047c --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/ExceptionMessages.properties @@ -0,0 +1,25 @@ +################################################################################ +# Exception messages # +# Use .. notation for keys. # +################################################################################ + +# AdminPortTask class +AdminPortTask.run.cancelled=Running already canceled administrator port check \ +task. + +# GlassFishVersion class +GlassFishVersion.toString.invalidVersion=Invalid GlassFish version + +# RunnerTask class +RunnerTask.run.cancelled=Running already canceled asadmin command check task. + +# StatusJobState class +StatusJobState.toString.invalidVersion=Invalid server status check internal \ +state + +# StatusScheduler class +StatusScheduler.scheduleNew.illegalState=Server status check job should be \ +in UNKNOWN state. +StatusScheduler.reschedule.reschedule=Server status check job shall not be in \ +UNKNOWN state. +StatusScheduler.reschedule.unhandled=Missing reschedule handling for some state. \ No newline at end of file diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/GlassFishStatusEntity.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/GlassFishStatusEntity.java new file mode 100644 index 00000000..7fad561e --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/GlassFishStatusEntity.java @@ -0,0 +1,114 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.state; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.GlassFishStatus; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishServerStatus; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * GlassFish server status entity. + *

+ * + * @author Tomas Kraus + */ +public class GlassFishStatusEntity implements GlassFishServerStatus { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(GlassFishStatusEntity.class); + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** GlassFish server entity. */ + private PayaraServer server; + + /** Current GlassFish server status. */ + private GlassFishStatus status; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server status entity. + *

+ * Initial server status value is set as unknown. + *

+ * + * @param server GlassFish server entity. + */ + public GlassFishStatusEntity(final PayaraServer server) { + this.server = server; + this.status = GlassFishStatus.UNKNOWN; + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get GlassFish server entity. + *

+ * + * @return GlassFish server entity. + */ + @Override + public PayaraServer getServer() { + return server; + } + + /** + * Set GlassFish server entity. + *

+ * + * @param server GlassFish server entity. + */ + void setServer(final PayaraServer server) { + this.server = server; + } + + /** + * Get current GlassFish server status. + *

+ * + * @return Current GlassFish server status. + */ + @Override + public GlassFishStatus getStatus() { + return status; + } + + /** + * Set current GlassFish server status. + *

+ * + * @param status Current GlassFish server status. + */ + void setStatus(final GlassFishStatus status) { + this.status = status; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/LogMessages.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/LogMessages.properties new file mode 100644 index 00000000..b03fc8ac --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/LogMessages.properties @@ -0,0 +1,49 @@ +################################################################################ +# Log messages # +# Use .. notation for keys. # +################################################################################ + +# AdminPortTask class +AdminPortTask.closeSocket.failed=Socket closing failed when connecting \ +to {0}:{1}: {2} +AdminPortTask.closeSocket.failedTm=[{0}] Socket closing failed when connecting \ +to {1}:{2}: {3} +# AdminPortTask class +AdminPortTask.run.cancelled=Running already canceled administrator port check \ +task. +AdminPortTask.run.started=Administrator port check task for server {0} \ +in state {1} started. +AdminPortTask.run.connect=Port check could not connect to {0}:{1}: {2} +AdminPortTask.run.connectTm=[{0}] Port check could not connect to {1}:{2}: {3} +AdminPortTask.run.timeout=Port check timeout when connecting to {0}:{1}: {2} +AdminPortTask.run.timeoutTm=[{0}] Port check timeout when connecting \ +to {1}:{2}: {3} +AdminPortTask.run.ioException=Port check caught IO exception when connecting \ +to {0}:{1}: {2} +AdminPortTask.run.ioExceptionTm=[{0}] Port check caught IO exception when \ +connecting to {1}:{2}: {3} +AdminPortTask.run.success=[{0}] Port status check for state {1} succeeded \ +on {2}:{3} + +# StatusJob class +StatusJob.portCheckTransition.transition=Port check transition {0}: {1} -> {2} +StatusJob.commandLocationsTransition.transition=Command check transition \ +{0}: {1} -> {2} +StatusJob.commandVersionTransition.transition=Version check transition \ +{0}: {1} -> {2} + +# StatusJob.ListenerLocations class +ListenerLocations.operationStateChanged.result=Status check locations command \ +result: {0} + +# StatusJob.ListenerVersion class +ListenerVersion.operationStateChanged.result=Status check version command \ +result: {0} + +# StatusJob.ListenerPortCheck class +ListenerPortCheck.operationStateChanged.result=Status administrator port check \ +result: {0} + +# RunnerTask class +RunnerTask.run.cancelled=Running already canceled asadmin command check task. +RunnerTask.run.started=Asadmin command task for server {0} in state {1} started. diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/RunnerTask.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/RunnerTask.java new file mode 100644 index 00000000..102e19b2 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/RunnerTask.java @@ -0,0 +1,158 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.state; + +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.sdk.TaskEvent; +import fish.payara.eclipse.tools.server.sdk.TaskState; +import fish.payara.eclipse.tools.server.sdk.TaskStateListener; +import fish.payara.eclipse.tools.server.sdk.admin.AdminFactory; +import fish.payara.eclipse.tools.server.sdk.admin.Command; +import fish.payara.eclipse.tools.server.sdk.admin.Result; +import fish.payara.eclipse.tools.server.sdk.admin.Runner; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishStatusCheck; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * Individual server administrator command task to verify if server is responding properly. + *

+ * + * @author Tomas Kraus + */ +class RunnerTask extends AbstractTask { + + //////////////////////////////////////////////////////////////////////////// + // Inner classes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Command execution listener. + *

+ * Passes {@link TaskStateListener} arguments to job command task listeners registered for + * {@link RunnerTask} class. + */ + private class RunnerListener implements TaskStateListener { + + /** Server administrator command task. */ + final RunnerTask runnerTask; + + /** + * Constructs an instance of {@link Runner} listener. + */ + private RunnerListener(final RunnerTask runnerTask) { + this.runnerTask = runnerTask; + } + + /** + * Get notification about state change in {@link Runner} task. + *

+ * This is being called in {@link Runner#call()} method execution context. + *

+ * String arguments passed to state listener:

    + *
  • args[0] server name
  • + *
  • args[1] administration command
  • + *
  • args[2] exception message
  • + *
  • args[3] display message in GUI
  • + *
+ *

+ * + * @param newState New command execution state. + * @param event Event related to execution state change. + * @param args Additional String arguments. + */ + @Override + public void operationStateChanged(final TaskState newState, + final TaskEvent event, final String... args) { + runnerTask.handleStateChange(newState, event, args); + } + + } + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(RunnerTask.class); + + /** Server administration command to be executed. */ + private final Command cmd; + + /** Runner task execution result. */ + Result result; + + /** + * Constructs an instance of individual server administrator command task. + *

+ * + * @param job Server status check job internal data. + * @param task Individual status check task data. + * @param type Server status check type. + */ + RunnerTask(final StatusJob job, final StatusJob.RunnerTask task, + final GlassFishStatusCheck type) { + super(job, task, type); + this.cmd = task.getCommand(); + this.result = null; + } + + //////////////////////////////////////////////////////////////////////// + // Runnable run() method // + //////////////////////////////////////////////////////////////////////// + + /** + * Thread main method to be executed. + *

+ * Runs command runner without starting new thread. + */ + @Override + public void run() { + final String METHOD = "run"; + if (cancelled) { + LOGGER.log(Level.FINER, METHOD, "cancelled"); + throw new IllegalStateException(LOGGER.excMsg(METHOD, "cancelled")); + } + LOGGER.log(Level.FINER, METHOD, "started", new String[] { + job.getStatus().getServer().getName(), jobState.toString() }); + TaskStateListener[] listeners = task.getListeners(); + AdminFactory af = AdminFactory.getInstance( + job.getStatus().getServer().getAdminInterface()); + Runner runner = af.getRunner(job.getStatus().getServer(), cmd); + if (listeners != null) { + for (TaskStateListener listener : listeners) { + if (listener instanceof StatusJob.Listener) { + ((StatusJob.Listener) listener).setRunner(runner); + } + } + } + runner.setStateListeners( + new TaskStateListener[] { new RunnerListener(this) }); + runner.setReadyState(); + result = runner.call(); + if (listeners != null) { + for (TaskStateListener listener : listeners) { + if (listener instanceof StatusJob.Listener) { + ((StatusJob.Listener) listener).clearRunner(); + } + } + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/ServerStateException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/ServerStateException.java new file mode 100644 index 00000000..96e2b4b7 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/ServerStateException.java @@ -0,0 +1,88 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.state; + +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * GlassFish IDE SDK Exception related to server configuration problems. + *

+ * + * @author Tomas Kraus, Peter Benedikovic + */ +public class ServerStateException extends PayaraIdeException { + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Constructs an instance of ServerConfigException without detail message. + */ + public ServerStateException() { + super(); + } + + /** + * Constructs an instance of ServerConfigException with the specified detail message. + *

+ * + * @param msg The detail message. + */ + public ServerStateException(final String msg) { + super(msg); + } + + /** + * Constructs an instance of ServerConfigException with the specified detail message + * and arguments. + *

+ * Uses {@link java.text.MessageFormat} to format message. + *

+ * + * @param msg The detail message. + * @param arguments Arguments to be inserted into message. + */ + public ServerStateException(final String msg, final Object... arguments) { + super(msg, arguments); + } + + /** + * Constructs an instance of ServerConfigException with the specified detail message + * and cause. Exception is logged on WARN level. + *

+ * Note that the detail message associated with {@code cause} is not automatically + * incorporated in this runtime exception's detail message. + *

+ * + * @param msg the detail message (which is saved for later retrieval by the {@link #getMessage()} + * method). + * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A + * null value is permitted, and indicates that the cause is nonexistent or unknown.) + */ + public ServerStateException(final String msg, final Throwable cause) { + super(msg, cause); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusJob.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusJob.java new file mode 100644 index 00000000..db3e1af7 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusJob.java @@ -0,0 +1,1365 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.state; + +import static fish.payara.eclipse.tools.server.sdk.server.state.StatusJobState.NO_CHECK; +import static fish.payara.eclipse.tools.server.sdk.server.state.StatusJobState.OFFLINE; +import static fish.payara.eclipse.tools.server.sdk.server.state.StatusJobState.OFFLINE_PORT; +import static fish.payara.eclipse.tools.server.sdk.server.state.StatusJobState.ONLINE; +import static fish.payara.eclipse.tools.server.sdk.server.state.StatusJobState.SHUTDOWN; +import static fish.payara.eclipse.tools.server.sdk.server.state.StatusJobState.SHUTDOWN_PORT; +import static fish.payara.eclipse.tools.server.sdk.server.state.StatusJobState.STARTUP; +import static fish.payara.eclipse.tools.server.sdk.server.state.StatusJobState.STARTUP_PORT; +import static fish.payara.eclipse.tools.server.sdk.server.state.StatusJobState.UNKNOWN; +import static fish.payara.eclipse.tools.server.sdk.server.state.StatusJobState.UNKNOWN_PORT; + +import java.util.concurrent.ScheduledFuture; +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.sdk.GlassFishStatus; +import fish.payara.eclipse.tools.server.sdk.GlassFishStatusListener; +import fish.payara.eclipse.tools.server.sdk.TaskEvent; +import fish.payara.eclipse.tools.server.sdk.TaskState; +import fish.payara.eclipse.tools.server.sdk.TaskStateListener; +import fish.payara.eclipse.tools.server.sdk.admin.Command; +import fish.payara.eclipse.tools.server.sdk.admin.CommandLocation; +import fish.payara.eclipse.tools.server.sdk.admin.CommandVersion; +import fish.payara.eclipse.tools.server.sdk.admin.Result; +import fish.payara.eclipse.tools.server.sdk.admin.ResultMap; +import fish.payara.eclipse.tools.server.sdk.admin.ResultString; +import fish.payara.eclipse.tools.server.sdk.admin.Runner; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishStatusCheck; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishStatusCheckResult; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishStatusTask; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.utils.LinkedList; + +/** + * Server status check internal data for individual GlassFish server instance. + *

+ * + * @author Tomas Kraus + */ +public class StatusJob { + + //////////////////////////////////////////////////////////////////////////// + // Inner classes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Common server status check command execution state listener. + */ + abstract static class Listener implements TaskStateListener { + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(Listener.class); + + /** + * Should contain {@link Runner} object when it's {@link Runner#call()} method is executed. + */ + Runner runner; + + /** + * Server status check internal data for individual GlassFish server instance. + */ + final StatusJob job; + + /** + * Constructs an instance of common command execution state listener. + *

+ * + * @param job Server status check internal data for individual GlassFish server instance. + */ + private Listener(final StatusJob job) { + this.runner = null; + this.job = job; + } + + /** + * Set {@link Runner} object instance before it's {@link Runner#call()} method is executed. + *

+ * + * @param runner GlassFish server command execution runner. + */ + void setRunner(final Runner runner) { + this.runner = runner; + } + + /** + * Clear {@link Runner} object instance after {@link Runner#call()} method is finished. + */ + void clearRunner() { + this.runner = null; + } + + } + + /** + * Locations command execution state listener. + */ + static class ListenerLocations extends Listener { + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(ListenerLocations.class); + + /** + * Constructs an instance of __locations command execution state listener. + *

+ * + * @param job Server status check internal data for individual GlassFish server instance. + */ + private ListenerLocations(final StatusJob job) { + super(job); + } + + /** + * Evaluate __locations response to verify GlassFish server home and domain + * directories. + *

+ * + * @return Returns true when __locations response matches domain directory + * in GlassFish server entity or false otherwise. + */ + private boolean verifyResult() { + Result result = runner.getResult(); + if (result instanceof ResultMap) { + ResultMap resultMap = (ResultMap) result; + return CommandLocation.verifyResult( + resultMap, job.status.getServer()); + } else { + return false; + } + } + + /** + * Get notification about state change in {@link Runner} task. + *

+ * This is being called in {@link Runner#call()} method execution context. + *

+ * String arguments passed to state listener:

    + *
  • args[0] server name
  • + *
  • args[1] administration command
  • + *
  • args[2] exception message
  • + *
  • args[3] display message in GUI
  • + *
+ *

+ * + * @param newState New command execution state. + * @param event Event related to execution state change. + * @param args Additional String arguments. + */ + @Override + public void operationStateChanged(final TaskState newState, + final TaskEvent event, final String... args) { + final String METHOD = "operationStateChanged"; + switch (newState) { + case COMPLETED: + case FAILED: + String serverName; + String exceptionMeasage; + ResultMap taskResult = (ResultMap) runner.getResult(); + if (args != null && args.length >= 3) { + serverName = args[0]; + exceptionMeasage = args[2]; + } else { + serverName = null; + exceptionMeasage = null; + } + // Store task result into job task object + boolean notifyError = false; + synchronized (job.locations) { + switch (newState) { + case COMPLETED: + // Breaks only for true result. False result + // is handeld by FAILED case. + if (verifyResult()) { + job.locations.setResult( + new StatusResultLocations( + taskResult, + GlassFishStatusCheckResult.SUCCESS, + event)); + break; + } + case FAILED: + job.locations.setResult( + new StatusResultLocations(taskResult, + GlassFishStatusCheckResult.FAILED, + event)); + notifyError = true; + break; + } + } + LOGGER.log(Level.FINE, METHOD, "result", + job.locations.getResult().status.toString()); + if (notifyError) { + synchronized (job) { + job.notifyErrorListeners(job.locations); + } + } + commandTransition(job, job.locations); + } + + } + + } + + /** + * Locations command execution state listener. + */ + static class ListenerVersion extends Listener { + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(ListenerVersion.class); + + /** + * Constructs an instance of version command execution state listener. + *

+ * + * @param job Server status check internal data for individual GlassFish server instance. + */ + private ListenerVersion(final StatusJob job) { + super(job); + } + + /** + * Evaluate version response to verify GlassFish server version. + *

+ * + * @return Returns true when version response matches version in GlassFish + * server entity or false otherwise. + */ + private boolean verifyResult() { + Result result = runner.getResult(); + if (result instanceof ResultString) { + ResultString resultString = (ResultString) result; + return CommandVersion.verifyResult( + resultString, job.status.getServer()); + } else { + return false; + } + } + + /** + * Get notification about state change in {@link Runner} task. + *

+ * This is being called in {@link Runner#call()} method execution context. + *

+ * String arguments passed to state listener:

    + *
  • args[0] server name
  • + *
  • args[1] administration command
  • + *
  • args[2] exception message
  • + *
  • args[3] display message in GUI
  • + *
+ *

+ * + * @param newState New command execution state. + * @param event Event related to execution state change. + * @param args Additional String arguments. + */ + @Override + public void operationStateChanged(final TaskState newState, + final TaskEvent event, final String... args) { + final String METHOD = "operationStateChanged"; + switch (newState) { + case COMPLETED: + case FAILED: + String serverName; + String exceptionMeasage; + ResultString taskResult = (ResultString) runner.getResult(); + if (args != null && args.length >= 3) { + serverName = args[0]; + exceptionMeasage = args[2]; + } else { + serverName = null; + exceptionMeasage = null; + } + // Store task result into job task object + boolean notifyError = false; + synchronized (job.version) { + switch (newState) { + case COMPLETED: + // Breaks only for true result. False result + // is handeld by FAILED case. + if (verifyResult()) { + job.version.setResult( + new StatusResultVersion( + taskResult, + GlassFishStatusCheckResult.SUCCESS, + event)); + break; + } + case FAILED: + job.version.setResult( + new StatusResultVersion(taskResult, + GlassFishStatusCheckResult.FAILED, + event)); + notifyError = true; + break; + } + } + LOGGER.log(Level.FINE, METHOD, "result", + job.version.getResult().status.toString()); + if (notifyError) { + synchronized (job) { + job.notifyErrorListeners(job.version); + } + } + commandTransition(job, job.version); + } + } + + } + + /** + * Administrator port check task state listener. + */ + static class ListenerPortCheck extends Listener { + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(ListenerPortCheck.class); + + /** + * Constructs an instance of version command execution state listener. + *

+ * + * @param job Server status check internal data for individual GlassFish server instance. + */ + private ListenerPortCheck(final StatusJob job) { + super(job); + } + + /** + * Get notification about state change in running task. + *

+ * This is being called in {@link Runnable#run()} method execution context. + *

+ * String arguments passed to state listener:

    + *
  • args[0] host name
  • + *
  • args[1] port check task name
  • + *
  • args[2] exception message
  • + *

    + * + * @param newState New command execution state. + * @param event Event related to execution state change. + * @param args Additional String arguments. + */ + @Override + public void operationStateChanged(final TaskState newState, + final TaskEvent event, final String... args) { + final String METHOD = "operationStateChanged"; + // Store task result into job task object + AdminPortTask task = (AdminPortTask) job.portCheck.getTask(); + job.portCheck.setResult(task.getResult()); + LOGGER.log(Level.FINE, METHOD, "result", + job.portCheck.getResult().status.toString()); + // Evaluate taks result + portCheckTransition(job, job.portCheck); + } + + } + + /** + * Individual status check task data. + */ + static class Task implements GlassFishStatusTask { + + /** + * Server status task execution listener for asynchronous command execution. + */ + private Listener listener; + + /** Last command task execution result. */ + StatusResult result; + + /** Task thread currently being executed. */ + AbstractTask task; + + /** Task execution handler. */ + private ScheduledFuture future; + + /** All task listeners. */ + private TaskStateListener[] listeners; + + /** Server status check type. */ + private final GlassFishStatusCheck type; + + /** + * Constructs an instance of individual job task. + *

    + * + * @param type Server status check type. + * @param listener Server status task execution listener for asynchronous command execution. + */ + private Task(final GlassFishStatusCheck type, + final Listener listener) { + this.listener = listener; + this.type = type; + this.result = null; + this.task = null; + this.future = null; + this.listeners = new TaskStateListener[] { listener }; + } + + /** + * Get server status task execution listener for asynchronous command execution. + *

    + * + * @return Server status task execution listener for asynchronous command execution. + */ + Listener getListener() { + return listener; + } + + /** + * Set server status task execution listener for asynchronous command execution. + *

    + * + * @param listener Server status task execution listener for asynchronous command execution. + */ + void setListener(final Listener listener) { + this.listener = listener; + } + + /** + * Get server status check type. + *

    + * + * @return Server status check type. + */ + @Override + public GlassFishStatusCheck getType() { + return type; + } + + /** + * Get last command task execution result. + *

    + * + * @return Last command task execution result. + */ + StatusResult getResult() { + return result; + } + + /** + * Set last command task execution result. + *

    + * + * @param result Last command task execution result. + */ + void setResult(final StatusResult result) { + this.result = result; + } + + /** + * Get last command task execution status. + *

    + * + * @return Last command task execution status. + */ + @Override + public GlassFishStatusCheckResult getStatus() { + return result != null ? result.status : null; + } + + /** + * Get last command task execution status. + *

    + * + * @return Last command task execution status. + */ + @Override + public TaskEvent getEvent() { + return result != null ? result.event : null; + } + + /** + * Get task thread currently being executed. + *

    + * + * @return Task thread currently being executed. + */ + AbstractTask getTask() { + return task; + } + + /** + * Set task thread currently being executed. + *

    + * + * @param task Task thread currently being executed. + */ + void setTask(final AbstractTask task) { + this.task = task; + } + + /** + * Get all task listeners. + *

    + * + * @return All task listeners. + */ + TaskStateListener[] getListeners() { + return listeners; + } + + /** + * Get task execution handler. + *

    + * + * @return Task execution handler. + */ + ScheduledFuture getFuture() { + return future; + } + + /** + * Set task execution handler. + *

    + * + * @param future Task execution handler. + */ + void setFuture(final ScheduledFuture future) { + this.future = future; + } + + /** + * Set task execution handler and thread currently being executed. + *

    + * + * @param task Task thread currently being executed. + * @param future Task execution handler. + */ + void setTaskFuture(final AbstractTask task, + final ScheduledFuture future) { + this.task = task; + this.future = future; + } + + /** + * Clear task execution handler and thread currently being executed. + */ + void clearTaskFuture() { + this.task = null; + this.future = null; + } + + /** + * Evaluate task execution result. + *

    + * Task will fail only when task is scheduled for execution (task value is not null) + * and stored task result is FAILED or does not exist. + *

    + * + * @return Task execution result evaluation. + */ + GlassFishStatusCheckResult evalResult() { + return task == null + ? GlassFishStatusCheckResult.SUCCESS + : result == null + ? GlassFishStatusCheckResult.FAILED + : result.status; + } + + } + + /** + * Individual administrator command status check task data. + */ + static class RunnerTask extends Task { + + /** Server administration command to be executed. */ + private final Command command; + + /** + * Constructs an instance of individual job runner task. + *

    + * + * @param type Server status check type. + * @param cmd Server administration command to be executed. + * @param listener Server status task execution listener for asynchronous command execution. + */ + private RunnerTask(final GlassFishStatusCheck type, + final Command cmd, final Listener listener) { + super(type, listener); + this.command = cmd; + } + + /** + * Get server administration command to be executed. + *

    + * + * @return Server administration command to be executed. + */ + Command getCommand() { + return command; + } + + } + + /** + * Individual administrator command status check task data using version command. + */ + static class RunnerTaskLocations extends RunnerTask { + + /** + * Constructs an instance of individual job runner task running __locations command. + *

    + * + * @param listener Server status task execution listener for asynchronous command execution. + */ + private RunnerTaskLocations(final Listener listener) { + super(GlassFishStatusCheck.LOCATIONS, + new CommandLocation(), listener); + } + + } + + /** + * Individual administrator command status check task data using version command. + */ + static class RunnerTaskVersion extends RunnerTask { + + /** + * Constructs an instance of individual job runner task running version command. + *

    + * + * @param listener Server status task execution listener for asynchronous command execution. + */ + private RunnerTaskVersion(final Listener listener) { + super(GlassFishStatusCheck.VERSION, + new CommandVersion(), listener); + } + + } + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(StatusJob.class); + + /** State transition depending on administrator port check result . */ + private static final StatusJobState[][] portCheckTransition = { + // SUCCESS FAILED + { NO_CHECK, NO_CHECK }, // NO_CHECK + { UNKNOWN_PORT, OFFLINE }, // UNKNOWN + { UNKNOWN_PORT, OFFLINE }, // UNKNOWN_PORT + { OFFLINE_PORT, OFFLINE }, // OFFLINE + { OFFLINE_PORT, OFFLINE }, // OFFLINE_PORT + { STARTUP_PORT, STARTUP }, // STARTUP + { STARTUP_PORT, OFFLINE }, // STARTUP_PORT + { ONLINE, OFFLINE_PORT }, // ONLINE + { SHUTDOWN, SHUTDOWN_PORT }, // SHUTDOWN + { SHUTDOWN_PORT, OFFLINE } // SHUTDOWN_PORT + }; + + /** State transition depending on administrator command execution result. */ + private static final StatusJobState[][] commandTransition = { + // SUCCESS FAILED + { NO_CHECK, NO_CHECK }, // NO_CHECK + { ONLINE, UNKNOWN }, // UNKNOWN + { ONLINE, OFFLINE }, // UNKNOWN_PORT + { ONLINE, OFFLINE }, // OFFLINE + { ONLINE, OFFLINE_PORT }, // OFFLINE_PORT + { ONLINE, STARTUP }, // STARTUP + { ONLINE, STARTUP_PORT }, // STARTUP_PORT + { ONLINE, OFFLINE_PORT }, // ONLINE + { SHUTDOWN, SHUTDOWN_PORT }, // SHUTDOWN + { SHUTDOWN, SHUTDOWN_PORT } // SHUTDOWN_PORT + }; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Evaluate check result depending on running tasks and their result. + *

    + * + * @param job Server status job. + * @return Check result depending on running tasks and their result. + */ + private static GlassFishStatusCheckResult checkResult(final StatusJob job) { + return GlassFishStatusCheckResult.and(job.portCheck.evalResult(), + job.version.evalResult(), job.locations.evalResult()); + } + + /** + * Handles state transition and server status check tasks reschedule for administrator port check + * result evaluation. + *

    + * + * @param job Server status job. + * @param task GlassFish server status check task details. + */ + private static void portCheckTransition( + final StatusJob job, final GlassFishStatusTask task) { + final String METHOD = "portCheckTransition"; + GlassFishStatus oldState; + GlassFishStatus newState; + synchronized (job) { + StatusJobState oldInternalState = job.state; + oldState = job.status.getStatus(); + job.state = portCheckTransition[job.state.ordinal()][job.portCheck.result.status.ordinal()]; + LOGGER.log(Level.FINE, METHOD, "transition", + new String[] { job.portCheck.result.status.toString(), + oldInternalState.toString(), job.state.toString() }); + if (oldInternalState != job.state) { + StatusScheduler scheduler = StatusScheduler.getInstance(); + scheduler.remove(job); + scheduler.reschedule(job); + } + newState = job.state.toGlassFishStatus(); + if (oldState != newState) { + job.status.setStatus(newState); + } + } + if (job.portCheck.result.status == GlassFishStatusCheckResult.FAILED) { + job.notifyErrorListeners(job.portCheck); + } + if (oldState != newState) { + job.notifyNewStatusListeners(job.status.getStatus(), task); + } + job.notifyCurrStatusListeners(job.status.getStatus(), task); + } + + /** + * Handles state transition and server status check tasks reschedule for administrator command + * execution result evaluation. + *

    + * + * @param job Server status job. + * @param task GlassFish server status check task details. + */ + private static void commandTransition( + final StatusJob job, final GlassFishStatusTask task) { + final String METHOD = "commandLocationsTransition"; + GlassFishStatusCheckResult status = checkResult(job); + GlassFishStatus oldState; + GlassFishStatus newState; + synchronized (job) { + StatusJobState oldInternalState = job.state; + oldState = job.status.getStatus(); + job.state = commandTransition[job.state.ordinal()][status.ordinal()]; + LOGGER.log(Level.FINE, METHOD, "transition", + new String[] { status.toString(), oldInternalState.toString(), job.state.toString() }); + if (oldInternalState != job.state) { + StatusScheduler scheduler = StatusScheduler.getInstance(); + scheduler.remove(job); + scheduler.reschedule(job); + } + newState = job.state.toGlassFishStatus(); + if (oldState != newState) { + job.status.setStatus(newState); + } + } + if (oldState != newState) { + job.notifyNewStatusListeners(job.status.getStatus(), task); + } + job.notifyCurrStatusListeners(job.status.getStatus(), task); + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** GlassFish server status entity. */ + private final GlassFishStatusEntity status; + + /** Server status job internal state. */ + private StatusJobState state; + + /** Administrator port check asynchronous task. */ + private final Task portCheck; + + /** Command __locations asynchronous task. */ + private final RunnerTask locations; + + /** Command version asynchronous task. */ + private final RunnerTask version; + + /** Listeners to be notified about server status change. */ + private final LinkedList[] newStatusListeners; + + /** Listeners to be notified about every server status check result. */ + private final LinkedList currStatusListeners; + + /** Listeners to be notified about every server status check error. */ + private final LinkedList errorListeners; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of GlassFish server status check internal data. + *

    + * + * @param status GlassFish server status entity. + */ + StatusJob(final GlassFishStatusEntity status) { + this.status = status; + state = StatusJobState.UNKNOWN; + portCheck = new Task( + GlassFishStatusCheck.PORT, new ListenerPortCheck(this)); + locations = new RunnerTaskLocations(new ListenerLocations(this)); + version = new RunnerTaskVersion(new ListenerVersion(this)); + newStatusListeners = new LinkedList[GlassFishStatus.length]; + for (int i = 0; i < GlassFishStatus.length; i++) { + newStatusListeners[i] = new LinkedList<>(); + } + currStatusListeners = new LinkedList<>(); + errorListeners = new LinkedList<>(); + } + + //////////////////////////////////////////////////////////////////////////// + // Getters and Setters // + //////////////////////////////////////////////////////////////////////////// + + /** + * get GlassFish server status entity. + *

    + * + * @return GlassFish server status entity. + */ + GlassFishStatusEntity getStatus() { + return status; + } + + /** + * Get server status job internal state. + *

    + * + * @return Server status job internal state. + */ + StatusJobState getState() { + return state; + } + + /** + * Get server status job internal state. + *

    + * + * @param state Server status job internal state. + */ + void setState(final StatusJobState state) { + this.state = state; + } + + /** + * Get administrator port check asynchronous task. + *

    + * + * @return Administrator port check asynchronous task. + */ + Task getPortCheck() { + return portCheck; + } + + /** + * Get command __locations asynchronous task. + *

    + * + * @return Command __locations asynchronous task. + */ + RunnerTask getLocations() { + return locations; + } + + /** + * Get command version asynchronous task. + *

    + * + * @return Command version asynchronous task. + */ + RunnerTask getVersion() { + return version; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Attempts to restart job switching it into UNKNOWN_PORT state to restart status + * checking with fastest possible check. + *

    + * Job can be switched into UNKNOWN_PORT state only when it's in NO_CHECK + * state. This is equivalent to state transition methods. If listener is provided, it will be + * registered to receive any state change notification following status checking restart. This + * listener won't be unregistered automatically so caller should handle it properly. + *

    + * Called by job tasks scheduler. + *

    + * + * @param scheduler Job tasks scheduler calling this method. + * @param listener Server status listener to be registered when status checking is being restarted. + * @return Value of true when job was successfully switched into startup mode or false + * otherwise. + */ + boolean restartJob(final StatusScheduler scheduler, + final GlassFishStatusListener listener) { + boolean result; + synchronized (this) { + switch (state) { + case NO_CHECK: + state = UNKNOWN_PORT; + status.setStatus(state.toGlassFishStatus()); + scheduler.remove(this); + scheduler.reschedule(this); + result = true; + if (listener != null) { + addNewStatusListener(listener, GlassFishStatus.values()); + } + break; + default: + result = false; + } + } + return result; + } + + /** + * Stops job switching it into NO_CHECK state. + *

    + * Job can be switched into NO_CHECK state from any state. This is equivalent to state + * transition methods. + *

    + * Called by job tasks scheduler. + *

    + * + * @param scheduler Job tasks scheduler calling this method. + */ + void stopJob(StatusScheduler scheduler) { + synchronized (this) { + GlassFishStatus oldStatus = state.toGlassFishStatus(); + state = NO_CHECK; + status.setStatus(state.toGlassFishStatus()); + scheduler.remove(this); + scheduler.reschedule(this); + if (oldStatus != status.getStatus()) { + notifyNewStatusListeners(status.getStatus(), null); + } + } + } + + /** + * Switches job into STARTUP state. + *

    + * + * @param scheduler Job tasks scheduler calling this method. + * @param listener Server status listener to be registered together with switching into startup + * mode. + * @param newState Notify about server status change for new states provided as this argument. + */ + private void startStateImpl(StatusScheduler scheduler, + final GlassFishStatusListener listener, + final GlassFishStatus... newState) { + GlassFishStatus oldStatus = status.getStatus(); + state = STARTUP; + status.setStatus(state.toGlassFishStatus()); + scheduler.remove(this); + scheduler.reschedule(this); + if (oldStatus != status.getStatus()) { + notifyNewStatusListeners(status.getStatus(), null); + } + if (listener != null) { + addNewStatusListener(listener, newState); + } + } + + /** + * Attempts to switch job into STARTUP state. + *

    + * Job can be switched into STARTUP state only when it's in OFFLINE or + * OFFLINE_PORT state. This is equivalent to state transition methods. + *

    + * Called by job tasks scheduler. + *

    + * + * @param scheduler Job tasks scheduler calling this method. + * @param force Force startup mode for GlassFish server instance from any state then + * true. + * @param listener Server status listener to be registered together with switching into startup + * mode. + * @param newState Notify about server status change for new states provided as this argument. + * @return Value of true when job was successfully switched into startup mode or false + * otherwise. + */ + boolean startState(StatusScheduler scheduler, final boolean force, + final GlassFishStatusListener listener, + final GlassFishStatus... newState) { + boolean result; + synchronized (this) { + switch (state) { + case OFFLINE: + case OFFLINE_PORT: + startStateImpl(scheduler, listener, newState); + result = true; + break; + case STARTUP: + result = false; + break; + default: + if (force) { + startStateImpl(scheduler, listener, newState); + result = true; + } else { + result = false; + } + } + } + return result; + } + + /** + * Attempts to switch job into SHUTDOWN state. + *

    + * Job can be switched into SHUTDOWN state only when it's in ONLINE state. + * This is equivalent to state transition methods. + *

    + * Called by job tasks scheduler. + *

    + * + * @param scheduler Job tasks scheduler calling this method. + * @return Value of true when job was successfully switched into shutdown mode or false + * otherwise. + */ + boolean shutdownState(StatusScheduler scheduler) { + boolean result; + synchronized (this) { + switch (state) { + case ONLINE: + state = SHUTDOWN; + status.setStatus(state.toGlassFishStatus()); + scheduler.remove(this); + scheduler.reschedule(this); + result = true; + notifyNewStatusListeners(status.getStatus(), null); + break; + default: + result = false; + } + } + return result; + } + + /** + * Initial server status task schedule. + *

    + * Called by job tasks scheduler. + *

    + * + * @param scheduler Job tasks scheduler calling this method. + */ + void scheduleNew(StatusScheduler scheduler) { + synchronized (this) { + scheduler.scheduleNew(this); + } + } + + /** + * Notify server status change listeners about state change. + *

    + * Listeners list access is synchronized but they are just copied into temporary array and executed + * outside synchronized block to avoid deadlocks. + *

    + * + * @param status Current server status. + * @param task GlassFish server status check task details. + */ + public void notifyNewStatusListeners( + final GlassFishStatus status, final GlassFishStatusTask task) { + GlassFishStatusListener[] call; + // Copy registered status change listeners. + int i = 0; + boolean isElement; + LinkedList listeners; + synchronized (newStatusListeners) { + listeners = newStatusListeners[status.ordinal()]; + call = new GlassFishStatusListener[listeners.size()]; + isElement = listeners.first(); + while (isElement) { + call[i++] = listeners.getCurrent(); + isElement = listeners.next(); + } + } + // Execute them outside synchronized block. + for (GlassFishStatusListener listener : call) { + listener.newState(this.status.getServer(), status, task); + } + } + + /** + * Notify server status change listeners about current server status after every check. + *

    + * Listeners list access is synchronized but they are just copied into temporary array and executed + * outside synchronized block to avoid deadlocks. + *

    + * + * @param status Current server status. + * @param task GlassFish server status check task details. + */ + public void notifyCurrStatusListeners( + final GlassFishStatus status, final GlassFishStatusTask task) { + GlassFishStatusListener[] call; + // Copy registered status change listeners. + int i = 0; + boolean isElement; + synchronized (currStatusListeners) { + call = new GlassFishStatusListener[currStatusListeners.size()]; + isElement = currStatusListeners.first(); + while (isElement) { + call[i++] = currStatusListeners.getCurrent(); + isElement = currStatusListeners.next(); + } + } + // Execute them outside synchronized block. + for (GlassFishStatusListener listener : call) { + listener.currentState(this.status.getServer(), status, task); + } + } + + /** + * Notify server status check error listeners about every check error. + *

    + * Listeners list access is synchronized but they are just copied into temporary array and executed + * outside synchronized block to avoid deadlocks. + *

    + * + * @param task GlassFish server status check task details. + */ + public void notifyErrorListeners(final GlassFishStatusTask task) { + GlassFishStatusListener[] call; + // Copy registered status change listeners. + int i = 0; + boolean isElement; + synchronized (errorListeners) { + call = new GlassFishStatusListener[errorListeners.size()]; + isElement = errorListeners.first(); + while (isElement) { + call[i++] = errorListeners.getCurrent(); + isElement = errorListeners.next(); + } + } + // Execute them outside synchronized block. + for (GlassFishStatusListener listener : call) { + listener.error(this.status.getServer(), task); + } + } + + /** + * Register server status listener to be notified about current server status after every check. + *

    + * + * @param listener Server status listener to be registered. + * @return Value of true when listener was added or false when this + * listener was already registered. + */ + public boolean addCurrStatusListener( + final GlassFishStatusListener listener) { + boolean added = false; + boolean exists = false; + boolean isElement; + synchronized (currStatusListeners) { + isElement = currStatusListeners.first(); + while (isElement) { + if (listener.equals(currStatusListeners.getCurrent())) { + exists = true; + } + isElement = currStatusListeners.next(); + } + if (!exists) { + currStatusListeners.addLast(listener); + added = true; + } + } + if (added && listener != null) { + listener.added(); + } + return added; + } + + /** + * Register server status listener to be notified about server status change. + *

    + * + * @param listener Server status listener to be registered. + * @param newState Notify about server status change for new states provided as this argument. + * @return Value of true when listener was added in at least one list or + * false when this listener was already registered in all requested lists. + */ + public boolean addNewStatusListener( + final GlassFishStatusListener listener, + final GlassFishStatus... newState) { + boolean added = false; + boolean exists; + boolean isElement; + LinkedList listeners; + synchronized (newStatusListeners) { + for (GlassFishStatus stateToAdd : newState) { + listeners = newStatusListeners[stateToAdd.ordinal()]; + exists = false; + isElement = listeners.first(); + while (isElement) { + if (listener.equals(listeners.getCurrent())) { + exists = true; + } + isElement = listeners.next(); + } + if (!exists) { + listeners.addLast(listener); + added = true; + } + + } + } + if (added && listener != null) { + listener.added(); + } + return added; + } + + /** + * Register server status listener to be notified about server status check errors. + *

    + * + * @param listener Server status listener to be registered. + * @return Value of true when listener was added or false when this + * listener was already registered. + */ + public boolean addErrorListener( + final GlassFishStatusListener listener) { + boolean added = false; + boolean exists = false; + boolean isElement; + synchronized (errorListeners) { + isElement = errorListeners.first(); + while (isElement) { + if (listener.equals(errorListeners.getCurrent())) { + exists = true; + } + isElement = errorListeners.next(); + } + if (!exists) { + errorListeners.addLast(listener); + added = true; + } + } + if (added && listener != null) { + listener.added(); + } + return added; + } + + /** + * Register server status listener. + *

    + * + * @param listener Server status listener to be registered. + * @param currentState Notify about current server status after every check when true. + * @param newState Notify about server status change for new states provided as this argument. + * @return Value of true when listener was added in at least one list or + * false when this listener was already registered in all requested lists. + */ + public boolean addStatusListener( + final GlassFishStatusListener listener, + final boolean currentState, final GlassFishStatus... newState) { + boolean added; + // Notify about current server status after every check. + if (currentState) { + added = addCurrStatusListener(listener); + } else { + added = false; + } + // Notify about server status change. + if (newState != null) { + added = addNewStatusListener(listener, newState) || added; + } + if (added && listener != null) { + listener.added(); + } + return added; + } + + /** + * Unregister server status listener. + *

    + * + * @param listener Server status listener to be unregistered. + * @return Value of true when listener was found and removed or false when + * listener was not found among registered listeners. + */ + public boolean removeStatusListener( + final GlassFishStatusListener listener) { + boolean removed = false; + // Remove from current server status after every check list. + boolean isElement; + synchronized (currStatusListeners) { + isElement = currStatusListeners.first(); + while (isElement) { + if (listener.equals(currStatusListeners.getCurrent())) { + currStatusListeners.removeAndNext(); + isElement = currStatusListeners.isCurrent(); + removed = true; + } else { + isElement = currStatusListeners.next(); + } + } + } + // Remove from server status change lists. + LinkedList listeners; + synchronized (newStatusListeners) { + for (GlassFishStatus stateToRemove : GlassFishStatus.values()) { + listeners = newStatusListeners[stateToRemove.ordinal()]; + isElement = listeners.first(); + while (isElement) { + if (listener.equals(listeners.getCurrent())) { + listeners.removeAndNext(); + isElement = listeners.isCurrent(); + removed = true; + } else { + isElement = listeners.next(); + } + } + + } + } + // Remove from server status check errors list. + synchronized (errorListeners) { + isElement = errorListeners.first(); + while (isElement) { + if (listener.equals(errorListeners.getCurrent())) { + errorListeners.removeAndNext(); + isElement = errorListeners.isCurrent(); + removed = true; + } else { + isElement = errorListeners.next(); + } + } + } + if (removed && listener != null) { + listener.removed(); + } + return removed; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusJobState.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusJobState.java new file mode 100644 index 00000000..59dc420e --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusJobState.java @@ -0,0 +1,230 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.state; + +import java.util.HashMap; +import java.util.Map; + +import fish.payara.eclipse.tools.server.sdk.GlassFishStatus; +import fish.payara.eclipse.tools.server.sdk.data.DataException; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * Server status check internal state. + *

    + * Internally there are more states to be recognized when server is partially up but not fully + * responding. This helps to use just subset of checks in some states and also to use different + * checks synchronization strategy. + *

    + * + * @author Tomas Kraus + */ +public enum StatusJobState { + //////////////////////////////////////////////////////////////////////////// + // Enum values // + //////////////////////////////////////////////////////////////////////////// + + /** Server status checks are turned off. */ + NO_CHECK, + + /** Server status is unknown. */ + UNKNOWN, + + /** Server status yet unknown but administrator port is alive. */ + UNKNOWN_PORT, + + /** + * Server is offline (not running, not responding and administrator port is not alive). + */ + OFFLINE, + + /** + * Server is offline (not responding but running and administrator port is alive). + */ + OFFLINE_PORT, + + /** + * Server start or restart was requested but server is still not responding and administrator port + * is not alive. + */ + STARTUP, + + /** + * Server start or restart was requested but server is still not bully responding but administrator + * port is alive. + */ + STARTUP_PORT, + + /** Server is running and responding. */ + ONLINE, + + /** + * Server shutdown was requested but server is still running, responding and administrator port is + * alive. + */ + SHUTDOWN, + + /** + * Server shutdown was requested but server is still running, administrator port is alive but server + * is not responding. . + */ + SHUTDOWN_PORT; + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(StatusJobState.class); + + /** GlassFish version enumeration length. */ + public static final int length = StatusJobState.values().length; + + /** A String representation of NO_CHECK value. */ + private static final String NO_CHECK_STR = "NO_CHECK"; + + /** A String representation of UNKNOWN value. */ + private static final String UNKNOWN_STR = "UNKNOWN"; + + /** A String representation of UNKNOWN_PORT value. */ + private static final String UNKNOWN_PORT_STR = "UNKNOWN_PORT"; + + /** A String representation of OFFLINE value. */ + private static final String OFFLINE_STR = "OFFLINE"; + + /** A String representation of OFFLINE_PORT value. */ + private static final String OFFLINE_PORT_STR = "OFFLINE_PORT"; + + /** A String representation of STARTUP value. */ + private static final String STARTUP_STR = "STARTUP"; + + /** A String representation of STARTUP_PORT value. */ + private static final String STARTUP_PORT_STR = "STARTUP_PORT"; + + /** A String representation of ONLINE value. */ + private static final String ONLINE_STR = "ONLINE"; + + /** A String representation of SHUTDOWN value. */ + private static final String SHUTDOWN_STR = "SHUTDOWN"; + + /** A String representation of SHUTDOWN_PORT value. */ + private static final String SHUTDOWN_PORT_STR = "SHUTDOWN_PORT"; + + /** + * Stored String values for backward String conversion. + */ + private static final Map stringValuesMap = new HashMap<>(length); + static { + for (StatusJobState state : StatusJobState.values()) { + stringValuesMap.put(state.toString().toUpperCase(), state); + } + } + + /** + * Server status check internal state to public GlassFish server status translation table. + */ + private static final GlassFishStatus toGlassFishStatus[] = { + GlassFishStatus.UNKNOWN, // NO_CHECK + GlassFishStatus.UNKNOWN, // UNKNOWN + GlassFishStatus.UNKNOWN, // UNKNOWN_PORT + GlassFishStatus.OFFLINE, // OFFLINE + GlassFishStatus.OFFLINE, // OFFLINE_PORT + GlassFishStatus.STARTUP, // STARTUP + GlassFishStatus.STARTUP, // STARTUP_PORT + GlassFishStatus.ONLINE, // ONLINE + GlassFishStatus.SHUTDOWN, // SHUTDOWN + GlassFishStatus.SHUTDOWN // SHUTDOWN_PORT + }; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Returns a GlassFishStatus with a value represented by the specified + * String. The GlassFishStatus returned represents existing value only if + * specified String matches any String returned by toString + * method. Otherwise null value is returned. + *

    + * + * @param name Value containing GlassFishStatus toString representation. + * @return GlassFishStatus value represented by String or + * null if value was not recognized. + */ + public static StatusJobState toValue(final String name) { + if (name != null) { + return (stringValuesMap.get(name.toUpperCase())); + } else { + return null; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Convert StatusJobState value to String. + *

    + * + * @return A String representation of the value of this object. + */ + @Override + public String toString() { + final String METHOD = "toString"; + switch (this) { + case NO_CHECK: + return NO_CHECK_STR; + case UNKNOWN: + return UNKNOWN_STR; + case UNKNOWN_PORT: + return UNKNOWN_PORT_STR; + case OFFLINE: + return OFFLINE_STR; + case OFFLINE_PORT: + return OFFLINE_PORT_STR; + case STARTUP: + return STARTUP_STR; + case STARTUP_PORT: + return STARTUP_PORT_STR; + case ONLINE: + return ONLINE_STR; + case SHUTDOWN: + return SHUTDOWN_STR; + case SHUTDOWN_PORT: + return SHUTDOWN_PORT_STR; + // This is unrecheable. Being here means this class does not handle + // all possible values correctly. + default: + throw new DataException( + LOGGER.excMsg(METHOD, "invalidVersion")); + } + } + + /** + * Convert StatusJobState value to {@link GlassFishStatus}. + *

    + * + * @return A {@link GlassFishStatus} representation of the value of this object. + */ + GlassFishStatus toGlassFishStatus() { + return toGlassFishStatus[this.ordinal()]; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResult.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResult.java new file mode 100644 index 00000000..c370486a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResult.java @@ -0,0 +1,92 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.state; + +import fish.payara.eclipse.tools.server.sdk.TaskEvent; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishStatusCheckResult; + +/** + * Individual server status result including additional information. + *

    + * + * @author tomas Kraus + */ +class StatusResult { + + //////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////// + + /** Individual server status returned. */ + final GlassFishStatusCheckResult status; + + /** Task failure event. */ + final TaskEvent event; + + //////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////// + /** + * Creates an instance of individual server status result. + *

    + * + * @param status Individual server status returned. + * @param event Current status cause. + */ + StatusResult(final GlassFishStatusCheckResult status, + final TaskEvent event) { + this.status = status; + this.event = event; + } + + /** + * Creates an instance of individual server status result. + *

    + * + * @param status Individual server status returned. + */ + StatusResult(final GlassFishStatusCheckResult status) { + this(status, null); + } + + //////////////////////////////////////////////////////////////////////// + // Getters // + //////////////////////////////////////////////////////////////////////// + + /** + * Get individual check task status. + *

    + * + * @return Individual check task status. + */ + public GlassFishStatusCheckResult getStatus() { + return status; + } + + /** + * Get task failure event. + *

    + * + * @return Task failure event. + */ + public TaskEvent getEvent() { + return event; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResultLocations.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResultLocations.java new file mode 100644 index 00000000..10a61aa6 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResultLocations.java @@ -0,0 +1,82 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.state; + +import fish.payara.eclipse.tools.server.sdk.TaskEvent; +import fish.payara.eclipse.tools.server.sdk.admin.ResultMap; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishStatusCheckResult; + +/** + * Server status task execution result for __locations command including additional + * information. + *

    + * This class stores task execution result only. Value SUCCESS means that Locations + * command task execution finished successfully but it does not mean that administration command + * itself returned with COMPLETED status. When SUCCESS status is set, + * stored result value shall be examined too to see real administration command + * execution result. + *

    + * + * @author Tomas Kraus + */ +class StatusResultLocations extends StatusResult { + + //////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////// + + /** Command __locations execution result. */ + final ResultMap result; + + //////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of individual server status result for __locations command. + *

    + * Command __locations result is stored. + *

    + * + * @param result Command __locations execution result. + * @param status Individual server status returned. + * @param failureEvent Failure cause. + */ + StatusResultLocations(final ResultMap result, + final GlassFishStatusCheckResult status, + final TaskEvent failureEvent) { + super(status, failureEvent); + this.result = result; + } + + //////////////////////////////////////////////////////////////////////// + // Getters // + //////////////////////////////////////////////////////////////////////// + + /** + * Get __locations command execution result. + *

    + * + * @return __locations command execution result. + */ + public ResultMap getStatusResult() { + return result; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResultVersion.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResultVersion.java new file mode 100644 index 00000000..a41a90b2 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResultVersion.java @@ -0,0 +1,80 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.state; + +import fish.payara.eclipse.tools.server.sdk.TaskEvent; +import fish.payara.eclipse.tools.server.sdk.admin.ResultString; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishStatusCheckResult; + +/** + * Individual server status result for version command including additional + * information. + *

    + * This class stores task execution result only. Value SUCCESS means that Locations + * command task execution finished successfully but it does not mean that administration command + * itself returned with COMPLETED status. When SUCCESS status is set, + * stored result value shall be examined too to see real administration command + * execution result. + *

    + * + * @author Tomas Kraus + */ +class StatusResultVersion extends StatusResult { + + //////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////// + + /** Command version execution result. */ + final ResultString result; + + //////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of individual server status result for version command. + *

    + * Command version result is stored. + *

    + * + * @param result Command version execution result. + * @param status Individual server status returned. + * @param failureEvent Failure cause. + */ + StatusResultVersion(final ResultString result, + final GlassFishStatusCheckResult status, + final TaskEvent failureEvent) { + super(status, failureEvent); + this.result = result; + } + + //////////////////////////////////////////////////////////////////////// + // Getters // + //////////////////////////////////////////////////////////////////////// + /** + * Get version command execution result. + *

    + * + * @return version command execution result. + */ + public ResultString getResult() { + return result; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusScheduler.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusScheduler.java new file mode 100644 index 00000000..19e7fedc --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusScheduler.java @@ -0,0 +1,784 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.server.state; + +import static fish.payara.eclipse.tools.server.sdk.server.state.StatusJobState.NO_CHECK; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.GlassFishStatus; +import fish.payara.eclipse.tools.server.sdk.GlassFishStatusListener; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishServerStatus; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishStatusCheck; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * Thread responsible for processing all server status checks and updating server status entity + * objects with current server status. + *

    + * + * @author Tomas Kraus + */ +public class StatusScheduler { + + //////////////////////////////////////////////////////////////////////////// + // Inner classes // + //////////////////////////////////////////////////////////////////////////// + + /** + * GlassFish status tasks scheduler {@link ThreadFactory}. + *

    + * Constructs new threads for GlassFish log fetcher tasks. + */ + private static final class ThreadFactory + implements java.util.concurrent.ThreadFactory { + + /** Thread name. */ + private static final String THREAD_NAME = "GlassFish Status Tasks"; + + /** {@link ThreadGroup} of constructed thread. */ + private static final ThreadGroup threadGroup = initThreadGroup(); + + /** + * Initialize {@link ThreadGroup} object for threads being created in this factory. + *

    + * + * @return {@link ThreadGroup} object for threads being created in this factory. + */ + private static ThreadGroup initThreadGroup() { + ThreadGroup tg = Thread.currentThread().getThreadGroup(); + if (tg != null) { + ThreadGroup tgParrent; + while ((tgParrent = tg.getParent()) != null) { + tg = tgParrent; + } + } + return new ThreadGroup(tg, THREAD_NAME); + } + + /** + * Constructs a new {@link Thread}. + *

    + * + * @param r A runnable to be executed by new {@link Thread} instance. + * @return Constructed thread. + */ + @Override + public Thread newThread(final Runnable r) { + Thread t = new Thread(threadGroup, r, THREAD_NAME); + t.setDaemon(true); + return t; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(StatusScheduler.class); + + /** External executor instance. */ + private static ScheduledThreadPoolExecutor scheduledExecutor; + + /** Singleton object instance. */ + private static volatile StatusScheduler instance; + + /** + * The number of threads to keep in the pool, even if they are idle. Applies only to internal + * executor. + */ + private static final int DEFAULT_INTERNAL_CORE_POOL_SIZE = 3; + + /** Tasks execution delay [ms]. */ + private static final long DELAY = 6000; + + /** Tasks execution initial delay [ms]. */ + private static final long INITIAL_DELAY = 2000; + + /** Tasks execution delay in startup mode [ms]. */ + private static final long DELAY_STARTUP = 3000; + + /** Tasks execution initial delay in startup mode [ms]. */ + private static final long INITIAL_DELAY_STARTUP = 1000; + + /** Administration port connect timeout [ms]. */ + private static final int CONNECT_TIMEOUT = 5000; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Allows to initialize this class to use external executor. + *

    + * This method must be called before first usage of {@link #getInstance()} method. + *

    + * + * @param executor External executor to be supplied. + */ + public static void init(final ScheduledThreadPoolExecutor executor) { + synchronized (StatusScheduler.class) { + if (instance == null) { + scheduledExecutor = executor; + } else { + throw new IllegalStateException(); + } + } + } + + /** + * Allows to initialize this class to use internal executor. + *

    + * This method must be called before first usage of {@link #getInstance()} method. Caller should + * hold StatusScheduler.class lock. + */ + private static ScheduledThreadPoolExecutor newScheduledExecutor() { + ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor( + DEFAULT_INTERNAL_CORE_POOL_SIZE, new ThreadFactory()); + executor.setRemoveOnCancelPolicy(true); + return executor; + } + + /** + * Return existing singleton instance of this class or create a new one when no instance exists. + *

    + * + * @return GlassFishAccountInstanceProvider singleton instance. + */ + public static StatusScheduler getInstance() { + if (instance != null) { + return instance; + } + synchronized (StatusScheduler.class) { + if (instance == null) { + if (scheduledExecutor == null) { + scheduledExecutor = newScheduledExecutor(); + } + instance = new StatusScheduler(scheduledExecutor); + } + } + return instance; + } + + /** + * Select tasks execution delay depending on current job internal state. + *

    + * + * @param state Current job internal state. + * @return Tasks execution delay. + */ + private static long selectDelay(final StatusJobState state) { + switch (state) { + case STARTUP: + case STARTUP_PORT: + case SHUTDOWN: + case SHUTDOWN_PORT: + return DELAY_STARTUP; + default: + return DELAY; + } + } + + /** + * Select tasks execution initial delay depending on current job internal state. + *

    + * + * @param state Current job internal state. + * @return Tasks execution initial delay. + */ + private static long selectInitialDelay(final StatusJobState state) { + switch (state) { + case STARTUP: + case STARTUP_PORT: + case SHUTDOWN: + case SHUTDOWN_PORT: + return INITIAL_DELAY_STARTUP; + default: + return INITIAL_DELAY; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Executor to run server status checks. */ + private ScheduledThreadPoolExecutor executor; + + /** Server status jobs. */ + private final Map jobs; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of server status checks scheduler. + *

    + * + * @param executor External executor. + */ + private StatusScheduler(final ScheduledThreadPoolExecutor executor) { + this.executor = executor; + jobs = new HashMap<>(); + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Check if given GlassFisg server instance is registered. + *

    + * + * @param srv GlassFisg server instance to be checked. + * @return Value of true when server instance is registered in scheduler or + * false otherwise. + */ + public boolean exists(final PayaraServer srv) { + boolean result; + synchronized (jobs) { + result = jobs.containsKey(srv); + } + return result; + } + + /** + * Get GlassFisg server instance status object from scheduler. + *

    + * When status checking is disabled, it will restart it and return current status which is probably + * UNKNOWN. If listener is provided, it will be registered to receive any state change + * notification following status checking restart. This listener won't be unregistered automatically + * so caller should handle it properly. + *

    + * + * @param srv GlassFisg server instance to search for in jobs. + * @param listener Server status listener to be registered when status checking is being restarted. + * @return GlassFisg server status {@link GlassFishServerStatus} object. Returns null + * value for unregistered server instance. + */ + public GlassFishServerStatus get(final PayaraServer srv, + final GlassFishStatusListener listener) { + StatusJob job = getJob(srv); + if (job != null) { + if (job.getState() == NO_CHECK) { + job.restartJob(this, listener); + } + return job.getStatus(); + } + return null; + } + + /** + * Switch GlassFisg server status monitoring into startup mode. + *

    + * + * @param srv GlassFisg server instance to be started. + * @param force Force startup mode for GlassFish server instance from any state then + * true. + * @param listener Server status listener to be registered together with switching into startup + * mode. + * @param newState Notify about server status change for new states provided as this argument. + * @return Value of true when server instance is being monitored in startup mode or + * false if switching failed. + */ + public boolean start(final PayaraServer srv, final boolean force, + final GlassFishStatusListener listener, + final GlassFishStatus... newState) { + StatusJob job = getJob(srv); + return job != null + ? job.startState(this, force, listener, newState) + : false; + } + + /** + * Switch GlassFisg server status monitoring into shutdown mode. + *

    + * + * @param srv GlassFisg server instance to be stopped. + * @return Value of true when server instance is being monitored in startup mode or + * false if switching failed. + */ + public boolean shutdown(final PayaraServer srv) { + StatusJob job = getJob(srv); + return job != null ? job.shutdownState(this) : false; + } + + /** + * Register GlassFisg server instance into scheduler, register server status listener and launch + * server status checking jobs. + *

    + * + * @param status GlassFish server status entity. + * @param listener Server status listener to be registered. + * @param currentState Notify about current server status after every check when true. + * @param newState Notify about server status change for new states provided as this argument. + * @return Value of true when server instance was successfully added into scheduler and + * status checking job was started or false otherwise. + */ + public boolean add(final GlassFishStatusEntity status, + final GlassFishStatusListener listener, final boolean currentState, + final GlassFishStatus... newState) { + boolean result; + StatusJob job = new StatusJob(status); + job.addStatusListener(listener, currentState, newState); + if (result = addJob(job)) { + job.scheduleNew(this); + } + return result; + } + + /** + * Register GlassFisg server instance into scheduler and launch server status checking jobs. + *

    + * + * @param status GlassFish server status entity. + * @return Value of true when server instance was successfully added into scheduler and + * status checking job was started or false otherwise. + */ + public boolean add(final GlassFishStatusEntity status) { + boolean result; + StatusJob job = new StatusJob(status); + if (result = addJob(job)) { + job.scheduleNew(this); + } + return result; + } + + /** + * Unregister GlassFisg server instance from scheduler and and stop server status checking jobs. + *

    + * + * @param srv GlassFisg server instance to unregister. + * @return Value of true when server instance was successfully removed from scheduler + * and status checking job was stopped. or false when server instance was not + * registered. + */ + public boolean remove(final PayaraServer srv) { + StatusJob job = removeJob(srv); + if (job != null) { + remove(job); + } + return job != null; + } + + /** + * Suspend server status monitoring for GlassFisg server instance. + *

    + * + * @param srv GlassFish server instance for which to suspend monitoring. + * @return Value of true when server instance monitoring was suspended or + * false when server instance is not registered. + */ + public boolean suspend(final PayaraServer srv) { + StatusJob job = getJob(srv); + if (job == null) { + return false; + } else { + job.stopJob(this); + return true; + } + } + + /** + * Get server status job from jobs {@link Map}. + *

    + * + * @param srv GlassFisg server instance to search for in jobs. + * @return Server status job associated with GlassFisg server instance or null when no + * such job exists. + */ + public StatusJob getJob(final PayaraServer srv) { + StatusJob job; + synchronized (jobs) { + job = jobs.get(srv); + } + return job; + } + + /** + * Add server status job into jobs {@link Map}. + *

    + * Server status job will be added only if there is no other job for GlassFisg server instance + * associated with this job. + *

    + * + * @return Value of true when jow was added into jobs {@link Map} or false + * otherwise. + */ + private boolean addJob(final StatusJob job) { + synchronized (jobs) { + if (jobs.get(job.getStatus().getServer()) == null) { + jobs.put(job.getStatus().getServer(), job); + return true; + } else { + return false; + } + } + } + + /** + * Remove server status job from jobs {@link Map}. + *

    + * + * @param srv GlassFisg server instance associated with job to be removed. + * @return Server status job that was removed or null when no job for given server + * instance was found. + */ + private StatusJob removeJob(final PayaraServer srv) { + StatusJob job; + synchronized (jobs) { + job = jobs.remove(srv); + } + return job; + } + + /** + * Schedule periodic execution of __locations asynchronous task. + *

    + * Caller must own job lock. + *

    + * + * @param job Server status check job internal data. + * @param initialDelay Task execution initial delay. + */ + private ScheduledFuture scheduleLocationsTask( + final StatusJob job, final long initialDelay) { + RunnerTask runnerTask = new RunnerTask(job, + job.getLocations(), GlassFishStatusCheck.LOCATIONS); + long delay = selectDelay(job.getState()); + ScheduledFuture scheduledFuture = executor.scheduleWithFixedDelay( + runnerTask, initialDelay, delay, TimeUnit.MILLISECONDS); + job.getLocations().setTaskFuture(runnerTask, scheduledFuture); + return scheduledFuture; + } + + /** + * Schedule periodic execution of version asynchronous task. + *

    + * Caller must own job lock. + *

    + * + * @param job Server status check job internal data. + * @param initialDelay Task execution initial delay. + */ + private ScheduledFuture scheduleVersionTask( + final StatusJob job, final long initialDelay) { + RunnerTask runnerTask = new RunnerTask(job, + job.getVersion(), GlassFishStatusCheck.VERSION); + long delay = selectDelay(job.getState()); + ScheduledFuture scheduledFuture = executor.scheduleWithFixedDelay( + runnerTask, initialDelay, delay, TimeUnit.MILLISECONDS); + job.getVersion().setTaskFuture(runnerTask, scheduledFuture); + return scheduledFuture; + } + + /** + * Schedule periodic execution of __locations asynchronous task. + *

    + * Caller must own job lock. + *

    + * + * @param job Server status check job internal data. + */ + private ScheduledFuture scheduleLocationsTask(final StatusJob job) { + long initialDelay = selectInitialDelay(job.getState()); + return scheduleLocationsTask(job, initialDelay); + } + + /** + * Schedule periodic execution of version asynchronous task. + *

    + * Caller must own job lock. + *

    + * + * @param job Server status check job internal data. + */ + private ScheduledFuture scheduleVersionTask(final StatusJob job) { + long initialDelay = selectInitialDelay(job.getState()); + return scheduleVersionTask(job, initialDelay); + } + + /** + * Schedule periodic execution of port check asynchronous task. + *

    + * Caller must own job lock. + *

    + * + * @param job Server status check job internal data. + */ + private ScheduledFuture scheduleAdminPortTask(final StatusJob job) { + AdminPortTask portTask = new AdminPortTask(job, + job.getPortCheck(), CONNECT_TIMEOUT); + long delay = selectDelay(job.getState()); + long initialDelay = selectInitialDelay(job.getState()); + ScheduledFuture scheduledFuture = executor.scheduleWithFixedDelay( + portTask, initialDelay, delay, TimeUnit.MILLISECONDS); + job.getPortCheck().setTaskFuture(portTask, scheduledFuture); + return scheduledFuture; + } + + /** + * Cancel execution of scheduled job task. + *

    + * + * @param task Individual status check task data. + */ + void cancel(final StatusJob.Task task) { + ScheduledFuture future = task.getFuture(); + if (future != null) { + future.cancel(true); + } + AbstractTask runnable = task.getTask(); + if (runnable != null) { + runnable.cancel(); + executor.remove(runnable); + } + task.clearTaskFuture(); + } + + /** + * Administrator port only check for states where we do not expect server to be fully responding. + *

    + * Caller must own job lock. + *

    + * + * @param job Server status check job internal data. + */ + private void portCheckOnly(final StatusJob job) { + scheduleAdminPortTask(job); + job.getVersion().clearTaskFuture(); + job.getLocations().clearTaskFuture(); + } + + /** + * All checks at once when we need full result ASAP. + *

    + * Local check does not need version. Locations is enough to see if server is running from + * registered installation directory and domain. + *

    + * Caller must own job lock. + *

    + * + * @param job Server status check job internal data. + */ + private void localChecksAtOnce(final StatusJob job) { + scheduleAdminPortTask(job); + scheduleLocationsTask(job); + job.getVersion().clearTaskFuture(); + } + + /** + * All checks step by step when server state is stable and we have to run all checks. + *

    + * Local check does not need version. Locations is enough to see if server is running from + * registered installation directory and domain. + *

    + * Caller must own job lock. + *

    + * + * @param job Server status check job internal data. + */ + private void localChecksStepByStep(final StatusJob job) { + long delay = selectDelay(job.getState()); + long initialDelay = selectInitialDelay(job.getState()); + scheduleAdminPortTask(job); + scheduleLocationsTask(job, initialDelay + delay / 2); + job.getVersion().clearTaskFuture(); + } + + /** + * Checks for local server when in stable online state. + *

    + * Local check does not need version. Locations is enough to see if server is running from + * registered installation directory and domain. + *

    + * Caller must own job lock. + *

    + * + * @param job Server status check job internal data. + */ + private void localChecksCommand(final StatusJob job) { + long initialDelay = selectInitialDelay(job.getState()); + scheduleLocationsTask(job, initialDelay); + job.getPortCheck().clearTaskFuture(); + job.getVersion().clearTaskFuture(); + } + + /** + * Checks for remote server at once when we need full result ASAP. + *

    + * Locations task makes no sense for remote server because there is no way to verify registered + * installation directory and domain. We can at least check server version. Caller must own + * job lock. + *

    + * + * @param job Server status check job internal data. + */ + private void remoteChecksAtOnce(final StatusJob job) { + scheduleAdminPortTask(job); + scheduleVersionTask(job); + job.getLocations().clearTaskFuture(); + + } + + /** + * Checks for remote server step by step when server state is stable and we have to run all checks. + *

    + * Locations task makes no sense for remote server because there is no way to verify registered + * installation directory and domain. We can at least check server version. + *

    + * Caller must own job lock. + *

    + * + * @param job Server status check job internal data. + */ + private void remoteChecksStepByStep(final StatusJob job) { + long delay = selectDelay(job.getState()); + long initialDelay = selectInitialDelay(job.getState()); + scheduleAdminPortTask(job); + scheduleVersionTask(job, initialDelay + delay / 2); + job.getLocations().clearTaskFuture(); + } + + /** + * Checks for remote server when in stable online state. + *

    + * Locations task makes no sense for remote server because there is no way to verify registered + * installation directory and domain. We can at least check server version. + *

    + * Caller must own job lock. + *

    + * + * @param job Server status check job internal data. + */ + private void remoteChecksCommand(final StatusJob job) { + long initialDelay = selectInitialDelay(job.getState()); + scheduleVersionTask(job, initialDelay); + job.getPortCheck().clearTaskFuture(); + job.getLocations().clearTaskFuture(); + } + + /** + * Do not run any check. + *

    + * Caller must own job lock. + *

    + * + * @param job Server status check job internal data. + */ + private void noChecks(final StatusJob job) { + job.getPortCheck().clearTaskFuture(); + job.getLocations().clearTaskFuture(); + job.getVersion().clearTaskFuture(); + + } + + /** + * Remove all scheduled tasks from executor. + *

    + * Caller must own job lock. + */ + void remove(final StatusJob job) { + cancel(job.getPortCheck()); + cancel(job.getVersion()); + cancel(job.getLocations()); + executor.purge(); + } + + /** + * Schedule new server status job. + *

    + * Schedule tasks for newly created server status job which is still in UNKNOWN state. + *

    + * Caller must own job lock. + *

    + * + * @param job Server status job. + */ + void scheduleNew(final StatusJob job) { + final String METHOD = "scheduleNew"; + switch (job.getState()) { + case UNKNOWN: + portCheckOnly(job); + return; + default: + throw new IllegalStateException( + LOGGER.excMsg(METHOD, "illegalState")); + } + } + + /** + * Schedule server status job after internal state transition to follow current strategy. + *

    + * Schedule tasks for already existing job can be in any state except UNKNOWN. + *

    + * Caller must own job lock. + *

    + * + * @param job Server status job. + */ + void reschedule(final StatusJob job) { + final String METHOD = "reschedule"; + switch (job.getState()) { + case NO_CHECK: + noChecks(job); + return; + case OFFLINE: + case STARTUP: + case SHUTDOWN_PORT: + case UNKNOWN: + portCheckOnly(job); + return; + case ONLINE: + if (job.getStatus().getServer().isRemote()) { + remoteChecksCommand(job); + } else { + localChecksCommand(job); + } + return; + case SHUTDOWN: + if (job.getStatus().getServer().isRemote()) { + remoteChecksStepByStep(job); + } else { + localChecksStepByStep(job); + } + return; + case STARTUP_PORT: + case OFFLINE_PORT: + case UNKNOWN_PORT: + if (job.getStatus().getServer().isRemote()) { + remoteChecksAtOnce(job); + } else { + localChecksAtOnce(job); + } + return; + default: + throw new IllegalStateException( + LOGGER.excMsg(METHOD, "unhandled")); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/CyclicStringBuffer.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/CyclicStringBuffer.java new file mode 100644 index 00000000..784edf14 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/CyclicStringBuffer.java @@ -0,0 +1,183 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.utils; + +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * Cyclic String buffer. + *

    + * Stores up to <size> characters in cyclic buffer and allows to simply append + * new characters to the end or prepend new characters to the beginning of the buffer without + * necessity to move buffer content. + *

    + * + * @author Tomas Kraus + */ +public class CyclicStringBuffer { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(CyclicStringBuffer.class); + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Buffer size. */ + private int size; + + /** Buffer content. */ + private char[] buff; + + /** Count of valid characters in the buffer. */ + private int len; + + /** Current beginning of valid characters storage. */ + private int beg; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of cyclic String buffer. + *

    + * + * @param size Cyclic String buffer size. + */ + public CyclicStringBuffer(final int size) { + this.size = size; + this.buff = new char[size]; + len = 0; + beg = 0; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Resize cyclic String buffer. + *

    + * Content of buffer will be removed. + *

    + * + * @param size New cyclic String buffer size. + */ + public void resize(final int size) { + if (this.size != size) { + this.size = size; + this.buff = new char[size]; + } + len = 0; + beg = 0; + } + + /** + * Appends character at the end of the buffer. + *

    + * First character in the buffer will be discarded when buffer is full. + *

    + * + * @param c Character to be appended. + * @return Value of true when buffer was full and first character in the buffer got + * overwritten or false otherwise. + */ + public boolean append(final char c) { + buff[(beg + len) % size] = c; + if (len == size) { + beg = (beg + 1) % size; + return true; + } else { + len += 1; + return false; + } + } + + /** + * Appends character at the beginning of the buffer. + *

    + * Last character in the buffer will be discarded when buffer is full. + *

    + * + * @param c Character to be prepended. + * @return Value of true when buffer was full and last character in the buffer got + * overwritten or false otherwise. + */ + public boolean prepend(final char c) { + beg = (beg + size - 1) % size; + buff[beg] = c; + if (len == size) { + return true; + } else { + len += 1; + return false; + } + } + + /** + * Compares buffer content to the specific {@link String}. + *

    + * Empty {@link String} value and null value are considered as equivalent and are equal + * to zero length buffer content. + *

    + * + * @return Value of true if buffer content represents {@link String} equivalent to this + * provided string or false otherwise. + */ + public boolean equals(final String s) { + // Handle null value. + if (s == null) { + return len == 0; + } + // Cut evaluation for differend lengths. + if (len != s.length()) { + return false; + } + boolean result = true; + for (int i = 0; i < len; i++) { + if (buff[(beg + i) % size] != s.charAt(i)) { + result = false; + } + } + return result; + } + + /** + * Returns {@link String} stored in buffer. + *

    + * Zero length content is returned as zero length {@link String}; + *

    + * + * @return {@link String} stored in buffer. + */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(len); + for (int i = 0; i < len; i++) { + sb.append(buff[(beg + i) % size]); + } + return sb.toString(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/ExceptionMessages.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/ExceptionMessages.properties new file mode 100644 index 00000000..3b01cdce --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/ExceptionMessages.properties @@ -0,0 +1,15 @@ +################################################################################ +# Exception messages # +# Use .. notation for keys. # +################################################################################ + +# NetUtils class +NetUtils.getHostIPs.exception=Could not retrieve host IP addresses. +NetUtils.getHostIP4s.exception=Could not retrieve host IPv4 addresses. +NetUtils.getHostIP6s.exception=Could not retrieve host IPv6 addresses. + +# ServerUtils class +ServerUtils.getDomainConfigFile.domainsRootNull=GlassFish server domains root \ +full path shall not be null. +ServerUtils.getDomainConfigFile.domainNameNull=GlassFish server domains name \ +shall not be null. diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/Jar.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/Jar.java new file mode 100644 index 00000000..a23a965c --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/Jar.java @@ -0,0 +1,134 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.utils; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.jar.Attributes; +import java.util.jar.JarInputStream; +import java.util.jar.Manifest; + +/** + * JAR file utilities. + *

    + * This class is a stream wrapper. {@link #close} method should be called before class instance is + * abandoned like when working with streams. + *

    + * + * @author Tomas Kraus, Peter Benedikovic + */ +public class Jar { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** JManifest attribute containing version string. */ + public static final String MANIFEST_BUNDLE_VERSION = "Bundle-Version"; + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + /** JAR file input stream. */ + private final JarInputStream jar; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Creates an instance of JAR file. + *

    + * + * @param jarfile JAR file to be opened. + */ + public Jar(File jarfile) { + JarInputStream jarStream = null; + try { + jarStream = new JarInputStream(new FileInputStream(jarfile)); + } catch (IOException ioe) { + jar = null; + throw new JarException(JarException.OPEN_ERROR, ioe); + } + jar = jarStream; + } + + /** + * Creates an instance of JAR file. + *

    + * + * @param jarfile JAR file to be opened. + */ + public Jar(String jarfile) { + JarInputStream jarStream = null; + try { + jarStream = new JarInputStream(new FileInputStream(jarfile)); + } catch (IOException ioe) { + jar = null; + throw new JarException(JarException.OPEN_ERROR, ioe); + } + jar = jarStream; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Returns the Manifest for this JAR file, or null if none. + *

    + * + * @return The Manifest for this JAR file, or null if none. + */ + public Manifest getManifest() { + return jar.getManifest(); + } + + /** + * Returns the bundle version string from Manifest file. + *

    + * + * @return Bundle version string from Manifest file or null when no such attribute + * exists. + */ + public String getBundleVersion() { + Manifest manifest = jar.getManifest(); + Attributes attrs = manifest != null + ? manifest.getMainAttributes() + : null; + return attrs != null ? attrs.getValue(MANIFEST_BUNDLE_VERSION) : null; + } + + /** + * Close JAR file and release all allocated resources. + *

    + * This method should be called when this object is being released to avoid memory leaks. + */ + public void close() { + if (jar != null) { + try { + jar.close(); + } catch (IOException ioe) { + throw new JarException(JarException.CLOSE_ERROR, ioe); + } + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JarException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JarException.java new file mode 100644 index 00000000..a1ca6961 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JarException.java @@ -0,0 +1,118 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.utils; + +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; + +/** + * Utils JAR Exception related to JAR file handling problems. + *

    + * All exceptions are logging themselves on WARNING level when created. + *

    + * + * @author Tomas Kraus, Peter Benedikovic + */ +public class JarException extends PayaraIdeException { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Exception message for JAR file opening issues. */ + static final String OPEN_ERROR = "Cannot open JAR file."; + + /** Exception message for JAR file opening issues. */ + static final String CLOSE_ERROR = "Cannot close JAR file."; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of JarException without detail message. + */ + public JarException() { + super(); + } + + /** + * Constructs an instance of JarException with the specified detail message. + *

    + * + * @param msg The detail message. + */ + public JarException(String msg) { + super(msg); + } + + /** + * Constructs an instance of JarException with the specified detail message and + * arguments. + *

    + * Uses {@link java.text.MessageFormat} to format message. + *

    + * + * @param msg The detail message. + * @param arguments Arguments to be inserted into message. + */ + public JarException(String msg, Object... arguments) { + super(msg, arguments); + } + + /** + * Constructs an instance of JarException with the specified detail message and cause. + * Exception is logged on WARN level. + *

    + * Note that the detail message associated with {@code cause} is not automatically + * incorporated in this runtime exception's detail message. + *

    + * + * @param msg the detail message (which is saved for later retrieval by the {@link #getMessage()} + * method). + * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A + * null value is permitted, and indicates that the cause is nonexistent or unknown.) + */ + public JarException(String msg, Throwable cause) { + super(msg, cause); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JavaUtils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JavaUtils.java new file mode 100644 index 00000000..ddd3367d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JavaUtils.java @@ -0,0 +1,441 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.utils; + +import static java.util.logging.Level.WARNING; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Path; +import java.security.CodeSource; +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; +import java.util.logging.Level; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.server.config.JavaSEPlatform; + +/** + * Java related utilities + *

    + * + * @author Tomas Kraus, Peter Benedikovic + */ +public class JavaUtils { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(JavaUtils.class); + + /** Java executables directory underJava home. */ + private static final String JAVA_BIN_DIR = "bin"; + + /** Java VM executable file name (without path). */ + private static final String JAVA_VM_EXE = "java"; + + /** Java VM command line option to retrieve version. */ + private static final String VM_VERSION_OPT = "-version"; + + /** Java SE JDK class path option. */ + public static final String VM_CLASSPATH_OPTION = "-cp"; + + /** Java VM system property option. */ + private static final String VM_SYS_PROP_OPT = "-D"; + + /** Java VM system property quoting character. */ + private static final char VM_SYS_PROP_QUOTE = '"'; + + /** Java VM system property assignment. */ + private static final String VM_SYS_PROP_ASSIGN = "="; + + /** Java VM system environment JAVA_HOME variable name. */ + public static final String JAVA_HOME_ENV = "JAVA_HOME"; + + /** UTF-8 {@link Charset}. */ + public static final Charset UTF_8 = Charset.forName("UTF-8"); + /** + * Java VM version output regular expression pattern. + *

    + * Regular expression contains tokens to read individual version number components. Expected input + * is string like java version "1.6.0_30". + */ + // private static final String VM_VERSION_PATTERN = + // " *[jJ][aA][vV][aA] +[vV][eE][rR][sS][iI][oO][nN] +" + + // "\"{0,1}([0-9]+).([0-9]+).([0-9]+)_([0-9]+)\"{0,1} *"; + private static final String VM_VERSION_PATTERN = "[^0-9]*([0-9]+)\\.([0-9]+)(?:\\.([0-9]+)(?:[-_\\.]([0-9]+)){0,1}){0,1}[^0-9]*"; + + /** + * Number of Matcher groups (REGEX tokens) expected in Java VM version output. + */ + private static final int VM_MIN_VERSION_TOKENS = 2; + + //////////////////////////////////////////////////////////////////////////// + // Static classes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Java VM version storage class. + *

    + * Stored version is in <major>.<minor<.<revision<_<update<> + */ + public static class JavaVersion { + + //////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////// + + /** Major version number. */ + final int major; + + /** Minor version number. */ + final int minor; + + /** Revision number. */ + final int revision; + + /** Patch update number. */ + final int patch; + + //////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of Java VM version number. + *

    + * + * @param major + */ + public JavaVersion(int major, int minor, int revision, int patch) { + this.major = major; + this.minor = minor; + this.revision = revision; + this.patch = patch; + } + + //////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////// + + /** + * Compares this JavaVersion object against another one. + *

    + * + * @param version JavaVersion object to compare with this object. + * @return Compare result: + *

      + *
    • Value 1 if this value is greater than supplied + * version value. + *
    • Value -1 if this value is lesser than supplied + * version value. + *
    • Value 0 if both this value and supplied version + * values are equal. + *
    + */ + public int comapreTo(JavaVersion version) { + return this.major > version.major ? 1 + : this.major < version.major ? -1 + : this.minor > version.minor ? 1 + : this.minor < version.minor ? -1 + : this.revision > version.revision ? 1 + : this.revision < version.revision ? -1 + : this.patch > version.patch ? 1 : this.patch < version.patch ? -1 : 0; + } + + /** + * Return String representation of Java VM version object. + *

    + * + * @return Java VM version string. + */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(16); + sb.append(major); + sb.append('.'); + sb.append(minor); + sb.append('.'); + sb.append(revision); + sb.append('_'); + sb.append(patch); + return sb.toString(); + } + + /** + * Return {@link JavaSEPlatform} matching this Java SE version. + *

    + * + * @return {@link JavaSEPlatform} matching this Java SE version. + */ + public JavaSEPlatform toPlatform() { + StringBuilder sb = new StringBuilder(6); + sb.append(major); + sb.append('.'); + sb.append(minor); + return JavaSEPlatform.toValue(sb.toString()); + } + + } + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + // TODO: This test should be rewritten to use probe class to retrieve + // system properties from JRE. + /** + * Java VM version detector. + *

    + * Executes java -version and tries to find output line containing + *

      + *
    • java version "MA.MI.RE_PA" + *
    + * Where + *
      + *
    • MA is major version number, + *
    • MI is minor version number, + *
    • RE is revision number and + *
    • PA is patch update number, + *
    + * Label java version is parsed as non case sensitive. + */ + public static JavaVersion javaVmVersion(File javaVm) { + // Run Java VM: java -version. + ProcessBuilder pb = new ProcessBuilder(javaVm.getAbsolutePath(), VM_VERSION_OPT); + Process process; + pb.redirectErrorStream(true); + try { + process = pb.start(); + // Handle I/O errors. + } catch (IOException ioe) { + Logger.log(Level.WARNING, "Caught IOException while executing Java VM.", ioe); + return null; + // Handle security issues. + } catch (SecurityException se) { + Logger.log(Level.WARNING, "Caught SecurityException while executing Java VM.", se); + return null; + } + + // Read and parse Java VM output to search for version string. + BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream())); + int major = 0, minor = 0, revision = 0, patch = 0; + String line; + Pattern pattern = Pattern.compile(VM_VERSION_PATTERN); + try { + while ((line = in.readLine()) != null) { + Matcher matcher = pattern.matcher(line); + if (matcher.find()) { + int groupCount = matcher.groupCount(); + if (groupCount >= VM_MIN_VERSION_TOKENS) { + // [0-9]+ REGEX pattern is validating numbers in tokens. + // NumberFormatException can't be thrown. + major = Integer.parseInt(matcher.group(1)); + minor = Integer.parseInt(matcher.group(2)); + revision = groupCount > 2 && matcher.group(3) != null ? Integer.parseInt(matcher.group(3)) : 0; + patch = groupCount > 3 && matcher.group(4) != null ? Integer.parseInt(matcher.group(4)) : 0; + break; + } + } + } + // Handle I/O errors. + } catch (IOException ioe) { + LOGGER.log(WARNING, "javaVmVersion", "Caught IOException while reading Java VM output.", ioe); + return null; + } + + return new JavaVersion(major, minor, revision, patch); + } + + public static String getJavaVersionString(String javaHome) { + return getJavaVersionString(new File(javaVmExecutableFullPath(javaHome))); + } + + public static String getJavaVersionString(File javaVm) { + List javaVersions = new ArrayList<>(); + + try { + CodeSource src = JavaVersionDetector.class.getProtectionDomain().getCodeSource(); + if (src != null) { + + String className = JavaVersionDetector.class.getName(); + String classFileName = JavaVersionDetector.class.getSimpleName() + ".class"; + String classFilePackage = JavaVersionDetector.class.getPackage().getName().replace('.', '/'); + + URL classURL = JavaVersionDetector.class.getResource(classFileName); + + if (classURL != null) { + try (InputStream inputStream = classURL.openConnection().getInputStream()) { + + Path rootClassPath = Files.createTempDirectory("JavaVersionDetector"); + + Files.copy( + inputStream, + Files.createDirectories(rootClassPath.resolve(classFilePackage)) + .resolve(classFileName)); + + Process process = new ProcessBuilder( + javaVm.getAbsolutePath(), + VM_CLASSPATH_OPTION, rootClassPath.toAbsolutePath().toString(), + className) + .start(); + + try (Scanner scanner = new Scanner(process.getErrorStream())) { + scanner.useDelimiter("\\A") + .forEachRemaining(e -> javaVersions.add(e)); + } + + } + } + } + } catch (Exception e) { + LOGGER.log(WARNING, "javaVmVersion", "Caught exception when getting VM version", e); + } + + if (!javaVersions.isEmpty()) { + return javaVersions.get(0); + } + + JavaVersion version = javaVmVersion(javaVm); + + if (version != null) { + return version.toString(); + } + + return null; + } + + /** + * Build Java VM executable full path from Java Home directory. + *

    + * + * @param javaHome Full path to Java Home directory. + * @return Java VM executable full path. + */ + public static String javaVmExecutableFullPath(String javaHome) { + int javaHomeLen = javaHome.length(); + int execSuffixLen = OsUtils.EXEC_SUFFIX.length(); + boolean javaHomeEndsWithPathSep = javaHome.charAt(javaHomeLen - 1) == File.separatorChar; + boolean isExecSuffix = execSuffixLen > 0; + // Count full size to avoid resizing. + StringBuilder javaExecStr = new StringBuilder( + javaHomeLen + + (javaHomeEndsWithPathSep ? 0 : 1) + + JAVA_BIN_DIR.length() + 1 + JAVA_VM_EXE.length() + + (isExecSuffix ? execSuffixLen + 1 : 0)); + // Build string. + javaExecStr.append(javaHome); + if (!javaHomeEndsWithPathSep) { + javaExecStr.append(File.separatorChar); + } + javaExecStr.append(JAVA_BIN_DIR); + javaExecStr.append(File.separatorChar); + javaExecStr.append(JAVA_VM_EXE); + if (isExecSuffix) { + javaExecStr.append(OsUtils.EXEC_SUFFIX); + } + return javaExecStr.toString(); + } + + /** + * Build quoted Java VM system property name by prefixing property name with -D as + * -D"<name>". + *

    + * + * @param name Java VM system property name to be prefixed. + */ + public static String systemPropertyName(String name) { + StringBuilder sb = new StringBuilder( + 2 + VM_SYS_PROP_OPT.length() + name.length()); + return systemPropertyName(sb, name); + } + + /** + * Build quoted Java VM system property name by prefixing property name with -D as + * -D"<name>" into {@link StringBuilder} instance. + *

    + * + * @param sb {@link StringBuilder} instance where to append Java VM system property. + * @param name Java VM system property name to be prefixed. + */ + public static String systemPropertyName(StringBuilder sb, String name) { + sb.append(VM_SYS_PROP_OPT); + sb.append(VM_SYS_PROP_QUOTE); + sb.append(name); + sb.append(VM_SYS_PROP_QUOTE); + return sb.toString(); + } + + /** + * Build quoted Java VM system property -D"<name>=<value>". + *

    + * + * @param name Java VM system property name. + * @param value Java VM system property value. + */ + public static String systemProperty(String name, String value) { + StringBuilder sb = new StringBuilder(2 + VM_SYS_PROP_OPT.length() + + name.length() + VM_SYS_PROP_ASSIGN.length() + value.length()); + return systemProperty(sb, name, value); + } + + /** + * Append quoted Java VM system property -D"<name>=<value>" into + * {@link StringBuilder} instance. + *

    + * + * @param sb {@link StringBuilder} instance where to append Java VM system property. + * @param name Java VM system property name. + * @param value Java VM system property value. + */ + public static String systemProperty( + StringBuilder sb, String name, String value) { + sb.append(VM_SYS_PROP_OPT); + sb.append(VM_SYS_PROP_QUOTE); + sb.append(name); + sb.append(VM_SYS_PROP_ASSIGN); + sb.append(value); + sb.append(VM_SYS_PROP_QUOTE); + return sb.toString(); + } + + /** + * Get URL to access properties file in the same package as given class. + *

    + * + * @param c Class to determine package. + * @param file Properties file name (e.g. Messages.properties). + * @return URL to access properties file. + */ + public static URL getPropertiesURL(final Class c, final String file) { + return c.getResource(file); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JavaVersionDetector.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JavaVersionDetector.java new file mode 100644 index 00000000..18d9924d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JavaVersionDetector.java @@ -0,0 +1,29 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.utils; + +/** + * @author Konstantin + * Komissarchik + */ +public final class JavaVersionDetector { + public static void main(final String[] args) { + System.err.print(System.getProperty("java.version") + ":" + System.getProperty("java.specification.version")); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/LinkedList.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/LinkedList.java new file mode 100644 index 00000000..dcb45c54 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/LinkedList.java @@ -0,0 +1,666 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.utils; + +/** + * Doubly linked list with internal iterator. + *

    + * This linked list implementation allows to work with individual list elements on fly without the + * need of external iterator. + *

    + * List is not thread safe. + *

    + * + * @author Tomas Kraus, Peter Benedikovic + */ +public class LinkedList { + + //////////////////////////////////////////////////////////////////////////// + // Inner Classes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Linked list element containing stored value and links to neighbor nodes. + */ + public static class Element { + + //////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////// + + /** Pointer to previous element in list. */ + private Element previous; + + /** Pointer to next element in list. */ + private Element next; + + /** Stored value object. */ + private V value; + + //////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of linked list element and sets it's stored value object. + *

    + * Pointers to previous and next element are set to null. + *

    + * + * @param value Stored value object. + */ + Element(V value) { + this(value, null, null); + } + + /** + * Constructs an instance of linked list element and sets it's stored value object and + * pointers to previous and next/ element. + *

    + * + * @param value Stored value object. + */ + Element(V value, Element previous, Element next) { + this.value = value; + this.previous = previous; + this.next = next; + } + + //////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////// + + /** + * Clear all internal attributes (set them to null). + *

    + * Garbage collector helper. + */ + void clear() { + previous = null; + next = null; + value = null; + } + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * List head (first element in the list). List should be empty when this pointer is + * null. + */ + private Element head; + + /** + * List tail (last element in the list). List should be empty when this pointer is + * null. + */ + private Element tail; + + /** + * Current element in the list used by internal iterator. List should be empty when this pointer is + * null. + */ + private Element current; + + /** List size. */ + private int size; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + /** + * Constructs an instance of linked list. + *

    + * List is initialized as empty. + */ + public LinkedList() { + head = tail = current = null; + size = 0; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Add element at the end (after tail) of the list. + *

    + * Current element + *

      + *
    • won't be changed when list is not empty
    • or + *
    • will be set to newly added element when list is empty.
    • + *
    + * + * @param value New value to be added at the end of the list. + */ + public void addLast(V value) { + if (tail == null) { + head = tail = current = new Element<>(value); + } else { + tail.next = new Element<>(value, tail, null); + tail = tail.next; + } + size++; + } + + /** + * Add element at the beginning (before head) of the list. + *

    + * Current element + *

      + *
    • won't be changed when list is not empty
    • or + *
    • will be set to newly added element when list is empty.
    • + *
    + * + * @param value New value to be added at the end of the list. + */ + public void addFirst(V value) { + if (tail == null) { + head = tail = current = new Element<>(value); + } else { + head.previous = new Element<>(value, null, head); + head = tail.previous; + } + size++; + } + + /** + * Remove last (tail) element from the list. + *

    + * Current element + *

      + *
    • won't be changed when it is not tail of the list
    • or + *
    • will be set to previous element when it is tail of the list.
    • + *
    + * + * @return Data stored in removed last element of the list. Returns null when list is + * empty. + */ + public V removeLast() { + if (tail == null) { + return null; + } else { + Element remove = tail; + V value = tail.value; + if (tail.previous != null) { + tail.previous.next = null; + } else { + head = null; + } + if (current == tail) { + current = current.previous; + } + tail = tail.previous; + remove.clear(); + size--; + return value; + } + } + + /** + * Remove first (head) element from the list. + *

    + * Current element + *

      + *
    • won't be changed when it is not head of the list
    • or + *
    • will be set to next element when it is head of the list.
    • + *
    + * + * @return Data stored in removed last element of the list. Returns null when list is + * empty. + */ + public V removeFirst() { + if (head == null) { + return null; + } else { + Element remove = head; + V value = head.value; + if (head.next != null) { + head.next.previous = null; + } else { + tail = null; + } + if (current == head) { + current = current.next; + } + head = head.next; + remove.clear(); + size--; + return value; + } + } + + /** + * Add element after current element in the list. + *

    + * Current element + *

      + *
    • won't be changed when list is not empty
    • or + *
    • will be set to newly added element when list is empty.
    • + *
    + * Tail is moved to newly added element when current element is tail. + *

    + * + * @param value New value to be added at the end of the list. + */ + public void addNext(V value) { + if (current == null) { + head = tail = current = new Element(value); + } else { + Element add = new Element<>(value, current, current.next); + if (current.next != null) { + current.next.previous = add; + } else { + tail = add; + } + current.next = add; + } + size++; + } + + /** + * Add element before current element in the list. + *

    + * Current element + *

      + *
    • won't be changed when list is not empty
    • or + *
    • will be set to newly added element when list is empty.
    • + *
    + * Head is moved to newly added element when current element is head. + *

    + * + * @param value New value to be added at the end of the list. + */ + public void addPrevious(V value) { + if (current == null) { + head = tail = current = new Element(value); + } else { + Element add = new Element<>(value, current.previous, current); + if (current.previous != null) { + current.previous.next = add; + } else { + head = add; + } + current.previous = add; + } + size++; + } + + /** + * Remove current element and set current element to previous one if exists or null if + * there is no previous element. + *

    + * + * @return Data stored in removed current element of the list. Returns null when list + * is empty. + */ + public V removeAndPrevious() { + if (current == null) { + return null; + } else { + Element remove = current; + V value = current.value; + if (remove.previous != null) { + remove.previous.next = remove.next; + current = remove.previous; + } else { + head = remove.next; + current = null; + } + if (remove.next != null) { + remove.next.previous = remove.previous; + } else { + tail = remove.previous; + } + remove.clear(); + size--; + return value; + } + } + + /** + * Remove current element and set current element to next one if exists or null if + * there is no next element. + *

    + * + * @return Data stored in removed current element of the list. Returns null when list + * is empty. + */ + public V removeAndNext() { + if (current == null) { + return null; + } else { + Element remove = current; + V value = current.value; + if (remove.next != null) { + remove.next.previous = remove.previous; + current = remove.next; + } else { + tail = remove.previous; + current = null; + } + if (remove.previous != null) { + remove.previous.next = remove.next; + } else { + head = remove.next; + } + remove.clear(); + size--; + return value; + } + } + + /** + * Remove current element and set current element to previous one if exists or next element as + * fallback option. + *

    + * Current element should not be null except when list is empty. Additional check may + * be required to see which direction current element was moved. + *

    + * + * @return Data stored in removed current element of the list. Returns null when list + * is empty. + */ + public V removeAndPreviousOrNext() { + if (current == null) { + return null; + } else { + Element remove = current; + V value = current.value; + if (remove.previous != null) { + remove.previous.next = remove.next; + current = remove.previous; + } else { + head = remove.next; + current = remove.next; + } + if (remove.next != null) { + remove.next.previous = remove.previous; + } else { + tail = remove.previous; + } + remove.clear(); + size--; + return value; + } + } + + /** + * Remove current element and set current element to next one if exists or previous element as + * fallback option. + *

    + * Current element should not be null except when list is empty. Additional check may + * be required to see which direction current element was moved. + *

    + * + * @return Data stored in removed current element of the list. Returns null when list + * is empty. + */ + public V removeAndNextOrPrevious() { + if (current == null) { + return null; + } else { + Element remove = current; + V value = current.value; + if (remove.next != null) { + remove.next.previous = remove.previous; + current = remove.next; + } else { + tail = remove.previous; + current = remove.previous; + } + if (remove.previous != null) { + remove.previous.next = remove.next; + } else { + head = remove.next; + } + remove.clear(); + size--; + return value; + } + } + + /** + * Set current element to the first (head) element. + *

    + * + * @return Value of true if first element exists or false otherwise. + */ + public boolean first() { + return (current = head) != null; + } + + /** + * Set current element to the last (tail) element. + *

    + * + * @return Value of true if last element exists or false otherwise. + */ + public boolean last() { + return (current = tail) != null; + } + + /** + * Attempt to move current pointer to next element. + *

    + * Current pointer will be moved only if there is an element after current one. + *

    + * + * @return Value of true if current pointer was moved to next element or + * false otherwise. + */ + public boolean next() { + if (current != null && current.next != null) { + current = current.next; + return true; + } else { + return false; + } + } + + /** + * Attempt to move current pointer to previous element. + *

    + * Current pointer will be moved only if there is an element before current one. + *

    + * + * @return Value of true if current pointer was moved to previous element or + * false otherwise. + */ + public boolean previous() { + if (current != null && current.previous != null) { + current = current.previous; + return true; + } else { + return false; + } + } + + /** + * Check if list is empty. + *

    + * + * @return Value of true when list is empty (contains no elements) or + * false otherwise. + */ + public boolean isEmpty() { + return head == null; + } + + /** + * Check if there is a current element. + *

    + * + * @return Value of true when there is a current element or false + * otherwise. + */ + public boolean isCurrent() { + return current != null; + } + + /** + * Check if there is an element after current element. + *

    + * + * @return Value of true if there is an element after current element or + * false otherwise. + */ + public boolean isNext() { + return current != null && current.next != null; + } + + /** + * Check if there is an element before current element. + *

    + * + * @return Value of true if there is an element before current element or + * false otherwise. + */ + public boolean isPrevious() { + return current != null && current.previous != null; + } + + /** + * Get current size of list. + *

    + * + * @return Current size of list. + */ + public int size() { + return size; + } + + /** + * Get value stored in current element. + *

    + * + * @return Value stored in current element or null when list is empty. + */ + public V getCurrent() { + if (current != null) { + return current.value; + } else { + return null; + } + } + + /** + * Get value stored in first (head) element. + *

    + * + * @return Value stored in first (head) element or null when list is empty. + */ + public V getFirst() { + if (head != null) { + return head.value; + } else { + return null; + } + } + + /** + * Get value stored in last (tail) element. + *

    + * + * @return Value stored in last (tail) element or null when list is empty. + */ + public V getLast() { + if (tail != null) { + return tail.value; + } else { + return null; + } + } + + /** + * Get value stored in next element (after current). + *

    + * + * @return Value stored in next element or null when list is empty or current element + * is tail. + */ + public V getNext() { + if (current != null && current.next != null) { + return current.next.value; + } else { + return null; + } + } + + /** + * Get value stored in previous element (before current). + *

    + * + * @return Value stored in previous element or null when list is empty or current + * element is head. + */ + public V getPrevious() { + if (current != null && current.previous != null) { + return current.previous.value; + } else { + return null; + } + } + + /** + * Get string representation of list. + *

    + * This iteration over the list won't affect current pointer. + *

    + * + * @return String representation of all list element from head to tail. + */ + @Override + public String toString() { + Element element = head; + StringBuilder sb = new StringBuilder("["); + while (element != null) { + sb.append(element.value != null + ? element.value.toString() + : "null"); + element = element.next; + if (element != null) { + sb.append(','); + } + } + sb.append("]"); + return sb.toString(); + } + + /** + * Clear linked list content. + *

    + * Removes all elements from the list and sets it's size to 0. Also all + * individual elements are cleared to help garbage collector. + */ + public void clear() { + current = head; + while (current != null) { + Element delete = current; + current = current.next; + delete.clear(); + } + head = tail = current = null; + size = 0; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/LogMessages.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/LogMessages.properties new file mode 100644 index 00000000..54614d72 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/LogMessages.properties @@ -0,0 +1,16 @@ +################################################################################ +# Log messages # +# Use .. notation for keys. # +################################################################################ + +# NetUtils class +NetUtils.isPortListeningRemote.closeError=Could not close socket: {0} +NetUtils.isPortListeningLocal.closeError=Could not close socket: {0} +NetUtils.isSecurePort.socket=Using socket.connect + +################################################################################ +# Log messages for tests # +################################################################################ + +# StreamLinesList class +LinesReader.run.exception=Exception while reading server log lines: {0} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/NetUtils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/NetUtils.java new file mode 100644 index 00000000..c0abc47b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/NetUtils.java @@ -0,0 +1,453 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.utils; + +import java.io.IOException; +import java.net.ConnectException; +import java.net.Inet4Address; +import java.net.Inet6Address; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.InterfaceAddress; +import java.net.NetworkInterface; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.SocketException; +import java.net.SocketTimeoutException; +import java.net.URL; +import java.net.URLConnection; +import java.net.UnknownHostException; +import java.util.Comparator; +import java.util.Enumeration; +import java.util.List; +import java.util.Locale; +import java.util.Set; +import java.util.TreeSet; +import java.util.logging.Level; + +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; + +/** + * Networking utilities + *

    + * + * @author Tomas Kraus + */ +public class NetUtils { + + //////////////////////////////////////////////////////////////////////////// + // Inner classes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Comparator for {@link InetAddress} instances to be sorted. + */ + public static class InetAddressComparator + implements Comparator { + + /** + * Compares values of InetAddr instances. + *

    + * + * @param ip1 First InetAddr instance to be compared. + * @param ip2 Second InetAddr instance to be compared. + * @return A negative integer, zero, or a positive integer as the first argument is less than, equal + * to, or greater than the second. + */ + @Override + public int compare(final InetAddress ip1, final InetAddress ip2) { + byte[] addr1 = ip1.getAddress(); + byte[] addr2 = ip2.getAddress(); + int result = addr2.length - addr1.length; + if (result == 0) { + for (int i = 0; result == 0 && i < addr1.length; i++) { + result = addr1[i] - addr2[i]; + } + } + return result; + } + + } + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(ServerUtils.class); + + /** Port check timeout [ms]. */ + public static final int PORT_CHECK_TIMEOUT = 2000; + + /** + * This is the test query used to ping the server in an attempt to determine if it is secure or not. + */ + private static byte[] TEST_QUERY = new byte[] { + // The following SSL query is from nmap (http://www.insecure.org) + // This HTTPS request should work for most (all?) HTTPS servers + (byte) 0x16, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 'S', (byte) 0x01, + (byte) 0x00, (byte) 0x00, (byte) 'O', (byte) 0x03, (byte) 0x00, (byte) '?', + (byte) 'G', (byte) 0xd7, (byte) 0xf7, (byte) 0xba, (byte) ',', (byte) 0xee, + (byte) 0xea, (byte) 0xb2, (byte) '`', (byte) '~', (byte) 0xf3, (byte) 0x00, + (byte) 0xfd, (byte) 0x82, (byte) '{', (byte) 0xb9, (byte) 0xd5, (byte) 0x96, + (byte) 0xc8, (byte) 'w', (byte) 0x9b, (byte) 0xe6, (byte) 0xc4, (byte) 0xdb, + (byte) '<', (byte) '=', (byte) 0xdb, (byte) 'o', (byte) 0xef, (byte) 0x10, + (byte) 'n', (byte) 0x00, (byte) 0x00, (byte) '(', (byte) 0x00, (byte) 0x16, + (byte) 0x00, (byte) 0x13, (byte) 0x00, (byte) 0x0a, (byte) 0x00, (byte) 'f', + (byte) 0x00, (byte) 0x05, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 'e', + (byte) 0x00, (byte) 'd', (byte) 0x00, (byte) 'c', (byte) 0x00, (byte) 'b', + (byte) 0x00, (byte) 'a', (byte) 0x00, (byte) '`', (byte) 0x00, (byte) 0x15, + (byte) 0x00, (byte) 0x12, (byte) 0x00, (byte) 0x09, (byte) 0x00, (byte) 0x14, + (byte) 0x00, (byte) 0x11, (byte) 0x00, (byte) 0x08, (byte) 0x00, (byte) 0x06, + (byte) 0x00, (byte) 0x03, (byte) 0x01, (byte) 0x00, + // The following is a HTTP request, some HTTP servers won't + // respond unless the following is also sent + (byte) 'G', (byte) 'E', (byte) 'T', (byte) ' ', (byte) '/', + // change the detector to request something that the monitor knows to filter + // out. This will work-around 109891. Use the longest filtered prefix to + // avoid false positives.... + (byte) 'c', (byte) 'o', (byte) 'm', (byte) '_', (byte) 's', (byte) 'u', + (byte) 'n', (byte) '_', (byte) 'w', (byte) 'e', (byte) 'b', (byte) '_', + (byte) 'u', (byte) 'i', + (byte) ' ', + (byte) 'H', (byte) 'T', (byte) 'T', (byte) 'P', (byte) '/', (byte) '1', + (byte) '.', (byte) '0', (byte) '\n', (byte) '\n' + }; + + /** Comparator for {@link InetAddress} instances to be sorted. */ + private static final InetAddressComparator INET_ADDRESS_COMPARATOR = new InetAddressComparator(); + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Finds out if server is running on remote host by connecting to remote host and port. + *

    + * + * @param host Server host. + * @param port Server port. + * @param timeout Network connection timeout [ms]. + * @return Returns true when server port is accepting connections or false + * otherwise. + */ + public static boolean isPortListeningRemote(final String host, + final int port, final int timeout) { + final String METHOD = "isPortListeningRemote"; + if (null == host) { + return false; + } + Socket socket = null; + try { + socket = new Socket(); + socket.connect(new InetSocketAddress(host, port), timeout); + return true; + } catch (IOException ex) { + return false; + } finally { + if (socket != null) { + try { + socket.close(); + } catch (IOException ioe) { + LOGGER.log(Level.INFO, METHOD, + "closeError", ioe.getLocalizedMessage()); + } + } + } + } + + /** + * Finds out if server is running on remote host by connecting to remote host and port. + *

    + * + * @param host Server host. + * @param port Server port. + * @return Returns true when server port is accepting connections or false + * otherwise. + */ + public static boolean isPortListeningRemote(final String host, + final int port) { + return isPortListeningRemote(host, port, 0); + } + + /** + * Finds out if server is running on local host by binding to local port. + *

    + * + * @param host Server host or null value for address of the loopback interface. + * @param port Server port. + * @return Returns true when server port is accepting connections or false + * otherwise. + */ + public static boolean isPortListeningLocal(final String host, + final int port) { + final String METHOD = "isPortListeningLocal"; + ServerSocket socket = null; + try { + InetAddress ia = InetAddress.getByName(host); + socket = new ServerSocket(port, 1, ia); + return false; + } catch (IOException ioe) { + return true; + } finally { + if (socket != null) { + try { + socket.close(); + } catch (IOException ioe) { + LOGGER.log(Level.INFO, METHOD, + "closeError", ioe.getLocalizedMessage()); + } + } + } + } + + public static boolean isHttpPortListeningLocal(final String host, + final int port) { + try { + URLConnection conn = new URL("http://" + host + ":" + port).openConnection(); + conn.connect(); + return true; + } catch (IOException ioe) { + // ioe.printStackTrace(); + return false; + } + } + + /** + * Checks whether the host points to local machine. + *

    + * Dealing only with simple cases. + *

    + * + * @param host Host name to be checked. + */ + public static boolean isLocahost(String host) { + if (host == null || host.equals("")) { + return false; + } + + host = host.toLowerCase(); + if ("localhost".equals(host) || "127.0.0.1".equals(host) || "::1".equals(host)) { + return true; + } + + InetAddress localHostaddr; + try { + // Check simple cases. + localHostaddr = InetAddress.getLocalHost(); + } catch (UnknownHostException ex) { + java.util.logging.Logger.getLogger(ServerUtils.class.getName()).log(Level.SEVERE, null, ex); + // TODO add proper exception handling - + // propagate checked exception to client code. + return true; + } + if (host.equals(localHostaddr.getHostName().toLowerCase()) + || host.equals(localHostaddr.getHostAddress().toLowerCase())) { + return true; + } + return false; + } + + /** + * Determine whether an HTTP listener is secure or not.. + *

    + * This method accepts a host name and port #. It uses this information to attempt to connect to the + * port, send a test query, analyze the result to determine if the port is secure or is not secure + * (currently only HTTP / HTTPS is supported). it might emit a warning in the server log for + * GlassFish cases. No Harm, just an annoying warning, so we need to use this call only when really + * needed. + *

    + * + * @param hostname The host for the HTTP listener. + * @param port The port for the HTTP listener. + * @throws IOException + * @throws SocketTimeoutException + * @throws ConnectException + */ + public static boolean isSecurePort(String hostname, int port) + throws IOException, ConnectException, SocketTimeoutException { + return isSecurePort(hostname, port, 0); + } + + /** + * Determine whether an HTTP listener is secure or not.. + *

    + * This method accepts a host name and port #. It uses this information to attempt to connect to the + * port, send a test query, analyze the result to determine if the port is secure or is not secure + * (currently only HTTP / HTTPS is supported). it might emit a warning in the server log for + * GlassFish cases. No Harm, just an annoying warning, so we need to use this call only when really + * needed. + *

    + * + * @param hostname The host for the HTTP listener. + * @param port The port for the HTTP listener. + * @param depth Method calling depth. + * @throws IOException + * @throws SocketTimeoutException + * @throws ConnectException + */ + private static boolean isSecurePort(String hostname, int port, int depth) + throws IOException, ConnectException, SocketTimeoutException { + final String METHOD = "isSecurePort"; + boolean isSecure; + try (Socket socket = new Socket()) { + try { + LOGGER.log(Level.FINE, METHOD, "socket"); + socket.connect(new InetSocketAddress(hostname, port), PORT_CHECK_TIMEOUT); + socket.setSoTimeout(PORT_CHECK_TIMEOUT); + // This could be bug 70020 due to SOCKs proxy not having localhost + } catch (SocketException ex) { + String socksNonProxyHosts = System.getProperty("socksNonProxyHosts"); + if (socksNonProxyHosts != null && socksNonProxyHosts.indexOf("localhost") < 0) { + String localhost = socksNonProxyHosts.length() > 0 ? "|localhost" : "localhost"; + System.setProperty("socksNonProxyHosts", socksNonProxyHosts + localhost); + if (depth < 1) { + socket.close(); + return isSecurePort(hostname, port, 1); + } else { + socket.close(); + ConnectException ce = new ConnectException(); + ce.initCause(ex); + throw ce; // status unknow at this point + // next call, we'll be ok and it will really detect if we are secure or not + } + } + } + java.io.OutputStream ostream = socket.getOutputStream(); + ostream.write(TEST_QUERY); + java.io.InputStream istream = socket.getInputStream(); + byte[] input = new byte[8192]; + istream.read(input); + String response = new String(input).toLowerCase(Locale.ENGLISH); + isSecure = true; + if (response.length() == 0) { + // isSecure = false; + // Close the socket + socket.close(); + throw new ConnectException(); + } else if (response.startsWith("http/1.1 302 moved temporarily")) { + // 3.1 has started to use redirects... but 3.0 is still using the older strategies... + isSecure = true; + } else if (response.startsWith("http/1.")) { + isSecure = false; + } else if (response.indexOf("....</html>". It looks like + // something eats the "<html><hea" off the front of the data that + // gets returned. + // + // This test makes an allowance for that behavior. I figure testing + // the likely "last bit" is better than testing a bit that is close + // to the data that seems to get eaten. + // + isSecure = false; + } else if (response.indexOf("connection: ") != -1) { + isSecure = false; + } + } + return isSecure; + } + + /** + * Retrieve {@link Set} of IP addresses of this host. + * <p/> + * + * @return {@link Set} of IP addresses of this host. + * @throws PayaraIdeException if addresses of this host could not be retrieved. + */ + public static Set<InetAddress> getHostIPs() { + final String METHOD = "getHostIPs"; + Set<InetAddress> addrs = new TreeSet<>(INET_ADDRESS_COMPARATOR); + try { + Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces(); + while (ifaces.hasMoreElements()) { + NetworkInterface iface = ifaces.nextElement(); + List<InterfaceAddress> iAddrs = iface.getInterfaceAddresses(); + for (InterfaceAddress iAddr : iAddrs) { + addrs.add(iAddr.getAddress()); + } + } + } catch (SocketException se) { + addrs = null; + throw new PayaraIdeException(LOGGER.excMsg(METHOD, "exception")); + } + return addrs; + } + + /** + * Retrieve {@link Set} of IPv4 addresses of this host. + * <p/> + * + * @return {@link Set} of IPv4 addresses of this host. + */ + public static Set<Inet4Address> getHostIP4s() { + final String METHOD = "getHostIP4s"; + Set<Inet4Address> addrs = new TreeSet<>(INET_ADDRESS_COMPARATOR); + try { + Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces(); + while (ifaces.hasMoreElements()) { + NetworkInterface iface = ifaces.nextElement(); + List<InterfaceAddress> iAddrs = iface.getInterfaceAddresses(); + for (InterfaceAddress iAddr : iAddrs) { + InetAddress addr = iAddr.getAddress(); + if (addr instanceof Inet4Address) { + addrs.add((Inet4Address) addr); + } + } + } + } catch (SocketException se) { + addrs = null; + throw new PayaraIdeException(LOGGER.excMsg(METHOD, "exception")); + } + return addrs; + } + + /** + * Retrieve {@link Set} of IPv6 addresses of this host. + * <p/> + * + * @return {@link Set} of IPv6 addresses of this host. + */ + public static Set<Inet6Address> getHostIP6s() { + final String METHOD = "getHostIP6s"; + Set<Inet6Address> addrs = new TreeSet<>(INET_ADDRESS_COMPARATOR); + try { + Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces(); + while (ifaces.hasMoreElements()) { + NetworkInterface iface = ifaces.nextElement(); + List<InterfaceAddress> iAddrs = iface.getInterfaceAddresses(); + for (InterfaceAddress iAddr : iAddrs) { + InetAddress addr = iAddr.getAddress(); + if (addr instanceof Inet6Address) { + addrs.add((Inet6Address) addr); + } + } + } + } catch (SocketException se) { + addrs = null; + throw new PayaraIdeException(LOGGER.excMsg(METHOD, "exception")); + } + return addrs; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/OsUtils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/OsUtils.java new file mode 100644 index 00000000..c3e72ea6 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/OsUtils.java @@ -0,0 +1,424 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.utils; + +import java.io.File; +import java.util.LinkedList; +import java.util.List; + +/** + * OS related utilities + * <p/> + * + * @author Tomas Kraus, Peter Benedikovic + */ +public class OsUtils { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** System lines separator. */ + public static final String LINES_SEPARATOR = System.getProperty("line.separator"); + + /** System file separator length. */ + public static final int FILE_SEPARATOR_LENGTH = File.separator.length(); + + /** System property to retrieve OS name. */ + public static final String OS_NAME_PROPERTY = "os.name"; + + /** OS name from system properties. */ + public static final String OS_NAME = System.getProperty(OS_NAME_PROPERTY); + + /** OS name from system properties converted to upper case. */ + public static final String OS_NAME_UPCASE = OS_NAME != null ? OS_NAME.toUpperCase() : OS_NAME; + + /** + * Windows OS name substring used to identify Windows in OS name converted to upper case. + */ + private static final String OS_WIN_SUBSTR = "WINDOWS"; + + /** + * Test if OS where this JDK is running windows. + * <p/> + * Internally cached value. + */ + private static final boolean IS_WIN = OS_NAME != null ? OS_NAME_UPCASE.contains(OS_WIN_SUBSTR) : false; + + /** Executable file suffix (nothing on UNIX, .exe on windows, etc.). */ + public static final String EXEC_SUFFIX = IS_WIN ? ".exe" : ""; + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Check if OS where this JDK is running is windows. + * <p/> + * + * @return <code>true</code> when this JDK is running on Windows or <code>false</code> otherwise. + */ + public static boolean isWin() { + return IS_WIN; + } + + /** + * Parses parameters from a given string in shell-like manner and append them to executable file. + * <p/> + * Users of the Bourne shell (e.g. on Unix) will already be familiar with the behavior. For example + * you should be able to: + * <ul> + * <li/>Include command names with embedded spaces, such as + * <code>c:\Program Files\jdk\bin\javac</code>. + * <li/>Include extra command arguments, such as <code>-Dname=value</code>. + * <li/>Do anything else which might require unusual characters or processing. For example: + * <p/> + * <code><pre> + * "c:\program files\jdk\bin\java" -Dmessage="Hello /\\/\\ there!" -Xmx128m + * </pre></code> + * <p/> + * This example would create the following executable name and arguments: + * <ol> + * <li/><code>c:\program files\jdk\bin\java</code> + * <li/><code>-Dmessage=Hello /\/\ there!</code> + * <li/><code>-Xmx128m</code> + * </ol> + * Note that the command string does not escape its backslashes--under the assumption that Windows + * users will not think to do this, meaningless escapes are just left as backslashes plus following + * character. + * </ul> + * <em>Caveat</em>: even after parsing, Windows programs (such as the Java launcher) may not fully + * honor certain characters, such as quotes, in command names or arguments. This is because programs + * under Windows frequently perform their own parsing and unescaping (since the shell cannot be + * relied on to do this). On Unix, this problem should not occur. + * <p/> + * + * @param args A String to parse + * @return An array of executable file and parameters to be passed to it. + */ + public static String[] parseParameters(String exec, String args) { + int NULL = 0x0; // STICK + whitespace or NULL + non_" + int INPARAM = 0x1; // NULL + " or STICK + " or INPARAMPENDING + "\ // NOI18N + int INPARAMPENDING = 0x2; // INPARAM + \ + int STICK = 0x4; // INPARAM + " or STICK + non_" // NOI18N + int STICKPENDING = 0x8; // STICK + \ + List<String> params = new LinkedList<>(); + params.add(exec); + char c; + + int state = NULL; + StringBuilder buff = new StringBuilder(20); + int slength = args.length(); + + for (int i = 0; i < slength; i++) { + c = args.charAt(i); + + if (Character.isWhitespace(c)) { + if (state == NULL) { + if (buff.length() > 0) { + params.add(buff.toString()); + buff.setLength(0); + } + } else if (state == STICK) { + params.add(buff.toString()); + buff.setLength(0); + state = NULL; + } else if (state == STICKPENDING) { + buff.append('\\'); + params.add(buff.toString()); + buff.setLength(0); + state = NULL; + } else if (state == INPARAMPENDING) { + state = INPARAM; + buff.append('\\'); + buff.append(c); + } else { // INPARAM + buff.append(c); + } + + continue; + } + + if (c == '\\') { + if (state == NULL) { + ++i; + + if (i < slength) { + char cc = args.charAt(i); + + if ((cc == '"') || (cc == '\\')) { + buff.append(cc); + } else if (Character.isWhitespace(cc)) { + buff.append(c); + --i; + } else { + buff.append(c); + buff.append(cc); + } + } else { + buff.append('\\'); + + break; + } + + continue; + } else if (state == INPARAM) { + state = INPARAMPENDING; + } else if (state == INPARAMPENDING) { + buff.append('\\'); + state = INPARAM; + } else if (state == STICK) { + state = STICKPENDING; + } else if (state == STICKPENDING) { + buff.append('\\'); + state = STICK; + } + + continue; + } + + if (c == '"') { + if (state == NULL) { + state = INPARAM; + } else if (state == INPARAM) { + state = STICK; + } else if (state == STICK) { + state = INPARAM; + } else if (state == STICKPENDING) { + buff.append('"'); + state = STICK; + } else { // INPARAMPENDING + buff.append('"'); + state = INPARAM; + } + + continue; + } + + if (state == INPARAMPENDING) { + buff.append('\\'); + state = INPARAM; + } else if (state == STICKPENDING) { + buff.append('\\'); + state = STICK; + } + + buff.append(c); + } + + // collect + if (state == INPARAM) { + params.add(buff.toString()); + } else if ((state & (INPARAMPENDING | STICKPENDING)) != 0) { + buff.append('\\'); + params.add(buff.toString()); + } else { // NULL or STICK + + if (buff.length() != 0) { + params.add(buff.toString()); + } + } + + String[] retArgs = new String[params.size()]; + int i = 0; + for (String param : params) { + retArgs[i++] = param; + } + return retArgs; + } + + /** + * Complementary method to parseParameters + * + * @link #parseParameters + */ + public static String escapeParameters(String[] params) { + StringBuffer sb = new StringBuffer(); + + for (String param : params) { + escapeString(param, sb); + sb.append(' '); + } + + final int len = sb.length(); + + if (len > 0) { + sb.setLength(len - 1); + } + + return sb.toString().trim(); + } + + /** + * Escapes one string and appends it into provided {@link StringBuffer}. + * <p/> + * + * @param s String to be escaped. + * @param sb Target {@link StringBuffer}. + * @link #escapeParameters + */ + public static void escapeString(String s, StringBuffer sb) { + if (s.length() == 0) { + sb.append("\"\""); + return; + } + boolean hasSpace = false; + final int sz = sb.length(); + final int slen = s.length(); + char c; + for (int i = 0; i < slen; i++) { + c = s.charAt(i); + if (Character.isWhitespace(c)) { + hasSpace = true; + sb.append(c); + continue; + } + if (c == '\\') { + sb.append('\\').append('\\'); + continue; + } + if (c == '"') { + sb.append('\\').append('"'); + continue; + } + sb.append(c); + } + if (hasSpace) { + sb.insert(sz, '"'); + sb.append('"'); + } + } + + /** + * Escapes provided {@link String}. + * <p/> + * + * @param s {@link String} to be escaped. + * @return Escaped {@link String} value. + */ + public static String escapeString(String s) { + final int sLen = s.length(); + int tLen = sLen; + boolean quote = sLen == 0; + // Count length of target String to avoid StringBuilder resizing + for (int i = 0; i < sLen; i++) { + char c = s.charAt(i); + switch (c) { + case '\\': + case '"': + tLen++; + break; + default: + if (Character.isWhitespace(c)) { + quote = true; + } + } + } + if (quote) { + tLen += 2; + } + // Build target value. + StringBuilder sb = new StringBuilder(tLen); + if (quote) { + sb.append('\"'); + } + for (int i = 0; i < sLen; i++) { + char c = s.charAt(i); + switch (c) { + case '\\': + case '"': + sb.append('\\'); + break; + } + sb.append(c); + } + if (quote) { + sb.append('\"'); + } + return sb.toString(); + } + + /** + * Recursive delete of internal files and directory structure. + * <p/> + * Target directory is not removed. It's made empty. Think twice before using it. + * <p/> + * + * @param target File or directory which content will be deleted. + */ + public static boolean rmDirContent(File target) { + boolean result = true; + if (target != null) { + File[] content = target.listFiles(); + for (File file : content) { + if (file.canWrite()) { + if (file.isDirectory() && !".".equals(file.getName()) + && !"..".equals(file.getName())) { + result = result && rmDirContent(file); + } + result = result && file.delete(); + } else { + result = false; + } + } + } + return result; + } + + /** + * Recursive delete of directory structure. + * <p/> + * Target directory is also removed. Think twice before using it. + * <p/> + * + * @param target File or directory to be deleted. + */ + public static boolean rmDir(File target) { + boolean result = rmDirContent(target); + return result && target.delete(); + } + + /** + * Join 2 path elements separating them with path separator if not present at the end of first path + * element. + * <p/> + * + * @param e1 1st path element. + * @param e2 2nd path element. + */ + @SuppressWarnings("null") + public static String joinPaths(final String e1, final String e2) { + int l1 = e1 != null ? e1.length() : 0; + int l2 = e2 != null ? e2.length() : 0; + boolean separator = l1 > 0 && !e1.endsWith(File.separator); + StringBuilder sb = new StringBuilder( + l1 + l2 + (separator ? FILE_SEPARATOR_LENGTH : 0)); + if (l1 > 0) { + sb.append(e1); + } + if (separator) { + sb.append(File.separator); + } + if (l2 > 0) { + sb.append(e2); + } + return sb.toString(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/ServerUtils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/ServerUtils.java new file mode 100644 index 00000000..5de40d68 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/ServerUtils.java @@ -0,0 +1,879 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.utils; + +import java.io.File; +import java.io.FileFilter; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Base64; +import java.util.List; +import java.util.Map; +import java.util.jar.JarFile; +import java.util.jar.Manifest; +import java.util.logging.Level; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.admin.CommandException; +import fish.payara.eclipse.tools.server.sdk.data.GlassFishContainer; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.utils.Version; + +/** + * Common utilities. + * <p/> + * + * @author Vince Kraemer, Tomas Kraus, Peter Benedikovic + */ +public class ServerUtils { + + //////////////////////////////////////////////////////////////////////////// + // Inner Classes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Filtering the set of directories with GlassFish server home subdirectory shown to the user in + * file filter. + */ + public static class GlassFishFilter implements FileFilter { + + /** + * Test whether or not the specified pathname is GlassFish server subdirectory. + * <p/> + * + * @param path Pathname to be tested. + * @return Returns <code>true</code> when given <code>File</code> should be included or + * <code>false</code> otherwise. + */ + @Override + public boolean accept(final File path) { + if (path.isDirectory() && path.canRead()) { + File commonUtilJar = getCommonUtilJarInModules(path.getAbsolutePath()); + if (commonUtilJar.isFile() && commonUtilJar.canRead()) { + return true; + } else { + return false; + } + } else { + return false; + } + } + + } + + /** + * Filtering the set of GlassFish servers using file name pattern. + */ + private static class VersionFilter implements FileFilter { + + /** Compiled file name pattern. */ + private final Pattern pattern; + + /** + * Creates an instance of GlassFish servers file name pattern filter. + * <p/> + * + * @param namePattern GlassFish servers file name pattern. + */ + public VersionFilter(final String namePattern) { + pattern = Pattern.compile(namePattern); + } + + @Override + /** + * Test whether or not the specified pathname is valid GlassFish server. + * <p/> + * + * @param path Pathname to be tested. + * @return Returns <code>true</code> when given <code>File</code> should be included or + * <code>false</code> otherwise. + */ + public boolean accept(final File file) { + return pattern.matcher(file.getName()).matches(); + } + + } + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Logger instance for this class. */ + private static final Logger LOGGER = new Logger(ServerUtils.class); + + /** + * GlassFish Java VM system environment <code>AS_JAVA</code> variable name. This value should be + * equal to system environment <code>JAVA_HOME</code> value. + */ + public static final String AS_JAVA_ENV = "AS_JAVA"; + + /** GlassFish server Java VM root property name. */ + public static final String GF_JAVA_ROOT_PROPERTY = "com.sun.aas.javaRoot"; + + /** + * GlassFish server home property name. + * <p/> + * It's value says it is server installation root but in reality it is just <code>glassfish</code> + * subdirectory under server installation root which we usually call server home. + */ + public static final String GF_HOME_PROPERTY = "com.sun.aas.installRoot"; + + /** + * GlassFish server domain root property name. + * </p> + * It's value says it is server instance root which is the same. + */ + public static final String GF_DOMAIN_ROOT_PROPERTY = "com.sun.aas.instanceRoot"; + + /** GlassFish server Derby root property name. */ + public static final String GF_DERBY_ROOT_PROPERTY = "com.sun.aas.derbyRoot"; + + /** GlassFish server home subdirectory filter instance. */ + public static final GlassFishFilter GF_HOME_DIR_FILTER = new GlassFishFilter(); + + /** GlassFish server domains subdirectory. */ + public static final String GF_DOMAINS_DIR_NAME = "domains"; + + /** GlassFish server domains subdirectory. */ + public static final String GF_DOMAIN_CONFIG_DIR_NAME = "config"; + + /** GlassFish server domains subdirectory. */ + public static final String GF_DOMAIN_CONFIG_FILE_NAME = "domain.xml"; + + /** GlassFish server modules subdirectory. */ + public static final String GF_MODULES_DIR_NAME = "modules"; + + /** GlassFish server Derby subdirectory. */ + public static final String GF_DERBY_DIR_NAME = "javadb"; + + /** GlassFish server libraries subdirectory. */ + public static final String GF_LIB_DIR_NAME = "lib"; + + /** GlassFish server embedded libraries subdirectory under libraries. */ + public static final String GF_EMBEDDED_DIR_NAME = "embedded"; + + /** GlassFish server logs subdirectory. */ + public static String GF_LOG_DIR_NAME = "logs"; + + /** GlassFish server log file. */ + public static String GF_LOG_FILE_NAME = "server.log"; + + public static final String GFV3_VERSION_MATCHER = "(?:-[0-9bSNAPHOT]+(?:\\.[0-9]+(?:_[0-9]+|)|).*|).jar"; + public static final String GFV3_JAR_MATCHER = "glassfish" + GFV3_VERSION_MATCHER; + + /** + * Manifest attribute Bundle-Version containing GlassFish version <code>String</code>. + */ + public static final String BUNDLE_VERSION = "Bundle-Version"; + + /** Common utilities JAR file name. */ + public static final String GF_COMMON_UTIL_JAR = "common-util.jar"; + + /** Jersey 2.x common JAR file name. */ + public static final String GF_JERSEY_2_COMMON_JAR = "jersey-common.jar"; + + /** Jersey 1.x core JAR file name. */ + public static final String GF_JERSEY_1_CORE_JAR = "jersey-core.jar"; + + /** Embedded static shell JAR file name. */ + public static final String GF_EMBEDDED_STATIC_SHELL_JAR = "glassfish-embedded-static-shell.jar"; + + /** Verifier JAR file name. */ + public static final String GF_VERIFIER_JAR = "verifier.jar"; + + /** JavaHelp JAR file name. */ + public static final String GF_JAVAHELP_JAR = "javahelp.jar"; + + /** GlassFish Version class name (including package). */ + private static String VERSION_CLASS = "com.sun.appserv.server.util.Version"; + + /** GlassFish VerifierMain class name (including package). */ + public static String VERIFIER_MAIN_CLASS = "com.sun.enterprise.tools.verifier.VerifierMain"; + + /** + * Regex pattern to retrieve version string like 3.1.2.2 from full version string. + */ + private static String FULL_VERSION_PATTERN = "[0-9]+(\\.[0-9]+){1,3}"; + + /** GlassFish full version string getter method name. */ + private static String FULL_VERSION_METHOD = "getFullVersion"; + + /** GlassFish Basic Authorization user and password separator. */ + private static String AUTH_BASIC_FIELD_SEPARATPR = ":"; + + /** GlassFish server domain name command line argument. */ + public static String GF_DOMAIN_ARG = "--domain"; + + /** GlassFish server domain directory command line argument. */ + public static String GF_DOMAIN_DIR_ARG = "--domaindir"; + + /** + * GlassFish server service response while server is not yet ready. Copy-pasted from + * <code>com.sun.enterprise.v3.admin.AdminAdapter</code>. + */ + public static final String GF_SERVICE_NOT_YET_READY_MSG = "V3 cannot process this command at this time, please wait"; + /** End of line sequence in Manifest. */ + public static final String MANIFEST_EOL = "%%%EOL%%%"; + + /** + * REGEX expression used to split resources returned in <code>Manifest</code> object from HTTP + * response. + */ + public static final String MANIFEST_RESOURCES_SEPARATOR = "[,;]"; + + /** + * REGEX expression used to split components (applications) returned in <code>Manifest</code> object + * from HTTP response. + */ + public static final String MANIFEST_COMPONENTS_SEPARATOR = ";"; + + /** + * REGEX expression used to extract component name and containers from <code>Manifest</code> + * attribute. + */ + private static final String MANIFEST_COMPONENT_FULL_REGEX = " *([^ ]+) +< *([^ ,]+) *((?:, *[^ ,]+ *)*)> *"; + + /** + * REGEX expression used to extract additional containers from containers list of + * <code>Manifest</code> attribute. + */ + private static final String MANIFEST_COMPONENT_COMP_REGEX = ", *([^ ,]+) *"; + + /** + * REGEX pattern used to extract component name and containers from <code>Manifest</code> attribute. + */ + private static final Pattern MANIFEST_COMPONENT_FULL_PATTERN = Pattern.compile(MANIFEST_COMPONENT_FULL_REGEX, + Pattern.CASE_INSENSITIVE); + + /** + * REGEX pattern used to extract additional containers from containers list of <code>Manifest</code> + * attribute. + */ + private static final Pattern MANIFEST_COMPONENT_COMP_PATTERN = Pattern.compile(MANIFEST_COMPONENT_COMP_REGEX, + Pattern.CASE_INSENSITIVE); + + //////////////////////////////////////////////////////////////////////////// + // Static methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Search for <code>.jar</code> file matching given pattern in + * <code><serverHome>/modules</code> directory tree. + * <p/> + * + * @param serverHome GlassFish server home. + * @param pattern File name pattern. + * @return <code>File</code> object containing full <code>.jar<code> file + * path or <code>null</code> if no file was found. + */ + public static File getJarName(final String serverHome, final String pattern) { + return getJarName(serverHome, pattern, GF_MODULES_DIR_NAME); + } + + /** + * Search for <code>.jar</code> file matching given pattern in given directory tree. + * <p/> + * + * @param serverHome GlassFish server home. + * @param pattern File name pattern. + * @param dir Directory tree root to be searched for <code>.jar<code> file. + * @return <code>File</code> object containing full <code>.jar<code> file + * path or <code>null</code> if no file was found. + */ + public static File getJarName(final String serverHome, final String pattern, final String dir) { + File dirFile = new File(serverHome + File.separatorChar + dir); + return getFileFromPattern(pattern, dirFile); + } + + /** + * Search for file matching given <code>pattern</code> in given <code>dir</code>ectory tree. + * <p/> + * + * @param pattern Name pattern to search for. + * @param dir Directory tree root to be searched for pattern. + * @return <code>File</code> object that matches given <code>pattern</code> or <code>null</code> + * otherwise. + */ + public static File getFileFromPattern(String pattern, File dir) { + assert pattern != null : "Search pattern should not be null"; + assert dir != null : "Search directory tree root should not be null"; + // TODO: Check if this is OK of File.pathSeparator should be used. + int subindex = pattern.lastIndexOf("/"); + if (subindex != -1) { + String subdir = pattern.substring(0, subindex); + pattern = pattern.substring(subindex + 1); + dir = new File(dir, subdir); + } + if (dir.canRead() && dir.isDirectory()) { + // Express check first. + String expressPattern = pattern.replace(GFV3_VERSION_MATCHER, ".jar"); + File candidate = new File(dir, expressPattern); + if (!"".equals(expressPattern) && candidate.exists()) { + return candidate; + } + // Longer check second. + File[] candidates = dir.listFiles(new VersionFilter(pattern)); + if (candidates != null && candidates.length > 0) { + // First one is returned. + return candidates[0]; + } + } + return null; + } + + /** + * Append next path element to existing path in <code>StringBuilder</code>. Path separator is added + * only when there is no one at the end of existing path. + * <p/> + * + * @param rootPath Already existing path in <code>StringBuilder</code>. + * @param next Path to be appended at the end of already existing path. + */ + public static void addPathElement(final StringBuilder rootPath, final String next) { + int rootPathLength = rootPath.length(); + if (rootPathLength > 0 + && rootPath.lastIndexOf(File.separator) + OsUtils.FILE_SEPARATOR_LENGTH != rootPathLength) { + rootPath.append(File.separator); + } + rootPath.append(next); + } + + /** + * Build path to the <code>common-util.jar</code> file in GlassFish modules directory. + * <p/> + * + * @param serverHome GlassFish server home directory. + * @return Path to the <code>common-util.jar</code> file in GlassFish modules directory. + */ + public static File getCommonUtilJarInModules(final String serverHome) { + StringBuilder commonUtilJarPath = new StringBuilder(serverHome.length() + GF_MODULES_DIR_NAME.length() + + GF_COMMON_UTIL_JAR.length() + 2 * OsUtils.FILE_SEPARATOR_LENGTH); + commonUtilJarPath.append(serverHome); + addPathElement(commonUtilJarPath, GF_MODULES_DIR_NAME); + addPathElement(commonUtilJarPath, GF_COMMON_UTIL_JAR); + return new File(commonUtilJarPath.toString()); + } + + /** + * Build path to the supplied <code>.jar</code> file in GlassFish modules directory. + * <p/> + * + * @param serverHome GlassFish server home directory. This argument should not be <code>null</code>. + * @param jarName Supplied JAR file name. This argument should not be <code>null</code>. + * @return Path to the <code>.jar</code> file in GlassFish modules directory. + */ + public static File getJarInModules(final String serverHome, final String jarName) { + StringBuilder commonUtilJarPath = new StringBuilder(serverHome.length() + GF_MODULES_DIR_NAME.length() + + jarName.length() + 2 * OsUtils.FILE_SEPARATOR_LENGTH); + commonUtilJarPath.append(serverHome); + addPathElement(commonUtilJarPath, GF_MODULES_DIR_NAME); + addPathElement(commonUtilJarPath, jarName); + return new File(commonUtilJarPath.toString()); + } + + /** + * Build path to the <code>jersey-common.jar</code> or <code>jersey-core.jar</code> file in + * GlassFish modules directory. + * <p/> + * Searches for Jersey 1.x or 2.x common (core) jersey JAR file name in GlassFish modules directory + * and returns <code>File</code> that was found or <code>null</code> when no such a file exists and + * is readable. + * <p/> + * + * @param serverHome GlassFish server home directory. This argument should not be <code>null</code>. + */ + public static File getJerseyCommonJarInModules(final String serverHome) { + File jerseyCommon = ServerUtils.getJarInModules(serverHome, ServerUtils.GF_JERSEY_2_COMMON_JAR); + if (jerseyCommon.isFile() && jerseyCommon.canRead()) { + return jerseyCommon; + } + jerseyCommon = ServerUtils.getJarInModules(serverHome, ServerUtils.GF_JERSEY_1_CORE_JAR); + if (jerseyCommon.isFile() && jerseyCommon.canRead()) { + return jerseyCommon; + } else { + return null; + } + } + + /** + * Build path to the supplied <code>verifier.jar</code> library in GlassFish modules directory. + * <p/> + * + * @param serverHome GlassFish server home directory. This argument should not be <code>null</code>. + * @return Path to the <code>verifier.ja</code> file in GlassFish modules directory. + */ + public static String getVerifierJar(final String serverHome) { + assert serverHome != null : "GlassFish server home directory should not be null"; + boolean appendSeparator = serverHome.lastIndexOf(File.separator) + OsUtils.FILE_SEPARATOR_LENGTH != serverHome + .length(); + StringBuilder sb = new StringBuilder(serverHome.length() + + (appendSeparator ? 2 * OsUtils.FILE_SEPARATOR_LENGTH : 1 * OsUtils.FILE_SEPARATOR_LENGTH) + + GF_MODULES_DIR_NAME.length() + GF_VERIFIER_JAR.length()); + sb.append(serverHome); + if (appendSeparator) { + sb.append(File.separator); + } + sb.append(GF_MODULES_DIR_NAME); + sb.append(File.separator); + sb.append(GF_VERIFIER_JAR); + return sb.toString(); + } + + /** + * Build path to the supplied <code>javahelp.jar</code> library in GlassFish modules directory. + * <p/> + * + * @param serverHome GlassFish server home directory. This argument should not be <code>null</code>. + * @return Path to the <code>javahelp.jar</code> file in GlassFish libraries directory. + */ + public static String getJavaHelpJar(final String serverHome) { + assert serverHome != null : "GlassFish server home directory should not be null"; + boolean appendSeparator = serverHome.lastIndexOf(File.separator) + OsUtils.FILE_SEPARATOR_LENGTH != serverHome + .length(); + StringBuilder sb = new StringBuilder(serverHome.length() + + (appendSeparator ? 2 * OsUtils.FILE_SEPARATOR_LENGTH : 1 * OsUtils.FILE_SEPARATOR_LENGTH) + + GF_LIB_DIR_NAME.length() + GF_JAVAHELP_JAR.length()); + sb.append(serverHome); + if (appendSeparator) { + sb.append(File.separator); + } + sb.append(GF_LIB_DIR_NAME); + sb.append(File.separator); + sb.append(GF_JAVAHELP_JAR); + return sb.toString(); + } + + /** + * Build path to the <code>glassfish-embedded-static-shell.jar</code> library in embedded libraries + * directory. + * <p/> + * + * @param serverHome GlassFish server home directory. This argument should not be <code>null</code>. + * @return Path to the <code>glassfish-embedded-static-shell.jar</code> file in GlassFish embedded + * libraries directory. + */ + public static String getEmbeddedStaticShellJar(final String serverHome) { + assert serverHome != null : "GlassFish server home directory should not be null"; + boolean appendSeparator = serverHome.lastIndexOf(File.separator) + OsUtils.FILE_SEPARATOR_LENGTH != serverHome + .length(); + StringBuilder sb = new StringBuilder(serverHome.length() + + (appendSeparator ? 3 * OsUtils.FILE_SEPARATOR_LENGTH : 2 * OsUtils.FILE_SEPARATOR_LENGTH) + + GF_LIB_DIR_NAME.length() + GF_EMBEDDED_DIR_NAME.length() + GF_EMBEDDED_STATIC_SHELL_JAR.length()); + sb.append(serverHome); + if (appendSeparator) { + sb.append(File.separator); + } + sb.append(GF_LIB_DIR_NAME); + sb.append(File.separator); + sb.append(GF_EMBEDDED_DIR_NAME); + sb.append(File.separator); + sb.append(GF_EMBEDDED_STATIC_SHELL_JAR); + return sb.toString(); + } + + /** + * Retrieve Jersey version string from GlassFish modules. + * <p/> + * + * @param serverHome GlassFish server home directory. This argument should not be <code>null</code>. + * @return Jersey version string from GlassFish modules. + */ + public static String getJerseyVersion(final String serverHome) { + File jerseyFile = ServerUtils.getJerseyCommonJarInModules(serverHome); + if (jerseyFile != null) { + Jar jerseyJar = new Jar(jerseyFile); + String version = jerseyJar.getBundleVersion(); + jerseyJar.close(); + return version; + } else { + return null; + } + } + + /** + * Retrieve version numbers substring from full version string. + * <p/> + * + * @param fullVersionString GlassFish server full version string, e.g. + * <code>GlassFish Server Open Source Edition + * 3.1.2.2 (build 5)</code> + * @return Version numbers substring, e.g. <code>3.1.2.2</code> + */ + public static String getVersionString(final String fullVersionString) { + if (fullVersionString != null) { + Pattern p = Pattern.compile(FULL_VERSION_PATTERN); + Matcher m = p.matcher(fullVersionString); + if (m.find()) { + return fullVersionString.substring(m.start(), m.end()); + } + } + return null; + } + + /** + * Retrieve GlassFish version from local installation using file access. + * <p/> + * GlassFish version is read from modules <code>common-util.jar</code> archive and + * <code>com.sun.appserv.server.util.Version</code> class. It's not public GlassFish API so there is + * no guaranty for this to work forever. However GlassFish development team promised to keep this + * API working the same way in GlassFish 3 and 4. + * <p/> + * + * @param serverHome GlassFish server home directory. + * @return GlassFish server version. + */ + public static Version getServerVersion(final String serverHome) { + Version version = null; + File commonUtilJar = getCommonUtilJarInModules(serverHome); + if (commonUtilJar.canRead()) { + try { + ClassLoader cl = new URLClassLoader(new URL[] { commonUtilJar.toURI().toURL() }); + Class c = cl.loadClass(VERSION_CLASS); + // Try to get version from com.sun.appserv.server.util.Version. + try { + Method mGetFullVersion = c.getMethod(FULL_VERSION_METHOD); + System.getProperties().put(GF_HOME_PROPERTY, serverHome); + String fullVersionString = (String) mGetFullVersion.invoke(c); + System.getProperties().remove(GF_HOME_PROPERTY); + String versionString = getVersionString(fullVersionString); + version = new Version(versionString); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException + | NoSuchMethodException | SecurityException ex) { + Logger.log(Level.WARNING, + "Cannot retrieve Glassfish version: " + commonUtilJar.getAbsolutePath() + ": ", ex); + } + // Use Manifest Bundle-Version as fallback option. + if (version == null) { + try { + JarFile jar = new JarFile(commonUtilJar); + Manifest manifest = jar.getManifest(); + String versionString = getVersionString(manifest.getMainAttributes().getValue(BUNDLE_VERSION)); + if (versionString != null) { + version = new Version(versionString); + } + } catch (IOException ioe) { + Logger.log(Level.WARNING, + "Cannot retrieve Glassfish version: " + commonUtilJar.getAbsolutePath() + ": ", ioe); + } + } + } catch (MalformedURLException | ClassNotFoundException ex) { + Logger.log(Level.WARNING, + "Cannot retrieve Glassfish version: " + commonUtilJar.getAbsolutePath() + ": ", ex); + } + } + return version; + } + + /** + * Decode <code>Manifest</code> string to remove EOL sequences. + * <p/> + * + * @param str String to be decoded. + */ + public static String manifestDecode(final String str) { + if (str == null) { + return null; + } + return str.replaceAll(MANIFEST_EOL, "\n"); + } + + /** + * Build HTTP Basic authorization base64 encoded credentials argument containing user name and + * password. + * <p/> + * + * @param user Username to be stored into encoded argument. + * @param password Password to be stored into encoded argument. + */ + public static String basicAuthCredentials(final String user, final String password) { + StringBuilder sb = new StringBuilder(user.length() + AUTH_BASIC_FIELD_SEPARATPR.length() + password.length()); + sb.append(user); + sb.append(AUTH_BASIC_FIELD_SEPARATPR); + sb.append(password); + return Base64.getEncoder().encodeToString(sb.toString().getBytes()); + } + + /** + * Tests if the server listener port is occupied. + * <p/> + * + * @param server GlassFish server entity + * @return Value of <code>true</code> when server listener port is occupied or <code>false</code> + * otherwise. + */ + public static boolean isHttpPortListening(final PayaraServer server) { + return server.isRemote() ? NetUtils.isPortListeningRemote(server.getHost(), server.getPort()) + : NetUtils.isHttpPortListeningLocal(server.getHost(), server.getPort()); + } + + /** + * Tests if the server listener port is occupied. + * <p/> + * + * @param server GlassFish server entity + * @param timeout Network timeout [ms]. + * @return Value of <code>true</code> when server listener port is occupied or <code>false</code> + * otherwise. + */ + public static boolean isHttpPortListening(final PayaraServer server, final int timeout) { + return server.isRemote() ? NetUtils.isPortListeningRemote(server.getHost(), server.getPort(), timeout) + : NetUtils.isHttpPortListeningLocal(server.getHost(), server.getPort()); + } + + /** + * Tests if the server administrator's port is occupied. + * <p/> + * + * @param server GlassFish server entity. + * @return Value of <code>true</code> when server administrator port is occupied or + * <code>false</code> otherwise. + */ + public static boolean isAdminPortListening(final PayaraServer server) { + return server.isRemote() ? NetUtils.isPortListeningRemote(server.getHost(), server.getAdminPort()) + : NetUtils.isHttpPortListeningLocal(server.getHost(), server.getAdminPort()); + } + + /** + * Tests if the server administrator's port is occupied. + * <p/> + * + * @param server GlassFish server entity. + * @param timeout Network timeout [ms]. + * @return Value of <code>true</code> when server administrator port is occupied or + * <code>false</code> otherwise. + */ + public static boolean isAdminPortListening(final PayaraServer server, final int timeout) { + return server.isRemote() ? NetUtils.isPortListeningRemote(server.getHost(), server.getAdminPort(), timeout) + : NetUtils.isHttpPortListeningLocal(server.getHost(), server.getAdminPort()); + } + + /** + * Builds command line argument containing argument identifier, space and argument value, e.g. + * <code>--name value</code>. + * <p/> + * + * @param name Command line argument name including dashes at the beginning. + * @param value Value to be appended prefixed with single space. + * @return Command line argument concatenated together. + */ + public static String cmdLineArgument(final String name, final String value) { + StringBuilder sb = new StringBuilder(name.length() + " ".length() + value.length()); + sb.append(name); + sb.append(" "); + sb.append(value); + return sb.toString(); + } + + /** + * Parse server component (application) record and add it into <code>Map</code> containing container + * to components <code>List</code> mapping. + * <p/> + * Component records: <code><name> '<' <container> + * [',' <container>] '>'</code> + * </p> + * + * @param map Map where new component is stored under it's container key. + * @param component Component record retrieved from server. + * @throws <code>NullPointerException</code> when provided map argument is <code>null</code>. + */ + public static void addComponentToMap(final Map<String, List<String>> map, final String component) { + Logger.log(Level.FINER, "Processing component \"{0}\"", new Object[] { component }); + Matcher fullMatecher = ServerUtils.MANIFEST_COMPONENT_FULL_PATTERN.matcher(component); + if (fullMatecher.matches()) { + String componentName = fullMatecher.group(1); + GlassFishContainer container = GlassFishContainer.toValue(fullMatecher.group(2)); + String moreContainers = fullMatecher.group(3); + if (moreContainers != null && moreContainers.length() > 0) { + Matcher compMatcher = ServerUtils.MANIFEST_COMPONENT_COMP_PATTERN.matcher(moreContainers); + while (compMatcher.find()) { + GlassFishContainer nextContainer = GlassFishContainer.toValue(compMatcher.group(1)); + if (nextContainer != null && container != null && nextContainer.ordinal() < container.ordinal()) { + container = nextContainer; + } else if (nextContainer == null) { + Logger.log(Level.WARNING, "Error processing component \"{0}\"", new Object[] { component }); + } + } + } + String containerName = container != null ? container.toString() : "null"; + List<String> componentList = map.get(containerName); + if (componentList == null) { + componentList = new ArrayList<>(); + map.put(containerName, componentList); + } + componentList.add(componentName); + } else { + throw new CommandException(CommandException.MANIFEST_INVALID_COMPONENT_ITEM); + } + } + + /** + * Build GlassFish server log file sub path under domains root directory. + * <p/> + * + * @return GlassFish server log file path under domains root directory. + */ + public static String serverLogFileRelativePath() { + StringBuilder sb = new StringBuilder( + GF_LOG_DIR_NAME.length() + File.separator.length() + GF_LOG_FILE_NAME.length()); + sb.append(GF_LOG_DIR_NAME); + sb.append(File.separator); + sb.append(GF_LOG_FILE_NAME); + return sb.toString(); + } + + /** + * Get GlassFish server domain root full path. + * <p/> + * + * @param server GlassFish server entity + * @return GlassFish server domain root full path or <code>null</code> when server domains root + * folder or domain name is not set. + */ + public static String getDomainPath(final PayaraServer server) { + String domainName = server.getDomainName(); + String domainsFolder = server.getDomainsFolder(); + boolean appendSeparator = domainsFolder.lastIndexOf(File.separator) + + OsUtils.FILE_SEPARATOR_LENGTH != domainsFolder.length(); + StringBuilder sb = new StringBuilder(server.getDomainsFolder().length() + + (appendSeparator ? OsUtils.FILE_SEPARATOR_LENGTH : 0) + domainName.length()); + sb.append(domainsFolder); + if (appendSeparator) { + sb.append(File.separator); + } + sb.append(domainName); + return sb.toString(); + } + + /** + * Get GlassFish server domain configuration directory full path from domain root. + * <p/> + * + * @param domainDir GlassFish server domain root full path. + * @return GlassFish server domain configuration directory full path + */ + public static String getDomainConfigPath(final String domainDir) { + if (domainDir == null) { + return GF_DOMAIN_CONFIG_DIR_NAME; + } + boolean appendSeparator = domainDir.lastIndexOf(File.separator) + OsUtils.FILE_SEPARATOR_LENGTH != domainDir + .length(); + StringBuilder sb = new StringBuilder(domainDir.length() + (appendSeparator ? OsUtils.FILE_SEPARATOR_LENGTH : 0) + + GF_DOMAIN_CONFIG_DIR_NAME.length()); + sb.append(domainDir); + if (appendSeparator) { + sb.append(File.separator); + } + sb.append(GF_DOMAIN_CONFIG_DIR_NAME); + return sb.toString(); + } + + /** + * Get GlassFish server domain configuration file (domain.xml) full path from domains root and + * domain name. + * <p/> + * + * @param domainsRoot GlassFish server domains root full path. + * @param domainName GlassFish server domain name. + * @return GlassFish server domain configuration file full path + */ + public static String getDomainConfigFile(final String domainsRoot, final String domainName) { + final String METHOD = "getDomainConfigFile"; + if (domainsRoot == null) { + throw new IllegalArgumentException(LOGGER.excMsg(METHOD, "domainsRootNull")); + } + if (domainName == null) { + throw new IllegalArgumentException(LOGGER.excMsg(METHOD, "domainNameNull")); + } + StringBuilder sb = new StringBuilder( + domainsRoot.length() + domainName.length() + GF_DOMAIN_CONFIG_DIR_NAME.length() + + GF_DOMAIN_CONFIG_FILE_NAME.length() + (3 * OsUtils.FILE_SEPARATOR_LENGTH)); + sb.append(domainsRoot).append(File.separator); + sb.append(domainName).append(File.separator); + sb.append(GF_DOMAIN_CONFIG_DIR_NAME).append(File.separator); + sb.append(GF_DOMAIN_CONFIG_FILE_NAME); + return sb.toString(); + } + + /** + * Get GlassFish server log {@link File} object. + * <p/> + * + * @param server GlassFish server entity. + * @return GlassFish server log {@link File} object. + */ + public static File getServerLogFile(final PayaraServer server) { + return new File(getDomainPath(server), serverLogFileRelativePath()); + } + + /** + * Get GlassFish server derby root full path. + * <p/> + * + * @param server GlassFish server entity + * @return GlassFish server derby root full path or <code>null</code> when server server + * installation directory is not set. + */ + public static String getDerbyRoot(final PayaraServer server) { + String serverRoot = server.getServerRoot(); + if (serverRoot == null) { + return null; + } + StringBuilder sb = new StringBuilder( + serverRoot.length() + File.separator.length() + GF_DERBY_DIR_NAME.length()); + sb.append(serverRoot); + sb.append(File.separator); + sb.append(GF_DERBY_DIR_NAME); + return sb.toString(); + } + + /** + * Get GlassFish server Java VM root property. + * <p/> + * + * @param javaHome Java VM root (home) directory to be set as property value. + * @return GlassFish server Java VM root property to be passed to server startup command. + */ + public static String javaRootProperty(final String javaHome) { + return JavaUtils.systemProperty(GF_JAVA_ROOT_PROPERTY, javaHome); + } + + /** + * Check if given message is the one returned by GlassFish server service response while server is + * not yet ready. + * <p/> + * + * @param msg Message to be checked. + * @return Returns <code>true</code> if given message is server service response while server is not + * yet ready or <code>false</code> otherwise. + */ + public static boolean notYetReadyMsg(final String msg) { + if (msg == null) { + return false; + } + return msg.startsWith(GF_SERVICE_NOT_YET_READY_MSG); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/StringPrefixTree.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/StringPrefixTree.java new file mode 100644 index 00000000..d17796e7 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/StringPrefixTree.java @@ -0,0 +1,566 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.utils; + +import java.util.Iterator; +import java.util.TreeMap; + +/** + * String prefix tree used to find <code>String</code> in a set. + * <p/> + * This class is not thread safe so external synchronization may be needed in multi threaded + * environment. + * <p/> + * + * @author Tomas Kraus, Peter Benedikovic + */ +public class StringPrefixTree<Type> { + + //////////////////////////////////////////////////////////////////////////// + // Inner Classes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Prefix tree internal node representing single character of stored strings. + */ + private class Node { + + /** Mark state as final. */ + private boolean finalState; + + /** Store value in node. */ + private Type value; + + /** Next character. */ + private TreeMap<Character, Node> next; + + /** + * Create <code>Character</code> object from given char value and apply case sensitive settings on + * it. + * <p/> + * + * @param c Character to be used as <Character</code> object value. + * @return <code>Character</code> object containing given char value with case sensitive settings + * rules applied. + */ + Character toCharacter(final char c) { + return Character.valueOf( + caseSensitive ? c : Character.toUpperCase(c)); + } + + /** + * Creates an instance of internal tree node in inner state and no stored value. + */ + Node() { + this.finalState = false; + this.next = new TreeMap(); + } + + /** + * Creates an instance of internal tree node in final state and stored value. + * <p/> + * + * @param value Value to be stored into node. + */ + Node(Type value) { + this.finalState = true; + this.next = new TreeMap(); + this.value = value; + } + + /** + * Mark node as final state. + */ + void setFinal() { + finalState = true; + } + + /** + * Mark node as inner state. + */ + void setInner() { + finalState = false; + } + + /** + * Store value into node. + * <p/> + * Old value is overwritten if exists. + * <p/> + * + * @param value Value to be stored into node. + */ + void setValue(Type value) { + this.value = value; + } + + /** + * Retrieve value from node. + * <p/> + * + * @return Value stored in node or <code>null</code> if no value is stored. + */ + Type getValue() { + return value; + } + + /** + * Get node state. + * <p/> + * + * @return Value of <code>true</code> for final state or <code>false</code> for inner state. + */ + boolean isFinal() { + return finalState; + } + + /** + * Add next state on transition for given character. + * <p/> + * + * @param c Character to set transition to next state. + * @param node <code>Node</code> representing next transition. + */ + void add(char c, Node node) { + next.put(toCharacter(c), node); + } + + /** + * Remove next state on transition for given character. + * <p/> + * + * @param c Character to remove transition to next state. + */ + Node remove(char c) { + return next.remove(toCharacter(c)); + } + + /** + * Get next state on transition for given character. + * <p/> + * + * @param c Character to get transition to next state. + * @return <code>Node</code> representing next transition or <code>null</code> if there is no + * transition. + */ + Node get(char c) { + return next.get(toCharacter(c)); + } + + /** + * Get number of transitions to next states from this node. + * <p/> + * + * @return Number of transitions to next states from this node. + */ + int size() { + return next.size(); + } + + /** + * Destroy node. + * <p/> + * This is just garbage collector helper. + */ + void destroy() { + next.clear(); + next = null; + value = null; + } + + /** + * Get string representation of node. + */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("Value="); + sb.append(value != null ? value.toString() : "null"); + sb.append(" Transitions=["); + for (Iterator i = next.keySet().iterator(); i.hasNext();) { + sb.append(i.next()); + if (i.hasNext()) { + sb.append(','); + } + } + sb.append(']'); + return sb.toString(); + } + + } + + /** + * Stack data storage. + * <p/> + * Used for non recursive tree walk trough. Need to store current node and child nodes iterator. + */ + private class StackItem { + + /** Tree node. */ + Node node; + + /** + * Child nodes iterator. We don't need keys, walking trough child nodes is enough. + */ + Iterator<Node> child; + + /** + * Creates an instance of stack item (stack data storage). + * <p/> + * + * @param node Tree node to be processed. + */ + StackItem(Node node) { + this.node = node; + child = node.next.values().iterator(); + } + + } + + //////////////////////////////////////////////////////////////////////////// + // Instance attributes // + //////////////////////////////////////////////////////////////////////////// + + /** Root tree node. */ + private Node root; + + /** Size of tree (number of stored strings. */ + private int size; + + /** + * Case sensitivity turned on (<code>true</code>) or off (<code>false</code>). All strings are + * stored and compared as upper case when turned on. + */ + private boolean caseSensitive; + + //////////////////////////////////////////////////////////////////////////// + // Constructors // + //////////////////////////////////////////////////////////////////////////// + + public StringPrefixTree(boolean caseSensitive) { + root = new Node(); + size = 0; + this.caseSensitive = caseSensitive; + } + + //////////////////////////////////////////////////////////////////////////// + // Methods // + //////////////////////////////////////////////////////////////////////////// + + /** + * Add value into node and finish <cose>String</code> based on nodes already stored in prefix tree. + * <p/> + * This method will modify node that represents last character in newly added <code>String</code>. + * <p/> + * + * @param node Node to be marked as final and used to store value. + * @param value Value to be stored into node. + */ + private void finishExistingStringWithValue(Node node, Type value) { + size++; + node.setFinal(); + node.setValue(value); + } + + /** + * Remove value from node and mark node state as inner. + * <p/> + * This method will modify node that represents last character of <code>String</code> being removed. + * <p/> + * + * @param node Node to be marked as inner and to remove its value + */ + private void removeValuefromString(Node node) { + size--; + node.setInner(); + node.setValue(null); + } + + /** + * Add value into node and finish <cose>String</code> based on nodes (at least last one) newly added + * into prefix tree. + * <p/> + * This method adds new node representing last character in newly added <code>String</code> under + * given node which represents character before last one or nodes root. + * <p/> + * + * @param node Node where new node with last character will be attached. + * @param value Value to be stored into newly attached node. + */ + private void finishNewStringWithValue(Node node, char c, Type value) { + size++; + node.add(c, new Node(value)); + } + + // This should be as fast as possible. Tree walktrough is implemented + // as non-recursive. + /** + * Clear content of <code>String</code> prefix tree. + */ + public void clear() { + // Store old prefix tree. + Node oldRoot = root; + // Reinitialize as empty. + root = new Node(); + size = 0; + // Old structure cleanup. + LinkedList<StackItem> stack = new LinkedList<>(); + StackItem item; + stack.addFirst(new StackItem(oldRoot)); + while ((item = stack.getLast()) != null) { + // Tree step down. + if (item.child.hasNext()) { + stack.addLast(new StackItem(item.child.next())); + // Current node processing and tree setep up. + } else { + item.node.destroy(); + stack.removeLast(); + } + } + } + + /** + * Add new <code>String</code> into prefix tree and set value mapped to this string. + * <p/> + * <code>null</code> value of <code>str</code> argument is considered as empty string. + * <p/> + * + * @param str <code>String</code> to be added into prefix tree. + * @param value Value mapped to newly added <code>String</code>. + * @return Value of <code>true</code> if given <code>String</code> has been added or + * <code>false</code> if given <code>String</code> was already stored in prefix tree before and + * nothing has changed. + */ + public boolean add(String str, Type value) { + int strLen = str != null ? str.length() : 0; + int lastIndex = strLen > 0 ? strLen - 1 : 0; + Node act = root; + // Process inner characters. + for (int i = 0; i < lastIndex; i++) { + char c = str.charAt(i); + Node next = act.get(c); + if (next == null) { + act.add(c, act = new Node()); + } else { + act = next; + } + } + // Process final character. + boolean result; + if (strLen == 0 && !root.isFinal()) { + result = true; + finishExistingStringWithValue(root, value); + } else { + char c = str.charAt(lastIndex); + Node next = act.get(c); + if (next == null) { + result = true; + finishNewStringWithValue(act, c, value); + } else { + if (result = !next.isFinal()) { + finishExistingStringWithValue(next, value); + } + } + } + return result; + } + + /** + * Remove <code>String</code> from prefix tree and remove value mapped to this string. + * <P/> + * + * @param str <code>String</code> to be removed from prefix tree. + * @return Value mapped to removed node. + */ + public Type remove(String str) { + Type result = null; + int pos = 0; + int strLen = str != null ? str.length() : 0; + Node act = root; + Node last = null; + LinkedList<Node> stack = new LinkedList<>(); + while (pos <= strLen && act != null) { + if (pos < strLen) { + stack.addLast(act); + act = act.get(str.charAt(pos)); + } + if (pos == strLen && act.isFinal()) { + result = act.getValue(); + removeValuefromString(act); + } + pos++; + } + if (result != null) { + pos = str.length(); + while (--pos >= 0 && !act.isFinal() && act.size() == 0) { + Node del = act; + act = stack.removeLast(); + Node removed = act.remove(str.charAt(pos)); + if (removed == del) { + del.destroy(); + } else { + throw new VerifyError( + "Removed transition does not point to removed state."); + } + } + } + stack.clear(); + return result; + } + + /** + * Exact match of given <code>CharSequence</code> argument against <code>String</code>s stored in + * prefix tree. + * <p/> + * <code>null</code> value of <code>str</code> argument is considered as empty string. Matching is + * done from the beginning of given <code>String</code> argument. + * <p/> + * + * @param str String to match against tree. + * @return Value of matching <code>String</code> or <code>null</code> if no matching + * <code>String</code> was found. + */ + public Type match(final CharSequence str) { + return match(str, 0); + } + + /** + * Exact match of given <code>CharSequence</code> argument against <code>String</code>s stored in + * prefix tree. + * <p/> + * <code>null</code> value of <code>str</code> argument is considered as empty string. Matching is + * done from the beginning of given <code>String</code> argument. + * <p/> + * + * @param str String to match against tree. + * @param offset Beginning index for searching. + * @return Value of matching <code>String</code> or <code>null</code> if no matching + * <code>String</code> was found. + */ + public Type match(final CharSequence str, final int offset) { + int pos = offset; + int strLen = str != null ? str.length() : 0; + Type value = null; + Node act = root; + while (pos <= strLen && act != null) { + if (pos == strLen && act.isFinal()) { + value = act.getValue(); + } + if (pos < strLen) { + act = act.get(str.charAt(pos)); + } + pos++; + } + return value; + } + + /** + * Longest possible match of given cyclic buffer <code>buff</code> argument against + * <code>String</code>s stored in prefix tree. + * <p/> + * Search starts at <code>beg</code> index in <code>buff</code>. Next index is evaluated as + * <code>(<current index> + 1) % buff.length</code>. Maximum of <code>len</code> characters + * are compared and longest possible <code>String</code> stored in prefix tree is evaluated as + * matching. Zero length is evaluated as empty string. + * <p/> + * + * @param buff Cyclic buffer containing source string. + * @param len Length of string to be compared. + * @param beg Index of beginning of the string (1st character) in cyclic buffer. + * @return Value of matching <code>String</code> or <code>null</code> if no matching + * <code>String</code> was found. + */ + public Type matchCyclicBuffer(final char[] buff, final int len, + final int beg) { + int pos = beg; + int count = 0; + Type value = null; + Node act = root; + while (count <= len && act != null) { + if (act.isFinal()) { + value = act.getValue(); + } + if (count < len) { + act = act.get(buff[pos]); + } + count++; + pos = (beg + count) % buff.length; + } + return value; + } + + /** + * Match longest possible <code>CharSequence</code> stored in prefix tree against given + * <code>String</code> argument and return value stored under this <code>String</code>. + * <p/> + * <code>null</code> value of <code>str</code> argument is considered as empty string. Matching is + * done from the beginning of given <code>String</code> argument. + * <p/> + * + * @param str <code>String</code> used to prefixMatch prefix tree against. + * @return Value of longest possible <code>String</code> stored in prefix tree that is matching + * given <code>String</code> argument prefix or <code>null</code> if no such stored + * <code>String</code> was found. + */ + public Type prefixMatch(final CharSequence str) { + return prefixMatch(str, 0); + } + + /** + * Match longest possible <code>CharSequence</code> stored in prefix tree against given + * <code>String</code> argument and return value stored under this <code>String</code>. + * <p/> + * <code>null</code> value of <code>str</code> argument is considered as empty string. Matching is + * done from the beginning of given <code>String</code> argument. + * <p/> + * + * @param offset Beginning index for searching. + * @param str <code>String</code> used to prefixMatch prefix tree against. + * @return Value of longest possible <code>String</code> stored in prefix tree that is matching + * given <code>String</code> argument prefix or <code>null</code> if no such stored + * <code>String</code> was found. + */ + public Type prefixMatch(final CharSequence str, final int offset) { + int pos = offset; + int strLen = str != null ? str.length() : 0; + Type value = null; + Node act = root; + while (pos <= strLen && act != null) { + if (act.isFinal()) { + value = act.getValue(); + } + if (pos < strLen) { + act = act.get(str.charAt(pos)); + } + pos++; + } + return value; + } + + /** + * Get number of strings stored in prefix tree. + * <p/> + * + * @return Number of strings stored in prefix tree. + */ + public int size() { + return size; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/Utils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/Utils.java new file mode 100644 index 00000000..b3ceee80 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/Utils.java @@ -0,0 +1,197 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.sdk.utils; + +import static java.util.logging.Level.INFO; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Common utilities. + * <p/> + * + * @author Vince Kraemer, Tomas Kraus, Peter Benedikovic + */ +public class Utils { + + //////////////////////////////////////////////////////////////////////////// + // Class attributes // + //////////////////////////////////////////////////////////////////////////// + + /** + * Get system default line separator. + * <p/> + * + * @return System default line separator. + */ + public static String lineSeparator() { + String lineSeparator = System.getProperty("line.separator"); + if (lineSeparator == null) { + lineSeparator = "\n"; + } + return lineSeparator; + } + + /** + * Sanitize module name for use as Glassfish query parameter. + * <p/> + * + * @param name Glassfish module name. + * @return Sanitized Glassfish module name. + */ + public static String sanitizeName(String name) { + if (null == name || name.matches("[\\p{L}\\p{N}_][\\p{L}\\p{N}\\-_./;#:]*")) { + return name; + } + // the string is bad... + return "_" + name.replaceAll("[^\\p{L}\\p{N}\\-_./;#:]", "_"); + } + + /** + * Add quotes to string if and only if it contains space characters. + * <p/> + * Note: does not handle generalized white space (tabs, localized white space, etc.) + * <p/> + * + * @param path File path in string form. + * @return Quoted path if it contains any space characters, otherwise same. + */ + public static String quote(String path) { + return path.indexOf(' ') == -1 ? path : "\"" + path + "\""; + } + + /** + * Convert classpath fragment using standard separator to a list of normalized files (nonexistent + * jars will be removed). + * + * @param cp classpath string + * @param root root folder for expanding relative path names + * @return list of existing jars, normalized + */ + public static List<File> classPathToFileList(String cp, File root) { + List<File> result = new ArrayList<>(); + if (cp != null && cp.length() > 0) { + String[] jars = cp.split(File.pathSeparator); + for (String jar : jars) { + File jarFile = new File(jar); + if (!jarFile.isAbsolute() && root != null) { + jarFile = new File(root, jar); + } + if (jarFile.exists()) { + result.add(jarFile); + } + } + } + return result; + } + + /** + * Pattern that matches strings like ${com.sun.aas.instanceRoot} + */ + private static Pattern pattern = Pattern.compile("\\$\\{([^}]+)\\}"); // NOI18N + + /** + * Utility method that finds all occurrences of variable references and replaces them with their + * values. Values are taken from <code>varMap</code> and escaped. If they are not present there, + * system properties are queried. If not found there the variable reference is replaced with the + * same string with special characters escaped. + * + * @param value String value where the variables have to be replaced with values + * @param varMap mapping of variable names to their values + * @return String where the all the replacement was done + */ + public static String doSub(String value, Map<String, String> varMap) { + try { + Matcher matcher = pattern.matcher(value); + boolean result = matcher.find(); + if (result) { + StringBuffer sb = new StringBuffer(value.length() * 2); + do { + String key = matcher.group(1); + String replacement = varMap.get(key); + if (replacement == null) { + replacement = System.getProperty(key); + if (replacement != null) { + replacement = escapePath(replacement); + } else { + replacement = "\\$\\{" + key + "\\}"; + } + } else { + replacement = escapePath(replacement); + } + matcher.appendReplacement(sb, replacement); + result = matcher.find(); + } while (result); + matcher.appendTail(sb); + value = sb.toString(); + } + } catch (Exception ex) { + Logger.getLogger("glassfish").log(INFO, ex.getLocalizedMessage(), ex); + } + + return value; + } + + /** + * Add escape characters for backslash and dollar sign characters in path field. + * + * @param path file path in string form. + * @return adjusted path with backslashes and dollar signs escaped with backslash character. + */ + public static String escapePath(String path) { + return path.replace("\\", "\\\\").replace("$", "\\$"); // NOI18N + } + + public static String[] splitOptionsString(String optionString) { + return optionString.trim().split("\\s+(?=-)"); + } + + /** + * Concatenate elements of {@link String} array as a single <code>String</code> containing all + * elements separated by <code>,</code>. + * <p/> + * + * @param array {2see String} array containing elements to be concatenated. + * @return {2see String} containing all elements concatenated and separated by <code>,</code> or + * <code>null</code> when <code>array</code> is <code>null</code>. + */ + public static String concatenate(final String[] array) { + if (array != null) { + boolean first = true; + StringBuilder sb = new StringBuilder(); + for (String str : array) { + if (first) { + first = false; + } else { + sb.append(", "); + } + sb.append(str); + } + return sb.toString(); + } + return null; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/AppDesc.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/AppDesc.java new file mode 100644 index 00000000..f7c2d873 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/AppDesc.java @@ -0,0 +1,55 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.serverview; + +/** + * + * @author Peter Williams + */ +public class AppDesc { + + private final String name; + private final String path; + private final String contextRoot; + private final String engineType; + + public AppDesc(final String name, final String path, final String contextRoot, final String type) { + this.name = name; + this.path = path; + this.contextRoot = contextRoot; + this.engineType = type; + } + + public String getName() { + return name; + } + + public String getPath() { + return path; + } + + public String getContextRoot() { + return contextRoot; + } + + public String getType() { + return engineType; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/ResourceDesc.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/ResourceDesc.java new file mode 100644 index 00000000..353f5483 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/ResourceDesc.java @@ -0,0 +1,52 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.serverview; + +/** + * + * @author Peter Williams + */ +public class ResourceDesc implements Comparable<ResourceDesc> { + + private final String name; + private final String cmdSuffix; + + public ResourceDesc(final String name, final String cmdSuffix) { + this.name = name; + this.cmdSuffix = cmdSuffix; + } + + public String getName() { + return name; + } + + public String getCommandSuffix() { + return cmdSuffix; + } + + @Override + public int compareTo(ResourceDesc o) { + int result = name.compareTo(o.name); + if (result == 0) { + result = cmdSuffix.compareTo(o.cmdSuffix); + } + return result; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/WSDesc.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/WSDesc.java new file mode 100644 index 00000000..9c72be5d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/WSDesc.java @@ -0,0 +1,49 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.serverview; + +/** + * + * @author Peter Williams + */ +public class WSDesc { + + private final String testUrl; + private final String wsdlUrl; + private final String name; + + public WSDesc(final String name, final String wsdlUrl, final String testUrl) { + this.name = name; + this.testUrl = testUrl; + this.wsdlUrl = wsdlUrl; + } + + public String getName() { + return name; + } + + public String getTestURL() { + return testUrl; + } + + public String getWsdlUrl() { + return wsdlUrl; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/AdminCredentialsDialog.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/AdminCredentialsDialog.java new file mode 100644 index 00000000..75a6384e --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/AdminCredentialsDialog.java @@ -0,0 +1,132 @@ +/****************************************************************************** + * Copyright (c) 2020 Payara Foundation All rights reserved. This program and the accompanying + * materials are made available under the terms of the Eclipse Public License v2.0 which accompanies + * this distribution, and is available at http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.starting; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.PlatformUI; +import org.eclipse.wst.server.core.IServer; +import org.eclipse.wst.server.core.IServerWorkingCopy; + +import fish.payara.eclipse.tools.server.PayaraServer; + +public class AdminCredentialsDialog extends TitleAreaDialog { + + private Text adminNameText; + private Text passwordText; + + private static final String SAVE_LABEL = "Save"; + + private IServerWorkingCopy serverWorkingCopy; + + + private AdminCredentialsDialog(IServerWorkingCopy serverWorkingCopy, Shell parentShell) { + super(parentShell); + this.serverWorkingCopy = serverWorkingCopy; + } + + + public static void open(IServer server) { + Display display = PlatformUI.getWorkbench().getDisplay(); + display.asyncExec(() -> { + IServerWorkingCopy serverWorkingCopy; + if (server instanceof IServerWorkingCopy) { + serverWorkingCopy = (IServerWorkingCopy) server; + } else { + serverWorkingCopy = server.createWorkingCopy(); + } + AdminCredentialsDialog dialog = new AdminCredentialsDialog(serverWorkingCopy, display.getActiveShell()); + dialog.create(); + dialog.open(); + }); + } + + + @Override + public void create() { + super.create(); + super.getShell().setText("Payara Administrator Credentials"); + setTitle("Wrong user name or password"); + setMessage("Authorization failed while checking " + serverWorkingCopy.getName() + + " status. Please provide valid administrator credentials.", IMessageProvider.WARNING); + } + + + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, SAVE_LABEL, true); + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); + } + + + @Override + protected Control createDialogArea(Composite parent) { + Composite area = (Composite) super.createDialogArea(parent); + Composite container = new Composite(area, SWT.NONE); + container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + GridLayout layout = new GridLayout(2, false); + container.setLayout(layout); + + createAdminNameComponent(container); + createPasswordComponent(container); + + return area; + } + + + private void createAdminNameComponent(Composite container) { + Label adminNameLabel = new Label(container, SWT.NONE); + adminNameLabel.setText("Username"); + + GridData grid = new GridData(); + grid.grabExcessHorizontalSpace = true; + grid.horizontalAlignment = GridData.FILL; + + adminNameText = new Text(container, SWT.BORDER); + adminNameText.setText(serverWorkingCopy.getAttribute(PayaraServer.ATTR_ADMIN, "admin")); + adminNameText.setLayoutData(grid); + } + + + private void createPasswordComponent(Composite container) { + Label passwordLabel = new Label(container, SWT.NONE); + passwordLabel.setText("Password"); + + GridData grid = new GridData(); + grid.grabExcessHorizontalSpace = true; + grid.horizontalAlignment = GridData.FILL; + passwordText = new Text(container, SWT.PASSWORD | SWT.BORDER); + passwordText.setText(serverWorkingCopy.getAttribute(PayaraServer.ATTR_ADMINPASS, "")); + passwordText.setLayoutData(grid); + } + + + @Override + protected void okPressed() { + try { + serverWorkingCopy.setAttribute(PayaraServer.ATTR_ADMIN, adminNameText.getText()); + serverWorkingCopy.setAttribute(PayaraServer.ATTR_ADMINPASS, passwordText.getText()); + serverWorkingCopy.save(true, null); + } catch (CoreException e) { + throw new RuntimeException(e); + } + super.okPressed(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/PayaraServerLaunchDelegate.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/PayaraServerLaunchDelegate.java new file mode 100644 index 00000000..ae0b56e8 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/PayaraServerLaunchDelegate.java @@ -0,0 +1,419 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2020 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.starting; + +import static fish.payara.eclipse.tools.server.Messages.abortLaunchMsg; +import static fish.payara.eclipse.tools.server.Messages.badGateway; +import static fish.payara.eclipse.tools.server.Messages.canntCommunicate; +import static fish.payara.eclipse.tools.server.Messages.checkVpnOrProxy; +import static fish.payara.eclipse.tools.server.Messages.domainNotMatch; +import static fish.payara.eclipse.tools.server.Messages.wrongUsernamePassword; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.SYMBOLIC_NAME; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logError; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logMessage; +import static fish.payara.eclipse.tools.server.log.PayaraConsoleManager.getStandardConsole; +import static fish.payara.eclipse.tools.server.log.PayaraConsoleManager.showConsole; +import static fish.payara.eclipse.tools.server.sdk.server.ServerTasks.getDebugPort; +import static fish.payara.eclipse.tools.server.sdk.server.ServerTasks.StartMode.DEBUG; +import static fish.payara.eclipse.tools.server.sdk.server.ServerTasks.StartMode.START; +import static fish.payara.eclipse.tools.server.sdk.utils.ServerUtils.GFV3_JAR_MATCHER; +import static fish.payara.eclipse.tools.server.sdk.utils.ServerUtils.getJarName; +import static fish.payara.eclipse.tools.server.sdk.utils.Utils.quote; +import static fish.payara.eclipse.tools.server.utils.WtpUtil.load; +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static org.eclipse.core.runtime.IStatus.ERROR; +import static org.eclipse.core.runtime.IStatus.OK; +import static org.eclipse.debug.core.DebugPlugin.ATTR_CAPTURE_OUTPUT; +import static org.eclipse.debug.core.ILaunchManager.DEBUG_MODE; +import static org.eclipse.debug.core.ILaunchManager.RUN_MODE; +import static org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR; +import static org.eclipse.jface.dialogs.MessageDialog.openError; +import static org.eclipse.wst.server.core.IServer.STATE_STARTED; +import static org.eclipse.wst.server.core.IServer.STATE_STARTING; +import static org.eclipse.wst.server.core.IServer.STATE_STOPPED; +import static org.eclipse.wst.server.core.ServerUtil.getServer; + +import java.io.File; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeoutException; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.model.RuntimeProcess; +import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate; +import org.eclipse.jdt.launching.AbstractVMInstall; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.wst.server.core.IServer; +import org.eclipse.wst.server.core.ServerCore; +import org.eclipse.wst.server.core.model.ServerDelegate; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; +import fish.payara.eclipse.tools.server.exceptions.HttpPortUpdateException; +import fish.payara.eclipse.tools.server.log.IPayaraConsole; +import fish.payara.eclipse.tools.server.sdk.admin.ResultProcess; +import fish.payara.eclipse.tools.server.sdk.server.FetchLogPiped; +import fish.payara.eclipse.tools.server.sdk.server.ServerTasks.StartMode; + +/** + * This class takes care of actually starting (launching) the Payara / GlassFish server. + * + * <p> + * This class is registered in <code>plug-in.xml</code> in the + * <code>org.eclipse.debug.core.launchConfigurationTypes</code> extension point. + * </p> + * + */ +public class PayaraServerLaunchDelegate extends AbstractJavaLaunchConfigurationDelegate { + + private static final int MONITOR_TOTAL_WORK = 1000; + public static final int WORK_STEP = 200; + private static final IStatus DEBUG_STATUS = new Status(OK, SYMBOLIC_NAME, "Debugging"); + + private static final ExecutorService asyncJobsService = Executors.newCachedThreadPool(); + + @Override + public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { + + logMessage("in Payara launch"); + + monitor.beginTask("Starting Payara", MONITOR_TOTAL_WORK); + + IServer server = getServer(configuration); + if (server == null) { + abort("missing Server"); + } + + PayaraServerBehaviour serverBehavior = load(server, PayaraServerBehaviour.class); + PayaraServer serverAdapter = load(server, PayaraServer.class); + + serverBehavior.setLaunch(launch); + + try { + checkMonitorAndProgress(monitor, WORK_STEP); + } catch (InterruptedException e1) { + return; + } + + // Find out if our server is already running and ready + boolean isRunning = isRunning(serverBehavior); + + // If server is running and the mode is debug, try to attach the debugger + if (isRunning) { + + logMessage("Server is already started!"); + + if (DEBUG_MODE.equals(mode)) { + try { + serverBehavior.attach(launch, configuration.getWorkingCopy(), monitor); + } catch (CoreException e) { + Display.getDefault().asyncExec(() -> openError( + Display.getDefault().getActiveShell(), + "Error", + "Error attaching to Payara Server. Please make sure the server is started in debug mode.")); + + logError("Not able to attach debugger, running in normal mode", e); + + serverBehavior.setPayaraServerMode(RUN_MODE); + + throw e; + } + + serverBehavior.setPayaraServerStatus(DEBUG_STATUS); + } + } + + try { + if (serverAdapter.isRemote()) { + if (!isRunning) { + abort("Payara Remote Servers cannot be start from this machine."); + } + } else { + if (!isRunning) { + startDASAndTarget(serverAdapter, serverBehavior, configuration, launch, mode, monitor); + } + } + + } catch (InterruptedException e) { + getStandardConsole(serverAdapter).stopLogging(3); + logError("Server start interrupted.", e); + + serverBehavior.setPayaraServerState(STATE_STOPPED); + abort("Unable to start server due interruption."); + } catch (CoreException e) { + getStandardConsole(serverAdapter).stopLogging(3); + serverBehavior.setPayaraServerState(STATE_STOPPED); + throw e; + } finally { + monitor.done(); + } + + serverBehavior.setPayaraServerMode(mode); + } + + public ResultProcess launchServer(PayaraServerBehaviour serverBehavior, StartupArgsImpl payaraStartArguments, StartMode launchMode, IProgressMonitor monitor, ILaunchConfiguration configuration, ILaunch launch) throws TimeoutException, InterruptedException, ExecutionException, HttpPortUpdateException { + serverBehavior.setPayaraServerState(STATE_STARTING); + + ResultProcess process = waitForPayaraStarted( + serverBehavior, + asyncJobsService.submit(new PayaraStartJob( + serverBehavior, + payaraStartArguments, launchMode, + configuration, launch, monitor + )), + monitor); + + serverBehavior.updateHttpPort(); + + return process; + } + + private ResultProcess waitForPayaraStarted(PayaraServerBehaviour serverBehavior, Future<ResultProcess> futureProcess, IProgressMonitor monitor) throws TimeoutException, InterruptedException, ExecutionException { + long endTime = System.currentTimeMillis() + (serverBehavior.getServer().getStartTimeout() * 1000); + + while (System.currentTimeMillis() < endTime) { + + try { + return futureProcess.get(500, MILLISECONDS); + } catch (TimeoutException e) { + if (monitor.isCanceled()) { + futureProcess.cancel(true); + // TODO: check if Payara indeed stopped and if not explicitly give stop command + serverBehavior.serverStateChanged(STATE_STOPPED); + serverBehavior.setPayaraServerState(STATE_STOPPED); + throw new OperationCanceledException(); + } + } + } + + throw new TimeoutException("Timeout while waiting for Payara to start"); + } + + @Override + protected void abort(String message, Throwable exception, int code) throws CoreException { + throw new CoreException(new Status(ERROR, SYMBOLIC_NAME, code, message, exception)); + } + + // #### Private methods + + private void startDASAndTarget(PayaraServer serverAdapter, PayaraServerBehaviour serverBehavior, + ILaunchConfiguration configuration, ILaunch launch, String mode, IProgressMonitor monitor) + throws CoreException, InterruptedException { + + File bootstrapJar = getJarName(serverAdapter.getServerInstallationDirectory(), GFV3_JAR_MATCHER); + if (bootstrapJar == null) { + abort("bootstrap jar not found"); + } + + // TODO which java to use? for now ignore the one from launch config + AbstractVMInstall/* IVMInstall */ vm = (AbstractVMInstall) serverBehavior.getRuntimeDelegate().getVMInstall(); + + if (vm == null || vm.getInstallLocation() == null) { + abort("Invalid Java VM location for server " + serverAdapter.getName()); + } + + StartupArgsImpl startArgs = new StartupArgsImpl(); + startArgs.setJavaHome(vm.getInstallLocation().getAbsolutePath()); + + // Program & VM args + String programArgs = getProgramArguments(configuration); + String vmArgs = getVMArguments(configuration); + + StartMode startMode = DEBUG_MODE.equals(mode) ? DEBUG : START; + addJavaOptions(serverAdapter, mode, startArgs, vmArgs); + startArgs.addGlassfishArgs(programArgs); + startArgs.addGlassfishArgs("--domain " + serverAdapter.getDomainName()); + startArgs.addGlassfishArgs("--domaindir " + quote(serverAdapter.getDomainPath())); + + setDefaultSourceLocator(launch, configuration); + + checkMonitorAndProgress(monitor, WORK_STEP / 2); + + startLogging(serverAdapter, serverBehavior); + + ResultProcess process = null; + Process payaraProcess = null; + + try { + process = launchServer(serverBehavior, startArgs, startMode, monitor, configuration, launch); + payaraProcess = process.getValue().getProcess(); + launch.setAttribute(ATTR_CAPTURE_OUTPUT, "false"); + + new RuntimeProcess(launch, payaraProcess, "Payara Application Server", null); + } catch (TimeoutException e) { + abort("Unable to start server on time.", e); + } catch (ExecutionException e) { + abort("Unable to start server due following issues:", e.getCause()); + } catch (HttpPortUpdateException e) { + abort("Unable to update http port. Server shut down.", e); + } + + try { + checkMonitorAndProgress(monitor, WORK_STEP); + } catch (InterruptedException e) { + killProcesses(payaraProcess); + } + + setDefaultSourceLocator(launch, configuration); + + if (DEBUG_MODE.equals(mode) && !serverBehavior.getPayaraServerDelegate().getAttachDebuggerEarly()) { + try { + serverBehavior.attach(launch, configuration.getWorkingCopy(), monitor, getDebugPort(process)); + checkMonitorAndProgress(monitor, WORK_STEP); + } catch (IllegalArgumentException e) { + killProcesses(payaraProcess); + abort("Server run in debug mode but the debug port couldn't be determined!", e); + } + } + } + + private void addJavaOptions(PayaraServer serverAdapter, String mode, StartupArgsImpl args, String vmArgs) { + if (DEBUG_MODE.equals(mode)) { + args.addJavaArgs(vmArgs); + int debugPort = serverAdapter.getDebugPort(); + if (debugPort != -1) { + // Debug port was specified by user, use it + args.addJavaArgs(serverAdapter.getDebugOptions(debugPort)); + } + } else { + args.addJavaArgs(ignoreDebugArgs(vmArgs)); + } + } + + private String ignoreDebugArgs(String vmArgs) { + StringBuilder args = new StringBuilder(vmArgs.length()); + + for (String vmArgument : vmArgs.split("\\s")) { + if ("-Xdebug".equalsIgnoreCase(vmArgument) || (vmArgument.startsWith("-agentlib")) || vmArgument.startsWith("-Xrunjdwp")) { + break; + } + args.append(vmArgument); + args.append(" "); + } + + return args.toString(); + } + + private void checkMonitorAndProgress(IProgressMonitor monitor, int work) throws InterruptedException { + if (monitor.isCanceled()) { + throw new InterruptedException(); + } + + monitor.worked(work); + } + + private boolean isRunning(PayaraServerBehaviour serverBehavior) throws CoreException { + IServer thisServer = serverBehavior.getServer(); + + for (IServer server : ServerCore.getServers()) { + + if (server != thisServer && server.getServerState() == STATE_STARTED) { + ServerDelegate delegate = load(server, ServerDelegate.class); + if (delegate instanceof PayaraServer) { + PayaraServer runingGfServer = (PayaraServer) delegate; + + if (runingGfServer.isRemote()) { + continue; + } + + PayaraServer thisGfServer = (PayaraServer) (load(thisServer, ServerDelegate.class)); + if (runingGfServer.getPort() == thisGfServer.getPort() + || runingGfServer.getAdminPort() == thisGfServer.getAdminPort()) { + abort(canntCommunicate, new RuntimeException(domainNotMatch)); + return false; + } + } + } + } + + switch (serverBehavior.getServerStatus(true)) { + case RUNNING_CONNECTION_ERROR: + abort(canntCommunicate, new RuntimeException(abortLaunchMsg + domainNotMatch + checkVpnOrProxy)); + break; + case RUNNING_CREDENTIAL_PROBLEM: + AdminCredentialsDialog.open(thisServer); + abort(canntCommunicate, new RuntimeException(abortLaunchMsg + wrongUsernamePassword)); + break; + case RUNNING_DOMAIN_MATCHING: + return true; + case RUNNING_PROXY_ERROR: + abort(canntCommunicate, new RuntimeException(abortLaunchMsg + badGateway)); + break; + case STOPPED_DOMAIN_NOT_MATCHING: + abort(canntCommunicate, new RuntimeException(domainNotMatch)); + break; + case STOPPED_NOT_LISTENING: + return false; + default: + break; + } + + return false; + } + + private void startLogging(PayaraServer serverAdapter, PayaraServerBehaviour serverBehavior) { + try { + PlatformUI.getWorkbench().getDisplay().asyncExec(() -> { + File logFile = new File(serverAdapter.getDomainPath() + "/logs/server.log"); //$NON-NLS-1$ + try { + logFile.createNewFile(); + } catch (Exception e) { + // File probably exists + e.printStackTrace(); + } + + IPayaraConsole console = getStandardConsole(serverAdapter); + showConsole(console); + if (!console.isLogging()) { + console.startLogging(FetchLogPiped.create(serverAdapter, true)); + } + }); + } catch (Exception e) { + logError("page.showView", e); + } + } + + + + private void killProcesses(Process... processes) { + for (Process process : processes) { + if (process != null) { + process.destroy(); + } + } + } + + private void abort(String message) throws CoreException { + throw new CoreException(new Status(ERROR, SYMBOLIC_NAME, ERR_INTERNAL_ERROR, message, null)); + } + + private void abort(String message, Throwable exception) throws CoreException { + throw new CoreException(new Status(ERROR, SYMBOLIC_NAME, ERR_INTERNAL_ERROR, message, exception)); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/PayaraStartJob.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/PayaraStartJob.java new file mode 100644 index 00000000..b941a8a8 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/PayaraStartJob.java @@ -0,0 +1,209 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2019-2020 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ +package fish.payara.eclipse.tools.server.starting; + +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logMessage; +import static fish.payara.eclipse.tools.server.log.PayaraConsoleManager.getStandardConsole; +import static fish.payara.eclipse.tools.server.log.PayaraConsoleManager.getStartupProcessConsole; +import static fish.payara.eclipse.tools.server.log.PayaraConsoleManager.showConsole; +import static fish.payara.eclipse.tools.server.sdk.server.ServerTasks.getDebugPort; +import static fish.payara.eclipse.tools.server.sdk.server.ServerTasks.startServer; +import static fish.payara.eclipse.tools.server.sdk.server.ServerTasks.StartMode.DEBUG; +import static fish.payara.eclipse.tools.server.starting.PayaraServerLaunchDelegate.WORK_STEP; + +import java.util.concurrent.Callable; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; + +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; +import fish.payara.eclipse.tools.server.exceptions.PayaraLaunchException; +import fish.payara.eclipse.tools.server.log.IPayaraConsole; +import fish.payara.eclipse.tools.server.sdk.PayaraIdeException; +import fish.payara.eclipse.tools.server.sdk.admin.ResultProcess; +import fish.payara.eclipse.tools.server.sdk.server.FetchLogSimple; +import fish.payara.eclipse.tools.server.sdk.server.ServerTasks.StartMode; + +public class PayaraStartJob implements Callable<ResultProcess> { + + private PayaraServerBehaviour payaraServerBehaviour; + private StartupArgsImpl args; + private StartMode mode; + private ILaunchConfiguration configuration; + private ILaunch launch; + private IProgressMonitor monitor; + + public PayaraStartJob(PayaraServerBehaviour payaraServerBehaviour, StartupArgsImpl args, StartMode mode, ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) { + super(); + this.payaraServerBehaviour = payaraServerBehaviour; + this.args = args; + this.mode = mode; + this.configuration = configuration; + this.launch = launch; + this.monitor = monitor; + } + + @Override + public ResultProcess call() throws Exception { + + boolean earlyAttach = payaraServerBehaviour.getPayaraServerDelegate().getAttachDebuggerEarly(); + + // Create the process that starts the server + ResultProcess process = startPayara(earlyAttach); + + Process payaraProcess = process.getValue().getProcess(); + + // Read process std output to prevent process'es blocking + IPayaraConsole startupConsole = startLogging(payaraProcess); + + IPayaraConsole filelogConsole = getStandardConsole(payaraServerBehaviour.getPayaraServerDelegate()); + + synchronized (payaraServerBehaviour) { + + boolean attached = false; + boolean hasLogged = false; + boolean hasLoggedPayara = false; + + // Query the process status in a loop + + check_server_status: while (true) { + + switch (payaraServerBehaviour.getServerStatus(false)) { + case STOPPED_NOT_LISTENING: + try { + if (payaraProcess.isAlive()) { + + // Server is not (yet) listening. + // Check if we need to attach the debugger for it to continue. + // This happens when the server is started in debug with halt on start + + if (earlyAttach && mode == DEBUG && !attached) { + try { + payaraServerBehaviour.attach(launch, configuration.getWorkingCopy(), null, getDebugPort(process)); + checkMonitorAndProgress(monitor, WORK_STEP); + attached = true; + } catch (CoreException e) { + // Process may not have reached the point where it waits for a remote connection + logMessage(e.getMessage()); + } + } + } else { + int exitCode = payaraProcess.exitValue(); + + if (exitCode != 0) { + // Something bad happened, show user startup console + + logMessage("launch failed with exit code " + exitCode); + showConsole(startupConsole); + + throw new PayaraLaunchException("Launch process failed with exit code " + exitCode); + } + } + + } catch (IllegalThreadStateException e) { // still running, keep waiting + } + + break; + case RUNNING_PROXY_ERROR: + startupConsole.stopLogging(); + payaraProcess.destroy(); + + throw new PayaraLaunchException( + "BAD GATEWAY response code returned. Check your proxy settings. Killing startup process.", + payaraProcess); + case RUNNING_CREDENTIAL_PROBLEM: + startupConsole.stopLogging(); + payaraProcess.destroy(); + AdminCredentialsDialog.open(payaraServerBehaviour.getServer()); + + throw new PayaraLaunchException("Wrong user name or password. Killing startup process.", + payaraProcess); + case RUNNING_DOMAIN_MATCHING: + startupConsole.stopLogging(); + break check_server_status; + default: + break; + } + + // Wait for notification when server state changes + try { + checkMonitor(monitor); + + // Limit waiting so we can check process exit code again + payaraServerBehaviour.wait(500); + + if (!hasLogged && (startupConsole.hasLogged() || filelogConsole.hasLogged())) { + // Something has been logged meaning the JVM of the target + // process is activated. Could be JVM logging first + // like "waiting for connection", or the first log line of Payara starting + hasLogged = true; + checkMonitorAndProgress(monitor, WORK_STEP / 4); + } + + if (!hasLoggedPayara && filelogConsole.hasLoggedPayara()) { + + // A Payara logline has been written, meaning Payara is now starting up. + hasLoggedPayara = true; + checkMonitorAndProgress(monitor, WORK_STEP / 4); + } + + } catch (InterruptedException e) { + startupConsole.stopLogging(); + payaraProcess.destroy(); + throw e; + } + } + } + + return process; + } + + private ResultProcess startPayara(boolean earlyAttach) throws PayaraLaunchException { + try { + // Process the arguments and call the CommandStartDAS command which will initiate + // starting the Payara server + return startServer(payaraServerBehaviour.getPayaraServerDelegate(), args, mode, earlyAttach); + } catch (PayaraIdeException e) { + throw new PayaraLaunchException("Exception in startup library.", e); + } + } + + private IPayaraConsole startLogging(Process payaraProcess) { + IPayaraConsole startupConsole = getStartupProcessConsole(payaraServerBehaviour.getPayaraServerDelegate(), payaraProcess); + + startupConsole.startLogging( + new FetchLogSimple(payaraProcess.getInputStream()), + new FetchLogSimple(payaraProcess.getErrorStream())); + + return startupConsole; + } + + private void checkMonitor(IProgressMonitor monitor) throws InterruptedException { + if (monitor.isCanceled()) { + throw new InterruptedException(); + } + } + + private void checkMonitorAndProgress(IProgressMonitor monitor, int work) throws InterruptedException { + checkMonitor(monitor); + monitor.worked(work); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/StartupArgsImpl.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/StartupArgsImpl.java new file mode 100644 index 00000000..a53f3ab5 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/StartupArgsImpl.java @@ -0,0 +1,88 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.starting; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import fish.payara.eclipse.tools.server.sdk.data.StartupArgs; + +public class StartupArgsImpl implements StartupArgs { + + private String javaHome; + private ArrayList<String> javaArgs; + private ArrayList<String> glassfishArgs; + + public StartupArgsImpl() { + + } + + public void setJavaHome(String javaHome) { + this.javaHome = javaHome; + } + + /** + * Adds java arguments contained in <code>javaArgsString</code>. The parameter is parsed - the + * delimeter is defined as one or more whitespace characters followed by <code>-</code>. + * + * @param javaArgsString + */ + public void addJavaArgs(String javaArgsString) { + String[] args = javaArgsString.split("\\s+(?=-)"); + if (javaArgs == null) { + javaArgs = new ArrayList<>(args.length); + } + Collections.addAll(javaArgs, args); + } + + /** + * Adds single argument for bootstrap jar. No processing is done. + * + * @param glassfishArgsString + */ + public void addGlassfishArgs(String glassfishArgsString) { + if (glassfishArgs == null) { + glassfishArgs = new ArrayList<>(); + } + glassfishArgs.add(glassfishArgsString); + } + + @Override + public List<String> getGlassfishArgs() { + return glassfishArgs; + } + + @Override + public List<String> getJavaArgs() { + return javaArgs; + } + + @Override + public Map<String, String> getEnvironmentVars() { + return Collections.emptyMap(); + } + + @Override + public String getJavaHome() { + return javaHome; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/PayaraToolsUIPlugin.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/PayaraToolsUIPlugin.java new file mode 100644 index 00000000..23288309 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/PayaraToolsUIPlugin.java @@ -0,0 +1,109 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui; + +import static org.eclipse.jface.resource.ImageDescriptor.createFromURL; +import static org.eclipse.wst.server.core.IServer.STATE_UNKNOWN; + +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.eclipse.wst.server.core.IServer; +import org.eclipse.wst.server.core.IServerLifecycleListener; +import org.eclipse.wst.server.core.internal.ResourceManager; +import org.eclipse.wst.server.core.internal.UpdateServerJob; + +import fish.payara.eclipse.tools.server.PayaraServer; + +/** + * This is used as the OSGi bundle activator, as well as the central place to get images from. + */ +@SuppressWarnings("restriction") +public class PayaraToolsUIPlugin extends AbstractUIPlugin { + + public static final String PLUGIN_ID = "fish.payara.eclipse.tools.server.ui"; + + public static final String EAR_MODULE_IMG = "ear.img"; + public static final String EJB_MODULE_IMG = "ejb.img"; + public static final String GF_SERVER_IMG = "gf-server.img"; + public static final String LOG_FILE_IMG = "log-file.img"; + public static final String WEB_MODULE_IMG = "web.img"; + public static final String WEBSERVICE_IMG = "webservice.img"; + public static final String RESOURCES_IMG = "resources.img"; + public static final String GF_WIZARD = "wizard.img"; + + private static PayaraToolsUIPlugin instance; + + public PayaraToolsUIPlugin() { + instance = this; + addServerLifecycleListener(); + } + + /** + * Start a UpdateServerJob to update status when GF server is added + */ + private void addServerLifecycleListener() { + + IServerLifecycleListener serverLifecycleListener = new IServerLifecycleListener() { + @Override + public void serverAdded(IServer server) { + if (server.loadAdapter(PayaraServer.class, new NullProgressMonitor()) != null) { + if (server.getServerState() == STATE_UNKNOWN) { + UpdateServerJob job = new UpdateServerJob(new IServer[] { server }); + job.schedule(); + } + } + } + + @Override + public void serverChanged(IServer server) { + } + + @Override + public void serverRemoved(IServer server) { + } + }; + + ResourceManager.getInstance().addServerLifecycleListener(serverLifecycleListener); + } + + public static final PayaraToolsUIPlugin getInstance() { + return instance; + } + + public static Image getImg(String key) { + return getInstance().getImageRegistry().get(key); + } + + @Override + protected void initializeImageRegistry(ImageRegistry reg) { + super.initializeImageRegistry(reg); + + reg.put(EAR_MODULE_IMG, createFromURL(getBundle().getEntry("icons/obj16/ear.gif"))); + reg.put(EJB_MODULE_IMG, createFromURL(getBundle().getEntry("icons/obj16/ejb_module.gif"))); + reg.put(GF_SERVER_IMG, createFromURL(getBundle().getEntry("icons/obj16/payara-blue.png"))); + reg.put(LOG_FILE_IMG, createFromURL(getBundle().getEntry("icons/obj16/logfile.png"))); + reg.put(WEB_MODULE_IMG, createFromURL(getBundle().getEntry("icons/obj16/web_module.gif"))); + reg.put(WEBSERVICE_IMG, createFromURL(getBundle().getEntry("icons/obj16/webservice.png"))); + reg.put(RESOURCES_IMG, createFromURL(getBundle().getEntry("icons/obj16/resources.gif"))); + reg.put(GF_WIZARD, createFromURL(getBundle().getEntry("icons/wizard75x66.png"))); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/editorsections/LaunchConfigurationTabGroup.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/editorsections/LaunchConfigurationTabGroup.java new file mode 100644 index 00000000..a655e385 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/editorsections/LaunchConfigurationTabGroup.java @@ -0,0 +1,81 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.editorsections; + +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup; +import org.eclipse.debug.ui.CommonTab; +import org.eclipse.debug.ui.EnvironmentTab; +import org.eclipse.debug.ui.ILaunchConfigurationDialog; +import org.eclipse.debug.ui.ILaunchConfigurationTab; +import org.eclipse.debug.ui.sourcelookup.SourceLookupTab; +import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab; +import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab; +import org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab; +import org.eclipse.wst.server.ui.ServerLaunchConfigurationTab; + +/** + * The launch configuration that's shown when the "Open Launch Configuration" is clicked on e.g. the + * "Server Editor". See {@link ServerSection} + * + * <p> + * This is referred in <code>plug-in.xml</code> as extension + * <code>org.eclipse.debug.ui.launchConfigurationTabGroups</code> + * + */ +public class LaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup { + + @Override + public void createTabs(ILaunchConfigurationDialog dialog, String mode) { + ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[7]; + tabs[0] = new ComboServerLaunchConfigurationTab(new String[] { "payara.server" }); + tabs[0].setLaunchConfigurationDialog(dialog); + + tabs[1] = new JavaArgumentsTab(); + tabs[1].setLaunchConfigurationDialog(dialog); + + tabs[2] = new JavaClasspathTab(); + tabs[2].setLaunchConfigurationDialog(dialog); + + tabs[3] = new SourceLookupTab(); + tabs[3].setLaunchConfigurationDialog(dialog); + + tabs[4] = new EnvironmentTab(); + tabs[4].setLaunchConfigurationDialog(dialog); + + tabs[5] = new JavaJRETab(); + tabs[5].setLaunchConfigurationDialog(dialog); + + tabs[6] = new CommonTab(); + tabs[6].setLaunchConfigurationDialog(dialog); + setTabs(tabs); + } + + private static class ComboServerLaunchConfigurationTab extends ServerLaunchConfigurationTab { + public ComboServerLaunchConfigurationTab(String[] ids) { + super(ids); + } + + @Override + public void initializeFrom(ILaunchConfiguration configuration) { + super.initializeFrom(configuration); + handleServerSelection(); + } + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/editorsections/ServerSection.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/editorsections/ServerSection.java new file mode 100644 index 00000000..521bd202 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/editorsections/ServerSection.java @@ -0,0 +1,127 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.editorsections; + +import static fish.payara.eclipse.tools.server.Messages.wizardSectionTitle; +import static org.eclipse.swt.SWT.DEFAULT; +import static org.eclipse.swt.SWT.FILL; +import static org.eclipse.swt.SWT.UNDERLINE_LINK; +import static org.eclipse.ui.forms.widgets.ExpandableComposite.EXPANDED; +import static org.eclipse.ui.forms.widgets.ExpandableComposite.FOCUS_TITLE; +import static org.eclipse.ui.forms.widgets.ExpandableComposite.TITLE_BAR; +import static org.eclipse.ui.forms.widgets.ExpandableComposite.TWISTIE; +import static org.eclipse.ui.forms.widgets.Section.DESCRIPTION; +import static org.eclipse.ui.internal.dialogs.PropertyDialog.createDialogOn; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.forms.events.HyperlinkEvent; +import org.eclipse.ui.forms.events.IHyperlinkListener; +import org.eclipse.ui.forms.widgets.FormToolkit; +import org.eclipse.ui.forms.widgets.Hyperlink; +import org.eclipse.ui.forms.widgets.Section; +import org.eclipse.wst.server.ui.editor.ServerEditorSection; + +import fish.payara.eclipse.tools.server.Messages; +import fish.payara.eclipse.tools.server.ui.properties.ServerPropertyPage; + +/** + * This class contributes content to the "Server Editor", which is the editor that opens when you + * double click the Payara / GlassFish server in the Servers views. + * + * <p> + * This is the editor that shows the "Runtime Environment", "Open Launch Configuration" links and + * has the "Publishing" and "Timeouts' preferences. This class adds a link to the properties page + * (see {@link ServerPropertyPage}) that that editor. + * </p> + * + * @author ludo + */ +@SuppressWarnings("restriction") +public class ServerSection extends ServerEditorSection implements PropertyChangeListener { + + @Override + public void dispose() { + server.removePropertyChangeListener(this); + super.dispose(); + } + + @Override + public void createSection(Composite parent) { + super.createSection(parent); + + FormToolkit toolkit = getFormToolkit(parent.getDisplay()); + + Section section = toolkit.createSection(parent, TITLE_BAR | DESCRIPTION | TWISTIE | EXPANDED | FOCUS_TITLE); + section.setText(wizardSectionTitle); + section.setDescription(Messages.wizardSectionDescription); + section.setLayoutData(new GridData(FILL, FILL, false, false)); + + Composite composite = toolkit.createComposite(section); + GridLayout gridLayout = new GridLayout(); + gridLayout.numColumns = 3; + gridLayout.verticalSpacing = 5; + gridLayout.marginWidth = 10; + gridLayout.marginHeight = 5; + composite.setLayout(gridLayout); + composite.setLayoutData(new GridData(FILL, FILL, false, false)); + + section.setClient(composite); + + Hyperlink link = toolkit.createHyperlink(composite, "Open server properties page...", UNDERLINE_LINK); + link.addHyperlinkListener(new IHyperlinkListener() { + + @Override + public void linkActivated(HyperlinkEvent e) { + createDialogOn( + Display.getDefault().getActiveShell(), + "org.eclipse.wst.server.ui.properties", //$NON-NLS-1$ + server) + .open(); + } + + @Override + public void linkExited(HyperlinkEvent e) { + } + + @Override + public void linkEntered(HyperlinkEvent e) { + } + }); + + GridDataFactory.fillDefaults() + .grab(true, false) + .span(3, 1) + .hint(50, DEFAULT) + .applyTo(link); + + } + + // note that this is currently not working due to issue 140 + @Override + public void propertyChange(PropertyChangeEvent evt) { + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/JAXRSActionPanels.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/JAXRSActionPanels.java new file mode 100644 index 00000000..b4027817 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/JAXRSActionPanels.java @@ -0,0 +1,41 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.internal; + +import static org.eclipse.swt.SWT.NONE; + +import org.eclipse.jst.common.project.facet.ui.libprov.LibraryProviderOperationPanel; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** + * See <code>plug-in.xml</code> + * <code>org.eclipse.jst.common.project.facet.ui.libraryProviderActionPanels</code> + * + * @author arjan + * + */ +public class JAXRSActionPanels extends LibraryProviderOperationPanel { + + @Override + public Control createControl(Composite c) { + return new Composite(c, NONE); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProvider.java new file mode 100644 index 00000000..5dede4b2 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProvider.java @@ -0,0 +1,48 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.internal; + +import org.eclipse.osgi.util.NLS; +import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent; +import org.eclipse.wst.common.project.facet.ui.IRuntimeComponentLabelProvider; + +/** + * @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a> + */ +public final class PayaraRuntimeComponentLabelProvider implements IRuntimeComponentLabelProvider { + private final IRuntimeComponent rc; + + public PayaraRuntimeComponentLabelProvider(IRuntimeComponent rc) { + this.rc = rc; + } + + @Override + public String getLabel() { + return NLS.bind(Resources.label, rc.getRuntimeComponentVersion().getVersionString()); + } + + private static final class Resources extends NLS { + public static String label; + + static { + initializeMessages(PayaraRuntimeComponentLabelProvider.class.getName(), Resources.class); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProvider.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProvider.properties new file mode 100644 index 00000000..ff14a850 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProvider.properties @@ -0,0 +1 @@ +label = Payara {0} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProviderFactory.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProviderFactory.java new file mode 100644 index 00000000..eb607e15 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProviderFactory.java @@ -0,0 +1,42 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.internal; + +import org.eclipse.core.runtime.IAdapterFactory; +import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent; +import org.eclipse.wst.common.project.facet.ui.IRuntimeComponentLabelProvider; + +/** + * @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a> + */ + +public final class PayaraRuntimeComponentLabelProviderFactory implements IAdapterFactory { + private static final Class<?>[] ADAPTER_TYPES = { IRuntimeComponentLabelProvider.class }; + + @Override + public <T> T getAdapter(Object adaptable, Class<T> adapterType) { + return adapterType.cast(new PayaraRuntimeComponentLabelProvider((IRuntimeComponent) adaptable)); + } + + @Override + public Class<?>[] getAdapterList() { + return ADAPTER_TYPES; + } + +} \ No newline at end of file diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeLocatorDelegate.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeLocatorDelegate.java new file mode 100644 index 00000000..468d3346 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeLocatorDelegate.java @@ -0,0 +1,146 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.internal; + +import fish.payara.eclipse.tools.server.PayaraRuntime; +import fish.payara.eclipse.tools.server.PayaraServerPlugin; +import fish.payara.eclipse.tools.server.utils.PayaraLocationUtils; +import java.io.File; +import java.util.HashMap; +import java.util.Map; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.wst.server.core.IRuntime; +import org.eclipse.wst.server.core.IRuntimeType; +import org.eclipse.wst.server.core.IRuntimeWorkingCopy; +import org.eclipse.wst.server.core.ServerCore; +import org.eclipse.wst.server.core.internal.ResourceManager; +import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy; +import org.eclipse.wst.server.core.model.RuntimeLocatorDelegate; + +@SuppressWarnings("restriction") +public final class PayaraRuntimeLocatorDelegate extends RuntimeLocatorDelegate { + + private static final IRuntimeType RUNTIME_TYPE = ServerCore.findRuntimeType("payara.runtime"); + + @Override + public void searchForRuntimes(IPath path, IRuntimeSearchListener listener, IProgressMonitor monitor) { + search(path.toFile(), listener, monitor); + } + + private void search(File file, IRuntimeSearchListener listener, IProgressMonitor monitor) { + if (monitor.isCanceled() || !file.isDirectory() || file.isHidden()) { + return; + } + + try { + IRuntime runtime = create(file); + if (runtime != null) { + IRuntimeWorkingCopy wc = runtime.createWorkingCopy(); + listener.runtimeFound(wc); + return; + } + } catch (CoreException e) { + PayaraServerPlugin.log(e); + return; + } + + File[] children = file.listFiles(); + + if (children != null) { + for (File child : children) { + search(child, listener, monitor); + } + } + } + + private static IRuntime create(File gfhome) throws CoreException { + PayaraLocationUtils install = PayaraLocationUtils.find(gfhome); + if ((install == null) || (findRuntime(gfhome) != null)) { + return null; + } + + String name = PayaraRuntime.createDefaultRuntimeName(install.version()); + + final IRuntimeWorkingCopy created = RUNTIME_TYPE.createRuntime(name, null); + created.setLocation(new Path(gfhome.getAbsolutePath())); + created.setName(name); + + final RuntimeWorkingCopy rwc = (RuntimeWorkingCopy) created; + + final Map<String, String> props = new HashMap<>(); + props.put("payara.rootdirectory", rwc.getLocation().toPortableString()); + rwc.setAttribute("generic_server_instance_properties", props); + + final PayaraRuntime gf = (PayaraRuntime) rwc.loadAdapter(PayaraRuntime.class, null); + +// final IPayaraRuntimeModel gfmodel = gf.getModel(); +// final Value<org.eclipse.sapphire.modeling.Path> javaRuntimeEnvironmentProperty = gfmodel +// .getJavaRuntimeEnvironment(); + +// if (javaRuntimeEnvironmentProperty.content() == null) { +// final Display display = Display.getDefault(); +// +// display.syncExec(new Runnable() { +// @Override +// public void run() { +// new SapphireDialog(display.getActiveShell(), gfmodel, +// DefinitionLoader.sdef(PayaraRuntimeLocatorDelegate.class).dialog()).open(); +// } +// }); +// +// if (javaRuntimeEnvironmentProperty.content() == null) { +// rwc.dispose(); +// return null; +// } else { +// // Force JVM definition to be created +// +// gf.getVMInstall(); +// +// // Clear the explicit JVM location as the DefaultValueService will now pick it +// // up +// +// javaRuntimeEnvironmentProperty.clear(); +// } +// } + + final IStatus validationResult = created.validate(null); + + if (validationResult.getSeverity() != IStatus.ERROR) { + created.save(true, null); + return created.getOriginal(); + } + + return null; + } + + private static IRuntime findRuntime(File location) { + for (IRuntime runtime : ResourceManager.getInstance().getRuntimes()) { + if (RUNTIME_TYPE == runtime.getRuntimeType() && location.equals(runtime.getLocation().toFile())) { + return runtime; + } + } + + return null; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeLocatorDelegate.sdef b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeLocatorDelegate.sdef new file mode 100644 index 00000000..d423b6c2 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeLocatorDelegate.sdef @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<definition> + <dialog> + <id>FindJavaDialog</id> + <label>Locate JDK for Payara</label> + <content> + <label>Payara has been detected. A compatible JDK is needed in order to define this runtime.</label> + <spacer></spacer> + <property-editor> + <hint> + <name>read.only</name> + <value>true</value> + </hint> + <property>ServerRoot</property> + </property-editor> + <property-editor>JavaRuntimeEnvironment</property-editor> + </content> + <width>400</width> + <initial-focus>JavaRuntimeEnvironment</initial-focus> + </dialog> +</definition> \ No newline at end of file diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/LogStyle.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/LogStyle.java new file mode 100644 index 00000000..9ca272ca --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/LogStyle.java @@ -0,0 +1,109 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.log; + +import static fish.payara.eclipse.tools.server.preferences.PreferenceConstants.ENABLE_COLORS_CONSOLE; + +import java.util.Arrays; +import java.util.logging.Level; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.LineStyleEvent; +import org.eclipse.swt.custom.LineStyleListener; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; + +import fish.payara.eclipse.tools.server.PayaraServerPlugin; + +public class LogStyle implements LineStyleListener, IPropertyChangeListener { + Display display = Display.getCurrent(); + + IPreferenceStore store = PayaraServerPlugin.getInstance().getPreferenceStore(); + boolean colorInConsole = store.getBoolean(ENABLE_COLORS_CONSOLE); + + // private IDocument document; + + public LogStyle(IDocument document) { + store.addPropertyChangeListener(this); + } + + @Override + public void lineGetStyle(LineStyleEvent event) { + StyleRange styleRange = null; + String buf = event.lineText; + int start; + + if (colorInConsole) { + if ((start = buf.indexOf(Level.WARNING.getName())) != -1) { + styleRange = new StyleRange(); + styleRange.start = event.lineOffset + start; + styleRange.length = 6; + styleRange.foreground = display.getSystemColor(SWT.COLOR_DARK_YELLOW); + } else if ((start = buf.indexOf(Level.SEVERE.getName())) != -1) { + // Makr severe error and exception stack trace as error color + styleRange = new StyleRange(); + String errorColorName = org.eclipse.jface.preference.JFacePreferences.ERROR_COLOR; + styleRange.foreground = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry() + .get(errorColorName); + styleRange.start = event.lineOffset + start; + styleRange.length = 5; + styleRange.fontStyle = SWT.BOLD; + } else if ((start = buf.indexOf("FATAL")) != -1) { + styleRange = new StyleRange(); + String errorColorName = org.eclipse.jface.preference.JFacePreferences.ERROR_COLOR; + styleRange.foreground = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry() + .get(errorColorName); + styleRange.start = event.lineOffset + start; + styleRange.length = 4; + styleRange.fontStyle = SWT.BOLD; + } + + if (styleRange != null) { + StyleRange[] styles; + if (event.styles != null) { + styles = Arrays.copyOf(event.styles, event.styles.length + 1); + } else { + styles = new StyleRange[1]; + } + styles[styles.length - 1] = styleRange; + + // Set the styles for the line + event.styles = styles; + } + } + } + + @Override + public void propertyChange(PropertyChangeEvent event) { + if (event.getProperty().equals(ENABLE_COLORS_CONSOLE)) { + colorInConsole = store.getBoolean(ENABLE_COLORS_CONSOLE); + } + } + + @Override + protected void finalize() throws Throwable { + store.removePropertyChangeListener(this); + super.finalize(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/PayaraConsoleTracker.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/PayaraConsoleTracker.java new file mode 100644 index 00000000..444c126f --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/PayaraConsoleTracker.java @@ -0,0 +1,58 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.log; + +import org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceHyperlink; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.ui.console.IHyperlink; +import org.eclipse.ui.console.IPatternMatchListenerDelegate; +import org.eclipse.ui.console.PatternMatchEvent; +import org.eclipse.ui.console.TextConsole; + +@SuppressWarnings("restriction") +public class PayaraConsoleTracker implements IPatternMatchListenerDelegate { + + /** + * The console associated with this line tracker + */ + private TextConsole payaraConsole; + + @Override + public void connect(TextConsole console) { + payaraConsole = console; + } + + @Override + public void disconnect() { + payaraConsole = null; + } + + @Override + public void matchFound(PatternMatchEvent event) { + try { + int offset = event.getOffset(); + int length = event.getLength(); + IHyperlink link = new JavaStackTraceHyperlink(payaraConsole); + payaraConsole.addHyperlink(link, offset + 1, length - 2); + } catch (BadLocationException e) { + // Ignore + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/PayaraLogPageParticipant.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/PayaraLogPageParticipant.java new file mode 100644 index 00000000..5dcd1189 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/PayaraLogPageParticipant.java @@ -0,0 +1,54 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.log; + +import org.eclipse.swt.custom.StyledText; +import org.eclipse.ui.console.IConsole; +import org.eclipse.ui.console.IConsolePageParticipant; +import org.eclipse.ui.console.TextConsole; +import org.eclipse.ui.part.IPageBookViewPage; + +public class PayaraLogPageParticipant implements IConsolePageParticipant { + + @Override + public void init(IPageBookViewPage page, IConsole console) { + if (page.getControl() instanceof StyledText) { + StyledText viewer = (StyledText) page.getControl(); + viewer.addLineStyleListener(new LogStyle(((TextConsole) console).getDocument())); + } + } + + @Override + public void activated() { + } + + @Override + public void deactivated() { + } + + @Override + public void dispose() { + } + + @Override + public <T> T getAdapter(Class<T> adapter) { + return null; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/preferences/GlassFishPreferencePage.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/preferences/GlassFishPreferencePage.java new file mode 100644 index 00000000..84f9d1ed --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/preferences/GlassFishPreferencePage.java @@ -0,0 +1,84 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.preferences; + +import static fish.payara.eclipse.tools.server.preferences.PreferenceConstants.ENABLE_COLORS_CONSOLE; +import static fish.payara.eclipse.tools.server.preferences.PreferenceConstants.ENABLE_LOG; +import static fish.payara.eclipse.tools.server.preferences.PreferenceConstants.ENABLE_START_VERBOSE; + +import org.eclipse.jface.preference.BooleanFieldEditor; +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +import fish.payara.eclipse.tools.server.PayaraServerPlugin; + +/** + * This class represents a preference page that is contributed to the Preferences dialog. By + * subclassing <samp>FieldEditorPreferencePage</samp>, we can use the field support built into JFace + * that allows us to create a page that is small and knows how to save, restore and apply itself. + * <p> + * This page is used to modify preferences only. They are stored in the preference store that + * belongs to the main plug-in class. That way, preferences can be accessed directly via the + * preference store. + * + * @author Ludovic Champenois + */ +public class GlassFishPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { + + public GlassFishPreferencePage() { + super(GRID); + setPreferenceStore(PayaraServerPlugin.getInstance().getPreferenceStore()); + setDescription("You can configure Payara Enterprise Server Plugin global preferences"); + } + + /** + * Creates the field editors. Field editors are abstractions of the common GUI blocks needed to + * manipulate various types of preferences. Each field editor knows how to save and restore itself. + */ + @Override + public void createFieldEditors() { + addField( + new BooleanFieldEditor( + ENABLE_LOG, + "&Enable Payara Plugin Log information in the IDE log file", + getFieldEditorParent())); + addField( + new BooleanFieldEditor( + ENABLE_START_VERBOSE, + "&Start Payara Server in verbose mode (the Eclipse console can be used)", + getFieldEditorParent())); + + addField( + new BooleanFieldEditor( + ENABLE_COLORS_CONSOLE, + "Enable colored rendering in the Payara Log Viewer", + getFieldEditorParent())); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) + */ + @Override + public void init(IWorkbench workbench) { + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/ClasspathContainerPage.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/ClasspathContainerPage.java new file mode 100644 index 00000000..a0fbb120 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/ClasspathContainerPage.java @@ -0,0 +1,130 @@ +/****************************************************************************** + * Copyright (c) 2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.properties; + +import static org.eclipse.swt.layout.GridData.FILL_BOTH; +import static org.eclipse.swt.layout.GridData.FILL_HORIZONTAL; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.jdt.core.IClasspathEntry; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.ui.wizards.IClasspathContainerPage; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; + +/** + * This class implements the properties that are shown when Payara is set as a target runtime for a project + * and the corresponding library container is right clicked and then <code>properties</code> are selected. + * + * <p> + * For instance in an Eclipse project that would typically be + * + * <p> + * <verbatim> + * <code> + * Project explorer - [project name] - Java Resources - Libraries - Payara System Libraries - (right click) - Properties + * </code> + * </verbatim> + * + * <p> + * The properties this dialog implements are the choice between the default libraries for a Payara version that are targeted + * at application developers, and all the available libraries in Payara. + * + * @author Arjan Tijms + * + */ +public class ClasspathContainerPage extends WizardPage implements IClasspathContainerPage { + private final static String PAGE_NAME = ClasspathContainerPage.class.getName(); + + private IClasspathEntry selection; + + public ClasspathContainerPage() { + super(PAGE_NAME); + } + + @Override + public void createControl(Composite parent) { + setTitle("Payara System Library"); + setDescription("Select system library variant for the project build path."); + setMessage("Select system library variant for the project build path."); + + Composite composite = newComposite(parent); + + SystemLibrariesVariantBlock libraryChoice = newLibraryChoiceBlock(composite, "System library variant"); + + libraryChoice.addPropertyChangeListener(event -> { + IStatus status = libraryChoice.getStatus(); + if (status.isOK()) { + setErrorMessage(null); + + IPath containerPath = + new Path( + selection.getPath() + .segments()[0]) + .append((String)event.getNewValue()); + + selection = JavaCore.newContainerEntry( + containerPath, + selection.getAccessRules(), + selection.getExtraAttributes(), + selection.isExported()); + } else { + setErrorMessage(status.getMessage()); + } + }); + + setControl(composite); + } + + SystemLibrariesVariantBlock newLibraryChoiceBlock(Composite parent, String title) { + SystemLibrariesVariantBlock libraryChoice = new SystemLibrariesVariantBlock(selection); + libraryChoice.setTitle(title); + libraryChoice.createControl(parent); + libraryChoice.getControl().setLayoutData(new GridData(FILL_HORIZONTAL)); + + return libraryChoice; + } + + public static Composite newComposite(Composite parent) { + return newComposite(parent, 1); + } + + public static Composite newComposite(Composite parent, int columns) { + Composite composite = new Composite(parent, NONE); + composite.setLayout(new GridLayout(columns, false)); + composite.setFont(parent.getFont()); + + GridData gridData = new GridData(FILL_BOTH); + gridData.horizontalSpan = 1; + composite.setLayoutData(gridData); + + return composite; + } + + @Override + public boolean finish() { + return true; + } + + @Override + public IClasspathEntry getSelection() { + return selection; + } + + @Override + public void setSelection(IClasspathEntry containerEntry) { + this.selection = containerEntry; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/ServerPropertyPage.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/ServerPropertyPage.java new file mode 100644 index 00000000..31575a74 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/ServerPropertyPage.java @@ -0,0 +1,383 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.properties; + +import static fish.payara.eclipse.tools.server.PayaraServer.ATTR_ADMIN; +import static fish.payara.eclipse.tools.server.PayaraServer.ATTR_ADMINPASS; +import static fish.payara.eclipse.tools.server.PayaraServer.ATTR_ADMINPORT; +import static fish.payara.eclipse.tools.server.PayaraServer.ATTR_DEBUG_PORT; +import static fish.payara.eclipse.tools.server.PayaraServer.ATTR_DOMAINPATH; +import static fish.payara.eclipse.tools.server.PayaraServer.ATTR_RESTART_PATTERN; +import static fish.payara.eclipse.tools.server.PayaraServer.getDefaultDomainDir; +import static fish.payara.eclipse.tools.server.utils.Jobs.scheduleShortJob; +import static fish.payara.eclipse.tools.server.utils.WtpUtil.load; +import static org.eclipse.wst.server.core.IServer.PUBLISH_CLEAN; +import static org.eclipse.wst.server.core.IServer.STATE_STOPPED; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; +import fish.payara.eclipse.tools.server.Status; +import fish.payara.eclipse.tools.server.Status.Severity; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Spinner; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.dialogs.PropertyPage; +import org.eclipse.wst.server.core.IServer; +import org.eclipse.wst.server.core.IServerWorkingCopy; +import org.eclipse.wst.server.ui.internal.editor.GlobalCommandManager; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; +import fish.payara.eclipse.tools.server.ui.wizards.GlassfishWizardResources; + +/** + * Properties that are being shown for the Payara / GlassFish server when e.g. the server is right + * clicked in the Servers view and "Properties" is chosen from the context menu. + * + */ +public class ServerPropertyPage extends PropertyPage { + + private IServerWorkingCopy serverWorkingCopy; + + protected Text serverName; + + protected Text serverHost; + + protected Text domainLocation; + + protected Text adminName; + + protected Text adminPassword; + + protected Text restartPattern; + + protected Spinner debugPort; + + protected Button keepSessions; + + protected Button jarDeploy; + + protected Button hotDeploy; + + protected Button attachDebuggerEarly; + + private PayaraServer payaraServer; + + public static int MAXIMUM_PORT = 999999; + + @Override + protected Control createContents(Composite parent) { + + IServer server = (IServer) getElement(); + if (server instanceof IServerWorkingCopy) { + serverWorkingCopy = (IServerWorkingCopy) server; + } else { + serverWorkingCopy = server.createWorkingCopy(); + } + + payaraServer = load(serverWorkingCopy, PayaraServer.class); + + Control control = createContent(payaraServer, parent); + refreshStatus(); + + return control; + + } + + public Composite createContent(PayaraServer payaraServer, Composite parent) { + + GridLayout layout = new GridLayout(1, true); + parent.setLayout(layout); + parent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Composite group = new Composite(parent, SWT.NONE); + layout = new GridLayout(); + layout.numColumns = 2; + layout.marginWidth = 0; + layout.marginHeight = 0; + group.setLayout(layout); + group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Label label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.serverName); + GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + serverName = new Text(group, SWT.BORDER); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + serverName.setLayoutData(data); + serverName.setText(payaraServer.getName()); + + label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.serverHost); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + serverHost = new Text(group, SWT.BORDER); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + serverHost.setLayoutData(data); + serverHost.setText(payaraServer.getHost()); + + label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.domainPath); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + + domainLocation = new Text(group, SWT.BORDER); + data = new GridData(GridData.FILL_HORIZONTAL); + domainLocation.setLayoutData(data); + domainLocation.setText(payaraServer.getDomainPath()); + + Button browse = new Button(group, SWT.PUSH); + browse.setText(GlassfishWizardResources.browse); + browse.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent se) { + DirectoryDialog dialog = new DirectoryDialog(parent.getShell()); + dialog.setMessage(GlassfishWizardResources.selectInstallDir); + String selectedDirectory = dialog.open(); + if (selectedDirectory != null && !selectedDirectory.isEmpty()) + domainLocation.setText(selectedDirectory); + } + }); + + Button createDomain = new Button(group, SWT.PUSH); + createDomain.setText(GlassfishWizardResources.newDomainCreateButton); + createDomain.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent se) { + +// PayaraRuntime runtime = (PayaraRuntime) getServerRuntime().loadAdapter(PayaraRuntime.class, null); +// CreatePayaraDomain domain = new CreatePayaraDomain(parent.getShell(), payaraServer, runtime); +// domain.open(); +// String selectedDirectory = domain.getPath(); +// if (selectedDirectory != null && !selectedDirectory.isEmpty()) { + domainLocation.setText(""); +// } + } + }); + + label = new Label(group, SWT.HORIZONTAL | SWT.SEPARATOR); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + data.verticalIndent = 10; + label.setLayoutData(data); + + label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.adminName); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + + adminName = new Text(group, SWT.BORDER); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + adminName.setLayoutData(data); + adminName.setText(payaraServer.getAdminUser()); + + label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.adminPassword); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + + adminPassword = new Text(group, SWT.BORDER | SWT.PASSWORD); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + adminPassword.setLayoutData(data); + adminPassword.setText(payaraServer.getAdminPassword()); + + label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.debugPort); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + + debugPort = new Spinner(group, SWT.BORDER); + debugPort.setMinimum(0); + debugPort.setMaximum(MAXIMUM_PORT); + debugPort.setTextLimit((Integer.toString(MAXIMUM_PORT)).length()); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + debugPort.setLayoutData(data); + debugPort.setSelection(payaraServer.getDebugPort()); + + label = new Label(group, SWT.HORIZONTAL | SWT.SEPARATOR); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + data.verticalIndent = 10; + label.setLayoutData(data); + + keepSessions = new Button(group, SWT.CHECK); + keepSessions.setText(GlassfishWizardResources.keepSessions); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + keepSessions.setLayoutData(data); + keepSessions.setSelection(payaraServer.getKeepSessions()); + + jarDeploy = new Button(group, SWT.CHECK); + jarDeploy.setText(GlassfishWizardResources.jarDeploy); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + jarDeploy.setLayoutData(data); + jarDeploy.setSelection(payaraServer.getJarDeploy()); + + label = new Label(group, SWT.HORIZONTAL | SWT.SEPARATOR); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + data.verticalIndent = 10; + label.setLayoutData(data); + + label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.restartPattern); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + + restartPattern = new Text(group, SWT.BORDER); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + restartPattern.setLayoutData(data); + restartPattern.setText(payaraServer.getRestartPattern()); + restartPattern.addModifyListener(e -> payaraServer.setRestartPattern(restartPattern.getText())); + + hotDeploy = new Button(group, SWT.CHECK); + hotDeploy.setText(GlassfishWizardResources.enableHotDeploy); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + hotDeploy.setLayoutData(data); + hotDeploy.setSelection(payaraServer.getHotDeploy()); + + attachDebuggerEarly = new Button(group, SWT.CHECK); + attachDebuggerEarly.setText(GlassfishWizardResources.attachDebugEarly); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + attachDebuggerEarly.setLayoutData(data); + attachDebuggerEarly.setSelection(payaraServer.getAttachDebuggerEarly()); + return group; + } + + + private void refreshStatus() { + Status status = validation(); + + if (status.severity() == Severity.ERROR) { + setMessage(status.message(), ERROR); + setValid(false); + } else if (status.severity() == Severity.WARNING) { + setMessage(status.message(), WARNING); + setValid(true); + } else { + setMessage(null, NONE); + setValid(true); + } + + } + + private Status validation() { + return Status.createOkStatus(); + } + + // note that this is currently not working due to issue 140 + // public void propertyChange(PropertyChangeEvent evt) { + // if (AbstractGlassfishServer.DOMAINUPDATE == evt.getPropertyName()) { + // username.setText(payaraServer.getAdminUser()); + // password.setText(payaraServer.getAdminPassword()); + // adminServerPortNumber.setText(Integer.toString(payaraServer.getAdminPort())); + // serverPortNumber.setText(Integer.toString(payaraServer.getPort())); + // } + // } + + + @Override + public boolean performCancel() { + return super.performCancel(); + } + + @Override + protected void performApply() { + try { + IServer server = serverWorkingCopy.save(true, new NullProgressMonitor()); + GlobalCommandManager.getInstance().reload(server.getId()); + + serverWorkingCopy.setName(serverName.getText()); + serverWorkingCopy.setHost(serverHost.getText()); + payaraServer.setDomainPath(domainLocation.getText()); + payaraServer.setAdminUser(adminName.getText()); + payaraServer.setAdminPassword(adminPassword.getText()); + payaraServer.setDebugPort(debugPort.getSelection()); + payaraServer.setKeepSessions(keepSessions.getSelection()); + payaraServer.setJarDeploy(jarDeploy.getSelection()); + payaraServer.setRestartPattern(restartPattern.getText()); + payaraServer.setHotDeploy(hotDeploy.getSelection()); + payaraServer.setAttachDebuggerEarly(attachDebuggerEarly.getSelection()); + + scheduleShortJob("Update Payara server state", monitor -> { + + PayaraServerBehaviour serverBehavior = null; + + try { + serverBehavior = load(server, PayaraServerBehaviour.class); + serverBehavior.updateServerStatus(); + serverBehavior.setPayaraServerPublishState(PUBLISH_CLEAN); + } catch (Exception e) { + if (serverBehavior != null) { + serverBehavior.setPayaraServerState(STATE_STOPPED); + } + } + }); + } catch (CoreException e) { + // no-op + e.printStackTrace(); + } + } + + @Override + public boolean performOk() { + performApply(); + return true; + } + + @Override + protected void performDefaults() { + super.performDefaults(); + + serverWorkingCopy.setAttribute(ATTR_ADMIN, ""); + serverWorkingCopy.setAttribute(ATTR_ADMINPASS, ""); + serverWorkingCopy.setAttribute(ATTR_DOMAINPATH, getDefaultDomainDir(serverWorkingCopy.getRuntime().getLocation()).toString()); + serverWorkingCopy.setAttribute(ATTR_ADMINPORT, ""); + serverWorkingCopy.setAttribute(ATTR_DEBUG_PORT, ""); + serverWorkingCopy.setAttribute(ATTR_RESTART_PATTERN, ""); + +// model.refresh(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/SystemLibrariesVariantBlock.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/SystemLibrariesVariantBlock.java new file mode 100644 index 00000000..94d1c827 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/SystemLibrariesVariantBlock.java @@ -0,0 +1,186 @@ +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.properties; + +import static fish.payara.eclipse.tools.server.ui.properties.ClasspathContainerPage.newComposite; +import static fish.payara.eclipse.tools.server.utils.PayaraLocationUtils.ALL_LIBRARIES; +import static fish.payara.eclipse.tools.server.utils.PayaraLocationUtils.DEFAULT_LIBRARIES; +import static java.lang.Math.max; +import static org.eclipse.jface.dialogs.IDialogConstants.BUTTON_WIDTH; +import static org.eclipse.swt.SWT.DEFAULT; +import static org.eclipse.swt.SWT.NONE; +import static org.eclipse.swt.SWT.RADIO; +import static org.eclipse.swt.layout.GridData.BEGINNING; +import static org.eclipse.swt.layout.GridData.FILL; +import static org.eclipse.swt.layout.GridData.FILL_HORIZONTAL; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.ListenerList; +import org.eclipse.core.runtime.Status; +import org.eclipse.jdt.core.IClasspathEntry; +import org.eclipse.jface.layout.PixelConverter; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; + +/** + * This class implements the visual radio buttons on the properties page for {@link ClasspathContainerPage}. + * + * @author Arjan Tijms + */ +public class SystemLibrariesVariantBlock { + + private Composite control; + private final ListenerList<IPropertyChangeListener> changeListeners = new ListenerList<>(); + + private IClasspathEntry selection; + private String title; + + private Button defaultButton; + private Button allButton; + + private IStatus status = OK_STATUS; + private static IStatus OK_STATUS = new Status(IStatus.OK, "SystemLibrariesVariantBlock", 0, "", null); + + public SystemLibrariesVariantBlock(IClasspathEntry selection) { + this.selection = selection; + } + + /** + * Creates this block's control in the given control. + * + * @param anscestor containing control + */ + public void createControl(Composite ancestor) { + control = newComposite(ancestor); + + Composite composite = newComposite(newGroup(control, title), 3); + createDefaultButton(composite, 3); + createAllButton(composite, 3); + + IPath containerPath = selection.getPath(); + String libraryGroup = DEFAULT_LIBRARIES; + if (containerPath.segmentCount() > 1) { + libraryGroup = containerPath.segment(1); + } + + if (DEFAULT_LIBRARIES.equals(libraryGroup)) { + defaultButton.setSelection(true); + } else { + allButton.setSelection(true); + } + } + + public void addPropertyChangeListener(IPropertyChangeListener listener) { + changeListeners.add(listener); + } + + public void removePropertyChangeListener(IPropertyChangeListener listener) { + changeListeners.remove(listener); + } + + public Control getControl() { + return control; + } + + public void setTitle(String title) { + this.title = title; + } + + public String selection() { + if (defaultButton.getSelection()) { + return DEFAULT_LIBRARIES; + } + + return ALL_LIBRARIES; + } + + public IStatus getStatus() { + return status; + } + + private void setStatus(IStatus status) { + this.status = status; + } + + private void createDefaultButton(Composite composite, int horizontalSpan) { + defaultButton = createRadioButton(composite, "Libraries for current version", horizontalSpan); + defaultButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (defaultButton.getSelection()) { + setStatus(OK_STATUS); + firePropertyChange(); + } + } + }); + } + + private void createAllButton(Composite composite, int horizontalSpan) { + allButton = createRadioButton(composite, "All libraries in entire server", horizontalSpan); + allButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (allButton.getSelection()) { + setStatus(OK_STATUS); + firePropertyChange(); + } + } + }); + } + + private void firePropertyChange() { + PropertyChangeEvent event = new PropertyChangeEvent(this, "Payara library selection", null, selection()); + for (IPropertyChangeListener listener : changeListeners) { + listener.propertyChange(event); + } + } + + private static Group newGroup(Composite parent, String text) { + Group group = new Group(parent, NONE); + group.setLayout(new GridLayout(1, false)); + group.setText(text); + group.setFont(parent.getFont()); + + GridData gridData = new GridData(FILL_HORIZONTAL); + gridData.horizontalSpan = 1; + group.setLayoutData(gridData); + + return group; + } + + private static Button createRadioButton(Composite parent, String label, int horizontalSpan) { + Button button = new Button(parent, RADIO); + button.setFont(parent.getFont()); + button.setText(label); + + GridData gridData = new GridData(BEGINNING); + gridData.horizontalSpan = 3; + gridData.horizontalAlignment = FILL; + gridData.widthHint= computeWidth(button); + button.setLayoutData(gridData); + + return button; + } + + private static int computeWidth(Button button) { + return max( + new PixelConverter(button).convertHorizontalDLUsToPixels(BUTTON_WIDTH), + button.computeSize(DEFAULT, DEFAULT, true).x); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/DriverMaps.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/DriverMaps.java new file mode 100644 index 00000000..9fbccc5f --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/DriverMaps.java @@ -0,0 +1,363 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.resources; + +import java.util.HashMap; +import java.util.Map; + +/** + * From DatabaseUtils in the V2 plugin + * + * XXX This primarily code does linear searchs through map keys because of extra logic on key + * comparisons. Find a way to use the maps properly. + * + * NOTE: This is a copy of the file used in the NB V3 plugin, though it's in a different package + * there (org.netbeans.modules.glassfish.javaee.db). + * + * @author Nitya Doraisamy + * @author Peter Williams + */ +public class DriverMaps { + + private static final int INITIAL_MAP_SIZE = 107; + + private static Map<String, String> driverMap; + private static Map<String, String> dsClassMap; + private static Map<String, String> cpClassMap; + + private DriverMaps() { + } + + /** + * Returns the driver name for the given url + * + * @param url url of this connection + * @return driver name required + */ + public static final String getDriverName(String url) { + return getValueForUrl(driverMap, url); + } + + /** + * Returns driver class name for the given url + * + * @param url url of this connection + * @return driver class name required + */ + public static final String getDSClassName(String url) { + return getValueForUrl(dsClassMap, url); + } + + private static final String getValueForUrl(Map<String, String> mapping, String url) { + for (final Map.Entry<String, String> entry : mapping.entrySet()) { + final String urlPrefix = entry.getKey(); + if (url.startsWith(urlPrefix)) { + return entry.getValue(); + } + } + return null; + } + + /** + * Gets the URL prefix fiven a Datasource Classname + * + * @param inClass Datasource Classname + * @return URL prefix for given Datasource Classname + */ + public static final String getUrlPrefix(String inClass, String resType) { + return resType.equals("javax.sql.ConnectionPoolDataSource") ? getPrefix(cpClassMap, inClass) : getPrefix(dsClassMap, inClass); + } + + private static final String getPrefix(Map<String, String> classMap, String inClass) { + for (final Map.Entry<String, String> entry : classMap.entrySet()) { + final String urlPrefix = entry.getKey(); + final String dsClass = entry.getValue(); + if (dsClass.equalsIgnoreCase(inClass)) { + return urlPrefix; + } + } + return null; + } + + static { + driverMap = new HashMap<>(INITIAL_MAP_SIZE); + + // IBM DB2 + driverMap.put("jdbc:db2:", "COM.ibm.db2.jdbc.net.DB2Driver"); + // JDBC-ODBC Bridge + driverMap.put("jdbc:odbc:", "sun.jdbc.odbc.JdbcOdbcDriver"); + // Microsoft SQL Server (Weblogic driver) + driverMap.put("jdbc:weblogic:mssqlserver4:", "weblogic.jdbc.mssqlserver4.Driver"); + + // Oracle-thin + driverMap.put("jdbc:oracle:thin:", "oracle.jdbc.driver.OracleDriver"); + // Oracle //OCI 8i + driverMap.put("jdbc:oracle:oci8:", "oracle.jdbc.driver.OracleDriver"); + // Oracle //OCI 9i + driverMap.put("jdbc:oracle:oci:", "oracle.jdbc.driver.OracleDriver"); + + // PointBase + driverMap.put("jdbc:pointbase:", "com.pointbase.jdbc.jdbcUniversalDriver"); + // Cloudscape + driverMap.put("jdbc:cloudscape:", "COM.cloudscape.core.JDBCDriver"); + // Java DB (Net) + driverMap.put("jdbc:derby:", "org.apache.derby.jdbc.ClientDriver"); + // Firebird (JCA/JDBC driver) + driverMap.put("jdbc:firebirdsql:", "org.firebirdsql.jdbc.FBDriver"); + // FirstSQL/J //Enterprise Server Edition + driverMap.put("jdbc:dbcp:", "COM.FirstSQL.Dbcp.DbcpDriver"); + // FirstSQL/J //Professional Edition + driverMap.put("jdbc:dbcp:", "COM.FirstSQL.Dbcp.DbcpDriver"); + + // IBM DB2 (DataDirect Connect for JDBC) + driverMap.put("jdbc:datadirect:db2:", "com.ddtek.jdbc.db2.DB2Driver"); + // Informix Dynamic Server (DataDirect Connect for JDBC) + driverMap.put("jdbc:datadirect:informix:", "com.ddtek.jdbc.informix.InformixDriver"); + // Oracle (DataDirect Connect for JDBC) + driverMap.put("jdbc:datadirect:oracle:", "com.ddtek.jdbc.oracle.OracleDriver"); + // Microsoft SQL Server (DataDirect Connect for JDBC) + driverMap.put("jdbc:datadirect:sqlserver:", "com.ddtek.jdbc.sqlserver.SQLServerDriver"); + // Sybase (DataDirect Connect for JDBC) + driverMap.put("jdbc:datadirect:sybase:", "com.ddtek.jdbc.sybase.SybaseDriver"); + + // IDS Server + driverMap.put("jdbc:ids:", "ids.sql.IDSDriver"); + // Informix Dynamic Server + driverMap.put("jdbc:informix-sqli:", "com.informix.jdbc.IfxDriver"); + // InstantDB (v3.13 and earlier) + driverMap.put("jdbc:idb:", "jdbc.idbDriver"); + // InstantDB (v3.14 and later) + driverMap.put("jdbc:idb:", "org.enhydra.instantdb.jdbc.idbDriver"); + // Interbase (InterClient driver) + driverMap.put("jdbc:interbase:", "interbase.interclient.Driver"); + // HSQLDB //(server) + driverMap.put("jdbc:hsqldb:hsql:", "org.hsqldb.jdbcDriver"); + // HSQLDB //(webserver) + driverMap.put("jdbc:hsqldb:http:", "org.hsqldb.jdbcDriver"); + // Hypersonic SQL (v1.2 and earlier) + driverMap.put("jdbc:HypersonicSQL:", "hSql.hDriver"); + // Hypersonic SQL (v1.3 and later) + driverMap.put("jdbc:HypersonicSQL:", "org.hsql.jdbcDriver"); + // jTDS + driverMap.put("jdbc:jtds:sqlserver:", "net.sourceforge.jtds.jdbc.Driver"); + // jTDS + driverMap.put("jdbc:jtds:sybase:", "net.sourceforge.jtds.jdbc.Driver"); + // Mckoi SQL Database //(server) + driverMap.put("jdbc:mckoi:", "com.mckoi.JDBCDriver"); + // Mckoi SQL Database //(standalone) + driverMap.put("jdbc:mckoi:local:", "com.mckoi.JDBCDriver"); + // Microsoft SQL Server (JTurbo driver) + driverMap.put("jdbc:JTurbo:", "com.ashna.jturbo.driver.Driver"); + // Microsoft SQL Server (JTurbo driver 3.0) + // driverMap.put("jdbc:JTurbo:", "com.newatlanta.jturbo.driver.Driver"); + // Microsoft SQL Server (Sprinta driver) + driverMap.put("jdbc:inetdae:", "com.inet.tds.TdsDriver"); + // Microsoft SQL Server 2005 (Microsoft driver) + // driverMap.put("jdbc:microsoft:sqlserver:", "com.microsoft.jdbc.sqlserver.SQLServerDriver"); + driverMap.put("jdbc:sqlserver:", "com.microsoft.sqlserver.jdbc.SQLServerDriver"); // NOI18N + // MySQL (Connector/J driver) + driverMap.put("jdbc:mysql:", "com.mysql.jdbc.Driver"); + // MySQL (MM.MySQL driver) + // driverMap.put("jdbc:mysql:", "org.gjt.mm.mysql.Driver"); + + // PostgreSQL (v6.5 and earlier) + // driverMap.put("jdbc:postgresql:", "postgresql.Driver"); + // PostgreSQL (v7.0 and later) + driverMap.put("jdbc:postgresql:", "org.postgresql.Driver"); + // Quadcap Embeddable Database + driverMap.put("jdbc:qed:", "com.quadcap.jdbc.JdbcDriver"); + // Sybase (jConnect 4.2 and earlier) + // driverMap.put("jdbc:sybase:Tds:", "com.sybase.jdbc.SybDriver"); + // Sybase (jConnect 5.2) + driverMap.put("jdbc:sybase:Tds:", "com.sybase.jdbc2.jdbc.SybDriver"); + + // Following four entries for drivers to be included in Java Studio Enterprise 7 (Bow) + // Microsoft SQL Server Driver + driverMap.put("jdbc:sun:sqlserver:", "com.sun.sql.jdbc.sqlserver.SQLServerDriver"); + // DB2 Driver + driverMap.put("jdbc:sun:db2:", "com.sun.sql.jdbc.db2.DB2Driver"); + // Oracle Driver + driverMap.put("jdbc:sun:oracle:", "com.sun.sql.jdbc.oracle.OracleDriver"); + // Sybase Driver + driverMap.put("jdbc:sun:sybase:", "com.sun.sql.jdbc.sybase.SybaseDriver"); + + // AS400 Driver + driverMap.put("jdbc:as400:", "com.ibm.as400.access.AS400JDBCDriver"); + } + + static { + dsClassMap = new HashMap<>(INITIAL_MAP_SIZE); + + // IBM DB2 + dsClassMap.put("jdbc:db2:", "com.ibm.db2.jcc.DB2DataSource"); + // JDBC-ODBC Bridge + dsClassMap.put("jdbc:odbc:", "sun.jdbc.odbc.JdbcOdbcDriver"); + // Microsoft SQL Server (Weblogic driver) + // dsClassMap.put("jdbc:weblogic:mssqlserver4:", "weblogic.jdbc.mssqlserver4.Driver"); + + // Oracle-thin + dsClassMap.put("jdbc:oracle:thin:", "oracle.jdbc.pool.OracleDataSource"); + // Oracle //OCI 8i + dsClassMap.put("jdbc:oracle:oci8:", "oracle.jdbc.pool.OracleDataSource"); + // Oracle //OCI 9i + dsClassMap.put("jdbc:oracle:oci:", "oracle.jdbc.pool.OracleDataSource"); + + // PointBase + dsClassMap.put("jdbc:pointbase:", "com.pointbase.jdbc.jdbcDataSource"); + // Cloudscape + dsClassMap.put("jdbc:cloudscape:", "com.cloudscape.core.BasicDataSource"); + // Java DB (Net) + dsClassMap.put("jdbc:derby:", "org.apache.derby.jdbc.ClientDataSource"); + // Firebird (JCA/JDBC driver) + // dsClassMap.put("jdbc:firebirdsql:", "org.firebirdsql.jdbc.FBDriver"); + // FirstSQL/J //Enterprise Server Edition + // dsClassMap.put("jdbc:dbcp:", "COM.FirstSQL.Dbcp.DbcpDriver"); + // FirstSQL/J //Professional Edition + // dsClassMap.put("jdbc:dbcp:", "COM.FirstSQL.Dbcp.DbcpDriver"); + + // IBM DB2 (DataDirect Connect for JDBC) + dsClassMap.put("jdbc:datadirect:db2:", "com.ddtek.jdbcx.db2.DB2DataSource"); + // Informix Dynamic Server (DataDirect Connect for JDBC) + dsClassMap.put("jdbc:datadirect:informix:", "com.ddtek.jdbcx.informix.InformixDataSource"); + // Oracle (DataDirect Connect for JDBC) + dsClassMap.put("jdbc:datadirect:oracle:", "com.ddtek.jdbcx.oracle.OracleDataSource"); + // Microsoft SQL Server (DataDirect Connect for JDBC) + dsClassMap.put("jdbc:datadirect:sqlserver:", "com.ddtek.jdbcx.sqlserver.SQLServerDataSource"); + // Sybase (DataDirect Connect for JDBC) + dsClassMap.put("jdbc:datadirect:sybase:", "com.ddtek.jdbcx.sybase.SybaseDataSource"); + + // IDS Server + dsClassMap.put("jdbc:ids:", "ids.sql.IDSDriver"); + // Informix Dynamic Server + dsClassMap.put("jdbc:informix-sqli:", "com.informix.jdbcx.IfxDataSource"); + // InstantDB (v3.13 and earlier) + // dsClassMap.put("jdbc:idb:", "jdbc.idbDriver"); + // InstantDB (v3.14 and later) + // dsClassMap.put("jdbc:idb:", "org.enhydra.instantdb.jdbc.idbDriver"); + // Interbase (InterClient driver) + // dsClassMap.put("jdbc:interbase:", "interbase.interclient.Driver"); + // HSQLDB //(server) + // dsClassMap.put("jdbc:hsqldb:hsql:", "org.hsqldb.jdbcDriver"); + // HSQLDB //(webserver) + // dsClassMap.put("jdbc:hsqldb:http:", "org.hsqldb.jdbcDriver"); + // Hypersonic SQL (v1.2 and earlier) + // dsClassMap.put("jdbc:HypersonicSQL:", "hSql.hDriver"); + // Hypersonic SQL (v1.3 and later) + // dsClassMap.put("jdbc:HypersonicSQL:", "org.hsql.jdbcDriver"); + // jTDS + dsClassMap.put("jdbc:jtds:sqlserver:", "net.sourceforge.jtds.jdbcx.JtdsDataSource"); + // jTDS + dsClassMap.put("jdbc:jtds:sybase:", "net.sourceforge.jtds.jdbcx.JtdsDataSource"); + // Mckoi SQL Database //(server) + // dsClassMap.put("jdbc:mckoi:", "com.mckoi.JDBCDriver"); + // Mckoi SQL Database //(standalone) + // dsClassMap.put("jdbc:mckoi:local:", "com.mckoi.JDBCDriver"); + // Microsoft SQL Server (JTurbo driver old version) + // dsClassMap.put("jdbc:JTurbo:", "com.ashna.jturbo.driver.DataSource"); + // Microsoft SQL Server (JTurbo driver 3.0) + dsClassMap.put("jdbc:JTurbo:", "com.newatlanta.jturbo.driver.DataSource"); + // Microsoft SQL Server (Sprinta driver) + dsClassMap.put("jdbc:inetdae:", "com.inet.tds.TdsDataSource"); + // Microsoft SQL Server 2005 (Microsoft driver) + // dsClassMap.put("jdbc:microsoft:sqlserver:", "com.microsoft.jdbc.sqlserver.SQLServerDataSource"); + dsClassMap.put("jdbc:sqlserver:", "com.microsoft.sqlserver.jdbc.SQLServerDataSource"); // NOI18N + // MySQL (Connector/J driver) + // dsClassMap.put("jdbc:mysql:", "com.mysql.jdbc.Driver"); + // MySQL (MM.MySQL driver) + dsClassMap.put("jdbc:mysql:", "com.mysql.jdbc.jdbc2.optional.MysqlDataSource"); + + // PostgreSQL (v6.5 and earlier) + // dsClassMap.put("jdbc:postgresql:", "postgresql.Driver"); + // PostgreSQL (v7.0 and later) + dsClassMap.put("jdbc:postgresql:", "org.postgresql.ds.PGSimpleDataSource"); + // Quadcap Embeddable Database + // dsClassMap.put("jdbc:qed:", "com.quadcap.jdbc.JdbcDriver"); + // Sybase (jConnect 4.2 and earlier) + // dsClassMap.put("jdbc:sybase:Tds:", "com.sybase.jdbc.SybDriver"); + // Sybase (jConnect 5.2) + dsClassMap.put("jdbc:sybase:Tds:", "com.sybase.jdbc2.jdbc.SybDataSource"); + + // Following four entries for drivers to be included in Java Studio Enterprise 7 (Bow) + // Microsoft SQL Server Driver + dsClassMap.put("jdbc:sun:sqlserver:", "com.sun.sql.jdbcx.sqlserver.SQLServerDataSource"); + // DB2 Driver + dsClassMap.put("jdbc:sun:db2:", "com.sun.sql.jdbcx.db2.DB2DataSource"); + // Oracle Driver + dsClassMap.put("jdbc:sun:oracle:", "com.sun.sql.jdbcx.oracle.OracleDataSource"); + // Sybase + dsClassMap.put("jdbc:sun:sybase:", "com.sun.sql.jdbcx.sybase.SybaseDataSource"); + + // AS400 + dsClassMap.put("jdbc:as400:", "com.ibm.as400.access.AS400JDBCDataSource"); + } + + static { + cpClassMap = new HashMap<>(INITIAL_MAP_SIZE); + // Java DB (Net) + cpClassMap.put("jdbc:derby:", "org.apache.derby.jdbc.ClientConnectionPoolDataSource"); + // DB2 Driver + cpClassMap.put("jdbc:sun:db2:", "com.sun.sql.jdbcx.db2.DB2DataSource"); + // Microsoft SQL Server Driver + cpClassMap.put("jdbc:sun:sqlserver:", "com.sun.sql.jdbcx.sqlserver.SQLServerDataSource"); + // Oracle Driver + cpClassMap.put("jdbc:sun:oracle:", "com.sun.sql.jdbcx.oracle.OracleDataSource"); + // Sybase Driver + cpClassMap.put("jdbc:sun:sybase:", "com.sun.sql.jdbcx.sybase.SybaseDataSource"); + // PostgreSQL (v7.0 and later) + cpClassMap.put("jdbc:postgresql:", "org.postgresql.ds.PGConnectionPoolDataSource"); + // Microsoft SQL Server 2000 (Microsoft driver) + cpClassMap.put("jdbc:sqlserver:", "com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource"); + // jTDS + cpClassMap.put("jdbc:jtds:sqlserver:", "net.sourceforge.jtds.jdbcx.JtdsDataSource"); + // jTDS + cpClassMap.put("jdbc:jtds:sybase:", "net.sourceforge.jtds.jdbcx.JtdsDataSource"); + // Oracle //OCI 8i + cpClassMap.put("jdbc:oracle:oci8:", "oracle.jdbc.pool.OracleConnectionPoolDataSource"); + // Oracle-thin + cpClassMap.put("jdbc:oracle:thin:", "oracle.jdbc.pool.OracleConnectionPoolDataSource"); + // IBM DB2 + cpClassMap.put("jdbc:db2:", "com.ibm.db2.jcc.DB2ConnectionPoolDataSource"); + // Microsoft SQL Server (DataDirect Connect for JDBC) + cpClassMap.put("jdbc:datadirect:sqlserver:", "com.ddtek.jdbcx.sqlserver.SQLServerDataSource"); + // Oracle (DataDirect Connect for JDBC) + cpClassMap.put("jdbc:datadirect:oracle:", "com.ddtek.jdbcx.oracle.OracleDataSource"); + // IBM DB2 (DataDirect Connect for JDBC) + cpClassMap.put("jdbc:datadirect:db2:", "com.ddtek.jdbcx.db2.DB2DataSource"); + // Informix Dynamic Server (DataDirect Connect for JDBC) + cpClassMap.put("jdbc:datadirect:informix:", "com.ddtek.jdbcx.informix.InformixDataSource"); + // Sybase (DataDirect Connect for JDBC) + cpClassMap.put("jdbc:datadirect:sybase:", "com.ddtek.jdbcx.sybase.SybaseDataSource"); + // Sybase (jConnect 5.2) + cpClassMap.put("jdbc:sybase:Tds:", "com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource"); + // PointBase + cpClassMap.put("jdbc:pointbase:", "com.pointbase.jdbc.jdbcDataSource"); + // Cloudscape + cpClassMap.put("jdbc:cloudscape:", "COM.cloudscape.core.LocalConnectionPoolDataSource"); + // Informix Dynamic Server + cpClassMap.put("jdbc:informix-sqli:", "com.informix.jdbcx.IfxConnectionPoolDataSource"); + // MySQL (MM.MySQL driver) + cpClassMap.put("jdbc:mysql:", "com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"); + // JDBC-ODBC Bridge + cpClassMap.put("jdbc:odbc:", "sun.jdbc.odbc.JdbcOdbcDriver"); + + // AS400 + cpClassMap.put("jdbc:as400:", "com.ibm.as400.access.AS400JDBCConnectionPoolDataSource"); + + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/JDBCInfo.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/JDBCInfo.java new file mode 100644 index 00000000..a8edab05 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/JDBCInfo.java @@ -0,0 +1,84 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.resources; + +import org.eclipse.datatools.connectivity.IConnectionProfile; +import org.eclipse.datatools.connectivity.drivers.jdbc.IJDBCDriverDefinitionConstants; + +public class JDBCInfo { + private IConnectionProfile connectionProfile; + private UrlData urlDataParser; + + /** + * Constructor for JDBCInfo. + * + * @param profile + */ + public JDBCInfo(IConnectionProfile profile) { + connectionProfile = profile; + urlDataParser = new UrlData(getURL()); + } + + private String getProperty(String propName) { + if (connectionProfile != null) { + return connectionProfile.getBaseProperties().getProperty(propName); + } + return null; + } + + public String getUserName() { + return getProperty(IJDBCDriverDefinitionConstants.USERNAME_PROP_ID); + } + + public String getUserPassword() { + return getProperty(IJDBCDriverDefinitionConstants.PASSWORD_PROP_ID); + } + + public String getURL() { + return getProperty(IJDBCDriverDefinitionConstants.URL_PROP_ID); + } + + public String getDriverClass() { + return getProperty(IJDBCDriverDefinitionConstants.DRIVER_CLASS_PROP_ID); + } + + public String getDatasourceClass() { + return DriverMaps.getDSClassName(getURL()); + } + + public String getDatabaseVendor() { + return getProperty(IJDBCDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID); + } + + public String getPort() { + return urlDataParser.getPort(); + } + + public String getServerName() { + return urlDataParser.getHostName(); + } + + public String getDatabaseName() { + return getProperty(IJDBCDriverDefinitionConstants.DATABASE_NAME_PROP_ID); + } + + public String getAlternateDatabaseName() { + return urlDataParser.getAlternateDBName(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/JMSInfo.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/JMSInfo.java new file mode 100644 index 00000000..fddc8a64 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/JMSInfo.java @@ -0,0 +1,81 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.resources; + +/** + * @author Nitya Doraisamy + * + */ +public class JMSInfo { + + public static final String QUEUE = "javax.jms.Queue"; //$NON-NLS-1$ + public static final String TOPIC = "javax.jms.Topic"; //$NON-NLS-1$ + public static final String QUEUE_CONNECTION = "javax.jms.QueueConnectionFactory"; //$NON-NLS-1$ + public static final String TOPIC_CONNECTION = "javax.jms.TopicConnectionFactory"; //$NON-NLS-1$ + public static final String CONNECTION_FACTORY = "javax.jms.ConnectionFactory"; //$NON-NLS-1$ + + private String jndiName; + private String resourceType; + private boolean isConnector; + + public JMSInfo() { + + } + + /** + * @param jndiName the jndiName to set + */ + public void setJndiName(String jndiName) { + this.jndiName = jndiName; + } + + /** + * @return the jndiName + */ + public String getJndiName() { + return jndiName; + } + + /** + * @param resourceType the resourceType to set + */ + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + /** + * @return the resourceType + */ + public String getResourceType() { + return resourceType; + } + + /** + * @return the isConnector + */ + public boolean isConnector() { + if (resourceType.equals(QUEUE) || resourceType.equals(QUEUE)) { + isConnector = false; + } else { + isConnector = true; + } + return isConnector; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/MailInfo.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/MailInfo.java new file mode 100644 index 00000000..4677468c --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/MailInfo.java @@ -0,0 +1,88 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.resources; + +public class MailInfo { + + private String jndiName; + private String mailHost; + private String mailFrom; + private String mailUser; + + public MailInfo() { + + } + + /** + * @param jndiName the jndiName to set + */ + public void setJndiName(String jndiName) { + this.jndiName = jndiName; + } + + /** + * @return the jndiName + */ + public String getJndiName() { + return jndiName; + } + + /** + * @param mailHost the mailHost to set + */ + public void setMailHost(String mailHost) { + this.mailHost = mailHost; + } + + /** + * @return the mailHost + */ + public String getMailHost() { + return mailHost; + } + + /** + * @param mailFrom the mailFrom to set + */ + public void setMailFrom(String mailFrom) { + this.mailFrom = mailFrom; + } + + /** + * @return the mailFrom + */ + public String getMailFrom() { + return mailFrom; + } + + /** + * @param mailUser the mailUser to set + */ + public void setMailUser(String mailUser) { + this.mailUser = mailUser; + } + + /** + * @return the mailUser + */ + public String getMailUser() { + return mailUser; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/UrlData.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/UrlData.java new file mode 100644 index 00000000..f44f8d96 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/UrlData.java @@ -0,0 +1,261 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.resources; + +import java.util.Collections; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * For converting NetBeans DB Urls to their component parts or back. NOTE: This is a copy of the + * file used in the NB V3 plugin, though it's in a different package there + * (org.netbeans.modules.glassfish.eecommon.api). + * + * @author Peter Williams + */ +public class UrlData { + + // Replaced Unicode safe character classes with ASCII equivalents to + // avoid JDK bug 5088563, for which a fix is not available on Mac as of + // this writing - !PW 7/31/08 + private static String DBURL_PATTERN = "((?:[^:\\n]+:){2,3})" + // prefix (mandatory) + "(?://|@|([^ \\t]+)@)" + // alternate db name (optional) + "([^:;/\\\\ \\t]+)" + // hostname (mandatory) + "(?:\\\\([^ \\t:/;]+)|)" + // instance name (optional) + "(?::([0-9]+)|)" + // port (optional) + "(?:(?:/|:)([^:/;?&]+)|)((?:(?:;|\\?|&|:)" + // database (optional) + "(?:[^;&]+)|)+)"; // delimited properties (optional) + + // Indices for regular expression match capture blocks + private static final int DB_PREFIX = 0; + private static final int DB_ALT_DBNAME = 1; + private static final int DB_HOST = 2; + private static final int DB_INSTANCE_NAME = 3; + private static final int DB_PORT = 4; + private static final int DB_PRIMARY_DBNAME = 5; + private static final int DB_PROPERTIES = 6; + private static final int NUM_PARTS = 7; + + private static Pattern urlPattern = Pattern.compile(DBURL_PATTERN); + + private final String url; + private final String[] parts = new String[NUM_PARTS]; + private final Map<String, String> props = new LinkedHashMap<>(); + + public UrlData(String newUrl) { + url = newUrl; + parseUrl(); + } + + public UrlData(final String prefix, final String host, final String port, + final String dbname, String sid) { + this(prefix, host, port, dbname, null, null, parseProperties(sid)); + } + + public UrlData(final String prefix, final String host, final String port, + final String dbname, Map<String, String> properties) { + this(prefix, host, port, dbname, null, null, properties); + } + + public UrlData(final String prefix, final String host, final String port, + final String dbname, final String altdbname, final String instancename, + Map<String, String> properties) { + + parts[DB_PREFIX] = prefix; + parts[DB_ALT_DBNAME] = altdbname; + parts[DB_HOST] = host; + parts[DB_INSTANCE_NAME] = instancename; + parts[DB_PORT] = port; + parts[DB_PRIMARY_DBNAME] = dbname; + parts[DB_PROPERTIES] = null; // reconstruct? + props.putAll(properties); + url = constructUrl(); + } + + private void parseUrl() { + Logger.getLogger("glassfish.javaee").log(Level.FINEST, "Parsing DB Url: " + url); + Matcher matcher = urlPattern.matcher(url); + if (matcher.matches()) { + for (int i = 1; i <= matcher.groupCount(); i++) { + String part = matcher.group(i); + Logger.getLogger("glassfish.javaee").log(Level.FINEST, " Part " + i + " is " + part); + parts[i - 1] = part; + } + props.putAll(parseProperties(parts[DB_PROPERTIES])); + } else { + Logger.getLogger("glassfish.javaee").log(Level.FINE, "Url parsing failed for " + url); + } + } + + private static Map<String, String> parseProperties(final String data) { + Map<String, String> result = new LinkedHashMap<>(); + if (data != null && data.length() > 0) { + String[] properties = data.split("[;?&:]"); + for (String propertie : properties) { + if (propertie != null && propertie.length() > 0) { + int eqIndex = propertie.indexOf("="); + if (eqIndex != -1) { + result.put(propertie.substring(0, eqIndex), propertie.substring(eqIndex + 1)); + } else { + // not sure if we should keep this. Possibly invalid property + result.put(propertie, ""); + } + } + } + } + return result; + } + + /** + * package protected for testing purposes only. + */ + String constructUrl() { + StringBuilder builder = new StringBuilder(256); + builder.append(parts[DB_PREFIX]); + + if (notEmpty(parts[DB_ALT_DBNAME])) { + builder.append(parts[DB_ALT_DBNAME]); + builder.append('@'); + } else if ("jdbc:oracle:thin:".equals(parts[DB_PREFIX])) { + builder.append('@'); + } else { + // most formats + builder.append("//"); // NOI18N + } + + builder.append(parts[DB_HOST]); + + if (notEmpty(parts[DB_INSTANCE_NAME])) { + builder.append('\\'); + builder.append(parts[DB_INSTANCE_NAME]); + } + + if (notEmpty(parts[DB_PORT])) { + builder.append(':'); // NOI18N + builder.append(parts[DB_PORT]); + } + + if (notEmpty(parts[DB_PRIMARY_DBNAME])) { + if ("jdbc:oracle:thin:".equals(parts[DB_PREFIX])) { + builder.append(':'); // NOI18N + } else { + builder.append('/'); // NOI18N + } + builder.append(parts[DB_PRIMARY_DBNAME]); + } + + char propertyInitialSeparator = ';'; + char propertySeparator = ';'; + if ("jdbc:mysql:".equals(parts[DB_PREFIX])) { + propertyInitialSeparator = '?'; + propertySeparator = '&'; + } else if ("jdbc:informix-sqli:".equals(parts[DB_PREFIX])) { + propertyInitialSeparator = ':'; + } + + Set<Map.Entry<String, String>> entries = props.entrySet(); + Iterator<Map.Entry<String, String>> entryIterator = entries.iterator(); + if (entryIterator.hasNext()) { + builder.append(propertyInitialSeparator); + Map.Entry<String, String> entry = entryIterator.next(); + builder.append(entry.getKey()); + String value = entry.getValue(); + if (notEmpty(value)) { + builder.append('='); + builder.append(value); + } + } + + while (entryIterator.hasNext()) { + builder.append(propertySeparator); + Map.Entry<String, String> entry = entryIterator.next(); + builder.append(entry.getKey()); + String value = entry.getValue(); + if (notEmpty(value)) { + builder.append('='); + builder.append(value); + } + } + + return builder.toString(); + } + + public String getUrl() { + return url; + } + + public String getPrefix() { + return parts[DB_PREFIX]; + } + + public String getHostName() { + return parts[DB_HOST]; + } + + public String getPort() { + return parts[DB_PORT]; + } + + public String getInstanceName() { + return parts[DB_INSTANCE_NAME]; + } + + public String getDatabaseName() { + String dbname = parts[DB_PRIMARY_DBNAME]; + if (dbname == null) { + dbname = parts[DB_ALT_DBNAME]; + if (dbname == null) { + dbname = props.get("databaseName"); + if (dbname == null) { + dbname = props.get("databasename"); + if (dbname == null) { + dbname = props.get("SID"); + if (dbname == null) { + dbname = props.get("database name"); + } + } + } + } + } + return dbname; + } + + public String getAlternateDBName() { + return parts[DB_ALT_DBNAME]; + } + + public String getSid() { + return props.get("SID"); + } + + public Map<String, String> getProperties() { + return Collections.unmodifiableMap(props); + } + + private static boolean notEmpty(String s) { + return s != null && s.length() > 0; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JDBCResourceWizardPage.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JDBCResourceWizardPage.java new file mode 100644 index 00000000..513d29c1 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JDBCResourceWizardPage.java @@ -0,0 +1,333 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.resources.wizards; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.resources.IProject; +import org.eclipse.datatools.connectivity.ICategory; +import org.eclipse.datatools.connectivity.IConnectionProfile; +import org.eclipse.datatools.connectivity.IProfileListener; +import org.eclipse.datatools.connectivity.ProfileManager; +import org.eclipse.datatools.connectivity.internal.ConnectionProfileManager; +import org.eclipse.datatools.connectivity.internal.ui.wizards.CPWizardNode; +import org.eclipse.datatools.connectivity.internal.ui.wizards.NewCPWizard; +import org.eclipse.datatools.connectivity.internal.ui.wizards.ProfileWizardProvider; +import org.eclipse.datatools.connectivity.ui.wizards.IWizardCategoryProvider; +import org.eclipse.jem.util.emf.workbench.ProjectUtilities; +import org.eclipse.jface.dialogs.IDialogPage; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.jface.window.Window; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +import fish.payara.eclipse.tools.server.sdk.server.parser.ResourcesReader.ResourceType; +import fish.payara.eclipse.tools.server.ui.resources.JDBCInfo; +import fish.payara.eclipse.tools.server.utils.ResourceUtils; + +/** + * + */ + +public class JDBCResourceWizardPage extends WizardPage { + private static final String DATABASE_CATEGORY_ID = "org.eclipse.datatools.connectivity.db.category"; //$NON-NLS-1$ + + private Text jndiText; + private IConnectionProfile connectionProfile; + private IProject selectedProject; + private List<IProject> candidateProjects; + + private Combo combo; + private Combo projectNameCombo; + + private NewCPWizard wizard; + + private WizardDialog wizardDialog; + + private List<String> resources = new ArrayList<>(); + private String defaultJndiName = "jdbc/myDatasource"; //$NON-NLS-1$ + + /** + * Constructor for JDBCResourceWizardPage. + * + * @param selection + */ + public JDBCResourceWizardPage(IProject project, List<IProject> projects) { + super("wizardPage"); //$NON-NLS-1$ + setTitle(Messages.wizardTitle); + setDescription(Messages.wizardDescription); + selectedProject = project; + candidateProjects = projects; + } + + /** + * @see IDialogPage#createControl(Composite) + */ + @Override + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(); + layout.numColumns = 3; + container.setLayout(layout); + Label label = new Label(container, SWT.NULL); + label.setText(Messages.ProjectName); + + projectNameCombo = new Combo(container, SWT.READ_ONLY | SWT.SINGLE); + GridDataFactory.defaultsFor(projectNameCombo).span(2, 1).applyTo(projectNameCombo); + projectNameCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetDefaultSelected(SelectionEvent e) { + widgetSelected(e); + } + + @Override + public void widgetSelected(SelectionEvent e) { + String newSelection = projectNameCombo.getText(); + if (newSelection != null) { + selectedProject = ProjectUtilities.getProject(newSelection); + resources = ResourceUtils.getResources(selectedProject, ResourceType.JDBC_RESOURCE); + dialogChanged(); + } + } + }); + + label = new Label(container, SWT.NULL); + label.setText(Messages.JNDIName); + + jndiText = new Text(container, SWT.BORDER | SWT.SINGLE); + GridDataFactory.defaultsFor(jndiText).span(2, 1).applyTo(jndiText); + jndiText.setText(defaultJndiName); + jndiText.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + dialogChanged(); + } + }); + + label = new Label(container, SWT.NULL); + label.setText(Messages.Connection); + + combo = new Combo(container, SWT.READ_ONLY | SWT.SINGLE); + combo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetDefaultSelected(SelectionEvent e) { + widgetSelected(e); + } + + @Override + public void widgetSelected(SelectionEvent e) { + String newSelection = combo.getText(); + if (newSelection != null) { + connectionProfile = ProfileManager.getInstance().getProfileByName(newSelection); + } + } + }); + GridDataFactory.defaultsFor(combo).align(SWT.FILL, SWT.CENTER).applyTo(combo); + + Button button = new Button(container, SWT.PUSH); + button.setText(Messages.Create); + button.addSelectionListener(new SelectionListener() { + @Override + public void widgetDefaultSelected(SelectionEvent e) { + // do nothing + } + + @Override + public void widgetSelected(SelectionEvent e) { + IConnectionProfile newProfile = showCPWizard(); + if (newProfile != null) { + connectionProfile = newProfile; + String newName = connectionProfile.getName(); + + combo.add(newName); + combo.select(combo.indexOf(newName)); + combo.pack(); + } + dialogChanged(); + } + }); + GridDataFactory.defaultsFor(button).align(SWT.END, SWT.CENTER).applyTo(button); + + initialize(); + setControl(container); + } + + private void initialize() { + populateCombos(); + dialogChanged(); + resources = ResourceUtils.getResources(selectedProject, ResourceType.JDBC_RESOURCE); + if (resources.contains(defaultJndiName)) { + String jndiName = ResourceUtils.getUniqueResourceName(defaultJndiName, resources); + jndiText.setText(jndiName); + } + } + + private void dialogChanged() { + setPageComplete(false); + boolean hasProject = (projectNameCombo.getSelectionIndex() != -1); + boolean hasConnection = (combo.getSelectionIndex() != -1); + + if (!hasProject) { + setErrorMessage(Messages.errorProjectMissing); + return; + } + String jndiName = getJNDIName(); + if ((jndiName == null) || (jndiName.length() == 0)) { + setErrorMessage(Messages.errorJndiNameMissing); + return; + } else { + if (ResourceUtils.isDuplicate(jndiName, resources)) { + setErrorMessage(NLS.bind(Messages.errorDuplicateName, jndiName)); + return; + } + } + if (!hasConnection) { + setErrorMessage(Messages.errorConnectionMissing); + return; + } + if (connectionProfile == null) { + setErrorMessage(Messages.errorConnectionInvalid); + return; + } + + setErrorMessage(null); + setPageComplete(true); + } + + public String getJNDIName() { + return jndiText.getText(); + } + + public IProject getSelectedProject() { + return selectedProject; + } + + private IConnectionProfile showCPWizard() { + // Filter datasource category + ViewerFilter viewerFilter = new ViewerFilter() { + + @Override + public boolean select(Viewer viewer, Object parentElement, Object element) { + + CPWizardNode wizardNode = (CPWizardNode) element; + if (!(wizardNode.getProvider() instanceof IWizardCategoryProvider)) { + ICategory cat = ConnectionProfileManager.getInstance().getProvider( + ((ProfileWizardProvider) wizardNode.getProvider()).getProfile()).getCategory(); + + // Only display wizards belong to database category + while (cat != null) { + if (cat.getId().equals(DATABASE_CATEGORY_ID)) { + return true; + } + cat = cat.getParent(); + } + } + return false; + } + }; + wizard = new NewCPWizard(viewerFilter, null); + Shell currentShell = Display.getCurrent().getActiveShell(); + wizardDialog = new WizardDialog(currentShell, wizard); + wizardDialog.setBlockOnOpen(true); + + ProfileManager profileManager = ProfileManager.getInstance(); + ProfileListener listener = new ProfileListener(); + profileManager.addProfileListener(listener); + int result = wizardDialog.open(); + profileManager.removeProfileListener(listener); + + return ((result != Window.CANCEL) ? listener.newProfile : null); + } + + private IConnectionProfile[] getConnectionProfiles() { + return ProfileManager.getInstance().getProfilesByCategory(DATABASE_CATEGORY_ID); + } + + private void populateCombos() { + combo.removeAll(); + for (IConnectionProfile profile : getConnectionProfiles()) { + if (connectionProfile == null) { + connectionProfile = profile; + } + combo.add(profile.getName()); + } + + if (combo.getItemCount() > 0) { + combo.select(0); + } + + projectNameCombo.removeAll(); + String selectProjectName = ((selectedProject != null) ? selectedProject.getName() : null); + int selectionIndex = -1; + for (int i = 0; i < candidateProjects.size(); i++) { + IProject nextProject = candidateProjects.get(i); + String projectName = nextProject.getName(); + projectNameCombo.add(projectName); + if (projectName.equals(selectProjectName)) { + selectionIndex = i; + } + } + if ((selectionIndex != -1) && (projectNameCombo.getItemCount() > 0)) { + projectNameCombo.select(selectionIndex); + } else { // selectedProject is not a valid candidate project + selectedProject = null; + } + } + + JDBCInfo getJDBCInfo() { + return new JDBCInfo(connectionProfile); + } + + static class ProfileListener implements IProfileListener { + IConnectionProfile newProfile; + + @Override + public void profileAdded(IConnectionProfile profile) { + newProfile = profile; + } + + @Override + public void profileChanged(IConnectionProfile profile) { + // do nothing + } + + @Override + public void profileDeleted(IConnectionProfile profile) { + // do nothing + } + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JDBCWizard.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JDBCWizard.java new file mode 100644 index 00000000..f979f015 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JDBCWizard.java @@ -0,0 +1,258 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.resources.wizards; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.InvocationTargetException; +import java.nio.charset.StandardCharsets; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; + +import fish.payara.eclipse.tools.server.sdk.server.parser.ResourcesReader.ResourceType; +import fish.payara.eclipse.tools.server.ui.resources.JDBCInfo; +import fish.payara.eclipse.tools.server.utils.ResourceUtils; + +/** + * This is a wizard that creates a new JDBC resource. + */ + +public class JDBCWizard extends ResourceWizard { + private JDBCResourceWizardPage page; + + /** + * Constructor for JDBC Wizard. + */ + public JDBCWizard() { + super(); + setNeedsProgressMonitor(true); + } + + /** + * Adding the page to the wizard. + */ + + @Override + public void addPages() { + IContainer containerResource = getContainerResource(); + IProject selectedProject = ((containerResource != null) ? containerResource.getProject() : null); + page = new JDBCResourceWizardPage(selectedProject, getGlassFishAndSailfinProjects()); + addPage(page); + } + + /** + * This method is called when 'Finish' button is pressed in the wizard. We will create an operation + * and run it using wizard as execution context. + */ + @Override + public boolean performFinish() { + final String jndiName = page.getJNDIName(); + final JDBCInfo jdbcInfo = page.getJDBCInfo(); + final IProject selectedProject = page.getSelectedProject(); + IRunnableWithProgress op = new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException { + try { + doFinish(jndiName, jdbcInfo, selectedProject, monitor); + } catch (CoreException e) { + throw new InvocationTargetException(e); + } finally { + monitor.done(); + } + } + }; + try { + getContainer().run(true, false, op); + } catch (InterruptedException e) { + return false; + } catch (InvocationTargetException e) { + Throwable realException = e.getTargetException(); + String message = realException.getMessage(); + if (message == null) { + message = Messages.errorUnknown; + } + MessageDialog.openError(getShell(), Messages.ErrorTitle, message); + return false; + } + return true; + } + + /** + * The worker method. It will find the container, create the file and open the editor on the newly + * created file. If the file already exists, show an error + */ + + private void doFinish(String jndiName, JDBCInfo jdbcInfo, IProject selectedProject, + IProgressMonitor monitor) throws CoreException { + checkDir(selectedProject); + + monitor.beginTask("Creating " + ResourceUtils.RESOURCE_FILE_NAME, 2); + + final IFile file = folder.getFile(new Path(ResourceUtils.RESOURCE_FILE_NAME)); + + try { + String fragment = createFragment(jndiName, jdbcInfo, selectedProject); + InputStream stream = ResourceUtils.appendResource(file, fragment); + if (!folder.exists()) { + folder.create(true, true, monitor); + } + if (file.exists()) { + file.setContents(stream, true, true, monitor); + } else { + file.create(stream, true, monitor); + } + stream.close(); + } catch (IOException e) { + } + monitor.worked(1); + monitor.setTaskName("Opening file for editing..."); + getShell().getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + try { + IDE.openEditor(page, file, true); + } catch (PartInitException e) { + } + } + }); + monitor.worked(1); + } + + /** + * Initialize the file contents to contents of the given resource. + */ + public static String createFragment(String jndiName, JDBCInfo jdbcInfo, IProject selectedProject) + throws CoreException { + + /* We want to be truly OS-agnostic */ + final String newline = System.getProperty("line.separator"); //$NON-NLS-1$ + + String line; + StringBuilder sb = new StringBuilder(); + final String serverName = jdbcInfo.getServerName(); + final String portNumber = jdbcInfo.getPort(); + final String databaseName = getDatabaseName(jdbcInfo); + final String vendorName = jdbcInfo.getDatabaseVendor(); + final String user = jdbcInfo.getUserName(); + final String poolName = constructPoolName(vendorName, databaseName, user); + final String driverClass = jdbcInfo.getDriverClass(); + final String datasourceClass = jdbcInfo.getDatasourceClass(); + final String password = jdbcInfo.getUserPassword(); + final String url = jdbcInfo.getURL(); + boolean matchStart = false; + boolean matchEnd = false; + boolean createConnPool = true; + + // Check if pool already exists for this vendor, database and user + // If present, don't add another connection pool + // TODO + // Extend this to do a complete check of the pool attributes like url, driverClass, datasourceClass + // etc + if (ResourceUtils.isDuplicate(poolName, ResourceType.JDBC_CONNECTION_POOL, selectedProject)) { + createConnPool = false; + } + + try { + InputStream input = JDBCInfo.class.getResourceAsStream(ResourceUtils.RESOURCE_FILE_TEMPLATE); + BufferedReader reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)); + try { + while ((line = reader.readLine()) != null) { + if (line.indexOf("<jdbc-resource") != -1) { //$NON-NLS-1$ + matchStart = true; + } + if ((matchStart) && (!matchEnd)) { + if (createConnPool) { + if (line.indexOf("</jdbc-connection-pool>") != -1) { //$NON-NLS-1$ + matchEnd = true; + } + } else { + if (line.indexOf("/>") != -1) { //$NON-NLS-1$ + matchEnd = true; + } + } + line = line.replaceAll("\\$\\{jndiName\\}", jndiName); //$NON-NLS-1$ + line = line.replaceAll("\\$\\{poolName\\}", poolName); //$NON-NLS-1$ + line = replaceOrRemove(line, "\\$\\{serverName\\}", serverName); //$NON-NLS-1$ + line = replaceOrRemove(line, "\\$\\{port\\}", portNumber); //$NON-NLS-1$ + line = replaceOrRemove(line, "\\$\\{databaseName\\}", databaseName); //$NON-NLS-1$ + line = replaceOrRemove(line, "\\$\\{driverClass\\}", driverClass); //$NON-NLS-1$ + line = replaceOrRemove(line, "\\$\\{datasourceClass\\}", datasourceClass); //$NON-NLS-1$ + line = replaceOrRemove(line, "\\$\\{user\\}", user); //$NON-NLS-1$ + line = replaceOrRemove(line, "\\$\\{password\\}", password); //$NON-NLS-1$ + line = replaceOrRemove(line, "\\$\\{url\\}", url); //$NON-NLS-1$ + if (line != null) { + sb.append(line); + sb.append(newline); + } + } + } + + } finally { + reader.close(); + } + + } catch (IOException ioe) { + IStatus status = new Status(IStatus.ERROR, "JDBCWizard", IStatus.OK, //$NON-NLS-1$ + ioe.getLocalizedMessage(), null); + throw new CoreException(status); + } + return sb.toString(); + + } + + private static String getDatabaseName(JDBCInfo jdbcInfo) { + String databaseName = jdbcInfo.getDatabaseName(); + + if (databaseName == null) { + databaseName = jdbcInfo.getAlternateDatabaseName(); + } + + return databaseName; + } + + private static String constructPoolName(String vendorName, String dbName, String userName) { + StringBuilder poolName = new StringBuilder(vendorName); + + if (dbName != null) { + poolName.append("_").append(dbName); //$NON-NLS-1$ + } + if (userName != null) { + poolName.append("_").append(userName); //$NON-NLS-1$ + } + poolName.append("Pool"); //$NON-NLS-1$ + + return poolName.toString(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JMSResourceWizardPage.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JMSResourceWizardPage.java new file mode 100644 index 00000000..d7e9a4bc --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JMSResourceWizardPage.java @@ -0,0 +1,267 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.resources.wizards; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.resources.IProject; +import org.eclipse.jem.util.emf.workbench.ProjectUtilities; +import org.eclipse.jface.dialogs.IDialogPage; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +import fish.payara.eclipse.tools.server.sdk.server.parser.ResourcesReader.ResourceType; +import fish.payara.eclipse.tools.server.ui.resources.JMSInfo; +import fish.payara.eclipse.tools.server.utils.ResourceUtils; + +/** + * @author Nitya Doraisamy + */ + +public class JMSResourceWizardPage extends WizardPage { + + private Text jndiText; + private Button queueRButton; + private Button topicRButton; + private Button queueConnectionRButton; + private Button topicConnectionRButton; + private Button connectionRButton; + + private IProject selectedProject; + private List<IProject> candidateProjects; + private JMSInfo jmsInfo; + + private Combo projectNameCombo; + + private List<String> resources = new ArrayList<>(); + private String defaultJndiName = "jms/myQueue"; //$NON-NLS-1$ + + /** + * Constructor for JMSResourceWizardPage. + * + * @param selection + */ + public JMSResourceWizardPage(IProject project, List<IProject> projects) { + super("wizardPage"); //$NON-NLS-1$ + setTitle(Messages.jmsWizardTitle); + setDescription(Messages.jmsWizardDescription); + selectedProject = project; + candidateProjects = projects; + } + + /** + * @see IDialogPage#createControl(Composite) + */ + @Override + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(); + layout.numColumns = 3; + container.setLayout(layout); + Label label = new Label(container, SWT.NULL); + label.setText(Messages.ProjectName); + + projectNameCombo = new Combo(container, SWT.READ_ONLY | SWT.SINGLE); + GridDataFactory.defaultsFor(projectNameCombo).span(2, 1).applyTo(projectNameCombo); + projectNameCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetDefaultSelected(SelectionEvent e) { + widgetSelected(e); + } + + @Override + public void widgetSelected(SelectionEvent e) { + String newSelection = projectNameCombo.getText(); + if (newSelection != null) { + selectedProject = ProjectUtilities.getProject(newSelection); + resources = ResourceUtils.getResources(selectedProject, ResourceType.JDBC_RESOURCE); + dialogChanged(); + } + } + }); + + label = new Label(container, SWT.NULL); + label.setText(Messages.JNDIName); + + jndiText = new Text(container, SWT.BORDER | SWT.SINGLE); + GridDataFactory.defaultsFor(jndiText).span(2, 1).applyTo(jndiText); + jndiText.setText(defaultJndiName); + jndiText.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + dialogChanged(); + } + }); + + // Dummy Label for spacing + label = new Label(container, SWT.NULL); + GridDataFactory.defaultsFor(label).span(3, 1).applyTo(label); + + label = new Label(container, SWT.NULL); + label.setText(Messages.lblChooseType); + GridDataFactory.defaultsFor(label).span(3, 1).applyTo(label); + + // Dummy Label for spacing + label = new Label(container, SWT.NULL); + GridDataFactory.defaultsFor(label).span(3, 1).applyTo(label); + + label = new Label(container, SWT.NULL); + label.setText(Messages.lblAdminObject); + GridDataFactory.defaultsFor(label).span(3, 1).applyTo(label); + + GridData gridData = new GridData(); + gridData.horizontalIndent = 40; + gridData.horizontalSpan = 3; + gridData.horizontalAlignment = GridData.FILL; + + queueRButton = new Button(container, SWT.RADIO); + queueRButton.setText(Messages.lblQueue); + queueRButton.setLayoutData(gridData); + queueRButton.setSelection(true); + + topicRButton = new Button(container, SWT.RADIO); + topicRButton.setText(Messages.lblTopic); + topicRButton.setLayoutData(gridData); + + // Dummy Label for spacing + label = new Label(container, SWT.NULL); + GridDataFactory.defaultsFor(label).span(3, 1).applyTo(label); + + label = new Label(container, SWT.NULL); + label.setText(Messages.lblConnector); + GridDataFactory.defaultsFor(label).span(3, 1).applyTo(label); + + queueConnectionRButton = new Button(container, SWT.RADIO); + queueConnectionRButton.setText(Messages.lblQueueConnectionFactory); + queueConnectionRButton.setLayoutData(gridData); + + topicConnectionRButton = new Button(container, SWT.RADIO); + topicConnectionRButton.setText(Messages.lblTopicConnectionFactory); + topicConnectionRButton.setLayoutData(gridData); + + connectionRButton = new Button(container, SWT.RADIO); + connectionRButton.setText(Messages.lblConnectionFactory); + connectionRButton.setLayoutData(gridData); + + initialize(); + dialogChanged(); + setControl(container); + } + + private void initialize() { + resources = ResourceUtils.getResources(selectedProject, ResourceType.CONNECTOR_RESOURCE, ResourceType.ADMIN_OBJECT_RESOURCE); + if (resources.contains(defaultJndiName)) { + String jndiName = ResourceUtils.getUniqueResourceName(defaultJndiName, resources); + jndiText.setText(jndiName); + } + populateCombos(); + dialogChanged(); + } + + public String getJNDIName() { + return jndiText.getText(); + } + + public String getResourceType() { + String resourceType = null; + if (queueRButton.getSelection()) { + resourceType = JMSInfo.QUEUE; + } else if (topicRButton.getSelection()) { + resourceType = JMSInfo.TOPIC; + } else if (queueConnectionRButton.getSelection()) { + resourceType = JMSInfo.QUEUE_CONNECTION; + } else if (topicConnectionRButton.getSelection()) { + resourceType = JMSInfo.TOPIC_CONNECTION; + } else if (connectionRButton.getSelection()) { + resourceType = JMSInfo.CONNECTION_FACTORY; + } + return resourceType; + } + + public IProject getSelectedProject() { + return selectedProject; + } + + private void dialogChanged() { + setPageComplete(false); + boolean hasProject = (projectNameCombo.getSelectionIndex() != -1); + if (!hasProject) { + setErrorMessage(Messages.errorProjectMissing); + return; + } + String jndiName = getJNDIName(); + if (jndiName.length() == 0) { + setErrorMessage(Messages.errorJndiNameMissing); + return; + } else { + if (ResourceUtils.isDuplicate(jndiName, resources)) { + setErrorMessage(NLS.bind(Messages.errorDuplicateName, jndiName)); + return; + } + } + + if ((getResourceType() == null) || (getResourceType().length() == 0)) { + setErrorMessage(Messages.errorResourceTypeMissing); + return; + } + setPageComplete(true); + setErrorMessage(null); + } + + private void populateCombos() { + projectNameCombo.removeAll(); + String selectProjectName = ((selectedProject != null) ? selectedProject.getName() : null); + int selectionIndex = -1; + for (int i = 0; i < candidateProjects.size(); i++) { + IProject nextProject = candidateProjects.get(i); + String projectName = nextProject.getName(); + projectNameCombo.add(projectName); + if (projectName.equals(selectProjectName)) { + selectionIndex = i; + } + } + if ((selectionIndex != -1) && (projectNameCombo.getItemCount() > 0)) { + projectNameCombo.select(selectionIndex); + } else { // selectedProject is not a valid candidate project + selectedProject = null; + } + } + + public JMSInfo getJMSInfo() { + jmsInfo = new JMSInfo(); + jmsInfo.setJndiName(getJNDIName()); + jmsInfo.setResourceType(getResourceType()); + return jmsInfo; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JMSWizard.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JMSWizard.java new file mode 100644 index 00000000..ea40746b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JMSWizard.java @@ -0,0 +1,224 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.resources.wizards; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.InvocationTargetException; +import java.nio.charset.StandardCharsets; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; + +import fish.payara.eclipse.tools.server.ui.resources.JMSInfo; +import fish.payara.eclipse.tools.server.utils.ResourceUtils; + +/** + * @author Nitya Doraisamy + * + * This is a wizard that creates a new JMS resource. + */ + +public class JMSWizard extends ResourceWizard { + private JMSResourceWizardPage page; + + /** + * Constructor for JMSWizard. + */ + public JMSWizard() { + super(); + setNeedsProgressMonitor(true); + } + + /** + * Adding the page to the wizard. + */ + + @Override + public void addPages() { + IContainer containerResource = getContainerResource(); + IProject selectedProject = ((containerResource != null) ? containerResource.getProject() : null); + page = new JMSResourceWizardPage(selectedProject, getGlassFishAndSailfinProjects()); + addPage(page); + } + + /** + * This method is called when 'Finish' button is pressed in the wizard. We will create an operation + * and run it using wizard as execution context. + */ + @Override + public boolean performFinish() { + final String jndiName = page.getJNDIName(); + final JMSInfo jmsInfo = page.getJMSInfo(); + final IProject selectedProject = page.getSelectedProject(); + + IRunnableWithProgress op = new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException { + try { + doFinish(jndiName, jmsInfo, selectedProject, monitor); + } catch (CoreException e) { + throw new InvocationTargetException(e); + } finally { + monitor.done(); + } + } + }; + try { + getContainer().run(true, false, op); + } catch (InterruptedException e) { + return false; + } catch (InvocationTargetException e) { + Throwable realException = e.getTargetException(); + String message = realException.getMessage(); + if (message == null) { + message = Messages.errorUnknown; + } + MessageDialog.openError(getShell(), Messages.ErrorTitle, message); + return false; + } + return true; + } + + /** + * The worker method. It will find the container, create the file and open the editor on the newly + * created file. If the file already exists, show an error + */ + + private void doFinish(String jndiName, JMSInfo jmsInfo, IProject selectedProject, IProgressMonitor monitor) throws CoreException { + checkDir(selectedProject); + + monitor.beginTask("Creating " + ResourceUtils.RESOURCE_FILE_NAME, 2); + + final IFile file = folder.getFile(new Path(ResourceUtils.RESOURCE_FILE_NAME)); + + try { + String fragment = createFragment(jndiName, jmsInfo); + InputStream stream = ResourceUtils.appendResource(file, fragment); + if (!folder.exists()) { + folder.create(true, true, monitor); + } + if (file.exists()) { + file.setContents(stream, true, true, monitor); + } else { + file.create(stream, true, monitor); + } + stream.close(); + } catch (IOException e) { + } + monitor.worked(1); + monitor.setTaskName("Opening file for editing..."); + getShell().getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + try { + IDE.openEditor(page, file, true); + } catch (PartInitException e) { + } + } + }); + monitor.worked(1); + } + + /** + * Initialize the file contents to contents of the given resource. + */ + public static String createFragment(String jndiName, JMSInfo jmsInfo) + throws CoreException { + + /* We want to be truly OS-agnostic */ + final String newline = System.getProperty("line.separator"); //$NON-NLS-1$ + + String line; + StringBuilder sb = new StringBuilder(); + final boolean isConnector = jmsInfo.isConnector(); + final String resourceType = jmsInfo.getResourceType(); + boolean matchStart = false; + boolean matchEnd = false; + + try { + InputStream input = JMSInfo.class.getResourceAsStream(ResourceUtils.RESOURCE_FILE_TEMPLATE); + BufferedReader reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)); + try { + while ((line = reader.readLine()) != null) { + if (isConnector) { + if (line.indexOf("<connector-resource") != -1) { //$NON-NLS-1$ + matchStart = true; + } + if ((matchStart) && (!matchEnd)) { + line = line.replaceAll("\\$\\{jndiName\\}", jndiName); //$NON-NLS-1$ + line = line.replaceAll("\\$\\{connectorPoolName\\}", jndiName); //$NON-NLS-1$ + line = line.replaceAll("\\$\\{resourceType\\}", resourceType); //$NON-NLS-1$ + + if (line != null) { + sb.append(line); + sb.append(newline); + } + if (line.indexOf("<connector-connection-pool") != -1) { //$NON-NLS-1$ + matchEnd = true; + } + } + } else { + if (line.indexOf("<admin-object-resource") != -1) { //$NON-NLS-1$ + matchStart = true; + } + if ((matchStart) && (!matchEnd)) { + line = line.replaceAll("\\$\\{jndiName\\}", jndiName); //$NON-NLS-1$ + line = line.replaceAll("\\$\\{resourceType\\}", resourceType); //$NON-NLS-1$ + + if (line != null) { + sb.append(line); + sb.append(newline); + } + if (line.indexOf("</admin-object-resource>") != -1) { //$NON-NLS-1$ + matchEnd = true; + } + } + } + } + + } finally { + reader.close(); + } + } catch (IOException ioe) { + IStatus status = new Status(IStatus.ERROR, "JMSWizard", IStatus.OK, //$NON-NLS-1$ + ioe.getLocalizedMessage(), null); + throw new CoreException(status); + } + + return sb.toString(); + + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/MailResourceWizardPage.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/MailResourceWizardPage.java new file mode 100644 index 00000000..d9c2955f --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/MailResourceWizardPage.java @@ -0,0 +1,256 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.resources.wizards; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.resources.IProject; +import org.eclipse.jem.util.emf.workbench.ProjectUtilities; +import org.eclipse.jface.dialogs.IDialogPage; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +import fish.payara.eclipse.tools.server.sdk.server.parser.ResourcesReader.ResourceType; +import fish.payara.eclipse.tools.server.ui.resources.MailInfo; +import fish.payara.eclipse.tools.server.utils.ResourceUtils; + +/** + * + */ + +public class MailResourceWizardPage extends WizardPage { + private Text jndiText; + private Text hostText; + private Text userText; + private Text fromText; + + private IProject selectedProject; + private List<IProject> candidateProjects; + private MailInfo mailInfo; + + private Combo projectNameCombo; + + private List<String> resources = new ArrayList<>(); + private String defaultJndiName = "mail/mymailSession"; //$NON-NLS-1$ + + /** + * Constructor for MailResourceWizardPage. + * + * @param selection + */ + public MailResourceWizardPage(IProject project, List<IProject> projects) { + super("wizardPage"); //$NON-NLS-1$ + setTitle(Messages.mailWizardTitle); + setDescription(Messages.mailWizardDescription); + selectedProject = project; + candidateProjects = projects; + } + + /** + * @see IDialogPage#createControl(Composite) + */ + @Override + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(); + layout.numColumns = 3; + container.setLayout(layout); + Label label = new Label(container, SWT.NULL); + label.setText(Messages.ProjectName); + + projectNameCombo = new Combo(container, SWT.READ_ONLY | SWT.SINGLE); + GridDataFactory.defaultsFor(projectNameCombo).span(2, 1).applyTo(projectNameCombo); + projectNameCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetDefaultSelected(SelectionEvent e) { + widgetSelected(e); + } + + @Override + public void widgetSelected(SelectionEvent e) { + String newSelection = projectNameCombo.getText(); + if (newSelection != null) { + selectedProject = ProjectUtilities.getProject(newSelection); + resources = ResourceUtils.getResources(selectedProject, ResourceType.JDBC_RESOURCE); + dialogChanged(); + } + } + }); + + label = new Label(container, SWT.NULL); + label.setText(Messages.JNDIName); + + jndiText = new Text(container, SWT.BORDER | SWT.SINGLE); + GridDataFactory.defaultsFor(jndiText).span(2, 1).applyTo(jndiText); + jndiText.setText(defaultJndiName); + jndiText.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + dialogChanged(); + } + }); + + label = new Label(container, SWT.NULL); + label.setText(Messages.MailHost); + + hostText = new Text(container, SWT.BORDER | SWT.SINGLE); + GridDataFactory.defaultsFor(hostText).span(2, 1).applyTo(hostText); + hostText.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + dialogChanged(); + } + }); + + label = new Label(container, SWT.NULL); + label.setText(Messages.MailUser); + + userText = new Text(container, SWT.BORDER | SWT.SINGLE); + GridDataFactory.defaultsFor(userText).span(2, 1).applyTo(userText); + userText.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + dialogChanged(); + } + }); + + label = new Label(container, SWT.NULL); + label.setText(Messages.MailFrom); + + fromText = new Text(container, SWT.BORDER | SWT.SINGLE); + GridDataFactory.defaultsFor(fromText).span(2, 1).applyTo(fromText); + fromText.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + dialogChanged(); + } + }); + + initialize(); + dialogChanged(); + setControl(container); + } + + private void initialize() { + resources = ResourceUtils.getResources(selectedProject, ResourceType.JAVA_MAIL); + if (resources.contains(defaultJndiName)) { + String jndiName = ResourceUtils.getUniqueResourceName(defaultJndiName, resources); + jndiText.setText(jndiName); + } + populateCombos(); + dialogChanged(); + } + + public String getJNDIName() { + return jndiText.getText(); + } + + public String getMailHost() { + return hostText.getText(); + } + + public String getMailUser() { + return userText.getText(); + } + + public String getMailFrom() { + return fromText.getText(); + } + + public IProject getSelectedProject() { + return selectedProject; + } + + private void dialogChanged() { + setPageComplete(false); + boolean hasProject = (projectNameCombo.getSelectionIndex() != -1); + if (!hasProject) { + setErrorMessage(Messages.errorProjectMissing); + return; + } + String jndiName = getJNDIName(); + if ((jndiName == null) || (jndiName.length() == 0)) { + setErrorMessage(Messages.errorJndiNameMissing); + return; + } else { + if (ResourceUtils.isDuplicate(jndiName, resources)) { + setErrorMessage(NLS.bind(Messages.errorDuplicateName, jndiName)); + return; + } + } + String mailHost = getMailHost(); + if ((mailHost == null) || (mailHost.length() == 0)) { + setErrorMessage(Messages.errorMailHostNameMissing); + return; + } + String mailUser = getMailUser(); + if ((mailUser == null) || (mailUser.length() == 0)) { + setErrorMessage(Messages.errorMailUserNameMissing); + return; + } + String mailFrom = getMailFrom(); + if ((mailFrom == null) || (mailFrom.length() == 0)) { + setErrorMessage(Messages.errorMailReturnAddrMissing); + return; + } + setPageComplete(true); + setErrorMessage(null); + } + + private void populateCombos() { + projectNameCombo.removeAll(); + String selectProjectName = ((selectedProject != null) ? selectedProject.getName() : null); + int selectionIndex = -1; + for (int i = 0; i < candidateProjects.size(); i++) { + IProject nextProject = candidateProjects.get(i); + String projectName = nextProject.getName(); + projectNameCombo.add(projectName); + if (projectName.equals(selectProjectName)) { + selectionIndex = i; + } + } + if ((selectionIndex != -1) && (projectNameCombo.getItemCount() > 0)) { + projectNameCombo.select(selectionIndex); + } else { // selectedProject is not a valid candidate project + selectedProject = null; + } + } + + public MailInfo getMailInfo() { + mailInfo = new MailInfo(); + mailInfo.setJndiName(getJNDIName()); + mailInfo.setMailFrom(getMailFrom()); + mailInfo.setMailHost(getMailHost()); + mailInfo.setMailUser(getMailUser()); + return mailInfo; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/MailWizard.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/MailWizard.java new file mode 100644 index 00000000..ca083e95 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/MailWizard.java @@ -0,0 +1,207 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.resources.wizards; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.InvocationTargetException; +import java.nio.charset.StandardCharsets; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; + +import fish.payara.eclipse.tools.server.ui.resources.MailInfo; +import fish.payara.eclipse.tools.server.utils.ResourceUtils; + +/** + * This is a wizard that creates a new JavaMail Session resource. + */ + +public class MailWizard extends ResourceWizard { + private MailResourceWizardPage page; + + /** + * Constructor for MailWizard. + */ + public MailWizard() { + super(); + setNeedsProgressMonitor(true); + } + + /** + * Adding the page to the wizard. + */ + + @Override + public void addPages() { + IContainer containerResource = getContainerResource(); + IProject selectedProject = ((containerResource != null) ? containerResource.getProject() : null); + page = new MailResourceWizardPage(selectedProject, getGlassFishAndSailfinProjects()); + addPage(page); + } + + /** + * This method is called when 'Finish' button is pressed in the wizard. We will create an operation + * and run it using wizard as execution context. + */ + @Override + public boolean performFinish() { + final String jndiName = page.getJNDIName(); + final MailInfo mailInfo = page.getMailInfo(); + final IProject selectedProject = page.getSelectedProject(); + + IRunnableWithProgress op = new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException { + try { + doFinish(jndiName, mailInfo, selectedProject, monitor); + } catch (CoreException e) { + throw new InvocationTargetException(e); + } finally { + monitor.done(); + } + } + }; + try { + getContainer().run(true, false, op); + } catch (InterruptedException e) { + return false; + } catch (InvocationTargetException e) { + Throwable realException = e.getTargetException(); + String message = realException.getMessage(); + if (message == null) { + message = Messages.errorUnknown; + } + MessageDialog.openError(getShell(), Messages.ErrorTitle, message); + return false; + } + return true; + } + + /** + * The worker method. It will find the container, create the file and open the editor on the newly + * created file. If the file already exists, show an error + */ + + private void doFinish(String jndiName, MailInfo mailInfo, IProject selectedProject, IProgressMonitor monitor) throws CoreException { + checkDir(selectedProject); + + monitor.beginTask("Creating " + ResourceUtils.RESOURCE_FILE_NAME, 2); + + final IFile file = folder.getFile(new Path(ResourceUtils.RESOURCE_FILE_NAME)); + + try { + String fragment = createFragment(jndiName, mailInfo); + InputStream stream = ResourceUtils.appendResource(file, fragment); + if (!folder.exists()) { + folder.create(true, true, monitor); + } + if (file.exists()) { + file.setContents(stream, true, true, monitor); + } else { + file.create(stream, true, monitor); + } + stream.close(); + } catch (IOException e) { + } + monitor.worked(1); + monitor.setTaskName("Opening file for editing..."); + getShell().getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + try { + IDE.openEditor(page, file, true); + } catch (PartInitException e) { + } + } + }); + monitor.worked(1); + } + + /** + * Initialize the file contents to contents of the given resource. + */ + public static String createFragment(String jndiName, MailInfo mailInfo) + throws CoreException { + + /* We want to be truly OS-agnostic */ + final String newline = System.getProperty("line.separator"); //$NON-NLS-1$ + + String line; + StringBuilder sb = new StringBuilder(); + final String mailHost = mailInfo.getMailHost(); + final String mailUser = mailInfo.getMailUser(); + final String mailFrom = mailInfo.getMailFrom(); + + boolean matchStart = false; + boolean matchEnd = false; + + try { + InputStream input = MailInfo.class.getResourceAsStream(ResourceUtils.RESOURCE_FILE_TEMPLATE); + BufferedReader reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8)); + try { + while ((line = reader.readLine()) != null) { + if (line.indexOf("<mail-resource") != -1) { //$NON-NLS-1$ + matchStart = true; + } + if ((matchStart) && (!matchEnd)) { + line = line.replaceAll("\\$\\{jndiName\\}", jndiName); //$NON-NLS-1$ + line = line.replaceAll("\\$\\{mailHost\\}", mailHost); //$NON-NLS-1$ + line = line.replaceAll("\\$\\{mailUser\\}", mailUser); //$NON-NLS-1$ + line = line.replaceAll("\\$\\{mailFrom\\}", mailFrom); //$NON-NLS-1$ + + if (line != null) { + sb.append(line); + sb.append(newline); + } + if (line.indexOf("</mail-resource>") != -1) { //$NON-NLS-1$ + matchEnd = true; + } + } + } + + } finally { + reader.close(); + } + } catch (IOException ioe) { + IStatus status = new Status(IStatus.ERROR, "MailWizard", IStatus.OK, //$NON-NLS-1$ + ioe.getLocalizedMessage(), null); + throw new CoreException(status); + } + + return sb.toString(); + + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/Messages.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/Messages.java new file mode 100644 index 00000000..35042684 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/Messages.java @@ -0,0 +1,68 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.resources.wizards; + +public class Messages extends org.eclipse.osgi.util.NLS { + static { + org.eclipse.osgi.util.NLS.initializeMessages( + "fish.payara.eclipse.tools.server.ui.resources.wizards.Messages", Messages.class); + } + + public static String Connection; + public static String Create; + public static String JNDIName; + public static String ProjectName; + public static String wizardTitle; + public static String wizardDescription; + public static String ErrorTitle; + public static String errorUnknown; + public static String errorFileExists; + public static String errorFolderMissing; + public static String errorProjectMissing; + public static String errorConnectionMissing; + public static String errorConnectionInvalid; + + // JavaMail Wizard + public static String mailWizardTitle; + public static String mailWizardDescription; + public static String MailHost; + public static String MailUser; + public static String MailFrom; + public static String errorMailHostNameMissing; + public static String errorMailUserNameMissing; + public static String errorMailReturnAddrMissing; + + // JMS Wizard + public static String jmsWizardTitle; + public static String jmsWizardDescription; + public static String lblChooseType; + public static String lblAdminObject; + public static String lblConnector; + public static String lblQueue; + public static String lblTopic; + public static String lblQueueConnectionFactory; + public static String lblTopicConnectionFactory; + public static String lblConnectionFactory; + + // Common + public static String errorJndiNameMissing; + public static String errorResourceTypeMissing; + public static String errorFolderNull; + public static String errorDuplicateName; +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/Messages.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/Messages.properties new file mode 100644 index 00000000..81b58c71 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/Messages.properties @@ -0,0 +1,40 @@ +JNDIName=&JNDI Name: +ProjectName=Project: +wizardTitle=Sun Resources File +wizardDescription=Create a sun-resources.xml file from an existing JDBC connection. Note that target project must contain the Sun Deployment Descriptors Files Facet. +Connection=&Connection: +Create=Create... + +mailWizardTitle=JavaMail Session Sun Resource +mailWizardDescription=Create/Update a sun-resources.xml file with a JavaMail Session resource. Note that target project must contain the Sun Deployment Descriptors Files Facet. +MailHost=&Mail Host: +MailUser=Default &User: +MailFrom=Default Return &Address: + +errorMailHostNameMissing=Mail Host must be specified +errorMailUserNameMissing=Default User must be specified +errorMailReturnAddrMissing=Default Return Address must be specified + +jmsWizardTitle=JMS Sun Resource +jmsWizardDescription=Create/Update a sun-resources.xml file with a JMS resource. Note that target project must contain the Sun Deployment Descriptors Files Facet. + +lblChooseType=Choose Resource Type: +lblAdminObject=Admin Object Resource +lblConnector=Connector Resource +lblQueue=javax.jms.&Queue +lblTopic=javax.jms.&Topic +lblQueueConnectionFactory=javax.jms.Queue&ConnectionFactory +lblTopicConnectionFactory=javax.jms.T&opicConnectionFactory +lblConnectionFactory=javax.jms.Co&nnectionFactory +errorResourceTypeMissing=Resource Type must be specified + +ErrorTitle=Error +errorUnknown=Unknown error creating file +errorFileExists=File already exists +errorFolderNull=Cannot create sun-resources.xml file in project of this type. +errorFolderMissing=Cannot create this type of resource in a project which does not contain a {0} folder +errorProjectMissing=Project must be specified. Note that target project must contain the Sun Deployment Descriptors Files Facet. +errorConnectionMissing=Connection must be specified +errorConnectionInvalid=Invalid Database Connection. Please specify a valid connection. +errorJndiNameMissing=JNDI Name must be specified +errorDuplicateName=A resource with name {0} already exists. Please provide a unique value. diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/ResourceWizard.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/ResourceWizard.java new file mode 100644 index 00000000..3921514a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/ResourceWizard.java @@ -0,0 +1,147 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.resources.wizards; + +import static org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities.getServerRuntime; +import static org.eclipse.wst.common.project.facet.core.FacetedProjectFramework.hasProjectFacet; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.jem.util.emf.workbench.ProjectUtilities; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.osgi.util.NLS; +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchWizard; +import org.eclipse.wst.server.core.IRuntime; + +import fish.payara.eclipse.tools.server.PayaraRuntime; +import fish.payara.eclipse.tools.server.utils.ResourceUtils; + +/** + * This is a superclass for wizards to create resources + */ + +@SuppressWarnings("restriction") +public abstract class ResourceWizard extends Wizard implements INewWizard { + + protected IStructuredSelection selection; + protected String dirName; + protected IFolder folder; + + /** + * Constructor + */ + public ResourceWizard() { + super(); + setNeedsProgressMonitor(true); + } + + protected void checkDir(IProject selectedProject) throws CoreException { + dirName = ResourceUtils.getResourceLocation(selectedProject); + if (dirName == null) { + IStatus status = new Status(IStatus.ERROR, getClass().getName(), IStatus.OK, + NLS.bind(Messages.errorFolderNull, dirName), null); + throw new CoreException(status); + } + IContainer containerResource = selectedProject; + folder = containerResource.getFolder(new Path(dirName)); + if (!folder.exists()) { + IStatus status = new Status(IStatus.ERROR, getClass().getName(), IStatus.OK, + NLS.bind(Messages.errorFolderMissing, dirName), null); + throw new CoreException(status); + } + } + + protected static String replaceOrRemove(String originalLine, String pattern, String value) { + String containsPattern = ".*" + pattern + ".*"; //$NON-NLS-1$ //$NON-NLS-2$ + if ((originalLine != null) && Pattern.matches(containsPattern, originalLine)) { + return (((value == null) || (value.length() == 0)) ? null : originalLine.replaceAll(pattern, value)); + } + return originalLine; + } + + protected IContainer getContainerResource() { + if (selection != null && !selection.isEmpty()) { + IStructuredSelection ssel = selection; + if (ssel.size() > 1) { + return null; + } + Object obj = ssel.getFirstElement(); + if (obj instanceof IResource) { + IContainer containerResource; + if (obj instanceof IContainer) { + containerResource = (IContainer) obj; + } else { + containerResource = ((IResource) obj).getParent(); + } + + return ((containerResource != null) ? containerResource.getProject() : null); + } + } + return null; + } + + protected List<IProject> getGlassFishAndSailfinProjects() { + IProject[] allProjects = ProjectUtilities.getAllProjects(); + List<IProject> returnProjects = new ArrayList<>(); + + for (IProject project2 : allProjects) { + try { + if (hasProjectFacet(project2, "sun.facet")) { //$NON-NLS-1$ + returnProjects.add(project2); + } else { + IRuntime runtime = getServerRuntime(project2); + if (runtime != null) { + String runtimeId = runtime.getRuntimeType().getId(); + + if (runtimeId.equals(PayaraRuntime.TYPE_ID)) { + returnProjects.add(project2); + } + } + } + } catch (CoreException e) { + // just skip from list + } + } + + return returnProjects; + } + + /** + * We will accept the selection in the workbench to see if we can initialize from it. + * + * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) + */ + @Override + public void init(IWorkbench workbench, IStructuredSelection selection) { + this.selection = selection; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceClassOperation.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceClassOperation.java new file mode 100644 index 00000000..23480070 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceClassOperation.java @@ -0,0 +1,119 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.rest.wizards; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.codegen.jet.JETException; +import org.eclipse.jdt.core.ICompilationUnit; +import org.eclipse.jdt.core.IPackageFragment; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jst.j2ee.internal.web.operations.NewWebClassOperation; +import org.eclipse.wst.common.frameworks.datamodel.IDataModel; +import org.eclipse.wst.common.frameworks.internal.enablement.nonui.WFTWrappedException; + +@SuppressWarnings("restriction") +public class AddGenericResourceClassOperation extends NewWebClassOperation { + + /** + * folder location of the Generic Resource creation templates directory + */ + protected static final String TEMPLATE_FILE = "/templates/genericresource.javajet"; //$NON-NLS-1$ + + public AddGenericResourceClassOperation(IDataModel dataModel) { + super(dataModel); + } + + @Override + protected void generateUsingTemplates(IProgressMonitor monitor, + IPackageFragment fragment) throws WFTWrappedException, + CoreException { + // Create the template model + AddGenericResourceTemplateModel tempModel = new AddGenericResourceTemplateModel(model); + // Using the WTPJetEmitter, generate the java source + // template model + try { + if (fragment != null) { + // Create the Generic Resource java file + doGeneration(monitor, fragment, GenericResourceTemplate.create(null), tempModel); + // also generate the second class if necessary + if (!tempModel.isSimplePattern()) { + tempModel.setIsContainerClass(); + doGeneration(monitor, fragment, ContainerResourceTemplate.create(null), tempModel); + } + } + } catch (Exception e) { + throw new WFTWrappedException(e); + } + } + + private void doGeneration(IProgressMonitor monitor, IPackageFragment fragment, + Object tempImpl, AddGenericResourceTemplateModel tempModel) throws JavaModelException, JETException { + try { + Method method = tempImpl.getClass().getMethod("generate", //$NON-NLS-1$ + new Class[] { Object.class }); + String source = (String) method.invoke(tempImpl, tempModel); + String javaFileName = tempModel.getClassName() + ".java"; //$NON-NLS-1$ + createJavaFile(monitor, fragment, source, javaFileName); + } catch (SecurityException e) { + throw new JETException(e); + } catch (NoSuchMethodException e) { + throw new JETException(e); + } catch (IllegalArgumentException e) { + throw new JETException(e); + } catch (IllegalAccessException e) { + throw new JETException(e); + } catch (InvocationTargetException e) { + throw new JETException(e); + } + } + + protected IFile createJavaFile(IProgressMonitor monitor, IPackageFragment fragment, String source, String className) + throws JavaModelException { + if (fragment != null) { + ICompilationUnit cu = fragment.getCompilationUnit(className); + // Add the compilation unit to the java file + if (cu == null || !cu.exists()) { + cu = fragment.createCompilationUnit(className, source, + true, monitor); + } + return (IFile) cu.getResource(); + } + return null; + } + + @Override + protected AddGenericResourceTemplateModel createTemplateModel() { + return new AddGenericResourceTemplateModel(model); + } + + @Override + protected String getTemplateFile() { + return TEMPLATE_FILE; + } + + @Override + protected Object getTemplateImplementation() { + return GenericResourceTemplate.create(null); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceDataModelProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceDataModelProvider.java new file mode 100644 index 00000000..480ca1d0 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceDataModelProvider.java @@ -0,0 +1,262 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.rest.wizards; + +import java.util.HashSet; +import java.util.Set; +import java.util.StringTokenizer; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.IType; +import org.eclipse.jdt.core.JavaConventions; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties; +import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider; +import org.eclipse.jst.j2ee.internal.common.operations.NewJavaEEArtifactClassOperation; +import org.eclipse.jst.j2ee.internal.web.operations.AddWebClassOperation; +import org.eclipse.jst.j2ee.internal.web.operations.NewWebClassDataModelProvider; +import org.eclipse.wst.common.frameworks.datamodel.IDataModel; +import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; +import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider; +import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin; + +import fish.payara.eclipse.tools.server.PayaraServerPlugin; + +@SuppressWarnings("restriction") +public class AddGenericResourceDataModelProvider extends + NewWebClassDataModelProvider { + + public static final String PATTERN = "AddGenericResource.PATTERN"; //$NON-NLS-1$ + public static final String PATH = "AddGenericResource.PATH"; //$NON-NLS-1$ + public static final String MIME_TYPE = "AddGenericResource.MIME_TYPE"; //$NON-NLS-1$ + public static final String REPRESENTATION_CLASS = "AddGenericResource.REPRESENTATION_CLASS"; //$NON-NLS-1$ + public static final String CONTAINER_REPRESENTATION_CLASS = "AddGenericResource.CONTAINER_REPRESENTATION_CLASS"; //$NON-NLS-1$ + public static final String CONTAINER_PATH = "AddGenericResource.CONTAINER_PATH"; //$NON-NLS-1$ + public static final String IN_CONTAINER_CLASS = "AddGenericResource.IN_CONTAINER_CLASS"; //$NON-NLS-1$ + public static final String ORIGINAL_CLASS_NAME = "AddGenericResource.ORIGINAL_CLASS_NAME"; //$NON-NLS-1$ + + @Override + public IDataModelOperation getDefaultOperation() { + return new AddWebClassOperation(getDataModel()) { + + @Override + protected NewJavaEEArtifactClassOperation getNewClassOperation() { + return new AddGenericResourceClassOperation(getDataModel()); + } + + @Override + protected void generateMetaData(IDataModel aModel, String qualifiedClassName) { + // for now, do nothing here - data model should be ok as is + } + }; + } + + /** + * Subclasses may extend this method to add their own data model's properties as valid base + * properties. + * + * @see org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider#getPropertyNames() + */ + @SuppressWarnings("unchecked") + @Override + public Set<String> getPropertyNames() { + // Add Resource specific properties defined in this data model + Set<String> propertyNames = super.getPropertyNames(); + + propertyNames.add(REPRESENTATION_CLASS); + propertyNames.add(MIME_TYPE); + propertyNames.add(CONTAINER_REPRESENTATION_CLASS); + propertyNames.add(CONTAINER_PATH); + propertyNames.add(PATH); + propertyNames.add(PATTERN); + propertyNames.add(IN_CONTAINER_CLASS); + propertyNames.add(ORIGINAL_CLASS_NAME); + + return propertyNames; + } + + /** + * Subclasses may extend this method to provide their own default values for any of the properties + * in the data model hierarchy. This method does not accept a null parameter. It may return null. + * + * @see NewJavaClassDataModelProvider#getDefaultProperty(String) + * @see IDataModelProvider#getDefaultProperty(String) + * + * @param propertyName + * @return Object default value of property + */ + @Override + public Object getDefaultProperty(String propertyName) { + if (REPRESENTATION_CLASS.equals(propertyName) || CONTAINER_REPRESENTATION_CLASS.equals(propertyName)) { + return "java.lang.String"; //$NON-NLS-1$ + } + + if (PATTERN.equals(propertyName)) { + return AddGenericResourceTemplateModel.SIMPLE_PATTERN; + } + + if (PATH.equals(propertyName)) { + return (isSimplePattern() ? "generic" : (isClientControlledPattern() ? "{name}" : "{id}")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + if (CONTAINER_PATH.equals(propertyName)) { + String className = getStringProperty(INewJavaClassDataModelProperties.CLASS_NAME); + if ((className != null) && (className.length() > 0)) { + return "/" + className.substring(0, 1).toLowerCase() + className.substring(1) + "s"; //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + if (IN_CONTAINER_CLASS.equals(propertyName)) { + return Boolean.FALSE; + } + + // Otherwise check super for default value for property + return super.getDefaultProperty(propertyName); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.jst.j2ee.internal.web.operations.NewWebClassDataModelProvider#isPropertyEnabled(java. + * lang.String) + */ + @Override + public boolean isPropertyEnabled(String propertyName) { + if (CONTAINER_REPRESENTATION_CLASS.equals(propertyName) || CONTAINER_PATH.equals(propertyName)) { + return !isSimplePattern(); + } + return super.isPropertyEnabled(propertyName); + } + + @Override + public IStatus validate(String propertyName) { + if (MIME_TYPE.equals(propertyName)) { + String value = (String) getProperty(MIME_TYPE); + if (value == null || value.trim().length() == 0) { + return PayaraServerPlugin.createErrorStatus( + Messages.errorMimeTypeMissing, null); + } + } + if (REPRESENTATION_CLASS.equals(propertyName)) { + return validateRepClass(REPRESENTATION_CLASS, Messages.errorRepresentationClassMissing, + Messages.errorRepresentationClassInvalid); + } + + if (PATH.equals(propertyName)) { + return validatePath((String) getProperty(PATH)); + } + + // these only need validation in the case of pattern != simple + if (isPropertyEnabled(propertyName)) { + if (CONTAINER_PATH.equals(propertyName)) { + String value = (String) getProperty(CONTAINER_PATH); + if (value == null || value.trim().length() == 0) { + return PayaraServerPlugin.createErrorStatus( + Messages.errorContainerPathMissing, null); + } + } + if (CONTAINER_REPRESENTATION_CLASS.equals(propertyName)) { + return validateRepClass(CONTAINER_REPRESENTATION_CLASS, Messages.errorContainerRepresentationClassMissing, + Messages.errorContainerRepresentationClassInvalid); + } + } + IStatus status = super.validate(propertyName); + return status; + } + + private boolean isSimplePattern() { + return AddGenericResourceTemplateModel.SIMPLE_PATTERN.equals(getStringProperty(PATTERN)); + } + + private boolean isClientControlledPattern() { + return AddGenericResourceTemplateModel.CLIENT_CONTAINER_PATTERN.equals(getStringProperty(PATTERN)); + } + + protected IStatus validateRepClass(String propertyName, String errorMessageKeyMissing, String errorMessageKeyInvalid) { + String value = (String) getProperty(propertyName); + if (value == null || value.trim().length() == 0) { + return PayaraServerPlugin.createErrorStatus(errorMessageKeyMissing, null); + } + // Check that unqualified class name is valid by standard java conventions + String className = value; + int index = value.lastIndexOf("."); //$NON-NLS-1$ + if (index != -1) { + className = value.substring(index + 1); + } + IStatus javaStatus = validateJavaClassName(className); + if (javaStatus.getSeverity() != IStatus.ERROR) { + // If the class does not exist, throw an error + IJavaProject javaProject = JavaCore.create(getTargetProject()); + IType type = null; + try { + type = javaProject.findType(value); + } catch (Exception e) { + // Just throw error below + } + if (type == null) { + return WTPCommonPlugin.createErrorStatus(errorMessageKeyInvalid); + } + return WTPCommonPlugin.OK_STATUS; + } + return javaStatus; + } + + private IStatus validatePath(String path) { + if (path == null || path.trim().length() == 0) { + return PayaraServerPlugin.createErrorStatus( + Messages.errorPathMissing, null); + } + if (!isSimplePattern()) { + StringTokenizer segments = new StringTokenizer(path, "/ "); //$NON-NLS-1$ + Set<String> pathParts = new HashSet<>(); + while (segments.hasMoreTokens()) { + String segment = segments.nextToken(); + if (segment.startsWith("{")) { //$NON-NLS-1$ + if (segment.length() > 2 && segment.endsWith("}")) { //$NON-NLS-1$ + String pathPart = segment.substring(1, segment.length() - 1); + IStatus javaStatus = JavaConventions.validateIdentifier(pathPart, + CompilerOptions.VERSION_1_3, CompilerOptions.VERSION_1_3); + if (javaStatus.getSeverity() == IStatus.ERROR) { + String msg = javaStatus.getMessage(); + return WTPCommonPlugin.createErrorStatus(msg); + } else if (javaStatus.getSeverity() == IStatus.WARNING) { + String msg = javaStatus.getMessage(); + return WTPCommonPlugin.createWarningStatus(msg); + } + if (pathParts.contains(pathPart)) { + return WTPCommonPlugin.createErrorStatus(Messages.errorPathInvalid); + } else { + pathParts.add(pathPart); + } + } else { + return WTPCommonPlugin.createErrorStatus(Messages.errorPathInvalid); + } + } else { + if (segment.contains("{") || segment.contains("}")) { //$NON-NLS-1$ //$NON-NLS-2$ + return WTPCommonPlugin.createErrorStatus(Messages.errorPathInvalid); + } + } + } + } + return WTPCommonPlugin.OK_STATUS; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceTemplateModel.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceTemplateModel.java new file mode 100644 index 00000000..e85f4a50 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceTemplateModel.java @@ -0,0 +1,238 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.rest.wizards; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; +import java.util.TreeSet; + +import org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties; +import org.eclipse.jst.j2ee.internal.web.operations.CreateWebClassTemplateModel; +import org.eclipse.wst.common.frameworks.datamodel.IDataModel; + +@SuppressWarnings("restriction") +public class AddGenericResourceTemplateModel extends CreateWebClassTemplateModel { + + public static final String QUALIFIED_CONTEXT = "javax.ws.rs.core.Context"; //$NON-NLS-1$ + public static final String QUALIFIED_URI_INFO = "javax.ws.rs.core.UriInfo"; //$NON-NLS-1$ + public static final String QUALIFIED_CONSUMES = "javax.ws.rs.Consumes"; //$NON-NLS-1$ + public static final String QUALIFIED_PUT = "javax.ws.rs.PUT"; //$NON-NLS-1$ + public static final String QUALIFIED_PATH = "javax.ws.rs.Path"; //$NON-NLS-1$ + public static final String QUALIFIED_GET = "javax.ws.rs.GET"; //$NON-NLS-1$ + public static final String QUALIFIED_DELETE = "javax.ws.rs.DELETE"; //$NON-NLS-1$ + public static final String QUALIFIED_PRODUCES = "javax.ws.rs.Produces"; //$NON-NLS-1$ + public static final String QUALIFIED_PATH_PARAM = "javax.ws.rs.PathParam"; //$NON-NLS-1$ + public static final String QUALIFIED_POST = "javax.ws.rs.POST"; //$NON-NLS-1$ + public static final String QUALIFIED_RESPONSE = "javax.ws.rs.core.Response"; //$NON-NLS-1$ + + protected static final String TYPE_APP_JSON = "application/json"; //$NON-NLS-1$ + protected static final String TYPE_APP_XML = "application/xml"; //$NON-NLS-1$ + protected static final String TYPE_TEXT_HTML = "text/html"; //$NON-NLS-1$ + protected static final String TYPE_TEXT_PLAIN = "text/plain"; //$NON-NLS-1$ + + protected static final String SUFFIX_JSON = "Json"; //$NON-NLS-1$ + protected static final String SUFFIX_XML = "Xml"; //$NON-NLS-1$ + protected static final String SUFFIX_HTML = "Html"; //$NON-NLS-1$ + protected static final String SUFFIX_TEXT = "Text"; //$NON-NLS-1$ + + protected static final String SIMPLE_PATTERN = "Simple"; //$NON-NLS-1$ + protected static final String CONTAINER_PATTERN = "Container"; //$NON-NLS-1$ + protected static final String CLIENT_CONTAINER_PATTERN = "Client"; //$NON-NLS-1$ + + private static final Map<String, String> typeToSuffix; + + static { + typeToSuffix = new HashMap<>(); + typeToSuffix.put(TYPE_APP_JSON, SUFFIX_JSON); + typeToSuffix.put(TYPE_APP_XML, SUFFIX_XML); + typeToSuffix.put(TYPE_TEXT_HTML, SUFFIX_HTML); + typeToSuffix.put(TYPE_TEXT_PLAIN, SUFFIX_TEXT); + } + + public AddGenericResourceTemplateModel(IDataModel dataModel) { + super(dataModel); + } + + @Override + public Collection<String> getImports() { + Collection<String> collection = super.getImports(); + boolean isContainerClass = isContainerClass(); + boolean isClientPattern = isClientControlledPattern(); + boolean usesContext = isSimplePattern() || isContainerClass; + + collection.add(QUALIFIED_CONSUMES); + collection.add(QUALIFIED_GET); + collection.add(QUALIFIED_PRODUCES); + + if (usesContext) { + collection.add(QUALIFIED_CONTEXT); + collection.add(QUALIFIED_URI_INFO); + collection.add(QUALIFIED_PATH); + } else { + collection.add(QUALIFIED_DELETE); + } + if (isContainerClass) { + if (!isClientPattern) { + collection.add(QUALIFIED_POST); + collection.add(QUALIFIED_RESPONSE); + } else { + collection.remove(QUALIFIED_CONSUMES); + } + if (getParamList() != null) { + collection.add(QUALIFIED_PATH_PARAM); + } + } else { + collection.add(QUALIFIED_PUT); + } + + // if repClass is not in java.lang, add an import for it as well + // actually, the return from super.getImports returns a collection which is + // smart enough to skip adding java.lang classes + String repPropName = (isContainerClass ? AddGenericResourceDataModelProvider.CONTAINER_REPRESENTATION_CLASS + : AddGenericResourceDataModelProvider.REPRESENTATION_CLASS); + String repClass = getProperty(repPropName); + + if (repClass != null) { + // so, this is all we should need to do + collection.add(repClass); + // however, ImportsCollection has a bug that also skips adding + // classes like java.lang.reflect.Method, so we need to do this as + // a workaround (for eclipse bug 294688) + int index = repClass.lastIndexOf("."); //$NON-NLS-1$ + if (index != -1) { + String packageName = repClass.substring(0, index); + if (repClass.startsWith("java.lang.") && //$NON-NLS-1$ + !packageName.equals("java.lang")) { //$NON-NLS-1$ + Collection<String> myCollection = new TreeSet<>(); + myCollection.addAll(collection); + myCollection.add(repClass); + return myCollection; + } + } // end workaround + } + + return collection; + } + + protected boolean isSimplePattern() { + String patternProp = getProperty(AddGenericResourceDataModelProvider.PATTERN); + return patternProp.equals(SIMPLE_PATTERN); + } + + protected boolean isClientControlledPattern() { + String patternProp = getProperty(AddGenericResourceDataModelProvider.PATTERN); + return patternProp.equals(CLIENT_CONTAINER_PATTERN); + } + + @Override + public String getProperty(String propertyName) { + return dataModel.getStringProperty(propertyName); + } + + protected String getMethodNameSuffixFromMimeType() { + String mimeType = getProperty(AddGenericResourceDataModelProvider.MIME_TYPE); + + return ((mimeType != null) ? typeToSuffix.get(mimeType) : null); + } + + protected String getUnqualifiedRepresentationClass() { + return getUnqualifiedRepresentationClass(AddGenericResourceDataModelProvider.REPRESENTATION_CLASS); + } + + protected String getUnqualifiedContainerRepresentationClass() { + return getUnqualifiedRepresentationClass(AddGenericResourceDataModelProvider.CONTAINER_REPRESENTATION_CLASS); + } + + protected String getUnqualifiedRepresentationClass(String propertyName) { + String repClass = getProperty(propertyName); + + if (repClass != null) { + int index = repClass.lastIndexOf("."); //$NON-NLS-1$ + if (index != -1) { + return repClass.substring(index + 1); + } + } + return null; + } + + // assumes that it has passed validation + protected String[] getParamList() { + if (!isSimplePattern()) { + String path = getProperty(AddGenericResourceDataModelProvider.PATH); + StringTokenizer segments = new StringTokenizer(path, "/ "); //$NON-NLS-1$ + List<String> pathParts = new ArrayList<>(); + while (segments.hasMoreTokens()) { + String segment = segments.nextToken(); + if (segment.startsWith("{")) { //$NON-NLS-1$ + if (segment.length() > 2 && segment.endsWith("}")) { //$NON-NLS-1$ + pathParts.add(segment.substring(1, segment.length() - 1)); + } + } + } + return (pathParts.isEmpty() ? null : (String[]) pathParts.toArray(new String[] {})); + } + return null; + } + + protected String getCommaSeparatedParamList() { + return buildCommaSeparatedParamList(null); + } + + protected String getCommaSeparatedParamListWithTypes() { + return buildCommaSeparatedParamList("String"); //$NON-NLS-1$ + } + + private String buildCommaSeparatedParamList(String additionalString) { + String[] paramList = getParamList(); + StringBuilder buffer = new StringBuilder(); + + if (paramList != null) { + int count = paramList.length; + + for (int i = 0; i < count; i++) { + String string = paramList[i]; + if (additionalString != null) { + buffer.append(additionalString); + buffer.append(" "); //$NON-NLS-1$ + } + buffer.append(string); + if (i < count - 1) { + buffer.append(", "); //$NON-NLS-1$ + } + } + return buffer.toString(); + } + return null; + } + + protected void setIsContainerClass() { + String existingClassName = getProperty(INewJavaClassDataModelProperties.CLASS_NAME); + dataModel.setBooleanProperty(AddGenericResourceDataModelProvider.IN_CONTAINER_CLASS, Boolean.TRUE); + dataModel.setProperty(INewJavaClassDataModelProperties.CLASS_NAME, existingClassName + CONTAINER_PATTERN); + dataModel.setProperty(AddGenericResourceDataModelProvider.ORIGINAL_CLASS_NAME, existingClassName); + } + + private boolean isContainerClass() { + return dataModel.getBooleanProperty(AddGenericResourceDataModelProvider.IN_CONTAINER_CLASS); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceWizard.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceWizard.java new file mode 100644 index 00000000..e475381b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceWizard.java @@ -0,0 +1,111 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.rest.wizards; + +import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.JAVA_PACKAGE; +import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.PROJECT; + +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jst.j2ee.internal.plugin.J2EEEditorUtility; +import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants; +import org.eclipse.jst.servlet.ui.internal.plugin.ServletUIPlugin; +import org.eclipse.jst.servlet.ui.internal.wizard.NewWebArtifactWizard; +import org.eclipse.wst.common.frameworks.datamodel.IDataModel; +import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider; + +@SuppressWarnings("restriction") +public class AddGenericResourceWizard extends NewWebArtifactWizard { + + public AddGenericResourceWizard() { + this(null); + } + + public AddGenericResourceWizard(IDataModel model) { + super(model); + setWindowTitle(Messages.genericResourceWizardTitle); + } + + @Override + protected void doAddPages() { + AddGenericResourceWizardPage page1 = new AddGenericResourceWizardPage(getDataModel(), + "page1", Messages.genericResourceWizardDescription, //$NON-NLS-1$ + Messages.genericResourceWizardTitle, IJ2EEFacetConstants.DYNAMIC_WEB); + addPage(page1); + } + + @Override + protected IDataModelProvider getDefaultProvider() { + return new AddGenericResourceDataModelProvider(); + } + + @Override + protected ImageDescriptor getImage() { + // TODO Auto-generated method stub + return null; + } + + @Override + protected String getTitle() { + return Messages.genericResourceWizardTitle; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard#postPerformFinish() + */ + @Override + protected void postPerformFinish() throws InvocationTargetException { + openJavaClass(); + super.postPerformFinish(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.servlet.ui.internal.wizard.NewWebArtifactWizard#openJavaClass() + */ + @Override + protected void openJavaClass() { + IDataModel model = getDataModel(); + if (model.getBooleanProperty(AddGenericResourceDataModelProvider.IN_CONTAINER_CLASS)) { + try { + String className = model.getStringProperty(AddGenericResourceDataModelProvider.ORIGINAL_CLASS_NAME); + String packageName = model.getStringProperty(JAVA_PACKAGE); + + if (packageName != null && packageName.trim().length() > 0) { + className = packageName + "." + className; //$NON-NLS-1$ + } + + IProject p = (IProject) model.getProperty(PROJECT); + IJavaProject javaProject = J2EEEditorUtility.getJavaProject(p); + IFile file = (IFile) javaProject.findType(className).getResource(); + openEditor(file); + } catch (Exception cantOpen) { + ServletUIPlugin.log(cantOpen); + } + } + super.openJavaClass(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceWizardPage.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceWizardPage.java new file mode 100644 index 00000000..0bc47dc1 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceWizardPage.java @@ -0,0 +1,336 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.rest.wizards; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.resources.IProject; +import org.eclipse.jdt.core.IPackageFragmentRoot; +import org.eclipse.jdt.core.IType; +import org.eclipse.jdt.core.search.IJavaSearchConstants; +import org.eclipse.jdt.core.search.IJavaSearchScope; +import org.eclipse.jdt.internal.ui.dialogs.FilteredTypesSelectionDialog; +import org.eclipse.jface.window.Window; +import org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties; +import org.eclipse.jst.j2ee.internal.dialogs.TypeSearchEngine; +import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages; +import org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties; +import org.eclipse.jst.jee.ui.internal.navigator.web.WebAppProvider; +import org.eclipse.jst.servlet.ui.internal.wizard.NewWebClassWizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent; +import org.eclipse.wst.common.frameworks.datamodel.IDataModel; + +import fish.payara.eclipse.tools.server.utils.WizardUtil; + +@SuppressWarnings("restriction") +public class AddGenericResourceWizardPage extends NewWebClassWizardPage { + + private Combo patternTypeCombo; + private Text pathText; + private Combo mimeTypeCombo; + private Text repText; + private Text containerRepText; + private Button containerRepButton; + private Text containerPathText; + + private static final Map<String, String> patternStringToObject; + + static { + patternStringToObject = new HashMap<>(); + patternStringToObject.put(Messages.patternTypeSimpleValue, AddGenericResourceTemplateModel.SIMPLE_PATTERN); + patternStringToObject.put(Messages.patternTypeContainerValue, AddGenericResourceTemplateModel.CONTAINER_PATTERN); + patternStringToObject.put(Messages.patternTypeClientContainerValue, AddGenericResourceTemplateModel.CLIENT_CONTAINER_PATTERN); + } + + public AddGenericResourceWizardPage(IDataModel model, String pageName, + String pageDesc, String pageTitle, String moduleType) { + super(model, pageName, pageDesc, pageTitle, moduleType); + } + + @Override + protected Composite createTopLevelComposite(Composite parent) { + Composite composite = super.createTopLevelComposite(parent); + Label typeLabel = new Label(composite, SWT.NONE); + GridData data = new GridData(); + + typeLabel.setText(Messages.patternTypeLabel); + typeLabel.setLayoutData(data); + patternTypeCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 1; + patternTypeCombo.setLayoutData(data); + patternTypeCombo.addSelectionListener(new SelectionListener() { + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void widgetSelected(SelectionEvent e) { + Combo combo = (Combo) e.getSource(); + String patternName = combo.getItem(combo.getSelectionIndex()); + String patternObject = patternStringToObject.get(patternName); + + model.setProperty(AddGenericResourceDataModelProvider.PATTERN, + patternObject); + model.setProperty(AddGenericResourceDataModelProvider.PATH, + model.getDefaultProperty(AddGenericResourceDataModelProvider.PATH)); + model.notifyPropertyChange(AddGenericResourceDataModelProvider.PATTERN, DataModelEvent.ENABLE_CHG); + updateEnablementFromPattern(); + validatePage(); + } + + }); + new Label(composite, SWT.NONE); // placeholder so layout is correct + + typeLabel = new Label(composite, SWT.NONE); + typeLabel.setText(Messages.pathLabel); + data = new GridData(); + typeLabel.setLayoutData(data); + pathText = new Text(composite, SWT.SINGLE | SWT.BORDER); + pathText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + synchHelper.synchText(pathText, AddGenericResourceDataModelProvider.PATH, null); + new Label(composite, SWT.NONE); // placeholder so layout is correct + + typeLabel = new Label(composite, SWT.NONE); + typeLabel.setText(Messages.mimeTypeLabel); + data = new GridData(); + typeLabel.setLayoutData(data); + mimeTypeCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY); + data = new GridData(GridData.FILL_HORIZONTAL); + data.widthHint = 300; + data.horizontalSpan = 1; + mimeTypeCombo.setLayoutData(data); + synchHelper.synchCombo(mimeTypeCombo, + AddGenericResourceDataModelProvider.MIME_TYPE, null); + populateCombos(); + new Label(composite, SWT.NONE); // placeholder so layout is correct + + addRepresentationClassGroup(composite); + addContainerRepresentationClassGroup(composite); + + typeLabel = new Label(composite, SWT.NONE); + typeLabel.setText(Messages.containerPathLabel); + data = new GridData(); + typeLabel.setLayoutData(data); + containerPathText = new Text(composite, SWT.SINGLE | SWT.BORDER); + containerPathText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + synchHelper.synchText(containerPathText, AddGenericResourceDataModelProvider.CONTAINER_PATH, null); + classText.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + model.setProperty(AddGenericResourceDataModelProvider.CONTAINER_PATH, + model.getDefaultProperty(AddGenericResourceDataModelProvider.CONTAINER_PATH)); + } + }); + + // remove entire existing class section + hideControl(existingClassButton); + hideControl(existingClassLabel); + hideControl(existingClassText); + hideControl(existingButton); + + updateEnablementFromPattern(); + + return composite; + } + + /** + * Add representation class group to the composite + */ + private void addRepresentationClassGroup(Composite composite) { + repText = addRepresentationClassLabelAndTextGroup(composite, Messages.representationClassLabel, + AddGenericResourceDataModelProvider.REPRESENTATION_CLASS); + addRepresentationClassButton(composite, Messages.representationClassDialogTitle, + Messages.representationClassDialogLabel, repText); + } + + /** + * Add container representation class group to the composite + */ + private void addContainerRepresentationClassGroup(Composite composite) { + containerRepText = addRepresentationClassLabelAndTextGroup(composite, Messages.containerRepresentationClassLabel, + AddGenericResourceDataModelProvider.CONTAINER_REPRESENTATION_CLASS); + containerRepButton = addRepresentationClassButton(composite, Messages.containerRepresentationClassDialogTitle, + Messages.containerRepresentationClassDialogLabel, containerRepText); + } + + /** + * Utility method for adding representation class groups + */ + private Text addRepresentationClassLabelAndTextGroup(Composite composite, String repLabelString, String propertyName) { + Label repLabel = new Label(composite, SWT.LEFT); + repLabel.setText(repLabelString); + repLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); + + Text repTextField = new Text(composite, SWT.SINGLE | SWT.BORDER); + repTextField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + synchHelper.synchText(repTextField, propertyName, null); + + return repTextField; + } + + /** + * Utility method for adding representation class groups + */ + private Button addRepresentationClassButton(Composite composite, final String dialogTitle, final String dialogLabel, + final Text repTextField) { + Button repButton = new Button(composite, SWT.PUSH); + repButton.setText(J2EEUIMessages.BROWSE_BUTTON_LABEL); + repButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); + repButton.addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent e) { + handleRepButtonPressed(dialogTitle, dialogLabel, repTextField); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + // Do nothing + } + }); + return repButton; + } + + protected void handleRepButtonPressed(String dialogTitle, String dialogLabel, Text repTextField) { + getControl().setCursor(new Cursor(getShell().getDisplay(), SWT.CURSOR_WAIT)); + IPackageFragmentRoot packRoot = (IPackageFragmentRoot) model + .getProperty(INewJavaClassDataModelProperties.JAVA_PACKAGE_FRAGMENT_ROOT); + if (packRoot == null) { + return; + } + + // this eliminates the non-exported classpath entries + final IJavaSearchScope scope = TypeSearchEngine.createJavaSearchScopeForAProject(packRoot.getJavaProject(), true, true); + + FilteredTypesSelectionDialog dialog = new FilteredTypesSelectionDialog(getShell(), false, getWizard().getContainer(), scope, + IJavaSearchConstants.CLASS); + dialog.setTitle(dialogTitle); + dialog.setMessage(dialogLabel); + + if (dialog.open() == Window.OK) { + IType type = (IType) dialog.getFirstResult(); + String repClassFullPath = J2EEUIMessages.EMPTY_STRING; + if (type != null) { + repClassFullPath = type.getFullyQualifiedName(); + } + repTextField.setText(repClassFullPath); + getControl().setCursor(null); + return; + } + getControl().setCursor(null); + } + + private void updateEnablementFromPattern() { + boolean enableExtras = !model.getProperty(AddGenericResourceDataModelProvider.PATTERN).equals( + AddGenericResourceTemplateModel.SIMPLE_PATTERN); + + containerPathText.setEnabled(enableExtras); + containerRepText.setEnabled(enableExtras); + containerRepButton.setEnabled(enableExtras); + } + + private void populateCombos() { + mimeTypeCombo.add(AddGenericResourceTemplateModel.TYPE_APP_XML); + mimeTypeCombo.add(AddGenericResourceTemplateModel.TYPE_APP_JSON); + mimeTypeCombo.add(AddGenericResourceTemplateModel.TYPE_TEXT_PLAIN); + mimeTypeCombo.add(AddGenericResourceTemplateModel.TYPE_TEXT_HTML); + mimeTypeCombo.select(0); + + patternTypeCombo.add(Messages.patternTypeSimpleValue); + patternTypeCombo.add(Messages.patternTypeContainerValue); + patternTypeCombo.add(Messages.patternTypeClientContainerValue); + patternTypeCombo.select(0); + } + + @Override + protected String[] getValidationPropertyNames() { + String[] base = super.getValidationPropertyNames(); + String[] result = new String[base.length + 5]; + System.arraycopy(base, 0, result, 0, base.length); + result[base.length] = AddGenericResourceDataModelProvider.PATH; + result[base.length + 1] = AddGenericResourceDataModelProvider.MIME_TYPE; + result[base.length + 2] = AddGenericResourceDataModelProvider.REPRESENTATION_CLASS; + result[base.length + 3] = AddGenericResourceDataModelProvider.CONTAINER_REPRESENTATION_CLASS; + result[base.length + 4] = AddGenericResourceDataModelProvider.CONTAINER_PATH; + + return result; + } + + @Override + protected boolean isProjectValid(IProject project) { + if (super.isProjectValid(project)) { + return WizardUtil.hasGF3Runtime(project); + } + return false; + } + + @Override + protected IProject getExtendedSelectedProject(Object selection) { + if (selection instanceof WebAppProvider) { + return ((WebAppProvider) selection).getProject(); + } + + return super.getExtendedSelectedProject(selection); + } + + @Override + protected String getUseExistingCheckboxText() { + // this is for the existing class browse button, which we have hidden + return "Unused"; //$NON-NLS-1$ + } + + @Override + protected String getUseExistingProperty() { + // this is for the existing class browse button, which we have hidden + return INewWebClassDataModelProperties.USE_EXISTING_CLASS; + } + + @Override + protected void handleClassButtonSelected() { + // this is for the existing class browse button, which we have hidden + } + + private void hideControl(Control control) { + if (control != null) { + control.setVisible(false); + GridData data = new GridData(); + data.exclude = true; + data.horizontalSpan = 2; + data.horizontalAlignment = SWT.FILL; + control.setLayoutData(data); + } + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/ContainerResourceTemplate.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/ContainerResourceTemplate.java new file mode 100644 index 00000000..141959e8 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/ContainerResourceTemplate.java @@ -0,0 +1,367 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.rest.wizards; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.jst.j2ee.internal.common.operations.Constructor; +import org.eclipse.jst.j2ee.internal.common.operations.CreateJavaEEArtifactTemplateModel; +import org.eclipse.jst.j2ee.internal.common.operations.Method; + +/* + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sun Microsystems + * Oracle + */ + +@SuppressWarnings("restriction") +public class ContainerResourceTemplate { + static String nl; + + public static synchronized ContainerResourceTemplate create(String lineSeparator) { + nl = lineSeparator; + ContainerResourceTemplate result = new ContainerResourceTemplate(); + nl = null; + return result; + } + + public static final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; + protected static final String TEXT_1 = "package "; + protected static final String TEXT_2 = ";"; + protected static final String TEXT_3 = NL; + protected static final String TEXT_4 = NL + "import "; + protected static final String TEXT_5 = ";"; + protected static final String TEXT_6 = NL + NL + "@Path(\""; + protected static final String TEXT_7 = "\")"; + protected static final String TEXT_8 = NL + "public "; + protected static final String TEXT_9 = "abstract "; + protected static final String TEXT_10 = "final "; + protected static final String TEXT_11 = "class "; + protected static final String TEXT_12 = " extends "; + protected static final String TEXT_13 = " implements "; + protected static final String TEXT_14 = ", "; + protected static final String TEXT_15 = " {"; + protected static final String TEXT_16 = NL + " @SuppressWarnings(\"unused\")"; + protected static final String TEXT_17 = NL + " @Context" + NL + " private UriInfo context;"; + protected static final String TEXT_18 = NL + NL + " /**" + NL + " * Default constructor. " + NL + " */" + NL + " public "; + protected static final String TEXT_19 = "() {" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; + protected static final String TEXT_20 = NL + " " + NL + " /**" + NL + " * @see "; + protected static final String TEXT_21 = "#"; + protected static final String TEXT_22 = "("; + protected static final String TEXT_23 = ")" + NL + " */" + NL + " public "; + protected static final String TEXT_24 = "("; + protected static final String TEXT_25 = ") {" + NL + " super("; + protected static final String TEXT_26 = ");" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; + protected static final String TEXT_27 = NL + NL + "\t/**" + NL + " * @see "; + protected static final String TEXT_28 = "#"; + protected static final String TEXT_29 = "("; + protected static final String TEXT_30 = ")" + NL + " */" + NL + " public "; + protected static final String TEXT_31 = " "; + protected static final String TEXT_32 = "("; + protected static final String TEXT_33 = ") {" + NL + " // TODO Auto-generated method stub"; + protected static final String TEXT_34 = NL + "\t\t\treturn "; + protected static final String TEXT_35 = ";"; + protected static final String TEXT_36 = NL + " }"; + protected static final String TEXT_37 = NL + NL + " /**" + NL + " * Retrieves representation of an instance of "; + protected static final String TEXT_38 = NL + " * @return an instance of "; + protected static final String TEXT_39 = NL + " */" + NL + " @GET" + NL + " @Produces(\""; + protected static final String TEXT_40 = "\")" + NL + " public "; + protected static final String TEXT_41 = " get"; + protected static final String TEXT_42 = "() {" + NL + " // TODO return proper representation object" + NL + + " throw new UnsupportedOperationException();" + NL + " }" + NL; + protected static final String TEXT_43 = NL + " /**" + NL + " * POST method for creating an instance of "; + protected static final String TEXT_44 = NL + " * @param content representation for the new resource" + NL + + " * @return an HTTP response with content of the created resource" + NL + " */" + NL + " @POST" + NL + + " @Consumes(\""; + protected static final String TEXT_45 = "\")" + NL + " @Produces(\""; + protected static final String TEXT_46 = "\")" + NL + " public Response post"; + protected static final String TEXT_47 = "("; + protected static final String TEXT_48 = " content) {" + NL + " // TODO" + NL + + " return Response.created(context.getAbsolutePath()).build();" + NL + " }" + NL; + protected static final String TEXT_49 = NL + "\t/**" + NL + " * Sub-resource locator method for "; + protected static final String TEXT_50 = NL + " */" + NL + " @Path(\""; + protected static final String TEXT_51 = "\")" + NL + " public "; + protected static final String TEXT_52 = " get"; + protected static final String TEXT_53 = "("; + protected static final String TEXT_54 = ") {" + NL + " return "; + protected static final String TEXT_55 = ".getInstance("; + protected static final String TEXT_56 = ");" + NL + " }" + NL + "}"; + + public String generate(Object argument) { + final StringBuilder stringBuffer = new StringBuilder(); + + AddGenericResourceTemplateModel model = (AddGenericResourceTemplateModel) argument; + String containerRepresentationClass = model.getUnqualifiedContainerRepresentationClass(); + String mimeType = model.getProperty(AddGenericResourceDataModelProvider.MIME_TYPE).trim(); + String path = model.getProperty(AddGenericResourceDataModelProvider.PATH).trim(); + String containerPath = model.getProperty(AddGenericResourceDataModelProvider.CONTAINER_PATH).trim(); + String methodNameFromMimeType = model.getMethodNameSuffixFromMimeType(); + String originalClassName = model.getProperty(AddGenericResourceDataModelProvider.ORIGINAL_CLASS_NAME).trim(); + String[] paramListStrings = model.getParamList(); + String paramList = model.getCommaSeparatedParamList(); + boolean hasParam = (paramListStrings != null); + String paramListNoTypes = (hasParam ? paramList : ""); + StringBuilder pathParams = new StringBuilder(); + boolean isClientPattern = model.isClientControlledPattern(); + + if (hasParam) { + for (int i = 0; i < paramListStrings.length; i++) { + pathParams.append("@PathParam(\"" + paramListStrings[i] + "\") String " + paramListStrings[i]); + if (i < paramListStrings.length - 1) { + pathParams.append(", "); + } + } + } + + /* + * This Content is provided under the terms and conditions of the Eclipse Public License Version 1.0 + * ("EPL"). A copy of the EPL is available at http://www.eclipse.org/org/documents/epl-v10.php For + * purposes of the EPL, "Program" will mean the Content. + * + * Copied from org.eclipse.jst.j2ee.ejb plugin. + */ + + model.removeFlags(CreateJavaEEArtifactTemplateModel.FLAG_QUALIFIED_SUPERCLASS_NAME); + + /* + * This Content is provided under the terms and conditions of the Eclipse Public License Version 1.0 + * ("EPL"). A copy of the EPL is available at http://www.eclipse.org/org/documents/epl-v10.php For + * purposes of the EPL, "Program" will mean the Content. + * + * Copied from org.eclipse.jst.j2ee.ejb plugin. + */ + + if (model.getJavaPackageName() != null && model.getJavaPackageName().length() > 0) { + + stringBuffer.append(TEXT_1); + stringBuffer.append(model.getJavaPackageName()); + stringBuffer.append(TEXT_2); + + } + + stringBuffer.append(TEXT_3); + /* + * This Content is provided under the terms and conditions of the Eclipse Public License Version 1.0 + * ("EPL"). A copy of the EPL is available at http://www.eclipse.org/org/documents/epl-v10.php For + * purposes of the EPL, "Program" will mean the Content. + * + * Copied from org.eclipse.jst.j2ee.ejb plugin. + */ + + Collection<String> imports = model.getImports(); + for (String anImport : imports) { + + stringBuffer.append(TEXT_4); + stringBuffer.append(anImport); + stringBuffer.append(TEXT_5); + + } + + stringBuffer.append(TEXT_6); + stringBuffer.append(containerPath); + stringBuffer.append(TEXT_7); + /* + * This Content is provided under the terms and conditions of the Eclipse Public License Version 1.0 + * ("EPL"). A copy of the EPL is available at http://www.eclipse.org/org/documents/epl-v10.php For + * purposes of the EPL, "Program" will mean the Content. + * + * Copied from org.eclipse.jst.j2ee.ejb plugin. + */ + + if (model.isPublic()) { + + stringBuffer.append(TEXT_8); + + } + + if (model.isAbstract()) { + + stringBuffer.append(TEXT_9); + + } + + if (model.isFinal()) { + + stringBuffer.append(TEXT_10); + + } + + stringBuffer.append(TEXT_11); + stringBuffer.append(model.getClassName()); + + String superClass = model.getSuperclassName(); + if (superClass != null && superClass.length() > 0) { + + stringBuffer.append(TEXT_12); + stringBuffer.append(superClass); + + } + + List<String> interfaces = model.getInterfaces(); + if (interfaces.size() > 0) { + + stringBuffer.append(TEXT_13); + + } + + for (int i = 0; i < interfaces.size(); i++) { + String INTERFACE = interfaces.get(i); + if (i > 0) { + + stringBuffer.append(TEXT_14); + + } + + stringBuffer.append(INTERFACE); + + } + + stringBuffer.append(TEXT_15); + if (isClientPattern) { + stringBuffer.append(TEXT_16); + } + stringBuffer.append(TEXT_17); + /* + * This Content is provided under the terms and conditions of the Eclipse Public License Version 1.0 + * ("EPL"). A copy of the EPL is available at http://www.eclipse.org/org/documents/epl-v10.php For + * purposes of the EPL, "Program" will mean the Content. + * + * Copied from org.eclipse.jst.j2ee.ejb plugin. + */ + + if (!model.hasEmptySuperclassConstructor()) { + + stringBuffer.append(TEXT_18); + stringBuffer.append(model.getClassName()); + stringBuffer.append(TEXT_19); + + } + + if (model.shouldGenSuperclassConstructors()) { + List<Constructor> constructors = model.getConstructors(); + for (Constructor constructor : constructors) { + if (constructor.isPublic() || constructor.isProtected()) { + + stringBuffer.append(TEXT_20); + stringBuffer.append(model.getSuperclassName()); + stringBuffer.append(TEXT_21); + stringBuffer.append(model.getSuperclassName()); + stringBuffer.append(TEXT_22); + stringBuffer.append(constructor.getParamsForJavadoc()); + stringBuffer.append(TEXT_23); + stringBuffer.append(model.getClassName()); + stringBuffer.append(TEXT_24); + stringBuffer.append(constructor.getParamsForDeclaration()); + stringBuffer.append(TEXT_25); + stringBuffer.append(constructor.getParamsForCall()); + stringBuffer.append(TEXT_26); + + } + } + } + + /* + * This Content is provided under the terms and conditions of the Eclipse Public License Version 1.0 + * ("EPL"). A copy of the EPL is available at http://www.eclipse.org/org/documents/epl-v10.php For + * purposes of the EPL, "Program" will mean the Content. + * + * Copied from org.eclipse.jst.j2ee.ejb plugin. + */ + + if (model.shouldImplementAbstractMethods()) { + for (Method method : model.getUnimplementedMethods()) { + + stringBuffer.append(TEXT_27); + stringBuffer.append(method.getContainingJavaClass()); + stringBuffer.append(TEXT_28); + stringBuffer.append(method.getName()); + stringBuffer.append(TEXT_29); + stringBuffer.append(method.getParamsForJavadoc()); + stringBuffer.append(TEXT_30); + stringBuffer.append(method.getReturnType()); + stringBuffer.append(TEXT_31); + stringBuffer.append(method.getName()); + stringBuffer.append(TEXT_32); + stringBuffer.append(method.getParamsForDeclaration()); + stringBuffer.append(TEXT_33); + + String defaultReturnValue = method.getDefaultReturnValue(); + if (defaultReturnValue != null) { + + stringBuffer.append(TEXT_34); + stringBuffer.append(defaultReturnValue); + stringBuffer.append(TEXT_35); + + } + + stringBuffer.append(TEXT_36); + + } + } + + stringBuffer.append(TEXT_37); + stringBuffer.append(model.getClassName()); + stringBuffer.append(TEXT_38); + stringBuffer.append(containerRepresentationClass); + stringBuffer.append(TEXT_39); + stringBuffer.append(mimeType); + stringBuffer.append(TEXT_40); + stringBuffer.append(containerRepresentationClass); + stringBuffer.append(TEXT_41); + stringBuffer.append(methodNameFromMimeType); + stringBuffer.append(TEXT_42); + if (!isClientPattern) { + stringBuffer.append(TEXT_43); + stringBuffer.append(originalClassName); + stringBuffer.append(TEXT_44); + stringBuffer.append(mimeType); + stringBuffer.append(TEXT_45); + stringBuffer.append(mimeType); + stringBuffer.append(TEXT_46); + stringBuffer.append(methodNameFromMimeType); + stringBuffer.append(TEXT_47); + stringBuffer.append(model.getUnqualifiedRepresentationClass()); + stringBuffer.append(TEXT_48); + } + stringBuffer.append(TEXT_49); + stringBuffer.append(path); + stringBuffer.append(TEXT_50); + stringBuffer.append(path); + stringBuffer.append(TEXT_51); + stringBuffer.append(originalClassName); + stringBuffer.append(TEXT_52); + stringBuffer.append(originalClassName); + stringBuffer.append(TEXT_53); + stringBuffer.append(pathParams); + stringBuffer.append(TEXT_54); + stringBuffer.append(originalClassName); + stringBuffer.append(TEXT_55); + stringBuffer.append(paramListNoTypes); + stringBuffer.append(TEXT_56); + return stringBuffer.toString(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/GenericResourceTemplate.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/GenericResourceTemplate.java new file mode 100644 index 00000000..e3f5d863 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/GenericResourceTemplate.java @@ -0,0 +1,394 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.rest.wizards; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.jst.j2ee.internal.common.operations.Constructor; +import org.eclipse.jst.j2ee.internal.common.operations.CreateJavaEEArtifactTemplateModel; +import org.eclipse.jst.j2ee.internal.common.operations.Method; + +/* + * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sun Microsystems + * Oracle + */ + +@SuppressWarnings("restriction") +public class GenericResourceTemplate { + protected static String nl; + + public static synchronized GenericResourceTemplate create(String lineSeparator) { + nl = lineSeparator; + GenericResourceTemplate result = new GenericResourceTemplate(); + nl = null; + return result; + } + + public static final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; + protected static final String TEXT_1 = "package "; + protected static final String TEXT_2 = ";"; + protected static final String TEXT_3 = NL; + protected static final String TEXT_4 = NL + "import "; + protected static final String TEXT_5 = ";"; + protected static final String TEXT_6 = NL; + protected static final String TEXT_7 = NL + "@Path(\""; + protected static final String TEXT_8 = "\")"; + protected static final String TEXT_9 = NL + "public "; + protected static final String TEXT_10 = "abstract "; + protected static final String TEXT_11 = "final "; + protected static final String TEXT_12 = "class "; + protected static final String TEXT_13 = " extends "; + protected static final String TEXT_14 = " implements "; + protected static final String TEXT_15 = ", "; + protected static final String TEXT_16 = " {"; + protected static final String TEXT_17 = NL + " @SuppressWarnings(\"unused\")" + NL + " @Context" + NL + + " private UriInfo context;"; + protected static final String TEXT_18 = NL + "\t@SuppressWarnings(\"unused\")" + NL + "\tprivate String "; + protected static final String TEXT_19 = ";" + NL; + protected static final String TEXT_20 = NL + " /** Creates a new instance of "; + protected static final String TEXT_21 = " */" + NL + " private "; + protected static final String TEXT_22 = "("; + protected static final String TEXT_23 = ") {" + NL + "\t\t"; + protected static final String TEXT_24 = NL + " }"; + protected static final String TEXT_25 = NL + NL + " /**" + NL + " * Default constructor. " + NL + " */" + NL + " public "; + protected static final String TEXT_26 = "() {" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; + protected static final String TEXT_27 = NL + " " + NL + " /**" + NL + " * @see "; + protected static final String TEXT_28 = "#"; + protected static final String TEXT_29 = "("; + protected static final String TEXT_30 = ")" + NL + " */" + NL + " public "; + protected static final String TEXT_31 = "("; + protected static final String TEXT_32 = ") {" + NL + " super("; + protected static final String TEXT_33 = ");" + NL + " // TODO Auto-generated constructor stub" + NL + " }"; + protected static final String TEXT_34 = NL + NL + "\t/**" + NL + " * @see "; + protected static final String TEXT_35 = "#"; + protected static final String TEXT_36 = "("; + protected static final String TEXT_37 = ")" + NL + " */" + NL + " public "; + protected static final String TEXT_38 = " "; + protected static final String TEXT_39 = "("; + protected static final String TEXT_40 = ") {" + NL + " // TODO Auto-generated method stub"; + protected static final String TEXT_41 = NL + "\t\t\treturn "; + protected static final String TEXT_42 = ";"; + protected static final String TEXT_43 = NL + " }"; + protected static final String TEXT_44 = NL + NL + " /** Get instance of the "; + protected static final String TEXT_45 = " */" + NL + " public static "; + protected static final String TEXT_46 = " getInstance("; + protected static final String TEXT_47 = ") {" + NL + " // The user may use some kind of persistence mechanism" + NL + + " // to store and restore instances of "; + protected static final String TEXT_48 = " class." + NL + " return new "; + protected static final String TEXT_49 = "("; + protected static final String TEXT_50 = ");" + NL + " }"; + protected static final String TEXT_51 = NL + NL + " /**" + NL + " * Retrieves representation of an instance of "; + protected static final String TEXT_52 = NL + " * @return an instance of "; + protected static final String TEXT_53 = NL + " */" + NL + " @GET" + NL + " @Produces(\""; + protected static final String TEXT_54 = "\")" + NL + " public "; + protected static final String TEXT_55 = " get"; + protected static final String TEXT_56 = "() {" + NL + " // TODO return proper representation object" + NL + + " throw new UnsupportedOperationException();" + NL + " }" + NL + "" + NL + " /**" + NL + + " * PUT method for updating or creating an instance of "; + protected static final String TEXT_57 = NL + " * @param content representation for the resource" + NL + + " * @return an HTTP response with content of the updated or created resource." + NL + " */" + NL + " @PUT" + NL + + " @Consumes(\""; + protected static final String TEXT_58 = "\")" + NL + " public void put"; + protected static final String TEXT_59 = "("; + protected static final String TEXT_60 = " content) {" + NL + " }" + NL; + protected static final String TEXT_61 = NL + " /**" + NL + " * DELETE method for resource "; + protected static final String TEXT_62 = NL + " */" + NL + " @DELETE" + NL + " public void delete() {" + NL + " }"; + protected static final String TEXT_63 = NL + "}"; + + public String generate(Object argument) { + final StringBuilder stringBuffer = new StringBuilder(); + + AddGenericResourceTemplateModel model = (AddGenericResourceTemplateModel) argument; + String representationClass = model.getUnqualifiedRepresentationClass(); + String mimeType = model.getProperty(AddGenericResourceDataModelProvider.MIME_TYPE).trim(); + String path = model.getProperty(AddGenericResourceDataModelProvider.PATH).trim(); + String methodNameFromMimeType = model.getMethodNameSuffixFromMimeType(); + boolean isSimplePattern = model.isSimplePattern(); + String[] paramListStrings = model.getParamList(); + String paramList = model.getCommaSeparatedParamList(); + boolean hasParam = (paramListStrings != null); + String paramListNoTypes = (hasParam ? paramList : ""); + String paramListWithTypes = (hasParam ? model.getCommaSeparatedParamListWithTypes() : ""); + final StringBuilder assignmentStmts = new StringBuilder(); + + if (hasParam) { + for (int i = 0; i < paramListStrings.length; i++) { + assignmentStmts.append("this.").append(paramListStrings[i]).append(" = ").append(paramListStrings[i]).append(';'); + if (i < paramListStrings.length - 1) { + assignmentStmts.append("\n "); + } + } + } + + /* + * This Content is provided under the terms and conditions of the Eclipse Public License Version 1.0 + * ("EPL"). A copy of the EPL is available at http://www.eclipse.org/org/documents/epl-v10.php For + * purposes of the EPL, "Program" will mean the Content. + * + * Copied from org.eclipse.jst.j2ee.ejb plugin. + */ + + model.removeFlags(CreateJavaEEArtifactTemplateModel.FLAG_QUALIFIED_SUPERCLASS_NAME); + + /* + * This Content is provided under the terms and conditions of the Eclipse Public License Version 1.0 + * ("EPL"). A copy of the EPL is available at http://www.eclipse.org/org/documents/epl-v10.php For + * purposes of the EPL, "Program" will mean the Content. + * + * Copied from org.eclipse.jst.j2ee.ejb plugin. + */ + + if (model.getJavaPackageName() != null && model.getJavaPackageName().length() > 0) { + + stringBuffer.append(TEXT_1); + stringBuffer.append(model.getJavaPackageName()); + stringBuffer.append(TEXT_2); + + } + + stringBuffer.append(TEXT_3); + /* + * This Content is provided under the terms and conditions of the Eclipse Public License Version 1.0 + * ("EPL"). A copy of the EPL is available at http://www.eclipse.org/org/documents/epl-v10.php For + * purposes of the EPL, "Program" will mean the Content. + * + * Copied from org.eclipse.jst.j2ee.ejb plugin. + */ + + Collection<String> imports = model.getImports(); + for (String anImport : imports) { + + stringBuffer.append(TEXT_4); + stringBuffer.append(anImport); + stringBuffer.append(TEXT_5); + + } + + stringBuffer.append(TEXT_6); + if (isSimplePattern) { + stringBuffer.append(TEXT_7); + stringBuffer.append(path); + stringBuffer.append(TEXT_8); + } + /* + * This Content is provided under the terms and conditions of the Eclipse Public License Version 1.0 + * ("EPL"). A copy of the EPL is available at http://www.eclipse.org/org/documents/epl-v10.php For + * purposes of the EPL, "Program" will mean the Content. + * + * Copied from org.eclipse.jst.j2ee.ejb plugin. + */ + + if (model.isPublic()) { + + stringBuffer.append(TEXT_9); + + } + + if (model.isAbstract()) { + + stringBuffer.append(TEXT_10); + + } + + if (model.isFinal()) { + + stringBuffer.append(TEXT_11); + + } + + stringBuffer.append(TEXT_12); + stringBuffer.append(model.getClassName()); + + String superClass = model.getSuperclassName(); + if (superClass != null && superClass.length() > 0) { + + stringBuffer.append(TEXT_13); + stringBuffer.append(superClass); + + } + + List<String> interfaces = model.getInterfaces(); + if (interfaces.size() > 0) { + + stringBuffer.append(TEXT_14); + + } + + for (int i = 0; i < interfaces.size(); i++) { + String INTERFACE = interfaces.get(i); + if (i > 0) { + + stringBuffer.append(TEXT_15); + + } + + stringBuffer.append(INTERFACE); + + } + + stringBuffer.append(TEXT_16); + if (isSimplePattern) { + stringBuffer.append(TEXT_17); + } else if (hasParam) { + stringBuffer.append(TEXT_18); + stringBuffer.append(paramList); + stringBuffer.append(TEXT_19); + } + if (!isSimplePattern) { + stringBuffer.append(TEXT_20); + stringBuffer.append(model.getClassName()); + stringBuffer.append(TEXT_21); + stringBuffer.append(model.getClassName()); + stringBuffer.append(TEXT_22); + stringBuffer.append(paramListWithTypes); + stringBuffer.append(TEXT_23); + stringBuffer.append(assignmentStmts); + stringBuffer.append(TEXT_24); + } else { + /* + * This Content is provided under the terms and conditions of the Eclipse Public License Version 1.0 + * ("EPL"). A copy of the EPL is available at http://www.eclipse.org/org/documents/epl-v10.php For + * purposes of the EPL, "Program" will mean the Content. + * + * Copied from org.eclipse.jst.j2ee.ejb plugin. + */ + + if (!model.hasEmptySuperclassConstructor()) { + + stringBuffer.append(TEXT_25); + stringBuffer.append(model.getClassName()); + stringBuffer.append(TEXT_26); + + } + + if (model.shouldGenSuperclassConstructors()) { + List<Constructor> constructors = model.getConstructors(); + for (Constructor constructor : constructors) { + if (constructor.isPublic() || constructor.isProtected()) { + + stringBuffer.append(TEXT_27); + stringBuffer.append(model.getSuperclassName()); + stringBuffer.append(TEXT_28); + stringBuffer.append(model.getSuperclassName()); + stringBuffer.append(TEXT_29); + stringBuffer.append(constructor.getParamsForJavadoc()); + stringBuffer.append(TEXT_30); + stringBuffer.append(model.getClassName()); + stringBuffer.append(TEXT_31); + stringBuffer.append(constructor.getParamsForDeclaration()); + stringBuffer.append(TEXT_32); + stringBuffer.append(constructor.getParamsForCall()); + stringBuffer.append(TEXT_33); + + } + } + } + + } + /* + * This Content is provided under the terms and conditions of the Eclipse Public License Version 1.0 + * ("EPL"). A copy of the EPL is available at http://www.eclipse.org/org/documents/epl-v10.php For + * purposes of the EPL, "Program" will mean the Content. + * + * Copied from org.eclipse.jst.j2ee.ejb plugin. + */ + + if (model.shouldImplementAbstractMethods()) { + for (Method method : model.getUnimplementedMethods()) { + + stringBuffer.append(TEXT_34); + stringBuffer.append(method.getContainingJavaClass()); + stringBuffer.append(TEXT_35); + stringBuffer.append(method.getName()); + stringBuffer.append(TEXT_36); + stringBuffer.append(method.getParamsForJavadoc()); + stringBuffer.append(TEXT_37); + stringBuffer.append(method.getReturnType()); + stringBuffer.append(TEXT_38); + stringBuffer.append(method.getName()); + stringBuffer.append(TEXT_39); + stringBuffer.append(method.getParamsForDeclaration()); + stringBuffer.append(TEXT_40); + + String defaultReturnValue = method.getDefaultReturnValue(); + if (defaultReturnValue != null) { + + stringBuffer.append(TEXT_41); + stringBuffer.append(defaultReturnValue); + stringBuffer.append(TEXT_42); + + } + + stringBuffer.append(TEXT_43); + + } + } + + if (!isSimplePattern) { + stringBuffer.append(TEXT_44); + stringBuffer.append(model.getClassName()); + stringBuffer.append(TEXT_45); + stringBuffer.append(model.getClassName()); + stringBuffer.append(TEXT_46); + stringBuffer.append(paramListWithTypes); + stringBuffer.append(TEXT_47); + stringBuffer.append(model.getClassName()); + stringBuffer.append(TEXT_48); + stringBuffer.append(model.getClassName()); + stringBuffer.append(TEXT_49); + stringBuffer.append(paramListNoTypes); + stringBuffer.append(TEXT_50); + } + stringBuffer.append(TEXT_51); + stringBuffer.append(model.getClassName()); + stringBuffer.append(TEXT_52); + stringBuffer.append(representationClass); + stringBuffer.append(TEXT_53); + stringBuffer.append(mimeType); + stringBuffer.append(TEXT_54); + stringBuffer.append(representationClass); + stringBuffer.append(TEXT_55); + stringBuffer.append(methodNameFromMimeType); + stringBuffer.append(TEXT_56); + stringBuffer.append(model.getClassName()); + stringBuffer.append(TEXT_57); + stringBuffer.append(mimeType); + stringBuffer.append(TEXT_58); + stringBuffer.append(methodNameFromMimeType); + stringBuffer.append(TEXT_59); + stringBuffer.append(representationClass); + stringBuffer.append(TEXT_60); + if (!isSimplePattern) { + stringBuffer.append(TEXT_61); + stringBuffer.append(model.getClassName()); + stringBuffer.append(TEXT_62); + } + stringBuffer.append(TEXT_63); + return stringBuffer.toString(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/Messages.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/Messages.java new file mode 100644 index 00000000..f65513b3 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/Messages.java @@ -0,0 +1,61 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.rest.wizards; + +public class Messages extends org.eclipse.osgi.util.NLS { + static { + org.eclipse.osgi.util.NLS.initializeMessages( + "fish.payara.eclipse.tools.server.ui.rest.wizards.Messages", Messages.class); + } + + public static String ProjectName; + public static String sessionWizardTitle; + public static String errorBusinessInterfaceMissing; + + public static String timerWizardTitle; + public static String timerWizardDescription; + public static String timerScheduleLabel; + public static String timerScheduleDefault; + public static String errorTimerScheduleMissing; + + public static String genericResourceWizardTitle; + public static String genericResourceWizardDescription; + public static String patternTypeLabel; + public static String patternTypeSimpleValue; + public static String patternTypeContainerValue; + public static String patternTypeClientContainerValue; + public static String mimeTypeLabel; + public static String errorMimeTypeMissing; + public static String representationClassLabel; + public static String representationClassDialogTitle; + public static String representationClassDialogLabel; + public static String errorRepresentationClassMissing; + public static String errorRepresentationClassInvalid; + + public static String containerRepresentationClassLabel; + public static String containerRepresentationClassDialogTitle; + public static String containerRepresentationClassDialogLabel; + public static String errorContainerRepresentationClassMissing; + public static String errorContainerRepresentationClassInvalid; + public static String pathLabel; + public static String errorPathMissing; + public static String errorPathInvalid; + public static String containerPathLabel; + public static String errorContainerPathMissing; +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/Messages.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/Messages.properties new file mode 100644 index 00000000..1b1d786b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/Messages.properties @@ -0,0 +1,33 @@ +ProjectName=Java EE 6 Project: +sessionWizardTitle=Create EJB 3.1 Session Bean +errorBusinessInterfaceMissing=At least one checkbox must be selected in Create business interface section + +timerWizardTitle=Create EJB Timer Callback +timerWizardDescription=Create Java class with an added EJB Timer Callback method. +timerScheduleLabel=Schedule: +timerScheduleDefault=second="*/10", minute="*", hour="8-23", dayOfWeek="Mon-Fri", dayOfMonth="*", month="*", year="*", info="MyTimer" +errorTimerScheduleMissing=The schedule cannot be empty. + +genericResourceWizardTitle=RESTful Web Service from Pattern +genericResourceWizardDescription=Create RESTful Web Service from Pattern. +patternTypeLabel=Pattern type: +patternTypeSimpleValue=Simple Root Resource +patternTypeContainerValue=Container-Item +patternTypeClientContainerValue=Client-Controlled Container-Item +mimeTypeLabel=MIME type: +errorMimeTypeMissing=The MIME type cannot be empty. +representationClassLabel=Representation class: +representationClassDialogTitle=Representation Class Selection +representationClassDialogLabel=Choose a representation class +errorRepresentationClassMissing=The Representation class cannot be empty. +errorRepresentationClassInvalid=The Representation class does not exist. +containerRepresentationClassLabel=Container representation class: +containerRepresentationClassDialogTitle=Container representation Class Selection +containerRepresentationClassDialogLabel=Choose a container representation class +errorContainerRepresentationClassMissing=The Container representation class cannot be empty. +errorContainerRepresentationClassInvalid=The Container representation class does not exist. +pathLabel=Path: +errorPathMissing=The Path cannot be empty. +errorPathInvalid=The Path must contain a list of unique java identifiers surrounded by braces, or string literals, separated by slashes. +containerPathLabel=Container path: +errorContainerPathMissing=The Container path cannot be empty. diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/GenericActionProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/GenericActionProvider.java new file mode 100644 index 00000000..afb6bccf --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/GenericActionProvider.java @@ -0,0 +1,120 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TreeSelection; +import org.eclipse.swt.widgets.Event; +import org.eclipse.ui.navigator.CommonActionProvider; +import org.eclipse.ui.navigator.CommonViewer; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; +import org.eclipse.ui.navigator.ICommonViewerSite; +import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite; + +/** + * Super class of action providers. Currently only used as super class for + * {@link ServerViewActionProvider}. + * + */ +public abstract class GenericActionProvider extends CommonActionProvider { + + private Action refreshAction; + protected ICommonActionExtensionSite actionSite; + + @Override + public void init(ICommonActionExtensionSite aSite) { + super.init(aSite); + + this.actionSite = aSite; + + ICommonViewerSite site = aSite.getViewSite(); + + if (site instanceof ICommonViewerWorkbenchSite) { + StructuredViewer v = aSite.getStructuredViewer(); + if (v instanceof CommonViewer) { + CommonViewer cv = (CommonViewer) v; + ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite) site; + makeActions(cv, wsSite.getSelectionProvider()); + } + } + } + + private void makeActions(CommonViewer cv, ISelectionProvider selectionProvider) { + refreshAction = new RefreshAction(selectionProvider.getSelection()); + } + + @Override + public void fillContextMenu(IMenuManager menu) { + super.fillContextMenu(menu); + + ICommonViewerSite site = actionSite.getViewSite(); + IStructuredSelection selection = null; + + if (site instanceof ICommonViewerWorkbenchSite) { + ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite) site; + selection = (IStructuredSelection) wsSite.getSelectionProvider().getSelection(); + + refreshAction = new RefreshAction(selection); + menu.add(refreshAction); + menu.add(new Separator()); + } + + } + + protected void refresh(Object selection) { + + } + + class RefreshAction extends Action { + + ISelection selection; + + public RefreshAction(ISelection selection) { + setText("Refresh"); + this.selection = selection; + } + + @Override + public void runWithEvent(Event event) { + if (selection instanceof TreeSelection) { + TreeSelection treeSelection = (TreeSelection) selection; + + Object obj = treeSelection.getFirstElement(); + + refresh(obj); + actionSite.getStructuredViewer().refresh(obj); + } + + super.run(); + + } + + @Override + public void run() { + runWithEvent(null); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerModuleActionProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerModuleActionProvider.java new file mode 100644 index 00000000..3ef0efcb --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerModuleActionProvider.java @@ -0,0 +1,110 @@ +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview; + +import static fish.payara.eclipse.tools.server.utils.WtpUtil.load; +import static org.eclipse.ui.PlatformUI.getWorkbench; + +import java.io.File; + +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.bindings.TriggerSequence; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.TreeSelection; +import org.eclipse.ui.keys.IBindingService; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; +import org.eclipse.ui.navigator.ICommonViewerSite; +import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite; +import org.eclipse.wst.server.core.IModule; +import org.eclipse.wst.server.core.IServer; +import org.eclipse.wst.server.ui.IServerModule; + +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; +import fish.payara.eclipse.tools.server.ui.serverview.actions.GotoModuleProjectInExplorerAction; +import fish.payara.eclipse.tools.server.ui.serverview.actions.OpenModuleInFileBrowserAction; + +/** + * This provider adds context actions to a deployed module + * </p> + * @author Arjan Tijms + */ +public class ServerModuleActionProvider extends GenericActionProvider { + + private ICommonActionExtensionSite actionSite; + + @Override + public void init(ICommonActionExtensionSite actionExtensionSite) { + super.init(actionExtensionSite); + this.actionSite = actionExtensionSite; + } + + @Override + public void fillContextMenu(IMenuManager menu) { + super.fillContextMenu(menu); + + ICommonViewerSite site = actionSite.getViewSite(); + + if (site instanceof ICommonViewerWorkbenchSite) { + + ISelection selection = site.getSelectionProvider().getSelection(); + + if (selection instanceof TreeSelection) { + + Object obj = ((TreeSelection) selection).getFirstElement(); + + if (obj instanceof IServerModule) { + + IServerModule module = (IServerModule) obj; + + IServer server = module.getServer(); + + PayaraServerBehaviour serverBehaviour = load(server, PayaraServerBehaviour.class); + + if (serverBehaviour == null) { + // Probably an other server was selected than Payara + return; + } + + IModule[] modules = module.getModule(); + if (modules.length > 1 && !new File(serverBehaviour.getModuleDeployPath(modules[1])).exists()) { + return; + } + + if (menu instanceof MenuManager) { + MenuManager menuManager = (MenuManager) menu; + + MenuManager showInSubMenu = (MenuManager) menuManager.find("org.eclipse.ui.navigate.showInQuickMenu"); + + if (showInSubMenu == null) { + String text = "Show In"; + + TriggerSequence[] activeBindings = getWorkbench().getAdapter(IBindingService.class) + .getActiveBindingsFor("org.eclipse.ui.navigate.showInQuickMenu"); + + if (activeBindings.length > 0) { + text += "\t" + activeBindings[0].format(); + } + + showInSubMenu = new MenuManager(text, "org.eclipse.ui.navigate.showInQuickMenu"); + menuManager.add(showInSubMenu); + } + + showInSubMenu.add(new OpenModuleInFileBrowserAction(selection)); + } + + menu.add(new GotoModuleProjectInExplorerAction(selection)); + + } + } + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewActionProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewActionProvider.java new file mode 100644 index 00000000..03fa8a77 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewActionProvider.java @@ -0,0 +1,138 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview; + +import static fish.payara.eclipse.tools.server.ui.serverview.ServerViewDynamicNodeProvider.GLASSFISH_MANAGEMENT; + +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.TreeSelection; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; +import org.eclipse.ui.navigator.ICommonViewerSite; +import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite; + +import fish.payara.eclipse.tools.server.ui.serverview.actions.OpenInBrowserAction; +import fish.payara.eclipse.tools.server.ui.serverview.actions.TestWebServiceAction; +import fish.payara.eclipse.tools.server.ui.serverview.actions.UndeployAction; +import fish.payara.eclipse.tools.server.ui.serverview.actions.UnregisterResourceAction; +import fish.payara.eclipse.tools.server.ui.serverview.actions.WSDLInfoWebServiceAction; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.ApplicationNode; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.DeployedApplicationsNode; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.ResourcesNode; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.TreeNode; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.WebServiceNode; + +/** + * This provider adds context actions to some of the dynamic tree nodes provided by + * {@link ServerViewDynamicNodeProvider}. + * + * <p> + * E.g. it adds the "unregister" action when you right click on a resource such as a JDBC data + * source + * </p> + * + */ +public class ServerViewActionProvider extends GenericActionProvider { + + private ICommonActionExtensionSite actionSite; + + @Override + public void init(ICommonActionExtensionSite actionExtensionSite) { + super.init(actionExtensionSite); + this.actionSite = actionExtensionSite; + } + + @Override + public void fillContextMenu(IMenuManager menu) { + super.fillContextMenu(menu); + + ICommonViewerSite site = actionSite.getViewSite(); + + if (site instanceof ICommonViewerWorkbenchSite) { + + ISelection selection = site.getSelectionProvider().getSelection(); + + if (selection instanceof TreeSelection) { + + Object obj = ((TreeSelection) selection).getFirstElement(); + + if (obj instanceof ResourcesNode) { + + // Add unregister action to resources + + ResourcesNode resourcesNode = (ResourcesNode) obj; + + if (resourcesNode.getResource() != null) { + menu.add(new Separator()); + menu.add(new UnregisterResourceAction(selection, actionSite)); + } + + } else if (obj instanceof ApplicationNode) { + + // Add undeploy and open in browser to applications + + menu.add(new Separator()); + menu.add(new UndeployAction(selection, actionSite)); + menu.add(new OpenInBrowserAction(selection)); + + } else if (obj instanceof WebServiceNode) { + + // Add test and info actions to (soap) web services + + menu.add(new TestWebServiceAction(selection)); + menu.add(new WSDLInfoWebServiceAction(selection)); + } + } + } + } + + @Override + public void fillActionBars(IActionBars o) { + super.fillActionBars(o); + } + + @Override + protected void refresh(Object selection) { + super.refresh(selection); + + DeployedApplicationsNode root = null; + + if (selection instanceof DeployedApplicationsNode) { + root = (DeployedApplicationsNode) selection; + } else if (selection instanceof TreeNode) { + TreeNode treeNode = (TreeNode) selection; + if (treeNode.getName().equals(GLASSFISH_MANAGEMENT)) { + for (Object child : treeNode.getChildren()) { + if (child instanceof DeployedApplicationsNode) { + root = (DeployedApplicationsNode) child; + break; + } + } + } + } + + if (root != null) { + root.refresh(); + } + + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewDynamicNodeProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewDynamicNodeProvider.java new file mode 100644 index 00000000..ea798a55 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewDynamicNodeProvider.java @@ -0,0 +1,125 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview; + +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.is31OrAbove; +import static fish.payara.eclipse.tools.server.utils.WtpUtil.load; +import static org.eclipse.wst.server.core.IServer.STATE_STARTED; + +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.wst.server.core.IServer; +import org.eclipse.wst.server.ui.internal.viewers.BaseContentProvider; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.ApplicationNode; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.DeployedApplicationsNode; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.DeployedWebServicesNode; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.ResourcesNode; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.TreeNode; + +/** + * This provides provides the dynamic nodes; the tree nodes that are inserted underneath a running + * Payara / GlassFish server node in the Servers view. + * + * @see fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes + * + */ +@SuppressWarnings("restriction") +public class ServerViewDynamicNodeProvider extends BaseContentProvider implements ITreeContentProvider { + + static String GLASSFISH_MANAGEMENT = "GlassFish Management"; //$NON-NLS-1$ + + @Override + public Object[] getChildren(Object parentElement) { + + if (parentElement instanceof IServer) { + IServer server = (IServer) parentElement; + + // Only active for a Payara or Glassfish 3.1.x server which is running, as we query + // the server dynamically for the various artefacts it has running and/or available. + + boolean is31x = is31OrAbove(server.getRuntime()); + + if ((is31x && server.getServerState() == STATE_STARTED)) { + + PayaraServer payaraServer = load(server, PayaraServer.class); + + if (payaraServer != null) { + + TreeNode root = new TreeNode(GLASSFISH_MANAGEMENT, GLASSFISH_MANAGEMENT); + + // Deployed Applications Node + root.addChild(new DeployedApplicationsNode(payaraServer)); + + // Resources Node + root.addChild(new ResourcesNode(payaraServer)); + + // Deployed web-services node + root.addChild(new DeployedWebServicesNode(payaraServer)); + + return new Object[] { root }; + } + } + } + + if (parentElement instanceof TreeNode) { + TreeNode root = (TreeNode) parentElement; + return root.getChildren(); + } + + return null; + } + + @Override + public Object[] getElements(Object parentElement) { + return getChildren(parentElement); + } + + @Override + public Object getParent(Object element) { + if (element instanceof DeployedApplicationsNode) { + return ((DeployedApplicationsNode) element).getServer(); + } + + if (element instanceof ApplicationNode) { + return ((ApplicationNode) element).getParent(); + } + + if (element instanceof TreeNode) { + return ((TreeNode) element).getParent(); + } + + return null; + } + + @Override + + public boolean hasChildren(Object element) { + if ((element instanceof IServer) || (element instanceof DeployedApplicationsNode) || (element instanceof ApplicationNode)) { + return true; + } + + if (element instanceof TreeNode) { + return ((TreeNode) element).getChildren().length > 0; + } + + return false; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewLabelProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewLabelProvider.java new file mode 100644 index 00000000..fbff21ac --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewLabelProvider.java @@ -0,0 +1,96 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview; + +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.EAR_MODULE_IMG; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.EJB_MODULE_IMG; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.GF_SERVER_IMG; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.RESOURCES_IMG; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.WEBSERVICE_IMG; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.WEB_MODULE_IMG; + +import org.eclipse.jface.viewers.ITableFontProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; + +import fish.payara.eclipse.tools.server.PayaraServerPlugin; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.ApplicationNode; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.DeployedWebServicesNode; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.ResourcesNode; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.TreeNode; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.WebServiceNode; + +/** + * This provides provides the icons and text associated with the dynamic nodes provided by + * {@link ServerViewDynamicNodeProvider} + * + */ +public class ServerViewLabelProvider extends LabelProvider implements ITableFontProvider { + + @Override + public Image getImage(Object element) { + if (element instanceof ApplicationNode) { + switch (((ApplicationNode) element).getApplicationInfo().getType()) { + case "web": + return PayaraServerPlugin.getImage(WEB_MODULE_IMG); + case "ejb": + return PayaraServerPlugin.getImage(EJB_MODULE_IMG); + case "ear": + return PayaraServerPlugin.getImage(EAR_MODULE_IMG); + } + } else if (element instanceof ResourcesNode) { + ResourcesNode rn = (ResourcesNode) element; + + if (rn.getResource() == null) { + return PayaraServerPlugin.getImage(RESOURCES_IMG); + } + + return PayaraServerPlugin.getImage(GF_SERVER_IMG); + } else if (element instanceof DeployedWebServicesNode) { + return PayaraServerPlugin.getImage(WEBSERVICE_IMG); + } else if (element instanceof WebServiceNode) { + return PayaraServerPlugin.getImage(WEBSERVICE_IMG); + } + + return PayaraServerPlugin.getImage(GF_SERVER_IMG); + } + + @Override + public String getText(Object element) { + if (element instanceof TreeNode) { + TreeNode module = (TreeNode) element; + String name = module.getName(); + if (name.endsWith("/") && !name.equals("/")) { + name = name.substring(0, name.length() - 1); + } + + return name; + } + + return null; + } + + @Override + public Font getFont(Object arg0, int arg1) { + return null; + + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/GotoModuleProjectInExplorerAction.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/GotoModuleProjectInExplorerAction.java new file mode 100644 index 00000000..5d1db3d0 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/GotoModuleProjectInExplorerAction.java @@ -0,0 +1,96 @@ +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview.actions; + +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logMessage; +import static org.eclipse.ui.ISharedImages.IMG_TOOL_FORWARD; +import static org.eclipse.ui.ISharedImages.IMG_TOOL_FORWARD_DISABLED; + +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TreeSelection; +import org.eclipse.swt.widgets.Event; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.navigator.resources.ProjectExplorer; +import org.eclipse.wst.server.core.IModule; +import org.eclipse.wst.server.ui.IServerModule; + +/** + * This action allows the user to navigate from the a module deployed to a server in the servers view + * to the project from which the module was created in the project explorer. + * + * @author Arjan Tijms + * + */ +public class GotoModuleProjectInExplorerAction extends Action { + + private ISelection selection; + + public GotoModuleProjectInExplorerAction(ISelection selection) { + setText("Goto Project"); + + ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); + setImageDescriptor(sharedImages.getImageDescriptor(IMG_TOOL_FORWARD)); + setDisabledImageDescriptor(sharedImages.getImageDescriptor(IMG_TOOL_FORWARD_DISABLED)); + + this.selection = selection; + } + + @Override + public void runWithEvent(Event event) { + if (selection instanceof TreeSelection) { + TreeSelection treeSelection = (TreeSelection) selection; + Object firstElement = treeSelection.getFirstElement(); + if (firstElement instanceof IServerModule) { + + IServerModule serverModule = (IServerModule) firstElement; + IModule[] modules = serverModule.getModule(); + + // Make sure we have a selection that actually contains modules + if (modules.length > 0) { + + // Get the project associated with the selection + IProject project = modules[0].getProject(); + + try { + + // Obtain the Project Explorer + ProjectExplorer projectExplorer = (ProjectExplorer) PlatformUI.getWorkbench() + .getActiveWorkbenchWindow() + .getActivePage() + .showView(ProjectExplorer.VIEW_ID); + + // Give focus to the explorer + projectExplorer.setFocus(); + + // Set the selection within the explorer to the project + projectExplorer.selectReveal(new StructuredSelection(project)); + + // Open the project node (expand nodes so the project and its direct children are visible) + projectExplorer.getCommonViewer().expandToLevel(project, 1); + } catch (Exception e) { + logMessage("Error navigating to project: " + e.getMessage()); + } + } + } + + super.run(); + } + } + + @Override + public void run() { + this.runWithEvent(null); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/OpenInBrowserAction.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/OpenInBrowserAction.java new file mode 100644 index 00000000..5c1017ce --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/OpenInBrowserAction.java @@ -0,0 +1,94 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview.actions; + +import static fish.payara.eclipse.tools.server.utils.Utils.getHttpListenerProtocol; +import static org.eclipse.ui.ISharedImages.IMG_TOOL_FORWARD; +import static org.eclipse.ui.ISharedImages.IMG_TOOL_FORWARD_DISABLED; +import static org.eclipse.ui.IWorkbenchCommandConstants.FILE_PRINT; +import static org.eclipse.ui.browser.IWorkbenchBrowserSupport.LOCATION_BAR; +import static org.eclipse.ui.browser.IWorkbenchBrowserSupport.NAVIGATION_BAR; + +import java.net.URI; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.TreeSelection; +import org.eclipse.swt.widgets.Event; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.browser.IWebBrowser; +import org.eclipse.ui.browser.IWorkbenchBrowserSupport; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.PayaraServerPlugin; +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.DeployedApplicationsNode; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.TreeNode; + +public class OpenInBrowserAction extends Action { + + ISelection selection; + + public OpenInBrowserAction(ISelection selection) { + setText("Open in Browser"); + + ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); + setImageDescriptor(sharedImages.getImageDescriptor(IMG_TOOL_FORWARD)); + setDisabledImageDescriptor(sharedImages.getImageDescriptor(IMG_TOOL_FORWARD_DISABLED)); + setActionDefinitionId(FILE_PRINT); + + this.selection = selection; + } + + @Override + public void runWithEvent(Event event) { + if (selection instanceof TreeSelection) { + TreeSelection ts = (TreeSelection) selection; + Object obj = ts.getFirstElement(); + if (obj instanceof TreeNode) { + TreeNode module = (TreeNode) obj; + DeployedApplicationsNode target = (DeployedApplicationsNode) module.getParent(); + + try { + PayaraServerBehaviour be = target.getServer().getServerBehaviourAdapter(); + + IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport(); + IWebBrowser browser = browserSupport.createBrowser(LOCATION_BAR | NAVIGATION_BAR, null, null, null); + PayaraServer server = be.getPayaraServerDelegate(); + String host = server.getServer().getHost(); + int port = server.getPort(); + + URI uri = new URI(getHttpListenerProtocol(host, port), null, host, port, "/" + module.getName(), null, null); // NOI18N + browser.openURL(uri.toURL()); + + } catch (Exception e) { + PayaraServerPlugin.logMessage("Error opening browser: " + e.getMessage()); + } + } + super.run(); + } + } + + @Override + public void run() { + this.runWithEvent(null); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/OpenModuleInFileBrowserAction.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/OpenModuleInFileBrowserAction.java new file mode 100644 index 00000000..bca58556 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/OpenModuleInFileBrowserAction.java @@ -0,0 +1,86 @@ +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview.actions; + +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logMessage; +import static fish.payara.eclipse.tools.server.utils.URIHelper.getModuleDeployURI; +import static fish.payara.eclipse.tools.server.utils.URIHelper.showURI; +import static fish.payara.eclipse.tools.server.utils.WtpUtil.load; +import static org.eclipse.ui.ISharedImages.IMG_OBJ_FOLDER; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.TreeSelection; +import org.eclipse.swt.widgets.Event; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; +import org.eclipse.wst.server.core.IModule; +import org.eclipse.wst.server.core.IServer; +import org.eclipse.wst.server.ui.IServerModule; + +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; + +/** + * This action opens an assembled module (e.g. a .war archive or exploded folder) that's deployed to a Payara server + * in the file browser from the operating system. + * + * <p> + * Inspecting the actual assembled module is sometimes necessary to resolve and diagnose deployment errors. + * + * @author Arjan Tijms + * + */ +public class OpenModuleInFileBrowserAction extends Action { + + ISelection selection; + + public OpenModuleInFileBrowserAction(ISelection selection) { + setText("Open in File Browser"); + + ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); + setImageDescriptor(sharedImages.getImageDescriptor(IMG_OBJ_FOLDER)); + + this.selection = selection; + } + + @Override + public void runWithEvent(Event event) { + if (selection instanceof TreeSelection) { + TreeSelection ts = (TreeSelection) selection; + Object firstElement = ts.getFirstElement(); + if (firstElement instanceof IServerModule) { + + IServerModule module = (IServerModule) firstElement; + + IServer server = module.getServer(); + IModule[] modules = module.getModule(); + + if (modules.length > 0) { + + PayaraServerBehaviour serverBehaviour = load(server, PayaraServerBehaviour.class); + + try { + showURI(getModuleDeployURI(serverBehaviour, modules[0])); + } catch (Exception e) { + logMessage("Error opening browser: " + e.getMessage()); + } + } + } + + super.run(); + } + } + + @Override + public void run() { + this.runWithEvent(null); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/TestWebServiceAction.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/TestWebServiceAction.java new file mode 100644 index 00000000..9b7d36ec --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/TestWebServiceAction.java @@ -0,0 +1,90 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview.actions; + +import java.net.URL; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.TreeSelection; +import org.eclipse.swt.widgets.Event; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.browser.IWebBrowser; +import org.eclipse.ui.browser.IWorkbenchBrowserSupport; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.PayaraServerPlugin; +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.DeployedWebServicesNode; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.WebServiceNode; +import fish.payara.eclipse.tools.server.utils.Utils; + +public class TestWebServiceAction extends Action { + ISelection selection; + + public TestWebServiceAction(ISelection selection) { + setText("Test Web Service in Browser"); + + this.selection = selection; + } + + @Override + public void runWithEvent(Event event) { + if (selection instanceof TreeSelection) { + TreeSelection ts = (TreeSelection) selection; + Object obj = ts.getFirstElement(); + if (obj instanceof WebServiceNode) { + final WebServiceNode module = (WebServiceNode) obj; + final DeployedWebServicesNode target = (DeployedWebServicesNode) module + .getParent(); + + try { + final PayaraServerBehaviour be = target.getServer() + .getServerBehaviourAdapter(); + + IWorkbenchBrowserSupport browserSupport = PlatformUI + .getWorkbench().getBrowserSupport(); + IWebBrowser browser = browserSupport + .createBrowser( + IWorkbenchBrowserSupport.LOCATION_BAR + | IWorkbenchBrowserSupport.NAVIGATION_BAR, + null, null, null); + PayaraServer server = be.getPayaraServerDelegate(); + String host = server.getServer().getHost(); + int port = server.getPort(); + + String url = Utils.getHttpListenerProtocol(host, port) + "://" + host + ":" + port + "/" + + module.getWSInfo().getTestURL(); + browser.openURL(new URL(url)); + + } catch (Exception e) { + PayaraServerPlugin.logMessage("Error opening browser: " + + e.getMessage()); + } + } + super.run(); + } + } + + @Override + public void run() { + this.runWithEvent(null); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/UndeployAction.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/UndeployAction.java new file mode 100644 index 00000000..d2bd88e5 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/UndeployAction.java @@ -0,0 +1,159 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview.actions; + +import static org.eclipse.ui.ISharedImages.IMG_TOOL_DELETE; +import static org.eclipse.ui.ISharedImages.IMG_TOOL_DELETE_DISABLED; +import static org.eclipse.ui.IWorkbenchCommandConstants.EDIT_DELETE; +import static org.eclipse.wst.server.core.IServer.PUBLISH_INCREMENTAL; +import static org.eclipse.wst.server.core.IServer.PUBLISH_STATE_FULL; +import static org.eclipse.wst.server.core.IServer.STATE_STOPPED; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TreeSelection; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; +import org.eclipse.wst.server.core.IModule; +import org.eclipse.wst.server.core.IServer; +import org.eclipse.wst.server.core.IServerWorkingCopy; +import org.eclipse.wst.server.core.internal.Server; +import org.eclipse.wst.server.ui.internal.ServerUIPlugin; + +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.DeployedApplicationsNode; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.TreeNode; + +@SuppressWarnings("restriction") +public class UndeployAction extends Action { + + ISelection selection; + ICommonActionExtensionSite actionSite; + + public UndeployAction(ISelection selection, ICommonActionExtensionSite actionSite) { + setText("Undeploy"); + + ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); + setImageDescriptor(sharedImages.getImageDescriptor(IMG_TOOL_DELETE)); + setDisabledImageDescriptor(sharedImages.getImageDescriptor(IMG_TOOL_DELETE_DISABLED)); + setActionDefinitionId(EDIT_DELETE); + + this.selection = selection; + this.actionSite = actionSite; + } + + @Override + public void runWithEvent(Event event) { + if (selection instanceof TreeSelection) { + TreeSelection ts = (TreeSelection) selection; + Object obj = ts.getFirstElement(); + if (obj instanceof TreeNode) { + final TreeNode module = (TreeNode) obj; + final DeployedApplicationsNode target = (DeployedApplicationsNode) module.getParent(); + + try { + final PayaraServerBehaviour be = target.getServer().getServerBehaviourAdapter(); + IRunnableWithProgress op = new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) { + try { + + IServer server = be.getServer(); + + IModule[] modules = server.getModules(); + IModule imodule = null; + for (IModule element : modules) { + if (element.getName().equals(module.getName())) { + imodule = element; + + } + } + if (imodule == null) { + // undeploy and return + // TODO review undeploy functionality + be.undeploy(module.getName(), monitor); + return; + } + try { + IServerWorkingCopy wc = server.createWorkingCopy(); + wc.modifyModules(null, new IModule[] { imodule }, monitor); + server = wc.save(true, monitor); + + } catch (CoreException e) { + e.printStackTrace(); + } + + if (server.getServerState() != STATE_STOPPED + && ServerUIPlugin.getPreferences().getPublishOnAddRemoveModule()) { + final IAdaptable info = new IAdaptable() { + @Override + public <T> T getAdapter(final Class<T> adapter) { + if (Shell.class.equals(adapter)) { + return adapter.cast(Display.getDefault().getActiveShell()); + } + + return null; + } + }; + server.publish(PUBLISH_INCREMENTAL, null, info, null); + } + + } catch (Exception e) { + e.printStackTrace(); + + } + } + }; + + Shell shell = Display.getDefault().getActiveShell(); + if (shell != null) { + new ProgressMonitorDialog(shell).run(true, false, op); + } + target.refresh(); + StructuredViewer view = actionSite.getStructuredViewer(); + view.refresh(target); + + // set to FULL to tell the system a full deploy is + // needed. + Server server = (Server) be.getServer(); + server.setModulePublishState(server.getModules(), PUBLISH_STATE_FULL); + + } catch (Exception e) { + } + } + } + super.run(); + } + + @Override + public void run() { + this.runWithEvent(null); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/UnregisterResourceAction.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/UnregisterResourceAction.java new file mode 100644 index 00000000..c6f824d1 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/UnregisterResourceAction.java @@ -0,0 +1,154 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview.actions; + +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logError; +import static fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.NodeTypes.ADMINOBJECT_RESOURCE; +import static fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.NodeTypes.CONN_CONNECTION_POOL; +import static fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.NodeTypes.CONN_RESOURCE; +import static fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.NodeTypes.JAVAMAIL_RESOURCE; +import static fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.NodeTypes.JDBC_CONNECTION_POOL; +import static fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.NodeTypes.JDBC_RESOURCE; +import static java.util.concurrent.TimeUnit.SECONDS; + +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeoutException; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TreeSelection; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; +import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.PayaraServerPlugin; +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; +import fish.payara.eclipse.tools.server.sdk.TaskState; +import fish.payara.eclipse.tools.server.sdk.admin.CommandDeleteResource; +import fish.payara.eclipse.tools.server.sdk.admin.ResultString; +import fish.payara.eclipse.tools.server.sdk.admin.ServerAdmin; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.ResourcesNode; + +public class UnregisterResourceAction extends Action { + ISelection selection; + ICommonActionExtensionSite actionSite; + + public UnregisterResourceAction(ISelection selection, ICommonActionExtensionSite actionSite) { + setText("Unregister"); + ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); + setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)); + setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED)); + setActionDefinitionId(IWorkbenchActionDefinitionIds.DELETE); + + this.selection = selection; + this.actionSite = actionSite; + } + + @Override + public void runWithEvent(Event event) { + if (selection instanceof TreeSelection) { + TreeSelection ts = (TreeSelection) selection; + Object obj = ts.getFirstElement(); + if (obj instanceof ResourcesNode) { + final ResourcesNode currentResource = (ResourcesNode) obj; + if (currentResource.getResource() == null) { + return; + } + + try { + final PayaraServerBehaviour be = currentResource.getServer().getServerBehaviourAdapter(); + IRunnableWithProgress op = new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) { + PayaraServer server = be.getPayaraServerDelegate(); + + String propName = ""; + boolean cascadeDelete = false; + String type = currentResource.getType(); + if (type.equals(JDBC_RESOURCE)) { + propName = "jdbc_resource_name"; + } else if (type.equals(JDBC_CONNECTION_POOL)) { + propName = "jdbc_connection_pool_id"; + cascadeDelete = true; + } + + else if (type.equals(CONN_RESOURCE)) { + propName = "connector_resource_pool_id"; + } + + else if (type.equals(CONN_CONNECTION_POOL)) { + propName = "poolname"; + } + + else if (type.equals(ADMINOBJECT_RESOURCE)) { + propName = "jndi_name"; + } + + else if (type.equals(JAVAMAIL_RESOURCE)) { + propName = "jndi_name"; + } + + String resourceName = currentResource.getResource().getName(); + CommandDeleteResource command = new CommandDeleteResource(resourceName, + currentResource.getResource().getCommandSuffix(), propName, cascadeDelete); + Future<ResultString> future = ServerAdmin.<ResultString>exec(server, command); + ResultString result; + try { + result = future.get(30, SECONDS); + if (!TaskState.COMPLETED.equals(result.getState())) { + PayaraServerPlugin.logMessage("Unable to delete resource " + resourceName + + ". Message: " + result.getValue()); + } + } catch (InterruptedException | ExecutionException | TimeoutException e) { + logError("Unable to delete resource " + resourceName, e); + } + + } + }; + Shell shell = Display.getDefault().getActiveShell(); + if (shell != null) { + new ProgressMonitorDialog(shell).run(true, false, op); + } + + StructuredViewer view = actionSite.getStructuredViewer(); + view.refresh(currentResource.getParent()); + + } catch (Exception e) { + } + } + } + super.run(); + } + + @Override + public void run() { + this.runWithEvent(null); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/WSDLInfoWebServiceAction.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/WSDLInfoWebServiceAction.java new file mode 100644 index 00000000..4f92575d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/WSDLInfoWebServiceAction.java @@ -0,0 +1,89 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview.actions; + +import java.net.URL; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.TreeSelection; +import org.eclipse.swt.widgets.Event; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.browser.IWebBrowser; +import org.eclipse.ui.browser.IWorkbenchBrowserSupport; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.PayaraServerPlugin; +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.DeployedWebServicesNode; +import fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.WebServiceNode; +import fish.payara.eclipse.tools.server.utils.Utils; + +public class WSDLInfoWebServiceAction extends Action { + ISelection selection; + + public WSDLInfoWebServiceAction(ISelection selection) { + setText("Show WDSL content in Browser"); + + this.selection = selection; + } + + @Override + public void runWithEvent(Event event) { + if (selection instanceof TreeSelection) { + TreeSelection ts = (TreeSelection) selection; + Object obj = ts.getFirstElement(); + if (obj instanceof WebServiceNode) { + final WebServiceNode module = (WebServiceNode) obj; + final DeployedWebServicesNode target = (DeployedWebServicesNode) module + .getParent(); + + try { + final PayaraServerBehaviour be = target + .getServer().getServerBehaviourAdapter(); + + IWorkbenchBrowserSupport browserSupport = PlatformUI + .getWorkbench().getBrowserSupport(); + IWebBrowser browser = browserSupport + .createBrowser( + IWorkbenchBrowserSupport.LOCATION_BAR + | IWorkbenchBrowserSupport.NAVIGATION_BAR, + null, null, null); + PayaraServer server = be.getPayaraServerDelegate(); + String host = server.getServer().getHost(); + int port = server.getPort(); + + String url = Utils.getHttpListenerProtocol(host, port) + "://" + host + ":" + port + "/" + module.getWSInfo().getName(); + browser.openURL(new URL(url)); + + } catch (Exception e) { + PayaraServerPlugin.logMessage("Error opening browser: " + + e.getMessage()); + } + } + super.run(); + } + } + + @Override + public void run() { + this.runWithEvent(null); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/ApplicationNode.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/ApplicationNode.java new file mode 100644 index 00000000..2066d775 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/ApplicationNode.java @@ -0,0 +1,132 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes; + +import java.util.ArrayList; + +import org.eclipse.ui.views.properties.IPropertyDescriptor; +import org.eclipse.ui.views.properties.PropertyDescriptor; +import org.eclipse.ui.views.properties.TextPropertyDescriptor; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.serverview.AppDesc; + +/** + * A deployed app node in the server view + * + * <p> + * This node represents each application below the "Deployed Applications" parent node. + * </p> + * + * <p> + * The following depicts this element in the "Servers" view: + * </p> + * <p> + * + * <pre> + * Payara 5 [domain1] + * |- GlassFish Management + * |-Resources + * |-Deployed Applications + * |- App1 * + * |- App2 * + * |-Deployed Web Services + * |- [WTP managed application] + * </pre> + * </p> + * + * <p> + * Payara / GlassFish is dynamically queried for this list, hence it can only be retrieved for a + * running server. </> + * + * @author Ludovic Champenois + * + */ +public class ApplicationNode extends TreeNode { + + DeployedApplicationsNode parent; + PayaraServer server; + TreeNode[] modules; + AppDesc app; + + public ApplicationNode(DeployedApplicationsNode root, PayaraServer server, AppDesc app) { + super(app.getName(), null, root); + this.server = server; + this.app = app; + } + + public PayaraServer getServer() { + return this.server; + } + + public AppDesc getApplicationInfo() { + return this.app; + } + + @Override + + public IPropertyDescriptor[] getPropertyDescriptors() { + + ArrayList<IPropertyDescriptor> properties = new ArrayList<>(); + PropertyDescriptor pd; + + pd = new TextPropertyDescriptor("contextroot", "context root"); + pd.setCategory("Payara Applications"); + properties.add(pd); + + pd = new TextPropertyDescriptor("name", "name"); + pd.setCategory("Payara Applications"); + properties.add(pd); + + pd = new TextPropertyDescriptor("path", "path"); + pd.setCategory("Payara Applications"); + properties.add(pd); + + pd = new TextPropertyDescriptor("engine", "engine"); + pd.setCategory("Payara Applications"); + properties.add(pd); + + return properties.toArray(new IPropertyDescriptor[0]); + } + + @Override + + public Object getPropertyValue(Object id) { + + if (id.equals("contextroot")) { + return app.getContextRoot(); + } + + if (id.equals("name")) { + return app.getName(); + } + + if (id.equals("path")) { + return app.getPath(); + } + + if (id.equals("engine")) { + return app.getType(); + } + + return null; + + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/DeployedApplicationsNode.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/DeployedApplicationsNode.java new file mode 100644 index 00000000..1587e024 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/DeployedApplicationsNode.java @@ -0,0 +1,122 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.PayaraServerPlugin; +import fish.payara.eclipse.tools.server.serverview.AppDesc; +import fish.payara.eclipse.tools.server.utils.NodesUtils; + +/** + * This node shows is the root node below which the dynamically retrieved deployed applications + * reside. + * + * <p> + * The following depicts this element in the "Servers" views: + * </p> + * <p> + * + * <pre> + * Payara 5 [domain1] + * |- GlassFish Management + * |-Resources + * |-Deployed Applications * + * |-Deployed Web Services + * |- [WTP managed application] + * </pre> + * </p> + * + * <p> + * Note this is a (potentially) different list from the one that WTP keeps. + * </p> + * + * <p> + * Payara / GlassFish is dynamically queried for this list, hence it can only be retrieved for a + * running server. + * </p> + * + */ +public class DeployedApplicationsNode extends TreeNode { + + PayaraServer server; + ApplicationNode[] deployedapps; + + public DeployedApplicationsNode(PayaraServer server) { + super("Deployed Applications", null, null); + this.server = server; + } + + public PayaraServer getServer() { + return server; + } + + @Override + public Object[] getChildren() { + + ArrayList<ApplicationNode> appsList = new ArrayList<>(); + + if (deployedapps == null) { + + try { + + if (server == null) { + deployedapps = appsList.toArray(new ApplicationNode[appsList.size()]); + return deployedapps; + } + + try { + Map<String, List<AppDesc>> appMap = NodesUtils.getApplications(server, null); + + for (Entry<String, List<AppDesc>> entry : appMap.entrySet()) { + + List<AppDesc> apps = entry.getValue(); + + for (AppDesc app : apps) { + ApplicationNode t = new ApplicationNode(this, server, app); + appsList.add(t); + } + + } + + } catch (Exception ex) { + PayaraServerPlugin.logError("get Applications is failing=", ex); //$NON-NLS-1$ + } + + } catch (Exception e) { + + } + + this.deployedapps = appsList.toArray(new ApplicationNode[appsList.size()]); + + } + + return this.deployedapps; + + } + + public void refresh() { + deployedapps = null; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/DeployedWebServicesNode.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/DeployedWebServicesNode.java new file mode 100644 index 00000000..6645f5e9 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/DeployedWebServicesNode.java @@ -0,0 +1,120 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes; + +import static fish.payara.eclipse.tools.server.utils.NodesUtils.getWebServices; + +import java.util.ArrayList; +import java.util.List; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.PayaraServerPlugin; +import fish.payara.eclipse.tools.server.serverview.WSDesc; + +/** + * This node shows is the root node below which the dynamically retrieved web-services reside. + * + * <p> + * The following depicts this element in the "Servers" view: + * </p> + * <p> + * + * <pre> + * Payara 5 [domain1] + * |- GlassFish Management + * |-Resources + * |-Deployed Applications + * |-Deployed Web Services * + * |- [WTP managed application] + * </pre> + * </p> + * + * <p> + * Payara / GlassFish is dynamically queried for this list, hence it can only be retrieved for a + * running server. </> + * + */ +public class DeployedWebServicesNode extends TreeNode { + + private PayaraServer server; + private WebServiceNode[] deployedapps; + + public DeployedWebServicesNode(PayaraServer server) { + super("Deployed Web Services", null, null); + this.server = server; + } + + public PayaraServer getServer() { + return server; + } + + @Override + public Object[] getChildren() { + + ArrayList<WebServiceNode> appsList = new ArrayList<>(); + + if (deployedapps == null) { + + try { + + if (server == null) { + deployedapps = appsList.toArray(new WebServiceNode[appsList.size()]); + return deployedapps; + } + + try { + List<WSDesc> wss = getWebServices(server); + + for (WSDesc app : wss) { + + WebServiceNode t = new WebServiceNode(this, server, + + app); + + appsList.add(t); + + } + + } catch (Exception ex) { + + PayaraServerPlugin.logError("get Applications is failing=", ex); //$NON-NLS-1$ + + } + + } catch (Exception e) { + + } + + this.deployedapps = appsList + + .toArray(new WebServiceNode[appsList.size()]); + + } + + return this.deployedapps; + + } + + public void refresh() { + + this.deployedapps = null; + + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/NodeTypes.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/NodeTypes.java new file mode 100644 index 00000000..3b8041d4 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/NodeTypes.java @@ -0,0 +1,90 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes; + +import java.util.HashMap; + +public class NodeTypes { + + // Contract provider constants (identify the different containers in V3) + public static final String EAR_CONTAINER = "ear"; // NOI18N + public static final String WEB_CONTAINER = "web"; // NOI18N + public static final String EJB_CONTAINER = "ejb"; // NOI18N + public static final String APPCLIENT_CONTAINER = "appclient"; // NOI18N + public static final String CONNECTOR_CONTAINER = "connector"; // NOI18N + + // Resource types + public static final String JDBC = "JDBC"; // NOI18N + public static final String JDBC_RESOURCE = "jdbc-resource"; // NOI18N + public static final String JDBC_CONNECTION_POOL = "jdbc-connection-pool"; // NOI18N + public static final String SESSION_PRESERVATION_FLAG = "preserveSessionsOn"; + + public static final String CONNECTORS = "CONNECTORS"; // NOI18N + public static final String CONN_RESOURCE = "connector-resource"; // NOI18N + public static final String CONN_CONNECTION_POOL = "connector-connection-pool"; // NOI18N + public static final String ADMINOBJECT_RESOURCE = "admin-object"; // NOI18N + + public static final String JAVAMAIL = "JAVAMAIL"; // NOI18N + public static final String JAVAMAIL_RESOURCE = "javamail-resource"; // NOI18N + + private static HashMap<String, String[]> nodeTree; + + public static final String APPLICATIONS = "APPLICATIONS"; + public static final String EARS = "EARS"; + public static final String WEBAPPS = "WEBAPPS"; + public static final String EJBS = "EJBS"; + public static final String APPCLIENTS = "APPCLIENTS"; + + public static final String RESOURCES = "RESOURCES"; + + private static final String[] APPLICATIONS_TREE = { + EARS, WEBAPPS, EJBS, APPCLIENTS }; + private static final String[] RESOURCES_TREE = { + JDBC, CONNECTORS, JAVAMAIL }; + private static final String[] JDBC_TREE = { + JDBC_RESOURCE, JDBC_CONNECTION_POOL }; + private static final String[] CONNECTORS_TREE = { + CONN_RESOURCE, CONN_CONNECTION_POOL, ADMINOBJECT_RESOURCE }; + private static final String[] JAVAMAIL_TREE = { + JAVAMAIL_RESOURCE }; + + static { + nodeTree = new HashMap<>(); + nodeTree.put(APPLICATIONS, APPLICATIONS_TREE); + nodeTree.put(RESOURCES, RESOURCES_TREE); + nodeTree.put(JDBC, JDBC_TREE); + nodeTree.put(CONNECTORS, CONNECTORS_TREE); + nodeTree.put(JAVAMAIL, JAVAMAIL_TREE); + } + + private NodeTypes() { + } + + /** + * Returns an array of tree children as strings given a particular parent name. + * + * @param type The node from which children types are derived. + * + * @return All the children types for the node name passed. + */ + static String[] getChildTypes(String type) { + return nodeTree.get(type); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/ResourcesNode.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/ResourcesNode.java new file mode 100644 index 00000000..9ebd3798 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/ResourcesNode.java @@ -0,0 +1,193 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes; + +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logError; +import static fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.NodeTypes.RESOURCES; +import static fish.payara.eclipse.tools.server.utils.NodesUtils.getResourceData; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.eclipse.ui.views.properties.IPropertyDescriptor; +import org.eclipse.ui.views.properties.TextPropertyDescriptor; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.serverview.ResourceDesc; +import fish.payara.eclipse.tools.server.utils.NodesUtils; + +/** + * This node shows is the root node below which the dynamically retrieved "managed resources" (such + * as JDBC datasources, mail resources, etc) reside. + * + * <p> + * The following depicts this element in the "Servers" views: + * </p> + * <p> + * + * <pre> + * Payara 5 [domain1] + * |- GlassFish Management + * |-Resources * + * |-Deployed Applications + * |-Deployed Web Services + * |- [WTP managed application] + * </pre> + * </p> + * + * <p> + * Payara / GlassFish is dynamically queried for this list, hence it can only be retrieved for a + * running server. </> + * + */ +public class ResourcesNode extends TreeNode { + + private PayaraServer server; + private ResourcesNode[] children; + private boolean containerNode; + private ResourceDesc resDescriptor; + private Map<String, String> map; + + public ResourcesNode(PayaraServer server) { + this("Resources", RESOURCES, server, null); + containerNode = true; + } + + public ResourcesNode(String name, String type, PayaraServer server, ResourceDesc resDescriptor) { + super(name, type, null); + + this.server = server; + this.resDescriptor = resDescriptor; + + String[] childTypes = NodeTypes.getChildTypes(type); + + if (childTypes != null) { + for (String childtype : childTypes) { + + ResourcesNode n = new ResourcesNode(childtype, childtype, server, null); + + if (NodeTypes.getChildTypes(childtype) != null) { + n.setContainerNode(); + } + + addChild(n); + } + } + } + + public PayaraServer getServer() { + return server; + } + + public void setContainerNode() { + containerNode = true; + } + + public boolean isContainerNode() { + return containerNode; + } + + public ResourceDesc getResource() { + return resDescriptor; + } + + @Override + public Object[] getChildren() { + + // If a container node or a node that does shows a resource, return std + // child + + if (containerNode || resDescriptor != null) { + return childModules.toArray(); + } + + ArrayList<ResourcesNode> list = new ArrayList<>(); + + if (children == null) { + + try { + if (server == null) { + children = list.toArray(new ResourcesNode[list.size()]); + return children; + } + + try { + List<ResourceDesc> resourcesList = NodesUtils.getResources(server, type); + + for (ResourceDesc resource : resourcesList) { + list.add(new ResourcesNode(resource.getName(), type, server, resource)); + } + + } catch (Exception ex) { + logError("get GlassFish Resources is failing=", ex); //$NON-NLS-1$ + } + } catch (Exception e) { + } + + children = list.toArray(new ResourcesNode[list.size()]); + + } + + return children; + } + + public void refresh() { + children = null; + } + + @Override + public IPropertyDescriptor[] getPropertyDescriptors() { + + List<IPropertyDescriptor> properties = new ArrayList<>(); + + try { + if (resDescriptor != null) { + + map = getResourceData(server, resDescriptor.getName()); + + Set<String> s = map.keySet(); + + for (String prop : s) { + String realvalue = prop.substring(prop.lastIndexOf(".") + 1, prop.length()); + properties.add(new TextPropertyDescriptor(prop, realvalue)); + } + } + + return properties.toArray(new IPropertyDescriptor[0]); + + } catch (Exception ex) { + logError("get GlassFish Resources is failing=", ex); //$NON-NLS-1$ + } + + return null; + } + + @Override + public Object getPropertyValue(Object id) { + + if ((resDescriptor == null) || (map == null)) { + return null; + } + + return map.get(id); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/TreeNode.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/TreeNode.java new file mode 100644 index 00000000..923e3c8e --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/TreeNode.java @@ -0,0 +1,105 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.ui.views.properties.IPropertyDescriptor; +import org.eclipse.ui.views.properties.IPropertySource2; + +public class TreeNode implements IPropertySource2 { + + private TreeNode parent; + private String name; + + protected String type; + protected List<TreeNode> childModules = new ArrayList<>(); + + public TreeNode(String name, String type) { + this(name, type, null); + } + + /* + * + * type is ear, war, ejb etc + * + */ + public TreeNode(String name, String type, TreeNode parent) { + this.parent = parent; + this.name = name; + this.type = type; + } + + public String getName() { + return name; + } + + public String getType() { + return type; + } + + public void addChild(TreeNode childModule) { + childModules.add(childModule); + } + + public Object[] getChildren() { + return childModules.toArray(); + } + + public TreeNode getParent() { + return parent; + } + + @Override + public Object getEditableValue() { + return null; + } + + @Override + public IPropertyDescriptor[] getPropertyDescriptors() { + ArrayList<IPropertyDescriptor> properties = new ArrayList<>(); + return properties.toArray(new IPropertyDescriptor[0]); + } + + @Override + public Object getPropertyValue(Object id) { + return null; + } + + @Override + public void resetPropertyValue(Object arg0) { + + } + + @Override + public void setPropertyValue(Object arg0, Object arg1) { + } + + @Override + public boolean isPropertyResettable(Object arg0) { + return false; + } + + @Override + public boolean isPropertySet(Object arg0) { + return false; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/WebServiceNode.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/WebServiceNode.java new file mode 100644 index 00000000..f637991f --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/WebServiceNode.java @@ -0,0 +1,83 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes; + +import java.util.ArrayList; + +import org.eclipse.ui.views.properties.IPropertyDescriptor; +import org.eclipse.ui.views.properties.TextPropertyDescriptor; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.serverview.WSDesc; + +/** + * + * A deployed web service node in the server view + * + * @author Ludovic Champenois + */ +public class WebServiceNode extends TreeNode { + + private PayaraServer server; + private WSDesc app; + + public WebServiceNode(DeployedWebServicesNode root, PayaraServer server, WSDesc app) { + super(app.getName(), null, root); + this.server = server; + this.app = app; + } + + public PayaraServer getServer() { + return this.server; + } + + public WSDesc getWSInfo() { + return this.app; + } + + @Override + public IPropertyDescriptor[] getPropertyDescriptors() { + ArrayList<IPropertyDescriptor> properties = new ArrayList<>(); + + properties.add(new TextPropertyDescriptor("testurl", "Test URL")); + properties.add(new TextPropertyDescriptor("name", "name")); + properties.add(new TextPropertyDescriptor("wsdlurl", "WSDL URL")); + + return properties.toArray(new IPropertyDescriptor[0]); + } + + @Override + + public Object getPropertyValue(Object id) { + if (id.equals("testurl")) { + return app.getTestURL(); + } + + if (id.equals("name")) { + return app.getName(); + } + + if (id.equals("wsdlurl")) { + return app.getWsdlUrl(); + } + + return null; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/package-info.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/package-info.java new file mode 100644 index 00000000..371a5749 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/package-info.java @@ -0,0 +1,24 @@ + +/** + * This package contains the tree nodes that are rendered underneath a running Payara / GlassFish + * server in the Servers view. + * + * <p> + * The following depicts an example of this: + * </p> + * <p> + * + * <pre> + * Payara 5 [domain1] + * |- GlassFish Management + * |-Resources + * |-Deployed Applications + * |- App1 + * |- App2 + * |-Deployed Web Services + * |- App1 (WTP Managed) + * </pre> + * </p> + * + */ +package fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes; \ No newline at end of file diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/package-info.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/package-info.java new file mode 100644 index 00000000..1ed38636 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/package-info.java @@ -0,0 +1,7 @@ + +/** + * This package contains the UI code for the Payara / GlassFish elements of the + * <code>Window -> Show View -> Servers</code> view in Eclipse. + * + */ +package fish.payara.eclipse.tools.server.ui.serverview; \ No newline at end of file diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/CreatePayaraDomain.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/CreatePayaraDomain.java new file mode 100644 index 00000000..e6afe48c --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/CreatePayaraDomain.java @@ -0,0 +1,292 @@ +package fish.payara.eclipse.tools.server.ui.wizards; + +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.SYMBOLIC_NAME; +import static org.eclipse.core.runtime.IStatus.INFO; +import static org.eclipse.debug.core.ILaunchManager.RUN_MODE; + +import java.io.File; +import java.util.Arrays; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.Platform; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.Launch; +import org.eclipse.debug.core.model.IProcess; +import org.eclipse.jdt.internal.launching.LaunchingPlugin; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.ProgressBar; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Spinner; +import org.eclipse.swt.widgets.Text; + +import fish.payara.eclipse.tools.server.PayaraRuntime; +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.PayaraServerPlugin; + +/** + * Invoked when the user clicks on the "new domain" icon next to the "Domain Path" + * input field in the "new server" wizard. + * + */ + +public class CreatePayaraDomain extends MessageDialog { + + private Text domainName; + private Text domainDir; + private Spinner portBase; + private Label message; + private ProgressBar pb; + private PayaraServer payaraServer; + private PayaraRuntime runtime; + private String path; + public static int MAXIMUM_PORT = 999999; + public static int DEFAULT_PORT = 8000; + public static String DEFAULT_DOMAIN = "domain1"; + + public CreatePayaraDomain(Shell parentShell, PayaraServer payaraServer, PayaraRuntime runtime) { + super(parentShell, GlassfishWizardResources.newDomainTitle, + PayaraServerPlugin.getImage(PayaraServerPlugin.GF_SERVER_IMG), + GlassfishWizardResources.newDomainDescription, CONFIRM, + new String[] { GlassfishWizardResources.newDomainCreateButton, IDialogConstants.CANCEL_LABEL }, 0); + this.payaraServer = payaraServer; + this.runtime = runtime; + } + + public String getPath() { + return path; + } + + @Override + protected void buttonPressed(int buttonId) { + setReturnCode(buttonId); + if (buttonId != 0 || execute()) { + close(); + } + } + + protected boolean domainNameValidation() { + String name = domainName.getText(); + if (name != null && name.trim().length() > 0) { + + if (name.indexOf(' ') > 0) { + setMessage("Invalid value for domain name."); //$NON-NLS-1$ + return false; + } + File domainsDir = new File(domainDir.getText(), name); + if (domainsDir.exists()) { + setMessage("A domain already exists at the specified location."); //$NON-NLS-1$ + return false; + } + return true; + } + return false; + + } + +// @Override +// protected Object run(Presentation context) { +// IRuntime runtime = load(context.part().getModelElement().adapt(IServerWorkingCopy.class), PayaraServer.class) +// .getServer() +// .getRuntime(); +// +// ICreatePayaraDomainOp createDomainOperation = ICreatePayaraDomainOp.TYPE.instantiate(); +// +// // Set existing domain location +// createDomainOperation.setLocation(fromPortableString(runtime.getLocation().toPortableString())); +// +// // Set existing JDK location +// createDomainOperation.setJavaLocation( +// load(runtime, PayaraRuntime.class).getVMInstall().getInstallLocation().getAbsolutePath()); +// +// // Explicitly open Sapphire dialog that asks the user to fill out fields for new domain +// WizardDialog dlg = new WizardDialog( +// Display.getDefault().getActiveShell(), +// new SapphireWizard<>( +// createDomainOperation, +// context(BaseWizardFragment.class) +// .sdef("fish.payara.eclipse.tools.server.ui.PayaraUI") +// .wizard("new-domain-wizard"))); +// +// // If user okay'ed dialog, copy the provided values to our model +// if (dlg.open() == OK) { +// IPayaraServerModel model = (IPayaraServerModel) context.part().getModelElement(); +// +// model.setDomainPath(createDomainOperation.getDomainDir().content().append(createDomainOperation.getName().content())); +// model.setDebugPort(createDomainOperation.getPortBase().content() + 9); +// } +// +// createDomainOperation.dispose(); +// +// return null; +// } +// @Override + + public boolean execute() { + if(!domainNameValidation()) { + return false; + } + File asadmin = new File(new File(payaraServer.getServerHome(), "bin"), + Platform.getOS().equals(Platform.OS_WIN32) ? "asadmin.bat" : "asadmin"); + if (asadmin.exists()) { + String javaExecutablePath = asadmin.getAbsolutePath(); + String[] cmdLine = new String[] { javaExecutablePath, "create-domain", "--nopassword=true", "--portbase", + String.valueOf(portBase.getSelection()), "--domaindir", domainDir.getText(), domainName.getText() }; + + Process p = null; + + try { + final StringBuilder output = new StringBuilder(); + final StringBuilder errOutput = new StringBuilder(); + output.append(Arrays.toString(cmdLine) + "\n"); + + // Set AS_JAVA location which will be used to run asadmin + String envp[] = new String[1]; + envp[0] = "AS_JAVA=" + runtime.getVMInstall().getInstallLocation().getPath(); + + p = DebugPlugin.exec(cmdLine, null, envp); + IProcess process = DebugPlugin.newProcess(new Launch(null, RUN_MODE, null), p, "GlassFish asadmin"); //$NON-NLS-1$ + + // Log output + process.getStreamsProxy().getOutputStreamMonitor().addListener((text, monitor) -> output.append(text)); + + process.getStreamsProxy().getErrorStreamMonitor() + .addListener((text, monitor) -> errOutput.append(text)); + setMessage(""); + for (int i = 0; i < 600; i++) { + // Wait no more than 30 seconds (600 * 50 milliseconds) + if (process.isTerminated()) { + PayaraServerPlugin.getInstance().getLog().log(new org.eclipse.core.runtime.Status(INFO, + SYMBOLIC_NAME, 1, output.toString() + "\n" + errOutput.toString(), null)); + break; + } + try { + Thread.sleep(50); + pb.setSelection(i); + } catch (InterruptedException e) { + } + } + + File f = new File(domainDir.getText(), domainName.getText()); + if (!f.exists()) { + setMessage("Error in creating the Payara Server domain"); + return false; + } + } catch (CoreException ioe) { + LaunchingPlugin.log(ioe); + setMessage(ioe.getMessage()); + return false; + } finally { + if (p != null) { + p.destroy(); + } + } + } + path = domainDir.getText() + File.separator + domainName.getText(); + return true; + } + + private void setMessage(String text) { + message.setText(text); + message.setVisible(!text.isEmpty()); + pb.setVisible(text.isEmpty()); + } + + @Override + protected Control createCustomArea(Composite parent) { + + Composite container = new Composite(parent, SWT.NONE); + GridLayout grid = new GridLayout(2, false); + grid.marginWidth = 0; + container.setLayout(grid); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + + GridLayout layout = new GridLayout(1, true); + container.setLayout(layout); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Composite group = new Composite(container, SWT.NONE); + layout = new GridLayout(); + layout.numColumns = 2; + layout.marginWidth = 0; + layout.marginHeight = 0; + group.setLayout(layout); + group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Label label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.domainName); + GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + + domainName = new Text(group, SWT.BORDER); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + domainName.setLayoutData(data); + domainName.setText(DEFAULT_DOMAIN); + + label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.domainDir); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + + domainDir = new Text(group, SWT.BORDER); + data = new GridData(GridData.FILL_HORIZONTAL); + domainDir.setLayoutData(data); + domainDir.setText(payaraServer.getDomainsFolder()); + + Button browse = new Button(group, SWT.PUSH); + browse.setText(GlassfishWizardResources.browse); + browse.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent se) { + DirectoryDialog dialog = new DirectoryDialog(parent.getShell()); + dialog.setMessage(GlassfishWizardResources.selectInstallDir); + String selectedDirectory = dialog.open(); + if (selectedDirectory != null && !selectedDirectory.isEmpty()) + domainDir.setText(selectedDirectory); + } + }); + + label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.portBase); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + + portBase = new Spinner(group, SWT.BORDER); + portBase.setMinimum(0); + portBase.setMaximum(MAXIMUM_PORT); + portBase.setTextLimit((Integer.toString(MAXIMUM_PORT)).length()); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + portBase.setLayoutData(data); + portBase.setSelection(DEFAULT_PORT); + + message = new Label(group, SWT.NONE); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + message.setLayoutData(data); + message.setForeground(parent.getShell().getDisplay().getSystemColor(SWT.COLOR_RED)); + pb = new ProgressBar(group, SWT.HORIZONTAL); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + pb.setLayoutData(data); + pb.setMinimum(0); + pb.setMaximum(100); + pb.setVisible(false); + return container; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/GlassfishWizardResources.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/GlassfishWizardResources.java new file mode 100644 index 00000000..c243dd84 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/GlassfishWizardResources.java @@ -0,0 +1,56 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.wizards; + +public class GlassfishWizardResources extends org.eclipse.osgi.util.NLS { + + static { + initializeMessages( + "fish.payara.eclipse.tools.server.ui.wizards.GlassfishWizardResources", + GlassfishWizardResources.class); + } + + public static String wzdRuntimeDescription; + public static String wzdServerDescription; + public static String serverName; + public static String payaraLocation; + public static String installedJRE; + public static String installedJREs; + public static String runtimeDefaultJRE; + public static String browse; + public static String selectInstallDir; + + public static String serverHost; + public static String domainPath; + public static String adminName; + public static String adminPassword; + public static String debugPort; + public static String keepSessions; + public static String jarDeploy; + public static String restartPattern; + public static String attachDebugEarly; + public static String enableHotDeploy; + public static String domainName; + public static String domainDir; + public static String portBase; + public static String newDomainCreateButton; + public static String newDomainTitle; + public static String newDomainDescription; + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/GlassfishWizardResources.properties b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/GlassfishWizardResources.properties new file mode 100644 index 00000000..1a3df2e6 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/GlassfishWizardResources.properties @@ -0,0 +1,25 @@ +wzdServerDescription=Define Payara Application Server properties. +wzdRuntimeDescription=Define Payara runtime properties. +serverName=Name: +payaraLocation=Payara Location: +installedJRE=JRE: +installedJREs=Installed JREs... +runtimeDefaultJRE=Workbench default JRE +browse=Browse +selectInstallDir=Select the Payara Server installation directory. +serverHost=Host name: +domainPath=Domain path: +adminName=Admin name: +adminPassword=Admin password: +debugPort=Debug port: +keepSessions=Preserve sessions across redeployment: +jarDeploy=User jar archives for deployment: +restartPattern=Restart pattern: +attachDebugEarly=Attach debugger early: +enableHotDeploy=Enable the Hot Deploy mode: +domainName=Domain name: +domainDir=Domain directory: +portBase=Port base: +newDomainCreateButton=Create +newDomainTitle=Create New Payara Server Domain +newDomainDescription=Create a Payara server domain with default admin user, no password, administration port: portbase + 48 and HTTP port: portbase + 80. \ No newline at end of file diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraRuntimeWizardFragment.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraRuntimeWizardFragment.java new file mode 100644 index 00000000..6e314212 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraRuntimeWizardFragment.java @@ -0,0 +1,435 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2022 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.wizards; + +import static fish.payara.eclipse.tools.server.Messages.duplicateRuntimeName; +import static fish.payara.eclipse.tools.server.ui.wizards.GlassfishWizardResources.wzdRuntimeDescription; +import static fish.payara.eclipse.tools.server.utils.NamingUtils.createUniqueRuntimeName; +import static org.eclipse.wst.server.core.TaskModel.TASK_RUNTIME; + +import java.util.ArrayList; +import java.util.List; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.jdt.launching.AbstractVMInstall; +import org.eclipse.jdt.launching.IVMInstall; +import org.eclipse.jdt.launching.IVMInstallType; +import org.eclipse.jdt.launching.JavaRuntime; +import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.jface.preference.IPreferenceNode; +import org.eclipse.jface.preference.PreferenceDialog; +import org.eclipse.jface.preference.PreferenceManager; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.PlatformUI; +import org.eclipse.wst.server.core.IRuntimeWorkingCopy; +import org.eclipse.wst.server.core.IServerWorkingCopy; +import org.eclipse.wst.server.core.TaskModel; +import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy; +import org.eclipse.wst.server.ui.wizard.IWizardHandle; +import org.eclipse.wst.server.ui.wizard.WizardFragment; + +import fish.payara.eclipse.tools.server.PayaraRuntime; +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.PayaraServerPlugin; +import fish.payara.eclipse.tools.server.exceptions.UniqueNameNotFound; +import fish.payara.eclipse.tools.server.utils.JdkFilter; +import static org.eclipse.osgi.util.NLS.bind; +import org.eclipse.wst.server.core.IRuntime; +import org.eclipse.wst.server.core.IServer; +import static org.eclipse.wst.server.core.ServerCore.getRuntimes; +import static org.eclipse.wst.server.core.ServerCore.getServers; + +/** + * This wizard fragment plugs-in the wizard flow when + * <code>Servers -> New Server -> Payara -> Payara</code> is selected and + * subsequently the <code>next</code> button is pressed when no runtime exists + * yet, or the <code>add</code> button next to + * <code>Server runtime environment</code> is pressed. + * + * <p> + * This fragment essentially causes the screen with <code>Name</code>, + * <code>Payara location</code>, <code>Java Location</code> etc to be rendered. + * + */ +@SuppressWarnings("restriction") +public class NewPayaraRuntimeWizardFragment extends WizardFragment { + + private Text serverName; + + private Text serverLocation; + + private Combo jrecombo; + + private List<IVMInstall> installedJREs; + + private String[] jreNames; + + /* + * (non-Javadoc) + * + * @see org.eclipse.wst.server.ui.wizard.WizardFragment#hasComposite() + */ + @Override + public boolean hasComposite() { + return true; + } + + @Override + public Composite createComposite(Composite parent, IWizardHandle handle) { + Composite container = new Composite(parent, SWT.NONE); + GridLayout grid = new GridLayout(2, false); + grid.marginWidth = 0; + container.setLayout(grid); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + + handle.setImageDescriptor(PayaraServerPlugin.getImageDescriptor(PayaraServerPlugin.GF_WIZARD)); + handle.setTitle(getTitle()); + handle.setDescription(getDescription()); + createContent(container, handle); + return container; + } + + public void createContent(Composite parent, IWizardHandle handle) { + PayaraRuntime payaraRuntime = (PayaraRuntime) getServerRuntime().loadAdapter(PayaraRuntime.class, null); + + GridLayout layout = new GridLayout(1, true); + parent.setLayout(layout); + parent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Composite group = new Composite(parent, SWT.NONE); + layout = new GridLayout(); + layout.numColumns = 2; + layout.marginWidth = 0; + layout.marginHeight = 0; + group.setLayout(layout); + group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Label label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.serverName); + GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + serverName = new Text(group, SWT.BORDER); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + serverName.setLayoutData(data); + serverName.setText(getServerRuntime().getName()); + serverName.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + getServerRuntime().setName(serverName.getText().trim()); + validate(handle); + } + }); + + label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.payaraLocation); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + + serverLocation = new Text(group, SWT.BORDER); + data = new GridData(GridData.FILL_HORIZONTAL); + serverLocation.setLayoutData(data); + serverLocation.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + getServerRuntime().setLocation(new Path(serverLocation.getText().trim())); + validate(handle); + } + }); + + Button browse = new Button(group, SWT.PUSH); + browse.setText(GlassfishWizardResources.browse); + browse.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent se) { + DirectoryDialog dialog = new DirectoryDialog(parent.getShell()); + dialog.setMessage(GlassfishWizardResources.selectInstallDir); + String selectedDirectory = dialog.open(); + if (selectedDirectory != null && !selectedDirectory.isEmpty()) { + serverLocation.setText(selectedDirectory); + getServerRuntime().setLocation(new Path(serverLocation.getText().trim())); + } +// JdkFilter jdkFilter = payaraRuntime.getVersion() == null ? null +// : new JdkFilter(payaraRuntime.getJavaVersionConstraint()); +// updateJREs(jdkFilter); + } + }); + + // JDK location + JdkFilter jdkFilter = payaraRuntime.getVersion() == null ? null + : new JdkFilter(payaraRuntime.getJavaVersionConstraint()); + updateJREs(jdkFilter); +// updateJREs(); + label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.installedJRE); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + + jrecombo = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY); + jrecombo.setItems(jreNames); + data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); + jrecombo.setLayoutData(data); + + jrecombo.addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent e) { + int sel = jrecombo.getSelectionIndex(); + IVMInstall vmInstall = null; + if (sel > 0) { + vmInstall = installedJREs.get(sel - 1); + } + PayaraRuntime payaraRuntime = (PayaraRuntime) getServerRuntime().loadAdapter(PayaraRuntime.class, null); + payaraRuntime.setVMInstall(vmInstall); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + widgetSelected(e); + } + }); + + Button button = SWTUtil.createButton(group, GlassfishWizardResources.installedJREs); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + String currentVM = jrecombo.getText(); + if (showPreferencePage(parent)) { + JdkFilter jdkFilter = payaraRuntime.getVersion() == null ? null + : new JdkFilter(payaraRuntime.getJavaVersionConstraint()); + updateJREs(jdkFilter); +// updateJREs(); + jrecombo.setItems(jreNames); + jrecombo.setText(currentVM); + if (jrecombo.getSelectionIndex() == -1) + jrecombo.select(0); + } + } + }); + } + + protected void updateJREs(JdkFilter jdkFilter) { + // get all installed JVMs + installedJREs = new ArrayList<>(); + IVMInstallType[] vmInstallTypes = JavaRuntime.getVMInstallTypes(); + int size = vmInstallTypes.length; + for (int i = 0; i < size; i++) { + IVMInstall[] vmInstalls = vmInstallTypes[i].getVMInstalls(); + int size2 = vmInstalls.length; + for (int j = 0; j < size2; j++) { +// if (jdkFilter == null || jdkFilter.allows(vmInstalls[j])) { + installedJREs.add(vmInstalls[j]); +// } + } + } + + // get names + size = installedJREs.size(); + jreNames = new String[size + 1]; + jreNames[0] = GlassfishWizardResources.runtimeDefaultJRE; + for (int i = 0; i < size; i++) { + IVMInstall vmInstall = installedJREs.get(i); + jreNames[i + 1] = vmInstall.getName(); + } + if (jrecombo != null) { + jrecombo.setItems(jreNames); + } + } + + private boolean internal(final IVMInstall jvm) { + if (jvm instanceof AbstractVMInstall) { + final String internal = ((AbstractVMInstall) jvm).getAttribute("internal"); + return "true".equals(internal); + } + + return false; + } + + protected boolean showPreferencePage(Composite parent) { + String id = "org.eclipse.jdt.debug.ui.preferences.VMPreferencePage"; + + // should be using the following API, but it only allows a single preference + // page instance. + // see bug 168211 for details + // PreferenceDialog dialog = + // PreferencesUtil.createPreferenceDialogOn(getShell(), id, new String[] { id }, + // null); + // return (dialog.open() == Window.OK); + + PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager(); + IPreferenceNode node = manager.find("org.eclipse.jdt.ui.preferences.JavaBasePreferencePage").findSubNode(id); + PreferenceManager manager2 = new PreferenceManager(); + manager2.addToRoot(node); + PreferenceDialog dialog = new PreferenceDialog(parent.getShell(), manager2); + dialog.create(); + return (dialog.open() == Window.OK); + } + + private String getServerName() { + if (getServer() != null && getServer().getRuntime() != null) + return getServer().getRuntime().getRuntimeType().getName(); + return null; + } + + private IServerWorkingCopy getServer() { + return (IServerWorkingCopy) getTaskModel().getObject(TaskModel.TASK_SERVER); + } + + private IRuntimeWorkingCopy getServerRuntime() { + return (IRuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.wst.server.ui.wizard.WizardFragment#isComplete() + */ + @Override + public boolean isComplete() { + return validate(null); + } + + private PayaraServer getPayaraServer() { + PayaraServer payaraServer = getServer().getAdapter(PayaraServer.class); + if (payaraServer == null) + payaraServer = (PayaraServer) getServer().loadAdapter(PayaraServer.class, null); + return payaraServer; + } + + protected String getTitle() { + return ((IRuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME)).getRuntimeType().getName(); + } + + protected String getDescription() { + return wzdRuntimeDescription; + } + + @Override + public void setTaskModel(TaskModel taskModel) { + super.setTaskModel(taskModel); + + IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); + if (runtime.getOriginal() == null) { + try { + runtime.setName(createUniqueRuntimeName(runtime.getRuntimeType().getName())); + } catch (UniqueNameNotFound e) { + // Set the type name and let the user handle validation error + runtime.setName(runtime.getRuntimeType().getName()); + } + } + } + + @Override + public void performFinish(IProgressMonitor monitor) throws CoreException { + super.performFinish(monitor); + + RuntimeWorkingCopy runtime = (RuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); + runtime.save(true, monitor); + runtime.dispose(); + } + + @Override + public void performCancel(final IProgressMonitor monitor) throws CoreException { + super.performCancel(monitor); + + RuntimeWorkingCopy runtime = (RuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); + runtime.dispose(); + } + + protected boolean validate(IWizardHandle wizard) { + boolean valid = true; + if (wizard != null) { + wizard.setMessage(null, IMessageProvider.NONE); + } + PayaraRuntime payaraRuntime = (PayaraRuntime) getServerRuntime().loadAdapter(PayaraRuntime.class, null); + IStatus status = payaraRuntime.validateServerLocation(new Path(serverLocation.getText())); + if (status.getSeverity() > 0) { + valid = false; + if (wizard != null) { + wizard.setMessage(status.getMessage(), IMessageProvider.ERROR); + } + } + if (payaraRuntime.getVMInstall() == null) { + if (wizard != null) { + wizard.setMessage("JRE path is not valid", IMessageProvider.ERROR); + } + valid = false; + } + if (getServerRuntime().getName() == null || getServerRuntime().getName().isBlank()) { + if (wizard != null) { + wizard.setMessage("Runtime name is not valid", IMessageProvider.ERROR); + } + valid = false; + } else { + IRuntime thisRuntime = payaraRuntime.getRuntime(); + + if (thisRuntime instanceof IRuntimeWorkingCopy) { + thisRuntime = ((IRuntimeWorkingCopy) thisRuntime).getOriginal(); + } + + for (final IRuntime runtime : getRuntimes()) { + if (runtime != thisRuntime && getServerRuntime().getName().equals(runtime.getName())) { + wizard.setMessage(bind(duplicateRuntimeName, getServerRuntime().getName()), IMessageProvider.ERROR); + valid = false; + } + } + + } + if (wizard != null) { + wizard.update(); + } + return valid; + } + + protected String UniqueServerNameValidationService(String name, IServerWorkingCopy thisServerWorkingCopy) { + String duplicateServerName = "Server name %s is already in use"; + + if (!name.isEmpty()) { +// final IServerWorkingCopy thisServerWorkingCopy = name.element().adapt(IServerWorkingCopy.class); + final IServer thisServer = thisServerWorkingCopy.getOriginal(); + + for (final IServer server : getServers()) { + if (server != thisServer && name.equals(server.getName())) { + return String.format(duplicateServerName, name); + } + } + } + + return null; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraServerWizardFragment.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraServerWizardFragment.java new file mode 100644 index 00000000..610a4b17 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraServerWizardFragment.java @@ -0,0 +1,526 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2022 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.wizards; + +import static fish.payara.eclipse.tools.server.PayaraServer.getDefaultDomainDir; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.log; +import static fish.payara.eclipse.tools.server.utils.NamingUtils.createUniqueRuntimeName; +import static org.eclipse.wst.server.core.TaskModel.TASK_RUNTIME; +import static org.eclipse.wst.server.core.TaskModel.TASK_SERVER; +import static org.eclipse.wst.server.core.internal.Server.AUTO_PUBLISH_RESOURCE; +import static org.eclipse.wst.server.core.internal.Server.PROP_AUTO_PUBLISH_SETTING; +import static org.eclipse.wst.server.core.internal.Server.PROP_AUTO_PUBLISH_TIME; + +//import org.eclipse.core.internal.content.Activator; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.jface.preference.IPreferenceNode; +import org.eclipse.jface.preference.PreferenceDialog; +import org.eclipse.jface.preference.PreferenceManager; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Spinner; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.PlatformUI; +import org.eclipse.wst.server.core.IRuntimeWorkingCopy; +import org.eclipse.wst.server.core.IServerWorkingCopy; +import org.eclipse.wst.server.core.TaskModel; +import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy; +import org.eclipse.wst.server.ui.wizard.IWizardHandle; +import org.eclipse.wst.server.ui.wizard.WizardFragment; + +import fish.payara.eclipse.tools.server.PayaraRuntime; +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.PayaraServerPlugin; +import fish.payara.eclipse.tools.server.exceptions.UniqueNameNotFound; +import fish.payara.eclipse.tools.server.utils.WtpUtil; + +/** + * This wizard fragment plugs-in the wizard flow when + * <code>Servers -> New Server -> Payara -> Payara</code> is selected and + * subsequently the <code>next</code> button is pressed. + * + * <p> + * This fragment essentially causes the screen with <code>Name</code>, + * <code>Host name</code>, <code>Domain path</code> etc to be rendered. + * + */ +@SuppressWarnings("restriction") +public class NewPayaraServerWizardFragment extends WizardFragment { + + protected Text serverName; + + protected Text serverHost; + + protected Text domainLocation; + + protected Text adminName; + + protected Text adminPassword; + + protected Text restartPattern; + + protected Spinner debugPort; + + protected Button keepSessions; + + protected Button jarDeploy; + + protected Button hotDeploy; + + protected Button attachDebuggerEarly; + + public static int MAXIMUM_PORT = 999999; + + public static final String DEFAULT_DOMAINS_DIR = "domains"; + + public static final String DEFAULT_DOMAIN_NAME = "domain1"; + + /* + * (non-Javadoc) + * + * @see org.eclipse.wst.server.ui.wizard.WizardFragment#hasComposite() + */ + @Override + public boolean hasComposite() { + return true; + } + + @Override + public Composite createComposite(Composite parent, IWizardHandle handle) { + Composite container = new Composite(parent, SWT.NONE); + GridLayout grid = new GridLayout(2, false); + grid.marginWidth = 0; + container.setLayout(grid); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + + handle.setImageDescriptor(PayaraServerPlugin.getImageDescriptor(PayaraServerPlugin.GF_WIZARD)); + handle.setTitle(getTitle()); + handle.setDescription(getDescription()); + + PayaraServer payaraServer = getServer().getAdapter(PayaraServer.class); + payaraServer.setDomainPath(getDefaultDomainDir(getServer().getRuntime().getLocation()).toOSString()); + + createContent(container, handle); + + try { + getServer().setAttribute(PROP_AUTO_PUBLISH_SETTING, AUTO_PUBLISH_RESOURCE); + getServer().setAttribute(PROP_AUTO_PUBLISH_TIME, 1); + } catch (Exception e) { + log(e); + } + + return container; + } + + public void createContent(Composite parent, IWizardHandle handle) { + PayaraServer payaraServer = getServer().getAdapter(PayaraServer.class); + + GridLayout layout = new GridLayout(1, true); + parent.setLayout(layout); + parent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Composite group = new Composite(parent, SWT.NONE); + layout = new GridLayout(); + layout.numColumns = 2; + layout.marginWidth = 0; + layout.marginHeight = 0; + group.setLayout(layout); + group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Label label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.serverName); + GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + serverName = new Text(group, SWT.BORDER); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + serverName.setLayoutData(data); + serverName.setText(getServer().getName()); + serverName.addModifyListener(e -> { + getServer().setName(serverName.getText()); + validate(handle); + }); + updateServerName(); + + label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.serverHost); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + serverHost = new Text(group, SWT.BORDER); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + serverHost.setLayoutData(data); + serverHost.setText(getServer().getHost()); + serverHost.addModifyListener(e -> { + getServer().setHost(serverHost.getText()); + validate(handle); + }); + + label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.domainPath); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + + domainLocation = new Text(group, SWT.BORDER); + data = new GridData(GridData.FILL_HORIZONTAL); + domainLocation.setLayoutData(data); + domainLocation.setText(payaraServer.getDomainPath()); + domainLocation.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + payaraServer.setDomainPath(domainLocation.getText()); + updateServerName(); + validate(handle); + } + }); + + Button browse = new Button(group, SWT.PUSH); + browse.setText(GlassfishWizardResources.browse); + browse.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent se) { + DirectoryDialog dialog = new DirectoryDialog(parent.getShell()); + dialog.setMessage(GlassfishWizardResources.selectInstallDir); + String selectedDirectory = dialog.open(); + if (selectedDirectory != null && !selectedDirectory.isEmpty()) + domainLocation.setText(selectedDirectory); + updateServerName(); + validate(handle); + } + }); + + Button createDomain = new Button(group, SWT.PUSH); + createDomain.setText(GlassfishWizardResources.newDomainCreateButton); + createDomain.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent se) { + PayaraRuntime runtime = (PayaraRuntime) getServerRuntime().loadAdapter(PayaraRuntime.class, null); + CreatePayaraDomain domain = new CreatePayaraDomain(parent.getShell(), payaraServer, runtime); + domain.open(); + String selectedDirectory = domain.getPath(); + if (selectedDirectory != null && !selectedDirectory.isEmpty()) { + domainLocation.setText(selectedDirectory); + validate(handle); + } + } + }); + + label = new Label(group, SWT.HORIZONTAL | SWT.SEPARATOR); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + data.verticalIndent = 10; + label.setLayoutData(data); + + label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.adminName); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + + adminName = new Text(group, SWT.BORDER); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + adminName.setLayoutData(data); + adminName.setText(payaraServer.getAdminUser()); + adminName.addModifyListener(e -> { + payaraServer.setAdminUser(adminName.getText()); + validate(handle); + }); + + label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.adminPassword); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + + adminPassword = new Text(group, SWT.BORDER | SWT.PASSWORD); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + adminPassword.setLayoutData(data); + adminPassword.setText(payaraServer.getAdminPassword()); + adminPassword.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { +// IServerWorkingCopy copy = getServer(); +// PayaraServer ps = getServer().getAdapter(PayaraServer.class); +// IRuntimeWorkingCopy c2 = getServerRuntime(); + payaraServer.setAdminPassword(adminPassword.getText()); + } + }); + + label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.debugPort); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + + debugPort = new Spinner(group, SWT.BORDER); + debugPort.setMinimum(0); + debugPort.setMaximum(MAXIMUM_PORT); + debugPort.setTextLimit((Integer.toString(MAXIMUM_PORT)).length()); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + debugPort.setLayoutData(data); + debugPort.setSelection(payaraServer.getDebugPort()); + debugPort.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + payaraServer.setDebugPort(debugPort.getSelection()); + } + }); + + label = new Label(group, SWT.HORIZONTAL | SWT.SEPARATOR); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + data.verticalIndent = 10; + label.setLayoutData(data); + + keepSessions = new Button(group, SWT.CHECK); + keepSessions.setText(GlassfishWizardResources.keepSessions); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + keepSessions.setLayoutData(data); + keepSessions.setSelection(payaraServer.getKeepSessions()); + keepSessions.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent se) { + payaraServer.setKeepSessions(keepSessions.getSelection()); + } + }); + + jarDeploy = new Button(group, SWT.CHECK); + jarDeploy.setText(GlassfishWizardResources.jarDeploy); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + jarDeploy.setLayoutData(data); + jarDeploy.setSelection(payaraServer.getJarDeploy()); + jarDeploy.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent se) { + payaraServer.setJarDeploy(jarDeploy.getSelection()); + } + }); + + label = new Label(group, SWT.HORIZONTAL | SWT.SEPARATOR); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + data.verticalIndent = 10; + label.setLayoutData(data); + + label = new Label(group, SWT.NONE); + label.setText(GlassfishWizardResources.restartPattern); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END); + data.horizontalSpan = 2; + label.setLayoutData(data); + + restartPattern = new Text(group, SWT.BORDER); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + restartPattern.setLayoutData(data); + restartPattern.setText(payaraServer.getRestartPattern()); + restartPattern.addModifyListener(e -> payaraServer.setRestartPattern(restartPattern.getText())); + + hotDeploy = new Button(group, SWT.CHECK); + hotDeploy.setText(GlassfishWizardResources.enableHotDeploy); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + hotDeploy.setLayoutData(data); + hotDeploy.setSelection(payaraServer.getHotDeploy()); + hotDeploy.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent se) { + payaraServer.setHotDeploy(hotDeploy.getSelection()); + } + }); + + attachDebuggerEarly = new Button(group, SWT.CHECK); + attachDebuggerEarly.setText(GlassfishWizardResources.attachDebugEarly); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 2; + attachDebuggerEarly.setLayoutData(data); + attachDebuggerEarly.setSelection(payaraServer.getAttachDebuggerEarly()); + attachDebuggerEarly.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent se) { + payaraServer.setAttachDebuggerEarly(attachDebuggerEarly.getSelection()); + } + }); + } + + protected boolean showPreferencePage(Composite parent) { + String id = "org.eclipse.jdt.debug.ui.preferences.VMPreferencePage"; + + // should be using the following API, but it only allows a single preference + // page instance. + // see bug 168211 for details + // PreferenceDialog dialog = + // PreferencesUtil.createPreferenceDialogOn(getShell(), id, new String[] { id }, + // null); + // return (dialog.open() == Window.OK); + + PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager(); + IPreferenceNode node = manager.find("org.eclipse.jdt.ui.preferences.JavaBasePreferencePage").findSubNode(id); + PreferenceManager manager2 = new PreferenceManager(); + manager2.addToRoot(node); + PreferenceDialog dialog = new PreferenceDialog(parent.getShell(), manager2); + dialog.create(); + return (dialog.open() == Window.OK); + } + + @SuppressWarnings("unused") + private String getServerName() { + if (getServer() != null && getServer().getRuntime() != null) + return getServer().getRuntime().getRuntimeType().getName(); + return null; + } + + private IServerWorkingCopy getServer() { + return (IServerWorkingCopy) getTaskModel().getObject(TaskModel.TASK_SERVER); + } + + private IRuntimeWorkingCopy getServerRuntime() { + return (IRuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); + } + + private void updateServerName() { + PayaraServer payaraServer = getPayaraServer(); + String name = getServer().getRuntime().getName() + " ["; + + if (payaraServer.isRemote()) { + name = name + payaraServer.getHost(); + } else { + name = name + payaraServer.getDomainName(); + } + + name = name + "]"; + + getServer().setName(WtpUtil.findUniqueServerName(name)); + serverName.setText(getServer().getName()); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.wst.server.ui.wizard.WizardFragment#isComplete() + */ + @Override + public boolean isComplete() { + return validate(null); + } + + @SuppressWarnings("unused") + private PayaraServer getPayaraServer() { + PayaraServer payaraServer = getServer().getAdapter(PayaraServer.class); + if (payaraServer == null) + payaraServer = (PayaraServer) getServer().loadAdapter(PayaraServer.class, null); + return payaraServer; + } + + protected String getTitle() { + return getServer().getServerType().getName(); + } + + protected String getDescription() { + return GlassfishWizardResources.wzdServerDescription; + } + + @Override + public void setTaskModel(TaskModel taskModel) { + super.setTaskModel(taskModel); + + IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); + if (runtime.getOriginal() == null) { + try { + runtime.setName(createUniqueRuntimeName(runtime.getRuntimeType().getName())); + } catch (UniqueNameNotFound e) { + // Set the type name and let the user handle validation error + runtime.setName(runtime.getRuntimeType().getName()); + } + } + } + + @Override + public void performFinish(IProgressMonitor monitor) throws CoreException { + super.performFinish(monitor); + + RuntimeWorkingCopy runtime = (RuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); + runtime.save(true, monitor); + runtime.dispose(); + } + + @Override + public void performCancel(final IProgressMonitor monitor) throws CoreException { + super.performCancel(monitor); + + RuntimeWorkingCopy runtime = (RuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); + runtime.dispose(); + } + + protected boolean validate(IWizardHandle wizard) { + boolean valid = true; + PayaraServer payaraServer = getServer().getAdapter(PayaraServer.class); + if (wizard != null) { + wizard.setMessage(null, IMessageProvider.NONE); + } + if (payaraServer.getName() == null || payaraServer.getName().isBlank()) { + if (wizard != null) { + wizard.setMessage("Server name is not valid", IMessageProvider.ERROR); + } + } + if (payaraServer.getHost() == null || payaraServer.getHost().isBlank()) { + if (wizard != null) { + wizard.setMessage("Server Host is not valid", IMessageProvider.ERROR); + } + } + if (payaraServer.getAdminUser() == null || payaraServer.getAdminUser().isBlank()) { + if (wizard != null) { + wizard.setMessage("Admin user name is not valid", IMessageProvider.ERROR); + } + } + IStatus status = payaraServer.validate(); + if (status.getSeverity() > 0) { + valid = false; + if (wizard != null) { + wizard.setMessage(status.getMessage(), IMessageProvider.ERROR); + } + } + if (wizard != null) { + wizard.update(); + } + return valid; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/SWTUtil.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/SWTUtil.java new file mode 100644 index 00000000..021a06fb --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/SWTUtil.java @@ -0,0 +1,52 @@ +package fish.payara.eclipse.tools.server.ui.wizards; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.FontMetrics; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +/** + * SWT Utility class. + */ +public class SWTUtil { + private static FontMetrics fontMetrics; + + protected static void initializeDialogUnits(Control testControl) { + // Compute and store a font metric + GC gc = new GC(testControl); + gc.setFont(JFaceResources.getDialogFont()); + fontMetrics = gc.getFontMetrics(); + gc.dispose(); + } + + /** + * Returns a width hint for a button control. + */ + protected static int getButtonWidthHint(Button button) { + int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH); + return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); + } + + /** + * Create a new button with the standard size. + * + * @param comp the component to add the button to + * @param label the button label + * @return a button + */ + public static Button createButton(Composite comp, String label) { + Button b = new Button(comp, SWT.PUSH); + b.setText(label); + if (fontMetrics == null) + initializeDialogUnits(comp); + GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); + data.widthHint = getButtonWidthHint(b); + b.setLayoutData(data); + return b; + } +} \ No newline at end of file diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/actions/TestRemotePayaraConnectionAction.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/actions/TestRemotePayaraConnectionAction.java new file mode 100644 index 00000000..74c0a29b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/actions/TestRemotePayaraConnectionAction.java @@ -0,0 +1,127 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.ui.wizards.actions; + +import static fish.payara.eclipse.tools.server.Messages.versionsNotMatching; +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.SYMBOLIC_NAME; +import static fish.payara.eclipse.tools.server.ServerStatus.RUNNING_CONNECTION_ERROR; +import static fish.payara.eclipse.tools.server.ServerStatus.RUNNING_CREDENTIAL_PROBLEM; +import static fish.payara.eclipse.tools.server.ServerStatus.RUNNING_DOMAIN_MATCHING; +import static fish.payara.eclipse.tools.server.ServerStatus.RUNNING_PROXY_ERROR; +import static fish.payara.eclipse.tools.server.ServerStatus.RUNNING_REMOTE_NOT_SECURE; +import static fish.payara.eclipse.tools.server.ServerStatus.STOPPED_NOT_LISTENING; +import static fish.payara.eclipse.tools.server.utils.ServerStatusHelper.checkServerStatus; +import static fish.payara.eclipse.tools.server.utils.WtpUtil.load; +import static org.eclipse.core.runtime.IStatus.ERROR; +import static org.eclipse.core.runtime.IStatus.INFO; +import static org.eclipse.wst.common.frameworks.internal.dialog.ui.MessageDialog.openMessage; + +import org.eclipse.core.runtime.Status; +import org.eclipse.swt.widgets.Display; +import org.eclipse.wst.server.core.IServerWorkingCopy; + +import fish.payara.eclipse.tools.server.PayaraRuntime; +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.ServerStatus; +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; + +/** + * Action that's available on the new server wizard that allows testing the connection to a remote + * server. + * + * <p> + * Note that is only available for remote servers, not for local servers. + * </p> + * + */ +@SuppressWarnings("restriction") +public class TestRemotePayaraConnectionAction { + + protected Object run(IServerWorkingCopy wc) { + PayaraServer payaraServer = load(wc, PayaraServer.class); + + ServerStatus serverStatus = checkServerStatus(payaraServer); + + if (!serverStatus.equals(RUNNING_DOMAIN_MATCHING)) { + StringBuilder errorMessage = new StringBuilder(); + errorMessage.append("Cannot communicate with ") + .append(payaraServer.getServer().getHost()) + .append(":") + .append(payaraServer.getAdminPort()) + .append(" remote server."); + + // Give some hints + if (serverStatus.equals(STOPPED_NOT_LISTENING)) { + errorMessage.append(" Is it up?"); + } else if (serverStatus.equals(RUNNING_REMOTE_NOT_SECURE)) { + errorMessage.append(" Is it secure? (Hint: run asadmin enable-secure-admin)"); + } else if (serverStatus.equals(RUNNING_CREDENTIAL_PROBLEM)) { + errorMessage.append(" Wrong user name or password. Check your credentials."); + } else if (serverStatus.equals(RUNNING_PROXY_ERROR)) { + errorMessage.append(" Check your proxy settings."); + } else if (serverStatus.equals(RUNNING_CONNECTION_ERROR)) { + // Add all possible hints + errorMessage.append(" Is it up?") + .append(" Is it secure? (Hint: run asadmin enable-secure-admin)"); + } + + openMessage( + Display.getDefault().getActiveShell(), + "Error", "Error connecting to remote server", + new Status(ERROR, SYMBOLIC_NAME, errorMessage.toString())); + + } else { + + // Check server version + + String remoteServerVersion = PayaraServerBehaviour.getVersion(payaraServer); + String thisServerVersion = wc.getRuntime() + .getAdapter(PayaraRuntime.class) + .getVersion() + .toString(); + + int n = thisServerVersion.indexOf(".X"); + if (n > 0) { + thisServerVersion = thisServerVersion.substring(0, n + 1); + } + + if (remoteServerVersion != null && remoteServerVersion.indexOf(thisServerVersion) < 0) { + + openMessage( + Display.getDefault().getActiveShell(), + "Error", + versionsNotMatching, + new Status(ERROR, SYMBOLIC_NAME, "The remote server version is " + remoteServerVersion)); + + } else { + + // Everything seems to be OK + openMessage( + Display.getDefault().getActiveShell(), + "Connection successful", + "Connection to server was successful", + new Status(INFO, SYMBOLIC_NAME, "Connection to server was successful")); + } + } + + return null; + + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/EqualsFactory.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/EqualsFactory.java new file mode 100644 index 00000000..55e61954 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/EqualsFactory.java @@ -0,0 +1,179 @@ +/****************************************************************************** + * Copyright (c) 2016 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Konstantin Komissarchik - initial implementation and ongoing maintenance + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +/** + * @author <a href="mailto:konstantin@komissarchik.net">Konstantin Komissarchik</a> + */ + +public abstract class EqualsFactory +{ + private static EqualsFactory TRUE = new TrueEqualsFactory(); + private static EqualsFactory FALSE = new FalseEqualsFactory(); + + private EqualsFactory() + { + } + + public static EqualsFactory start() + { + return TRUE; + } + + public abstract EqualsFactory add( Object x, Object y ); + public abstract EqualsFactory add( boolean x, boolean y ); + public abstract EqualsFactory add( char x, char y ); + public abstract EqualsFactory add( byte x, byte y ); + public abstract EqualsFactory add( short x, short y ); + public abstract EqualsFactory add( int x, int y ); + public abstract EqualsFactory add( long x, long y ); + public abstract EqualsFactory add( float x, float y ); + public abstract EqualsFactory add( double x, double y ); + + public abstract boolean result(); + + private static final class TrueEqualsFactory extends EqualsFactory + { + @Override + public EqualsFactory add( final Object x, final Object y ) + { + if( x == y ) + { + return TRUE; + } + else if( x != null && y != null ) + { + return ( x.equals( y ) ? TRUE : FALSE ); + } + + return FALSE; + } + + @Override + public EqualsFactory add( final boolean x, final boolean y ) + { + return ( x == y ? TRUE : FALSE ); + } + + @Override + public EqualsFactory add( final char x, final char y ) + { + return ( x == y ? TRUE : FALSE ); + } + + @Override + public EqualsFactory add( final byte x, final byte y ) + { + return ( x == y ? TRUE : FALSE ); + } + + @Override + public EqualsFactory add( final short x, final short y ) + { + return ( x == y ? TRUE : FALSE ); + } + + @Override + public EqualsFactory add( final int x, final int y ) + { + return ( x == y ? TRUE : FALSE ); + } + + @Override + public EqualsFactory add( final long x, final long y ) + { + return ( x == y ? TRUE : FALSE ); + } + + @Override + public EqualsFactory add( final float x, final float y ) + { + return ( x == y ? TRUE : FALSE ); + } + + @Override + public EqualsFactory add( final double x, final double y ) + { + return ( x == y ? TRUE : FALSE ); + } + + @Override + public boolean result() + { + return true; + } + } + + private static final class FalseEqualsFactory extends EqualsFactory + { + @Override + public EqualsFactory add( final Object x, final Object y ) + { + return this; + } + + @Override + public EqualsFactory add( final boolean x, final boolean y ) + { + return this; + } + + @Override + public EqualsFactory add( final char x, final char y ) + { + return this; + } + + @Override + public EqualsFactory add( final byte x, final byte y ) + { + return this; + } + + @Override + public EqualsFactory add( final short x, final short y ) + { + return this; + } + + @Override + public EqualsFactory add( final int x, final int y ) + { + return this; + } + + @Override + public EqualsFactory add( final long x, final long y ) + { + return this; + } + + @Override + public EqualsFactory add( final float x, final float y ) + { + return this; + } + + @Override + public EqualsFactory add( final double x, final double y ) + { + return this; + } + + @Override + public boolean result() + { + return false; + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/Filter.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/Filter.java new file mode 100644 index 00000000..e7b3be9b --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/Filter.java @@ -0,0 +1,31 @@ +/****************************************************************************** + * Copyright (c) 2016 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Konstantin Komissarchik - initial implementation and ongoing maintenance + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +/** + * Generic filter interface that can be parameterized for different element types. + * + * @author <a href="mailto:konstantin@komissarchik.net">Konstantin Komissarchik</a> + */ + +public interface Filter<E> +{ + /** + * Evaluates whether the given element passes the criteria implemented by the filter. + * + * @param element the element to evaluate or null + * @return true if the given element is allowed by the filter, false otherwise + */ + + boolean allows( E element ); + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/HashCodeFactory.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/HashCodeFactory.java new file mode 100644 index 00000000..f4cfa2cd --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/HashCodeFactory.java @@ -0,0 +1,90 @@ +/****************************************************************************** + * Copyright (c) 2016 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Konstantin Komissarchik - initial implementation and ongoing maintenance + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +/** + * @author <a href="mailto:konstantin@komissarchik.net">Konstantin Komissarchik</a> + */ + +public final class HashCodeFactory +{ + private final int result; + + private HashCodeFactory( final int result ) + { + this.result = result; + } + + public static HashCodeFactory start() + { + return new HashCodeFactory( 1 ); + } + + public HashCodeFactory add( final Object object ) + { + if( object == null ) + { + return this; + } + else + { + return new HashCodeFactory( this.result ^ object.hashCode() ); + } + } + + public HashCodeFactory add( final boolean value ) + { + return new HashCodeFactory( this.result ^ ( value ? 1231 : 1237 ) ); + } + + public HashCodeFactory add( final char value ) + { + return new HashCodeFactory( this.result ^ value ); + } + + public HashCodeFactory add( final byte value ) + { + return new HashCodeFactory( this.result ^ value ); + } + + public HashCodeFactory add( final short value ) + { + return new HashCodeFactory( this.result ^ value ); + } + + public HashCodeFactory add( final int value ) + { + return new HashCodeFactory( this.result ^ value ); + } + + public HashCodeFactory add( final long value ) + { + return new HashCodeFactory( this.result ^ (int) ( value ^ ( value >>> 32 ) ) ); + } + + public HashCodeFactory add( final float value ) + { + return new HashCodeFactory( this.result ^ Float.floatToIntBits( value ) ); + } + + public HashCodeFactory add( final double value ) + { + final long v = Double.doubleToLongBits( value ); + return new HashCodeFactory( this.result ^ (int) ( v ^ ( v >>> 32 ) ) ); + } + + public int result() + { + return this.result; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/IsPayaraUtil.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/IsPayaraUtil.java new file mode 100644 index 00000000..e04ee7fd --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/IsPayaraUtil.java @@ -0,0 +1,77 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import org.eclipse.wst.common.project.facet.core.runtime.IRuntime; +import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent; +import org.eclipse.wst.server.core.IServer; +import org.eclipse.wst.server.core.IServerType; + +/** + * Set of utility methods to help determining whether something constitutes "Payara" or "GlassFish". + * + * + * @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a> + */ + +public final class IsPayaraUtil { + + public static boolean isPayara(org.eclipse.wst.server.core.IRuntime runtime) { + if (runtime != null) { + return runtime.getRuntimeType().getId().equals("payara.runtime"); + } + + return false; + } + + public static boolean isPayara(IRuntime runtime) { + if (runtime != null) { + for (IRuntimeComponent component : runtime.getRuntimeComponents()) { + return isPayara(component); + } + } + + return false; + } + + public static boolean isPayara(IRuntimeComponent component) { + if (component != null) { + return component.getRuntimeComponentType().getId().equals("payara.runtime"); + } + + return false; + } + + public static boolean isPayara(IServer server) { + if (server != null) { + return isPayara(server.getServerType()); + } + + return false; + } + + + public static boolean isPayara(IServerType type) { + if (type != null) { + return type.getId().equals("payara.server"); + } + + return false; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/JdkFilter.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/JdkFilter.java new file mode 100644 index 00000000..9470c5d3 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/JdkFilter.java @@ -0,0 +1,46 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import static fish.payara.eclipse.tools.server.utils.JdtUtil.validateJvm; + +import org.eclipse.jdt.launching.IVMInstall; + +/** + * @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a> + */ + +public final class JdkFilter implements Filter<IVMInstall> { + private final VersionConstraint versionConstraint; + + public JdkFilter(final VersionConstraint versionConstraint) { + if (versionConstraint == null) { + throw new IllegalArgumentException(); + } + + this.versionConstraint = versionConstraint; + } + + @Override + + public boolean allows(final IVMInstall jvm) { + return validateJvm(jvm).jdk().version(this.versionConstraint).result().ok(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/JdtUtil.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/JdtUtil.java new file mode 100644 index 00000000..c338acde --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/JdtUtil.java @@ -0,0 +1,401 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import java.io.File; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jdt.core.IClasspathEntry; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.launching.IVMInstall; +import org.eclipse.jdt.launching.IVMInstall2; +import org.eclipse.jdt.launching.IVMInstallType; +import org.eclipse.jdt.launching.JavaRuntime; +import org.eclipse.jdt.launching.VMStandin; +import org.osgi.framework.Bundle; + +import fish.payara.eclipse.tools.server.PayaraServerPlugin; +import fish.payara.eclipse.tools.server.Status; + +/** + * @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a> + */ + +public final class JdtUtil { + private static String invalidJavaLocationMessage = "Java installation not found in the specified folder"; + + private static String jdkIsRequiredMessage = "Java Development Kit (JDK) is required rather than a JRE"; + + private static String javaVersionRequiredSingle = "Java {0} is required"; + + private static String javaVersionRequiredMin = "Java {0} or higher is required"; + + private static String javaVersionRequiredMax = "Java {0} or lower is required"; + + private static String javaVersionRequiredOr = "Java {0} or {1} is required"; + + private static String javaVersionRequiredRange = "Java {0} through {1} is required"; + + private static final Map<File, String> jvmLocationToVersionMap = new HashMap<>(); + + public static final class JvmValidator { + + private File location; + private Status status; + + private JvmValidator(final File location) { + this.location = location; + this.status = (isValidJvmInstall(location) ? Status.createOkStatus() + : Status.createErrorStatus(invalidJavaLocationMessage)); + } + + public JvmValidator jdk() { + return this; + } + + public JvmValidator version(final String constraint) { + if (this.status.ok()) { + version(new VersionConstraint(constraint)); + } + + return this; + } + + /** + * Adds a Java version constraint. + * + * @param constraint the Java version constraint or null for no constraint + * @return this JvmValidator object for method chaining + */ + + public JvmValidator version(final VersionConstraint constraint) { + if (this.status.ok() && constraint != null) { + if (constraint.ranges().size() != 1) { + throw new IllegalArgumentException(); + } + + final VersionConstraint.Range range = constraint.ranges().get(0); + final VersionConstraint.Range.Limit min = range.min(); + final VersionConstraint.Range.Limit max = range.max(); + + if ((min != null && !min.inclusive()) || (max != null && !max.inclusive())) { + throw new IllegalArgumentException(); + } + + String version = detectJavaVersion(this.location); + + if (version != null) { + final String[] segments = version.split("\\."); + + if (segments.length >= 2) { + version = segments[0] + "." + segments[1]; + } + } + + if (version == null || !constraint.check(version)) { + if (min == null) { + this.status = Status.createErrorStatus(javaVersionRequiredMax.format(toDisplayVersion(max.version()))); + } else { + if (max == null) { + this.status = Status.createErrorStatus(javaVersionRequiredMin.format(toDisplayVersion(min.version()))); + } else { + final Version minver = min.version(); + final Version maxver = max.version(); + + if (minver.equals(maxver)) { + this.status = Status.createErrorStatus(javaVersionRequiredSingle.format(toDisplayVersion(minver))); + } else if (minver.segments().size() == 2 && maxver.segments().size() == 2 + && minver.segment(1) + 1L == maxver.segment(1)) { + this.status = Status.createErrorStatus( + javaVersionRequiredOr.format(toDisplayVersion(minver), toDisplayVersion(maxver))); + } else { + this.status = Status.createErrorStatus( + javaVersionRequiredRange.format(toDisplayVersion(minver), toDisplayVersion(maxver))); + } + } + } + } + } + + return this; + } + + public Status result() { + return this.status; + } + + private static String toDisplayVersion(final Version version) { + final List<Long> segments = version.segments(); + + if (segments.size() == 2) { + final Long secondSegment = segments.get(1); + + if (secondSegment >= 5L) { + return String.valueOf(secondSegment); + } + } + + return version.toString(); + } + } + + public static JvmValidator validateJvm(final File location) { + return new JvmValidator(location); + } + + public static JvmValidator validateJvm(final IVMInstall jvm) { + return new JvmValidator(jvm.getInstallLocation()); + } + + public static boolean isValidJvmInstall(final IPath location) { + return (location != null && isValidJvmInstall(location.toFile())); + } + + public static boolean isValidJvmInstall(final File location) { + return (location != null && findJavaExecutable(location) != null); + } + + public static IVMInstallType findStandardJvmType() { + return JavaRuntime.getVMInstallType("org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType"); + } + + public static IVMInstall findOrCreateJvm(final String location) { + if (location != null) { + return findOrCreateJvm(new File(location)); + } + + return null; + } + + public static IVMInstall findOrCreateJvm(final File location) { + IVMInstall jvm = null; + + if (isValidJvmInstall(location)) { + jvm = findJvmByLocation(location); + + if (jvm == null) { + final String jvmName = findUniqueJvmName(location.getName()); + final IVMInstallType standardJvmType = findStandardJvmType(); + + final VMStandin jvmStandin = new VMStandin(standardJvmType, jvmName); + jvmStandin.setName(jvmName); + jvmStandin.setInstallLocation(location); + + jvm = jvmStandin.convertToRealVM(); + + try { + JavaRuntime.saveVMConfiguration(); + JavaRuntime.getDefaultVMInstall(); + } catch (final Exception e) { + PayaraServerPlugin.log(e); + } + } + } + + return jvm; + } + + public static final IVMInstall findJvmByLocation(final String location) { + if (location != null) { + return findJvmByLocation(new File(location)); + } + + return null; + } + + public static final IVMInstall findJvmByLocation(final File location) { + if (location != null) { + for (final IVMInstallType type : JavaRuntime.getVMInstallTypes()) { + for (final IVMInstall jvm : type.getVMInstalls()) { + if (location.equals(jvm.getInstallLocation())) { + return jvm; + } + } + } + } + + return null; + } + + public static final IVMInstall findJvmByName(final String name) { + if (name != null) { + for (final IVMInstallType type : JavaRuntime.getVMInstallTypes()) { + final IVMInstall jvm = type.findVMInstallByName(name); + + if (jvm != null) { + return jvm; + } + } + } + + return null; + } + + public static IVMInstall findJdkByVersion(final VersionConstraint versionConstraint) { + return findJvm(new JdkFilter(versionConstraint)); + } + + public static IVMInstall findJvm(final Filter<IVMInstall> filter) { + IVMInstall jvm = null; + + for (final IVMInstallType vmInstallType : JavaRuntime.getVMInstallTypes()) { + for (final IVMInstall vmInstall : vmInstallType.getVMInstalls()) { + if (filter.allows(vmInstall)) { + jvm = newer(jvm, vmInstall); + } + } + } + + return (jvm == null ? null : jvm); + } + + public static String findUniqueJvmName(final String baseName) { + if (baseName == null) { + throw new IllegalArgumentException(); + } + + int counter = 0; + boolean unique = false; + String name = null; + + while (!unique) { + counter++; + name = baseName + (counter == 1 ? "" : " (" + counter + ")"); + unique = (findJvmByName(name) == null); + } + + return name; + } + + public static IVMInstall newer(final IVMInstall a, final IVMInstall b) { + if (a == null) { + return b; + } else if (b == null) { + return a; + } else { + final String av = ((IVMInstall2) a).getJavaVersion(); + final String bv = ((IVMInstall2) b).getJavaVersion(); + + if (new Version(av).compareTo(new Version(bv)) >= 0) { + return a; + } else { + return b; + } + } + } + + public static String detectJavaVersion(final File location) { + if (location != null) { + synchronized (jvmLocationToVersionMap) { + String version = jvmLocationToVersionMap.get(location); + + if (version == null) { + final File exec = findJavaExecutable(location); + + if (exec != null) { + try { + final Bundle bundle = Platform.getBundle("fish.payara.eclipse.tools.server.jver"); + + File cp = FileLocator.getBundleFile(bundle); + + if (cp.isDirectory()) { + cp = new File(cp, "bin"); + } + + final Process process = Runtime.getRuntime().exec( + new String[] { + exec.getAbsolutePath(), + "-cp", + cp.getAbsolutePath(), + "fish.payara.eclipse.tools.server.jver.JavaVersionDetector" + }); + + final StreamGobbler outStreamGobbler = new StreamGobbler(process.getInputStream()); + final StreamGobbler errStreamGobbler = new StreamGobbler(process.getErrorStream()); + + outStreamGobbler.start(); + errStreamGobbler.start(); + + try { + process.waitFor(); + } catch (final InterruptedException e) { + } + + final String output = outStreamGobbler.output().trim() + errStreamGobbler.output().trim(); + + if (output.length() > 0) { + version = output; + jvmLocationToVersionMap.put(location, version); + } + } catch (final Exception e) { + PayaraServerPlugin.log(e); + } + } + } + + return version; + } + } + + return null; + } + + private static final String[] fgCandidateJavaFiles = { "java", "java.exe" }; + private static final String[] fgCandidateJavaLocations = { "bin" + File.separatorChar, + "jre" + File.separatorChar + "bin" + File.separatorChar }; + + private static File findJavaExecutable(File vmInstallLocation) { + // Try each candidate in order. The first one found wins. Thus, the order + // of fgCandidateJavaLocations and fgCandidateJavaFiles is significant. + for (String fgCandidateJavaFile : fgCandidateJavaFiles) { + for (String fgCandidateJavaLocation : fgCandidateJavaLocations) { + File javaFile = new File(vmInstallLocation, fgCandidateJavaLocation + fgCandidateJavaFile); + if (javaFile.isFile()) { + return javaFile; + } + } + } + return null; + } + + public static void addToClasspath(IJavaProject project, IClasspathEntry entry) throws CoreException { + final IClasspathEntry[] oldEntries = project.getRawClasspath(); + + for (IClasspathEntry x : oldEntries) { + if (x.equals(entry)) { + return; + } + } + + int oldEntriesLength = oldEntries.length; + IClasspathEntry[] newEntries = new IClasspathEntry[oldEntriesLength + 1]; + System.arraycopy(oldEntries, 0, newEntries, 0, oldEntriesLength); + + newEntries[oldEntriesLength] = entry; + + project.setRawClasspath(newEntries, null); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/Jobs.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/Jobs.java new file mode 100644 index 00000000..86ea0ba3 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/Jobs.java @@ -0,0 +1,53 @@ +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import static org.eclipse.core.runtime.jobs.Job.SHORT; + +import org.eclipse.core.runtime.ICoreRunnable; +import org.eclipse.core.runtime.jobs.Job; + +/** + * Utility class for running jobs + * + * @author Arjan Tijms + * + */ +public class Jobs { + + /** + * Schedules the <code>runnable</code> to be run via a <code>Job</code> + * + * <p> + * The job is added to a queue of waiting jobs with the priority for short background jobs, + * and will be run when it arrives at the beginning of the queue. + * + * <p> + * The monitor is started and set at 100 steps, and closed after the <code>runnable</code> executes. + * + * @param name the name of the job + * @param runnable the runnable to execute + */ + public static void scheduleShortJob(String name, ICoreRunnable runnable) { + Job job = Job.create(name, + monitor -> { + try { + monitor.beginTask(name, 100); + runnable.run(monitor); + } finally { + monitor.done(); + } + }); + + job.setPriority(SHORT); + job.schedule(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/ListFactory.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/ListFactory.java new file mode 100644 index 00000000..dbffcb2d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/ListFactory.java @@ -0,0 +1,284 @@ +/****************************************************************************** + * Copyright (c) 2016 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Konstantin Komissarchik - initial implementation and ongoing maintenance + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +/** + * @author <a href="mailto:konstantin@komissarchik.net">Konstantin Komissarchik</a> + */ + +public final class ListFactory<E> +{ + private Filter<E> filter; + private E firstElement = null; + private ArrayList<E> list = null; + private boolean exported = false; + + private ListFactory() {} + + public static <E> List<E> empty() + { + return Collections.emptyList(); + } + + public static <E> List<E> singleton( final E element ) + { + return Collections.singletonList( element ); + } + + @SafeVarargs + + public static <E> List<E> unmodifiable( final E... elements ) + { + return ListFactory.<E>start().add( elements ).result(); + } + + public static <E> List<E> unmodifiable( final Collection<E> elements ) + { + return ListFactory.<E>start().add( elements ).result(); + } + + public static <E> ListFactory<E> start() + { + return new ListFactory<>(); + } + + public ListFactory<E> filter( final Filter<E> filter ) + { + if( this.exported ) + { + throw new IllegalStateException(); + } + + this.filter = filter; + + if( this.filter != null ) + { + if( this.list != null ) + { + for( Iterator<E> itr = this.list.iterator(); itr.hasNext(); ) + { + if( ! this.filter.allows( itr.next() ) ) + { + itr.remove(); + } + } + + final int size = this.list.size(); + + if( size == 1 ) + { + this.firstElement = this.list.get( 0 ); + this.list = null; + } + else if( size == 0 ) + { + this.list = null; + } + } + else if( this.firstElement != null ) + { + if( ! this.filter.allows( this.firstElement ) ) + { + this.firstElement = null; + } + } + } + + return this; + } + + public ListFactory<E> add( final E element ) + { + if( this.exported ) + { + throw new IllegalStateException(); + } + + if( element != null && ( this.filter == null || this.filter.allows( element ) ) ) + { + if( this.list != null ) + { + this.list.add( element ); + } + else if( this.firstElement != null ) + { + this.list = new ArrayList<>(); + this.list.add( this.firstElement ); + this.list.add( element ); + this.firstElement = null; + } + else + { + this.firstElement = element; + } + } + + return this; + } + + @SafeVarargs + + public final ListFactory<E> add( final E... elements ) + { + if( elements != null ) + { + for( E element : elements ) + { + add( element ); + } + } + + return this; + } + + public ListFactory<E> add( final Collection<E> elements ) + { + if( elements != null ) + { + for( E element : elements ) + { + add( element ); + } + } + + return this; + } + + public E remove( final int index ) + { + final int size = size(); + + if( index < 0 || index >= size ) + { + throw new IllegalArgumentException(); + } + + E removed; + + if( this.list != null ) + { + if( size == 2 ) + { + removed = this.list.get( index ); + this.firstElement = this.list.get( index == 0 ? 1 : 0 ); + this.list = null; + } + else + { + removed = this.list.remove( index ); + } + } + else if( this.firstElement != null ) + { + removed = this.firstElement; + this.firstElement = null; + } + else + { + throw new IllegalStateException(); + } + + return removed; + } + + public E get( final int index ) + { + if( index < 0 || index >= size() ) + { + throw new IllegalArgumentException(); + } + + E element; + + if( this.list != null ) + { + element = this.list.get( index ); + } + else if( this.firstElement != null ) + { + element = this.firstElement; + } + else + { + throw new IllegalStateException(); + } + + return element; + } + + public boolean contains( final E element ) + { + boolean contains = false; + + if( this.list != null ) + { + contains = this.list.contains( element ); + } + else if( this.firstElement != null && this.firstElement.equals( element ) ) + { + contains = true; + } + + return contains; + } + + public int size() + { + final int size; + + if( this.list != null ) + { + size = this.list.size(); + } + else if( this.firstElement != null) + { + size = 1; + } + else + { + size = 0; + } + + return size; + } + + public List<E> result() + { + if( this.exported ) + { + throw new IllegalStateException(); + } + + this.exported = true; + + if( this.list != null ) + { + this.list.trimToSize(); + return Collections.unmodifiableList( this.list ); + } + else if( this.firstElement != null ) + { + return Collections.singletonList( this.firstElement ); + } + else + { + return Collections.emptyList(); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/MiscUtil.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/MiscUtil.java new file mode 100644 index 00000000..78af8aa2 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/MiscUtil.java @@ -0,0 +1,234 @@ +/****************************************************************************** + * Copyright (c) 2016 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Konstantin Komissarchik - initial implementation and ongoing maintenance + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import static java.nio.charset.StandardCharsets.UTF_8; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.security.MessageDigest; +import java.util.Arrays; +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * @author <a href="mailto:konstantin@komissarchik.net">Konstantin Komissarchik</a> + */ + +public class MiscUtil +{ + + private static final Logger LOG = Logger.getLogger(MiscUtil.class.getName()); + + public static final String EMPTY_STRING = ""; //$NON-NLS-1$ + + public static final boolean equal( final Object obj1, + final Object obj2 ) + { + if( obj1 == obj2 ) + { + return true; + } + else if( obj1 != null && obj2 != null ) + { + return obj1.equals( obj2 ); + } + + return false; + } + + + public static boolean contains( final Object[] array, + final Object object ) + { + for( int i = 0; i < array.length; i++ ) + { + if( array[ i ].equals( object ) ) + { + return true; + } + } + + return false; + } + + public static <T> boolean containsUsingIdentity( final Collection<? extends T> collection, final T item ) + { + for( T x : collection ) + { + if( x == item ) + { + return true; + } + } + + return false; + } + + public static int indexOf( final Object[] array, + final Object object ) + { + for( int i = 0; i < array.length; i++ ) + { + if( array[ i ].equals( object ) ) + { + return i; + } + } + + throw new IllegalArgumentException(); + } + + public static String readTextContent( final Reader reader ) + + throws IOException + + { + final StringBuffer buf = new StringBuffer(); + final char[] chars = new char[ 8 * 1024 ]; + int count; + + while( ( count = reader.read( chars, 0, chars.length ) ) > 0 ) + { + buf.append( chars, 0, count ); + } + + return buf.toString(); + } + + public static String readTextContent( final InputStream in ) + + throws IOException + + { + return readTextContent( new InputStreamReader( in, UTF_8 ) ); + } + + public static String readTextResource( final ClassLoader cl, final String resourceFullPath ) + { + try( InputStream in = cl.getResourceAsStream( resourceFullPath ) ) + { + return readTextContent( in ); + } + catch( final IOException e ) + { + LOG.log(Level.SEVERE, null, e); + return ""; + } + } + + public static String readTextResource( final Class<?> c, final String resourceLocalName ) + { + final ClassLoader cl = c.getClassLoader(); + final String resourcePath = c.getName().replace( '.', '/' ) + "." + resourceLocalName; + + return readTextResource( cl, resourcePath ); + } + + public static final String createStringDigest( final String str ) + { + try + { + final MessageDigest md = MessageDigest.getInstance( "SHA-256" ); + final byte[] input = str.getBytes( UTF_8 ); + final byte[] digest = md.digest( input ); + + final StringBuilder buf = new StringBuilder(); + + for( int i = 0; i < digest.length; i++ ) + { + String hex = Integer.toHexString( 0xFF & digest[ i ] ); + + if( hex.length() == 1 ) + { + buf.append( '0' ); + } + + buf.append( hex ); + } + + return buf.toString(); + } + catch( Exception e ) + { + throw new RuntimeException( e ); + } + } + + public static String escapeForXml( final String string ) + { + final StringBuilder result = new StringBuilder(); + + for( int i = 0, n = string.length(); i < n; i++ ) + { + final char ch = string.charAt( i ); + + if( ch == '<' ) + { + result.append( "<" ); + } + else if( ch == '>' ) + { + result.append( ">" ); + } + else if( ch == '&' ) + { + result.append( "&" ); + } + else if( ch == '"' ) + { + result.append( """ ); + } + else if( ch == '\'' ) + { + result.append( "'" ); + } + else + { + result.append( ch ); + } + } + + return result.toString(); + } + + @SafeVarargs + + public static <T> List<T> list( final T... items ) + { + return Arrays.asList( items ); + } + + @SafeVarargs + + public static <T> Set<T> set( final T... items ) + { + return new LinkedHashSet<T>( Arrays.asList( items ) ); + } + + public static String normalizeToNull( final String string ) + { + return ( string != null && string.length() == 0 ? null : string ); + } + + public static String normalizeToEmptyString( final String string ) + { + return ( string == null ? EMPTY_STRING : string ); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/ModuleUtil.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/ModuleUtil.java new file mode 100644 index 00000000..37a0bffb --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/ModuleUtil.java @@ -0,0 +1,101 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; +import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; +import org.eclipse.wst.server.core.IModule; +import org.eclipse.wst.server.core.IModuleType; + +@SuppressWarnings("restriction") +public class ModuleUtil { + + public static boolean isEARModule(IModule[] modulePath) { + return matchModuleType(modulePath, IModuleConstants.JST_EAR_MODULE); + } + + public static boolean isWebModule(IModule[] modulePath) { + return matchModuleType(modulePath, IModuleConstants.JST_WEB_MODULE); + } + + public static boolean isEJBModule(IModule[] modulePath) { + return matchModuleType(modulePath, IModuleConstants.JST_EJB_MODULE); + } + + public static boolean isUtilityModule(IModule[] modulePath) { + return matchModuleType(modulePath, IModuleConstants.JST_UTILITY_MODULE); + } + + public static boolean isConnectorModule(IModule[] modulePath) { + return matchModuleType(modulePath, IModuleConstants.JST_CONNECTOR_MODULE); + } + + public static boolean isClientModule(IModule[] modulePath) { + return matchModuleType(modulePath, IModuleConstants.JST_APPCLIENT_MODULE); + } + + public static boolean isEARModule(IModule module) { + return matchModuleType(module, IModuleConstants.JST_EAR_MODULE); + } + + public static boolean isWebModule(IModule module) { + return matchModuleType(module, IModuleConstants.JST_WEB_MODULE); + } + + public static boolean isEJBModule(IModule module) { + return matchModuleType(module, IModuleConstants.JST_EJB_MODULE); + } + + public static boolean isUtilityModule(IModule module) { + return matchModuleType(module, IModuleConstants.JST_UTILITY_MODULE); + } + + public static boolean isWebFragmentModule(IModule module) { + return matchModuleType(module, IModuleConstants.JST_WEBFRAGMENT_MODULE); + } + + public static boolean isConnectorModule(IModule module) { + return matchModuleType(module, IModuleConstants.JST_CONNECTOR_MODULE); + } + + public static boolean isClientModule(IModule module) { + return matchModuleType(module, IModuleConstants.JST_APPCLIENT_MODULE); + } + + public static String getContextRoot(IModule module) { + return J2EEProjectUtilities.getServerContextRoot(module.getProject()); + } + + private static boolean matchModuleType(IModule[] modulePath, String typeId) { + IModule module = modulePath[modulePath.length - 1]; + IModuleType type = module.getModuleType(); + if (type == null) { + return false; + } + return typeId.equals(type.getId()); + } + + private static boolean matchModuleType(IModule module, String typeId) { + IModuleType type = module.getModuleType(); + if (type == null) { + return false; + } + return typeId.equals(type.getId()); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/NamingUtils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/NamingUtils.java new file mode 100644 index 00000000..a6ba15e2 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/NamingUtils.java @@ -0,0 +1,59 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import java.util.HashSet; +import java.util.Set; + +import org.eclipse.wst.server.core.IRuntime; +import org.eclipse.wst.server.core.ServerCore; + +import fish.payara.eclipse.tools.server.exceptions.UniqueNameNotFound; + +/** + * Set of utility methods for creating (unique) names. + * + */ +public class NamingUtils { + + public static String createUniqueRuntimeName(String runtimeName) throws UniqueNameNotFound { + IRuntime[] runtimes = ServerCore.getRuntimes(); + HashSet<String> takenNames = new HashSet<>(runtimes.length); + for (IRuntime runtime : runtimes) { + takenNames.add(runtime.getName()); + } + return createUniqueName(runtimeName, takenNames); + } + + private static String createUniqueName(String candidadeName, Set<String> takenNames) throws UniqueNameNotFound { + if (!takenNames.contains(candidadeName)) { + return candidadeName; + } + + for (int i = 2; i < Integer.MAX_VALUE; i++) { + String candidadeNameWithSuffix = candidadeName + " (" + i + ")"; + if (!takenNames.contains(candidadeNameWithSuffix)) { + return candidadeNameWithSuffix; + } + } + + throw new UniqueNameNotFound(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/NodesUtils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/NodesUtils.java new file mode 100644 index 00000000..76dae736 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/NodesUtils.java @@ -0,0 +1,165 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import static fish.payara.eclipse.tools.server.sdk.TaskState.COMPLETED; +import static java.util.Collections.emptyList; +import static java.util.concurrent.TimeUnit.SECONDS; +import static java.util.logging.Level.INFO; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.logging.Level; +import java.util.logging.Logger; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.sdk.TaskState; +import fish.payara.eclipse.tools.server.sdk.admin.Command; +import fish.payara.eclipse.tools.server.sdk.admin.CommandListComponents; +import fish.payara.eclipse.tools.server.sdk.admin.CommandListResources; +import fish.payara.eclipse.tools.server.sdk.admin.CommandListWebServices; +import fish.payara.eclipse.tools.server.sdk.admin.ResultList; +import fish.payara.eclipse.tools.server.sdk.admin.ResultMap; +import fish.payara.eclipse.tools.server.sdk.admin.ServerAdmin; +import fish.payara.eclipse.tools.server.serverview.AppDesc; +import fish.payara.eclipse.tools.server.serverview.ResourceDesc; +import fish.payara.eclipse.tools.server.serverview.WSDesc; + +public class NodesUtils { + + public static List<ResourceDesc> getResources(PayaraServer server, String type) { + List<String> result = Collections.emptyList(); + LinkedList<ResourceDesc> retVal = null; + try { + Command command = new CommandListResources(CommandListResources.command(type), null); + Future<ResultList<String>> future = ServerAdmin.<ResultList<String>>exec(server, command); + ResultList<String> res = future.get(); + if (COMPLETED.equals(res.getState())) { + result = res.getValue(); + } + retVal = new LinkedList<>(); + for (String rsc : result) { + retVal.add(new ResourceDesc(rsc, type)); + } + } catch (InterruptedException ex) { + Logger.getLogger("glassfish").log(Level.INFO, ex.getMessage(), ex); + } catch (Exception ex) { + Logger.getLogger("glassfish").log(Level.INFO, ex.getMessage(), ex); + } + return retVal; + } + + public static Map<String, List<AppDesc>> getApplications(PayaraServer server, String container) { + Map<String, List<String>> apps = Collections.emptyMap(); + Command command = new CommandListComponents(null); + Future<ResultMap<String, List<String>>> future = ServerAdmin.<ResultMap<String, List<String>>>exec(server, + command); + ResultMap<String, List<String>> result = null; + try { + result = future.get(10, TimeUnit.SECONDS); + } catch (InterruptedException e) { + Logger.getLogger("glassfish").log(Level.INFO, e.getMessage(), e); // NOI18N + } catch (ExecutionException e) { + Logger.getLogger("glassfish").log(Level.INFO, e.getMessage(), e); // NOI18N + } catch (TimeoutException e) { + Logger.getLogger("glassfish").log(Level.INFO, e.getMessage(), e); // NOI18N + } + if (result != null && result.getState().equals(TaskState.COMPLETED)) { + apps = result.getValue(); + } + if (apps == null || apps.isEmpty()) { + return Collections.emptyMap(); + } + + return processApplications(apps); + } + + private static Map<String, List<AppDesc>> processApplications(Map<String, List<String>> appsList) { + Map<String, List<AppDesc>> result = new HashMap<>(); + for (final Map.Entry<String, List<String>> entry : appsList.entrySet()) { + final String engine = entry.getKey(); + final List<String> apps = entry.getValue(); + for (int i = 0; i < apps.size(); i++) { + String name = apps.get(i).trim(); + + List<AppDesc> appList = result.get(engine); + if (appList == null) { + appList = new ArrayList<>(); + result.put(engine, appList); + } + appList.add(new AppDesc(name, null, null, engine)); + } + } + return result; + } + + /** + * Sends list-web-services command to server (synchronous) + * + * @return String array of names of deployed applications. + */ + public static List<WSDesc> getWebServices(PayaraServer server) { + List<String> wssList = null; + + Future<ResultList<String>> future = ServerAdmin.<ResultList<String>>exec(server, new CommandListWebServices()); + + ResultList<String> result = null; + try { + result = future.get(10, SECONDS); + } catch (InterruptedException | ExecutionException | TimeoutException e) { + Logger.getLogger("glassfish").log(INFO, e.getMessage(), e); // NOI18N + } + + if (result != null && result.getState().equals(COMPLETED)) { + wssList = result.getValue(); + } + + if (wssList == null || wssList.isEmpty()) { + return emptyList(); + } + + return processWebServices(wssList); + } + + private static List<WSDesc> processWebServices(List<String> wssList) { + List<WSDesc> result = new ArrayList<>(); + for (String a : wssList) { + result.add(new WSDesc(a, a + "?wsdl", a + "?Tester")); // NOI18N + } + return result; + } + + public static Map<String, String> getResourceData(PayaraServer server, String name) { + return getResourceData(server, name); + } + + public static void putResourceData(PayaraServer server, Map<String, String> data) + throws PartialCompletionException { + putResourceData(server, data); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/PartialCompletionException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/PartialCompletionException.java new file mode 100644 index 00000000..0f96e082 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/PartialCompletionException.java @@ -0,0 +1,43 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +/** + * + * @author vbk + */ +public class PartialCompletionException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 1L; + private String failedUpdates; + + PartialCompletionException(String itemsNotUpdated) { + // throw new UnsupportedOperationException("Not yet implemented"); + failedUpdates = itemsNotUpdated; + } + + @Override + public String getMessage() { + return "Failed to update: " + failedUpdates; + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/PayaraLocationUtils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/PayaraLocationUtils.java new file mode 100644 index 00000000..f832f34f --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/PayaraLocationUtils.java @@ -0,0 +1,303 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import static fish.payara.eclipse.tools.server.internal.ManifestUtil.readManifestEntry; +import static java.util.Collections.emptyList; + +import java.io.File; +import java.io.IOException; +import java.lang.ref.SoftReference; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.tools.ant.DirectoryScanner; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.wst.common.project.facet.core.IFacetedProject; +import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; +import org.eclipse.wst.common.project.facet.core.runtime.IRuntime; +import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent; + +import fish.payara.eclipse.tools.server.internal.SystemLibraries; + +/** + * Series of utils related to the location where Payara / GlassFish is installed. + * + * <p> + * Primarily supplies the version and the libraries associated with the Payara location. + * + * @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a> + */ +public final class PayaraLocationUtils { + + public static final String DEFAULT_LIBRARIES = "default"; + public static final String ALL_LIBRARIES = "all"; + + private static final Pattern VERSION_PATTERN = Pattern.compile("([0-9]\\.[0-9]+(\\.[0-9])?(\\.[0-9])?)(\\..*)?.*"); + + // Defined as: + // <extension point="org.eclipse.wst.common.project.facet.core.runtimes"> + // <runtime-component-type id="payara.runtime"/> + private static final String RUNTIME_COMPONENT_ID = "payara.runtime"; + + private static final Map<File, SoftReference<PayaraLocationUtils>> CACHE = new HashMap<>(); + + private final Version version; + private final Map<String, List<File>> libraries; + + + // #### static factory / finder methods + + + public static synchronized PayaraLocationUtils find(IJavaProject project) { + if (project != null) { + return find(project.getProject()); + } + + return null; + } + + public static synchronized PayaraLocationUtils find(IProject project) { + if (project != null) { + IFacetedProject facetedProject = null; + + try { + facetedProject = ProjectFacetsManager.create(project); + } catch (CoreException e) { + // Intentionally ignored. If project isn't faceted or another error occurs, + // all that matters is that the Payara install is not found, which is signaled by null + // return. + } + + return find(facetedProject); + } + + return null; + } + + public static synchronized PayaraLocationUtils find(IFacetedProject project) { + if (project != null) { + IRuntime primary = project.getPrimaryRuntime(); + + if (primary != null) { + PayaraLocationUtils payaraLocation = find(primary); + + if (payaraLocation != null) { + return payaraLocation; + } + + for (IRuntime runtime : project.getTargetedRuntimes()) { + if (runtime != primary) { + payaraLocation = find(runtime); + + if (payaraLocation != null) { + return payaraLocation; + } + } + } + } + } + + return null; + } + + public static synchronized PayaraLocationUtils find(IRuntime runtime) { + if (runtime != null) { + for (IRuntimeComponent component : runtime.getRuntimeComponents()) { + PayaraLocationUtils payaraLocation = find(component); + + if (payaraLocation != null) { + return payaraLocation; + } + } + } + + return null; + } + + public static synchronized PayaraLocationUtils find(IRuntimeComponent component) { + if (component != null && component.getRuntimeComponentType().getId().equals(RUNTIME_COMPONENT_ID)) { + String location = component.getProperty("location"); + + if (location != null) { + return find(new File(location)); + } + } + + return null; + } + + public static synchronized PayaraLocationUtils find(File location) { + + // Lazily cleanup cache keys + for (Iterator<Map.Entry<File, SoftReference<PayaraLocationUtils>>> itr = CACHE.entrySet().iterator(); itr.hasNext();) { + if (itr.next().getValue().get() == null) { + itr.remove(); + } + } + + PayaraLocationUtils payaraLocation = null; + + if (location != null) { + SoftReference<PayaraLocationUtils> payaraLocationReference = CACHE.get(location); + + if (payaraLocationReference != null) { + payaraLocation = payaraLocationReference.get(); + } + + if (payaraLocation == null) { + try { + payaraLocation = new PayaraLocationUtils(location); + } catch (IllegalArgumentException e) { + return null; + } + + CACHE.put(location, new SoftReference<>(payaraLocation)); + } + } + + return payaraLocation; + } + + + + // #### PayaraLocation instance methods + + private PayaraLocationUtils(File location) { + checkLocationIsValid(location); + + File payaraLocation = location; + + File gfApiJar = new File(payaraLocation, "modules/glassfish-api.jar"); + + if (!gfApiJar.exists()) { + payaraLocation = new File(payaraLocation, "glassfish"); + + gfApiJar = new File(payaraLocation, "modules/glassfish-api.jar"); + + if (!gfApiJar.exists()) { + throw new IllegalArgumentException(); + } + } + + if (!gfApiJar.isFile()) { + throw new IllegalArgumentException(); + } + + version = readPayaraVerionFromAPIJar(gfApiJar); + libraries = readLibraryFilesFromPayaraLocation(payaraLocation, version); + } + + public Version version() { + return version; + } + + public List<File> getLibraries(String libraryGroup) { + return libraries.get(libraryGroup); + } + + + + // #### Private methods + + private Version readPayaraVerionFromAPIJar(File gfApiJar) { + String versionString; + try { + versionString = readManifestEntry(gfApiJar, "Bundle-Version"); + } catch (IOException e) { + throw new IllegalArgumentException(e); + } + + Matcher versionMatcher = VERSION_PATTERN.matcher(versionString); + + if (!versionMatcher.matches()) { + throw new IllegalArgumentException(); + } + + return new Version(versionMatcher.group(1)); + } + + /** + * Gets the relative file name patterns for the system libraries corresponding to the given Payara + * version, and turns these into a list of actual files for the given Payara location on disk. + * + * @param payaraLocation location where Payara is installed + * @param payaraVersion version of Payara for which libraries are to be retrieved + * + * @return list of system libraries as actual files + */ + private Map<String, List<File>> readLibraryFilesFromPayaraLocation(File payaraLocation, Version payaraVersion) { + Map<String, List<File>> librariesPerVariant = new HashMap<>(); + + librariesPerVariant.put( + DEFAULT_LIBRARIES, + readLibrariesByPattern(payaraLocation, SystemLibraries.getLibraryIncludesByVersion(payaraVersion))); + + librariesPerVariant.put( + ALL_LIBRARIES, + readLibrariesByPattern(payaraLocation, new String[] {"**/*.jar"}, new String[] {"**/osgi-cache/**"})); + + return librariesPerVariant; + } + + private List<File> readLibrariesByPattern(File payaraLocation, String[] inclusionPattern) { + return readLibrariesByPattern(payaraLocation, inclusionPattern, null); + } + + private List<File> readLibrariesByPattern(File payaraLocation, String[] inclusionPattern, String[] exclusionPattern) { + if (inclusionPattern == null) { + return emptyList(); + } + + File parentFolderToLocation = payaraLocation.getParentFile(); + + // Use a directory scanner to resolve the wildcards and obtain an expanded + // list of relative files. + DirectoryScanner scanner = new DirectoryScanner(); + scanner.setBasedir(parentFolderToLocation); + scanner.setIncludes(inclusionPattern); + if (exclusionPattern != null) { + scanner.setExcludes(exclusionPattern); + } + scanner.scan(); + + // Turn the expanded, but still relative, string based paths into absolute files. + List<File> libraries = new ArrayList<>(); + for (String libraryRelativePath : scanner.getIncludedFiles()) { + libraries.add(new File(parentFolderToLocation, libraryRelativePath)); + } + + return libraries; + + } + + private void checkLocationIsValid(File location) { + if (location == null || !location.exists() || !location.isDirectory()) { + throw new IllegalArgumentException(); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/PluginUtil.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/PluginUtil.java new file mode 100644 index 00000000..3952740d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/PluginUtil.java @@ -0,0 +1,328 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.log; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.osgi.util.NLS; +import org.osgi.framework.Bundle; + +/** + * Utility methods that are helpful for implementing extension points. + * + * @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a> + */ + +public final class PluginUtil { + private static final String ATTR_BUNDLE_VERSION = "Bundle-Version"; + private static final String PLUGIN_LOCATION_PREFIX = "reference:file:"; + + public static final class InvalidExtensionException + + extends Exception + + { + private static final long serialVersionUID = 1L; + } + + private PluginUtil() { + } + + public static Collection<IExtension> findExtensions(final String pluginId, + final String extensionPointId) { + final IExtensionRegistry registry = Platform.getExtensionRegistry(); + final IExtensionPoint point = registry.getExtensionPoint(pluginId, extensionPointId); + + if (point == null) { + throw new RuntimeException(); + } + + final List<IExtension> extensions = new ArrayList<>(); + + for (IExtension extension : point.getExtensions()) { + extensions.add(extension); + } + + return extensions; + } + + public static Collection<IConfigurationElement> getTopLevelElements(final Collection<IExtension> extensions) { + final List<IConfigurationElement> elements = new ArrayList<>(); + + for (IExtension extension : extensions) { + for (IConfigurationElement element : extension.getConfigurationElements()) { + elements.add(element); + } + } + + return elements; + } + + public static void reportInvalildElement(final IExtension extension, + final IConfigurationElement element) { + final String msg = NLS.bind(Resources.invalidElement, extension.getSimpleIdentifier(), element.getName()); + + logError(extension.getContributor().getName(), msg); + } + + public static void reportMissingAttribute(final IConfigurationElement el, + final String attribute) { + final String msg = NLS.bind(Resources.missingAttribute, el.getName(), attribute); + + logError(el.getContributor().getName(), msg); + } + + public static void reportMissingElement(final IConfigurationElement el, + final String element) { + final String msg = NLS.bind(Resources.missingElement, el.getName(), element); + + logError(el.getContributor().getName(), msg); + } + + private static void logError(final String bundle, final String message) { + logError(bundle, message, null); + } + + private static void logError(final String bundle, final String message, final Exception e) { + log(new Status(IStatus.ERROR, bundle, 0, message, e)); + } + + public static String findRequiredAttribute(final IConfigurationElement el, + final String attribute) + + throws InvalidExtensionException + + { + final String val = el.getAttribute(attribute); + + if (val == null) { + reportMissingAttribute(el, attribute); + throw new InvalidExtensionException(); + } + + return val; + } + + public static String findOptionalAttribute(final IConfigurationElement el, + final String attribute) { + final String val = el.getAttribute(attribute); + return val; + } + + public static IConfigurationElement findRequiredElement(final IConfigurationElement el, + final String childElement) + + throws InvalidExtensionException + + { + final IConfigurationElement[] children = el.getChildren(childElement); + + if (children.length == 0) { + reportMissingElement(el, childElement); + throw new InvalidExtensionException(); + } + + return children[0]; + } + + public static IConfigurationElement findOptionalElement(final IConfigurationElement el, + final String childElement) { + final IConfigurationElement[] children = el.getChildren(childElement); + + if (children.length == 0) { + return null; + } else { + return children[0]; + } + } + + public static String getElementValue(final IConfigurationElement el, + final String defaultValue) { + if (el != null) { + String text = el.getValue(); + + if (text != null) { + text = text.trim(); + + if (text.length() > 0) { + return text; + } + } + } + + return defaultValue; + } + + public static <T> Class<T> loadClass(final String pluginId, + final String clname) { + return loadClass(pluginId, clname, null); + } + + @SuppressWarnings("unchecked") + public static <T> Class<T> loadClass(final String pluginId, + final String clname, + final Class<T> interfc) { + final Bundle bundle = Platform.getBundle(pluginId); + final Class<?> cl; + + try { + cl = bundle.loadClass(clname); + } catch (Exception e) { + final String msg = NLS.bind(Resources.failedToLoadClass, clname, pluginId); + + logError(pluginId, msg, e); + + return null; + } + + if (interfc != null && !interfc.isAssignableFrom(cl)) { + final String msg = NLS.bind(Resources.doesNotImplement, clname, + interfc.getName()); + + logError(pluginId, msg); + + return null; + } + + return (Class<T>) cl; + } + + public static <T> T instantiate(final String pluginId, + final Class<T> cl) { + try { + return cl.newInstance(); + } catch (Exception e) { + final String msg = NLS.bind(Resources.failedToInstantiate, cl.getName(), pluginId); + + logError(pluginId, msg, e); + + return null; + } + } + + public static <T> T instantiate(final String pluginId, + final String clname) { + return instantiate(pluginId, clname, (Class<T>) null); + } + + public static <T> T instantiate(final String pluginId, + final String clname, + final Class<T> interfc) { + final Class<T> cl = loadClass(pluginId, clname, interfc); + + if (cl == null) { + return null; + } + + return instantiate(pluginId, cl); + } + + public static String getPluginVersion(final String pluginId) { + final Bundle bundle = Platform.getBundle(pluginId); + return bundle.getHeaders().get(ATTR_BUNDLE_VERSION); + } + + public static boolean waitForPluginToActivate(final String bundleId) { + final Bundle bundle = Platform.getBundle(bundleId); + return waitForPluginToActivate(bundle); + } + + public static boolean waitForPluginToActivate(final Bundle bundle) { + while (bundle.getState() != Bundle.ACTIVE) { + try { + Thread.sleep(500); + } catch (InterruptedException e) { + return false; + } + } + + return true; + } + + public static IPath getPluginLocation(final String bundleId) { + final Bundle bundle = Platform.getBundle(bundleId); + return getPluginLocation(bundle); + } + + public static IPath getPluginLocation(final Bundle bundle) { + String location = bundle.getLocation(); + + if (location.startsWith(PLUGIN_LOCATION_PREFIX)) { + int offset = PLUGIN_LOCATION_PREFIX.length(); + + if (location.length() > offset + 1 && location.charAt(offset) == '/') { + offset++; + } + + location = location.substring(offset); + } + + final Path pluginLocation = new Path(location); + + if (pluginLocation.isAbsolute()) { + return pluginLocation; + } else { + final String installPath = Platform.getInstallLocation().getURL().getPath(); + return new Path(installPath + "/" + pluginLocation); //$NON-NLS-1$ + } + } + + public static final class ClassInfo { + public final String pluginId; + public final String className; + + public ClassInfo(final String pluginId, + final String className) { + this.pluginId = pluginId; + this.className = className; + } + } + + private static final class Resources + + extends NLS + + { + public static String invalidElement; + public static String missingAttribute; + public static String missingElement; + public static String failedToLoadClass; + public static String failedToInstantiate; + public static String doesNotImplement; + + static { + initializeMessages(PluginUtil.class.getName(), + Resources.class); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/ResourceUtils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/ResourceUtils.java new file mode 100644 index 00000000..e2b144cd --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/ResourceUtils.java @@ -0,0 +1,437 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Pattern; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities; +import org.eclipse.wst.common.componentcore.ComponentCore; +import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; +import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.PayaraServerPlugin; +import fish.payara.eclipse.tools.server.sdk.TaskState; +import fish.payara.eclipse.tools.server.sdk.admin.Command; +import fish.payara.eclipse.tools.server.sdk.admin.CommandGetProperty; +import fish.payara.eclipse.tools.server.sdk.admin.CommandSetProperty; +import fish.payara.eclipse.tools.server.sdk.admin.ResultMap; +import fish.payara.eclipse.tools.server.sdk.admin.ResultString; +import fish.payara.eclipse.tools.server.sdk.admin.ServerAdmin; +import fish.payara.eclipse.tools.server.sdk.server.parser.ResourcesReader; +import fish.payara.eclipse.tools.server.sdk.server.parser.ResourcesReader.ResourceType; +import fish.payara.eclipse.tools.server.sdk.server.parser.TreeParser; + +public class ResourceUtils { + public static final String RESOURCE_FILE_TEMPLATE = "templates/sun-resources-xml-template.resource"; //$NON-NLS-1$ + public static final String RESOURCE_FILE_NAME = "sun-resources.xml"; //$NON-NLS-1$ + public static final String WEB_CONTENT = "WebContent"; //$NON-NLS-1$ + public static final String WEB_INF = "WEB-INF"; //$NON-NLS-1$ + public static final String EAR_CONTENT = "EarContent"; //$NON-NLS-1$ + public static final String EJB_CONTENT = "ejbModule"; //$NON-NLS-1$ + public static final String META_INF = "META-INF"; //$NON-NLS-1$ + + private static final String SUN_RESOURCES_XML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<!DOCTYPE resources PUBLIC " + //$NON-NLS-1$ //$NON-NLS-2$ + "\"-//Sun Microsystems, Inc.//DTD Application Server 9.0 Resource Definitions //EN\" " + //$NON-NLS-1$ + "\"http://www.sun.com/software/appserver/dtds/sun-resources_1_3.dtd\">\n" + //$NON-NLS-1$ + "<resources>\n"; //$NON-NLS-1$ + private static final String SUN_RESOURCES_XML_FOOTER = "</resources>\n"; //$NON-NLS-1$ + + public static InputStream appendResource(IFile sunResourcesXml, String fragment) throws IOException, CoreException { + String sunResourcesBuf = readResourceFile(sunResourcesXml); + sunResourcesBuf = insertFragment(sunResourcesBuf, fragment); + return new ByteArrayInputStream(sunResourcesBuf.getBytes(StandardCharsets.UTF_8)); + } + + public static String readResourceFile(IFile sunResourcesXml) throws IOException, CoreException { + String content = null; + if (sunResourcesXml.exists()) { + InputStream is = null; + Reader reader = null; + try { + IPath location = sunResourcesXml.getLocation(); + if (location != null) { + File resFile = location.toFile(); + long flen = resFile.length(); + if (flen > 1000000) { + throw new IOException(resFile.getAbsolutePath() + " is too long to update."); //$NON-NLS-1$ + } + int length = (int) (2 * flen + 32); + char[] buf = new char[length]; + is = new BufferedInputStream(sunResourcesXml.getContents()); + String encoding = sunResourcesXml.getCharset(); + reader = new InputStreamReader(is, encoding); + int max = reader.read(buf); + if (max > 0) { + content = new String(buf, 0, max); + } + } + } finally { + if (is != null) { + try { + is.close(); + } catch (IOException ex) { + } + } + if (reader != null) { + try { + reader.close(); + } catch (IOException ex) { + } + } + } + } + return content; + } + + public static String insertFragment(String sunResourcesBuf, String fragment) throws IOException { + String header = SUN_RESOURCES_XML_HEADER; + String footer = SUN_RESOURCES_XML_FOOTER; + boolean insertNewLine = false; + + if (sunResourcesBuf != null) { + int closeIndex = sunResourcesBuf.indexOf("</resources>"); //$NON-NLS-1$ + if (closeIndex == -1) { + throw new IOException("Malformed XML"); //$NON-NLS-1$ + } + header = sunResourcesBuf.substring(0, closeIndex); + footer = sunResourcesBuf.substring(closeIndex); + + if (closeIndex > 0 && sunResourcesBuf.charAt(closeIndex - 1) != '\n') { + insertNewLine = true; + } + } + + int length = header.length() + footer.length() + 2; + if (fragment != null) { + length += fragment.length(); + } + + StringBuilder builder = new StringBuilder(length); + builder.append(header); + + if (insertNewLine) { + String lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$ + builder.append(lineSeparator != null ? lineSeparator : "\n"); //$NON-NLS-1$ + } + + if (fragment != null) { + builder.append(fragment); + } + + builder.append(footer); + return builder.toString(); + } + + public static String replaceOrRemove(String originalLine, String pattern, String value) { + String containsPattern = ".*" + pattern + ".*"; //$NON-NLS-1$ //$NON-NLS-2$ + if ((originalLine != null) && Pattern.matches(containsPattern, originalLine)) { + return (((value == null) || (value.length() == 0)) ? null : originalLine.replaceAll(pattern, value)); + } + return originalLine; + } + + public static String getResourceLocation(IProject project) { + String setUpLocation = getProjectResourceLocation(project); + if (setUpLocation == null) { + if (JavaEEProjectUtilities.isDynamicWebProject(project)) { + setUpLocation = WEB_CONTENT + File.separatorChar + WEB_INF; + } else if (JavaEEProjectUtilities.isEARProject(project)) { + setUpLocation = EAR_CONTENT; + } else if (JavaEEProjectUtilities.isEJBProject(project)) { + setUpLocation = EJB_CONTENT + File.separatorChar + META_INF; + } + } else { + if (JavaEEProjectUtilities.isDynamicWebProject(project)) { + setUpLocation = setUpLocation + File.separatorChar + WEB_INF; + } else if (JavaEEProjectUtilities.isEJBProject(project)) { + setUpLocation = setUpLocation + File.separatorChar + META_INF; + } + } + return setUpLocation; + } + + public static String getRuntimeResourceLocation(IProject project) { + String setUpLocation = null; + if (JavaEEProjectUtilities.isDynamicWebProject(project)) { + setUpLocation = WEB_INF; + } else if (JavaEEProjectUtilities.isEARProject(project)) { + setUpLocation = ""; //$NON-NLS-1$ + } else if (JavaEEProjectUtilities.isEJBProject(project)) { + setUpLocation = META_INF; + } + return setUpLocation; + } + + private static String getProjectResourceLocation(IProject project) { + String setUpLocation = null; + IVirtualComponent component = ComponentCore.createComponent(project); + IVirtualFolder contentFolder = component.getRootFolder(); + IContainer resourceFolder = contentFolder.getUnderlyingFolder(); + setUpLocation = resourceFolder.getName(); + return setUpLocation; + } + + private static IFile getSunResourceIFile(IProject selectedProject) { + String dirName = getResourceLocation(selectedProject); + IContainer containerResource = selectedProject; + IFolder folder = containerResource.getFolder(new Path(dirName)); + IFile file = folder.getFile(new Path(RESOURCE_FILE_NAME)); + return file; + } + + public static File getSunResourceFile(IProject selectedProject) { + File resFile = null; + IFile sunResourcesXml = getSunResourceIFile(selectedProject); + IPath location = sunResourcesXml.getLocation(); + if (location != null) { + resFile = location.toFile(); + } + return resFile; + } + + public static List<String> getResources(IProject selectedProject, ResourceType... types) { + List<String> resources = new ArrayList<>(); + if (selectedProject != null) { + File xmlFile = getSunResourceFile(selectedProject); + if (xmlFile.exists()) { + for (ResourceType type : types) { + ResourcesReader reader = new ResourcesReader(type); + TreeParser.readXml(xmlFile, reader); + resources.addAll(reader.getResourceData().keySet()); + } + } + } else { + PayaraServerPlugin.logMessage("No valid project selected"); + } + return resources; + } + + public static void checkUpdateServerResources(File sunResourcesXml, PayaraServer sunAppsrv) { + Map<String, String> changedData = new HashMap<>(); + + ResourcesReader cpReader = new ResourcesReader(ResourceType.JDBC_CONNECTION_POOL); + ResourcesReader jdbcReader = new ResourcesReader(ResourceType.JDBC_RESOURCE); + ResourcesReader connectorPoolReader = new ResourcesReader(ResourceType.CONNECTOR_POOL); + ResourcesReader connectorResourceReader = new ResourcesReader(ResourceType.CONNECTOR_RESOURCE); + ResourcesReader aoReader = new ResourcesReader(ResourceType.ADMIN_OBJECT_RESOURCE); + ResourcesReader mailReader = new ResourcesReader(ResourceType.JAVA_MAIL); + + try { + TreeParser.readXml(sunResourcesXml, cpReader, jdbcReader, connectorPoolReader, + connectorResourceReader, aoReader, mailReader); + } catch (IllegalStateException ex) { + PayaraServerPlugin.logError("Exception while reading resource file : " + sunResourcesXml, ex); //$NON-NLS-1$ + } + Map<String, String> allRemoteData = getResourceData(sunAppsrv, null); + changedData = checkResources(cpReader, "resources.jdbc-connection-pool.", allRemoteData, changedData); //$NON-NLS-1$ + changedData = checkResources(jdbcReader, "resources.jdbc-resource.", allRemoteData, changedData); //$NON-NLS-1$ + changedData = checkResources(connectorPoolReader, "resources.connector-connection-pool.", allRemoteData, changedData); //$NON-NLS-1$ + changedData = checkResources(connectorResourceReader, "resources.connector-resource.", allRemoteData, changedData); //$NON-NLS-1$ + changedData = checkResources(aoReader, "resources.admin-object-resource.", allRemoteData, changedData); //$NON-NLS-1$ + changedData = checkResources(mailReader, "resources.mail-resource.", allRemoteData, changedData); //$NON-NLS-1$ + + if (changedData.size() > 0) { + try { + putResourceData(sunAppsrv, changedData); + } catch (PartialCompletionException e) { + PayaraServerPlugin.logError("Some of the resources were not updated!", e); + } + } + } + + public static Map<String, String> getResourceData(PayaraServer server, String name) { + try { + // GetPropertyCommand cmd; + String query; + if (null != name) { + query = "resources.*." + name + ".*"; //$NON-NLS-1$ //$NON-NLS-2$ + } else { + query = "resources.*"; //$NON-NLS-1$ + } + Command command = new CommandGetProperty(query); + Future<ResultMap<String, String>> future = ServerAdmin.<ResultMap<String, String>>exec(server, command); + ResultMap<String, String> result = future.get(30, TimeUnit.SECONDS); + + if (TaskState.COMPLETED.equals(result.getState())) { + Map<String, String> retVal = result.getValue(); + if (retVal.isEmpty()) { + Logger.getLogger("glassfish").log(Level.INFO, null, new IllegalStateException(query + " has no data")); //$NON-NLS-1$ + } + return retVal; + } + } catch (InterruptedException ex) { + Logger.getLogger("glassfish").log(Level.INFO, ex.getMessage(), ex); //$NON-NLS-1$ + } catch (Exception ex) { + Logger.getLogger("glassfish").log(Level.INFO, ex.getMessage(), ex); //$NON-NLS-1$ + } + return new HashMap<>(); + } + + private static Map<String, String> checkResources(ResourcesReader resourceReader, String prefix, Map<String, String> allRemoteData, + Map<String, String> changedData) { + Set<String> resources = resourceReader.getResourceData().keySet(); + for (String jndiName : resources) { + Map<String, String> localData = resourceReader.getResourceData().get(jndiName); + String remoteKey = prefix + jndiName + "."; //$NON-NLS-1$ + + Map<String, String> remoteData = new HashMap<>(); + for (final Map.Entry<String, String> entry : allRemoteData.entrySet()) { + final String key = entry.getKey(); + if (key.startsWith(remoteKey)) { + remoteData.put(key, entry.getValue()); + } + } + if (remoteData.size() > 0) { + changedData = getChangedData(remoteData, localData, changedData, remoteKey); + } + } + return changedData; + } + + private static Map<String, String> getChangedData(Map<String, String> remoteData, Map<String, String> localData, + Map<String, String> changedData, String resourceKey) { + List<String> props = new ArrayList<>(); + Set<String> localKeySet = localData.keySet(); + for (final Map.Entry<String, String> entry : remoteData.entrySet()) { + final String remoteDataKey = entry.getKey(); + final String remoteValue = entry.getValue(); + String[] split = remoteDataKey.split(resourceKey); + String key = split[1]; + if (key.indexOf("property.") != -1) { //$NON-NLS-1$ + props.add(key); + } + String localValue = localData.get(key); + if (localValue != null) { + if (remoteValue == null || !localValue.equals(remoteValue)) { + changedData.put(remoteDataKey, localValue); + } + } else { + if (localKeySet.contains(key)) { + if (remoteValue != null) { + changedData.put(remoteDataKey, localValue); + } + } + } + } + for (final Map.Entry<String, String> entry : localData.entrySet()) { + final String key = entry.getKey(); + if (key.indexOf("property.") != -1) { //$NON-NLS-1$ + if (!props.contains(key)) { + String remoteKey = resourceKey + key; + changedData.put(remoteKey, entry.getValue()); + } + } + } + return changedData; + } + + public static void putResourceData(PayaraServer server, Map<String, String> data) throws PartialCompletionException { + String itemsNotUpdated = null; + Throwable lastEx = null; + for (final Map.Entry<String, String> entry : data.entrySet()) { + String compName = entry.getKey(); + String compValue = entry.getValue(); + + try { + Command command = new CommandSetProperty(compName, compValue); + Future<ResultString> future = ServerAdmin.<ResultString>exec(server, command); + ResultString result = future.get(30, TimeUnit.SECONDS); + if (!TaskState.COMPLETED.equals(result.getState())) { + itemsNotUpdated = addName(compName, itemsNotUpdated); + } + } catch (InterruptedException ex) { + lastEx = ex; + Logger.getLogger("glassfish").log(Level.INFO, ex.getMessage(), ex); // NOI18N + itemsNotUpdated = addName(compName, itemsNotUpdated); + } catch (Exception ex) { + lastEx = ex; + Logger.getLogger("glassfish").log(Level.INFO, ex.getMessage(), ex); // NOI18N + itemsNotUpdated = addName(compName, itemsNotUpdated); + } + } + if (null != itemsNotUpdated) { + PartialCompletionException pce = new PartialCompletionException(itemsNotUpdated); + if (null != lastEx) { + pce.initCause(lastEx); + } + throw pce; + } + } + + private static String addName(final String compName, final String itemsNotUpdated) { + String retVal = itemsNotUpdated; + if (null != itemsNotUpdated) { + retVal += ", " + compName; + } else { + retVal = compName; + } + return retVal; + } + + public static String getUniqueResourceName(String name, List<String> resources) { + for (int i = 1;; i++) { + String resourceName = name + "_" + i; //$NON-NLS-1$ + if (!resources.contains(resourceName)) { + return resourceName; + } + } + } + + public static boolean isDuplicate(String name, List<String> resources) { + boolean isDuplicate = false; + if (resources.contains(name)) { + isDuplicate = true; + } + return isDuplicate; + } + + public static boolean isDuplicate(String name, ResourceType type, IProject selectedProject) { + boolean isDuplicate = false; + List<String> resources = getResources(selectedProject, type); + if (resources.contains(name)) { + isDuplicate = true; + } + return isDuplicate; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/ServerStatusHelper.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/ServerStatusHelper.java new file mode 100644 index 00000000..549eeb17 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/ServerStatusHelper.java @@ -0,0 +1,207 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import static fish.payara.eclipse.tools.server.PayaraServerPlugin.logMessage; +import static fish.payara.eclipse.tools.server.ServerStatus.NOT_DEFINED; +import static fish.payara.eclipse.tools.server.ServerStatus.RUNNING_CONNECTION_ERROR; +import static fish.payara.eclipse.tools.server.ServerStatus.RUNNING_CREDENTIAL_PROBLEM; +import static fish.payara.eclipse.tools.server.ServerStatus.RUNNING_DOMAIN_MATCHING; +import static fish.payara.eclipse.tools.server.ServerStatus.RUNNING_PROXY_ERROR; +import static fish.payara.eclipse.tools.server.ServerStatus.RUNNING_REMOTE_NOT_SECURE; +import static fish.payara.eclipse.tools.server.ServerStatus.STOPPED_DOMAIN_NOT_MATCHING; +import static fish.payara.eclipse.tools.server.ServerStatus.STOPPED_NOT_LISTENING; +import static fish.payara.eclipse.tools.server.sdk.TaskEvent.AUTH_FAILED; +import static fish.payara.eclipse.tools.server.sdk.TaskEvent.BAD_GATEWAY; +import static fish.payara.eclipse.tools.server.sdk.utils.ServerUtils.isAdminPortListening; +import static java.util.concurrent.TimeUnit.SECONDS; + +import java.io.File; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeoutException; + +import org.eclipse.wst.server.core.IServer; + +import fish.payara.eclipse.tools.server.PayaraRuntime; +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.ServerStatus; +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; +import fish.payara.eclipse.tools.server.sdk.TaskEvent; +import fish.payara.eclipse.tools.server.sdk.TaskState; +import fish.payara.eclipse.tools.server.sdk.TaskStateListener; +import fish.payara.eclipse.tools.server.sdk.admin.CommandLocation; +import fish.payara.eclipse.tools.server.sdk.admin.ResultMap; +import fish.payara.eclipse.tools.server.sdk.admin.ServerAdmin; + +public class ServerStatusHelper { + + public static ServerStatus checkServerStatus(PayaraServer server) { + + // Randomly wait for some random reason + try { + Thread.sleep(Math.round(Math.random() * 1000)); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + return NOT_DEFINED; + } + + if (!isAdminPortListening(server)) { + return STOPPED_NOT_LISTENING; + } + + if (server.isRemote()) { + IServer server1 = server.getServer(); + String remoteServerVersion = PayaraServerBehaviour.getVersion(server); + PayaraRuntime payaraRuntime = (PayaraRuntime) server1.getRuntime().loadAdapter(PayaraRuntime.class, null); + + String thisServerVersion = payaraRuntime.getVersion().toString(); + int n = thisServerVersion.indexOf(".X"); + + if (n > 0) { + thisServerVersion = thisServerVersion.substring(0, n + 1); + } + + if (remoteServerVersion != null && remoteServerVersion.indexOf(thisServerVersion) < 0) { + return STOPPED_DOMAIN_NOT_MATCHING; + } + } + + CommandLocation command = new CommandLocation(); + LastTaskEventListener listener = new LastTaskEventListener(); + ResultMap<String, String> result = null; + Future<ResultMap<String, String>> locationTask = null; + + try { + locationTask = ServerAdmin.exec(server, command, listener); + result = locationTask.get(10, SECONDS); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + logMessage("ServerStatusMonitor for " + server.getName() + " location interrupted"); + } catch (ExecutionException e) { + logMessage("ServerStatusMonitor for " + server.getName() + " location throws exception"); + e.printStackTrace(); + } catch (TimeoutException e) { + logMessage("ServerStatusMonitor for " + server.getName() + " location timed out"); + } finally { + if (result == null) { + if (locationTask != null) { + locationTask.cancel(true); + } + + return RUNNING_CONNECTION_ERROR; + } + } + + ServerStatus serverStatus = null; + switch (result.getState()) { + case COMPLETED: + try { + if (domainMatching(server, result.getValue())) { + serverStatus = RUNNING_DOMAIN_MATCHING; + } else { + serverStatus = STOPPED_DOMAIN_NOT_MATCHING; + } + } catch (IOException e) { + + } + break; + case FAILED: + if (isAuthException(listener.getLastEvent(), result)) { + serverStatus = RUNNING_CREDENTIAL_PROBLEM; + } else if (isRemoteAdminException(result)) { + serverStatus = RUNNING_REMOTE_NOT_SECURE; + } else if (listener.getLastEvent().equals(BAD_GATEWAY)) { + serverStatus = RUNNING_PROXY_ERROR; + } else { + serverStatus = RUNNING_CONNECTION_ERROR; + } + break; + case RUNNING: + logMessage("ServerStatusMonitor for " + server.getName() + " location takes long time..."); + locationTask.cancel(true); + serverStatus = NOT_DEFINED; + break; + default: + logMessage("ServerStatusMonitor for " + server.getName() + " location in ready state"); + serverStatus = NOT_DEFINED; + break; + } + + return serverStatus; + } + + private static boolean domainMatching(PayaraServer server, Map<String, String> locationResult) throws IOException { + if (server.isRemote()) { + return true; + } + + String expectedDomainRoot = server.getDomainsFolder() + File.separator + server.getDomainName(); + String actualDomainRoot = locationResult.get("Domain-Root_value"); + if (expectedDomainRoot != null && actualDomainRoot != null) { + File expected = new File(expectedDomainRoot); + File actual = new File(actualDomainRoot); + + if (expected.getCanonicalPath().equals(actual.getCanonicalPath())) { + return true; + } + } + + return false; + } + + private static boolean isAuthException(TaskEvent event, ResultMap<String, String> result) { + // for now handle remote admin access exception as auth issue + return event.equals(AUTH_FAILED) + || ((result.getValue() != null) && (result.getValue().get("message") != null) + && (result.getValue().get("message").contains("javax.security.auth.login.LoginException"))); + } + + private static boolean isRemoteAdminException(ResultMap<String, String> result) { + return (result.getValue() != null) && (result.getValue().get("message") != null) + && result.getValue().get("message").contains("org.glassfish.internal.api.RemoteAdminAccessException"); + } + + /** + * This listener stores the last task event that occurred during command execution. It's return + * value is well defined only after corresponding Future.get method returned. It can also return + * null if no event was observed or execution timed out. Do not put the same instance into two exec + * calls that run concurrently, it is not thread safe. + * + * @author Peter Benedikovic + * + */ + public static class LastTaskEventListener implements TaskStateListener { + + private TaskEvent lastEvent; + + @Override + public void operationStateChanged(TaskState newState, TaskEvent event, String... args) { + lastEvent = event; + } + + public TaskEvent getLastEvent() { + return lastEvent; + } + + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/SetFactory.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/SetFactory.java new file mode 100644 index 00000000..05de6ede --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/SetFactory.java @@ -0,0 +1,247 @@ +/****************************************************************************** + * Copyright (c) 2016 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Konstantin Komissarchik - initial implementation and ongoing maintenance + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.Set; + +/** + * @author <a href="mailto:konstantin@komissarchik.net">Konstantin Komissarchik</a> + */ + +public final class SetFactory<E> +{ + private Filter<E> filter; + private E firstElement = null; + private Set<E> set = null; + private boolean exported = false; + + private SetFactory() {} + + public static <E> Set<E> empty() + { + return Collections.emptySet(); + } + + public static <E> Set<E> singleton( final E element ) + { + return Collections.singleton( element ); + } + + @SafeVarargs + + public static <E> Set<E> unmodifiable( final E... elements ) + { + return SetFactory.<E>start().add( elements ).result(); + } + + public static <E> Set<E> unmodifiable( final Collection<E> elements ) + { + return SetFactory.<E>start().add( elements ).result(); + } + + public static <E> SetFactory<E> start() + { + return new SetFactory<E>(); + } + + public SetFactory<E> filter( final Filter<E> filter ) + { + if( this.exported ) + { + throw new IllegalStateException(); + } + + this.filter = filter; + + if( this.filter != null ) + { + if( this.set != null ) + { + for( Iterator<E> itr = this.set.iterator(); itr.hasNext(); ) + { + if( ! this.filter.allows( itr.next() ) ) + { + itr.remove(); + } + } + + final int size = this.set.size(); + + if( size == 1 ) + { + this.firstElement = this.set.iterator().next(); + this.set = null; + } + else if( size == 0 ) + { + this.set = null; + } + } + else if( this.firstElement != null ) + { + if( ! this.filter.allows( this.firstElement ) ) + { + this.firstElement = null; + } + } + } + + return this; + } + + public SetFactory<E> add( final E element ) + { + if( this.exported ) + { + throw new IllegalStateException(); + } + + if( element != null && ( this.filter == null || this.filter.allows( element ) ) ) + { + if( this.set != null ) + { + this.set.add( element ); + } + else if( this.firstElement != null ) + { + this.set = new LinkedHashSet<E>(); + this.set.add( this.firstElement ); + this.set.add( element ); + this.firstElement = null; + } + else + { + this.firstElement = element; + } + } + + return this; + } + + @SafeVarargs + + public final SetFactory<E> add( final E... elements ) + { + if( elements != null ) + { + for( E element : elements ) + { + add( element ); + } + } + + return this; + } + + public SetFactory<E> add( final Collection<E> elements ) + { + if( elements != null ) + { + for( E element : elements ) + { + add( element ); + } + } + + return this; + } + + public boolean remove( final E element ) + { + boolean removed = false; + + if( element != null ) + { + if( this.set != null ) + { + removed = this.set.remove( element ); + + if( this.set.size() == 1 ) + { + this.firstElement = this.set.iterator().next(); + this.set = null; + } + } + else if( this.firstElement != null && this.firstElement.equals( element ) ) + { + removed = true; + this.firstElement = null; + } + } + + return removed; + } + + public boolean contains( final E element ) + { + boolean contains = false; + + if( this.set != null ) + { + contains = this.set.contains( element ); + } + else if( this.firstElement != null && this.firstElement.equals( element ) ) + { + contains = true; + } + + return contains; + } + + public int size() + { + final int size; + + if( this.set != null ) + { + size = this.set.size(); + } + else if( this.firstElement != null) + { + size = 1; + } + else + { + size = 0; + } + + return size; + } + + public Set<E> result() + { + if( this.exported ) + { + throw new IllegalStateException(); + } + + this.exported = true; + + if( this.set != null ) + { + return Collections.unmodifiableSet( this.set ); + } + else if( this.firstElement != null ) + { + return Collections.singleton( this.firstElement ); + } + else + { + return Collections.emptySet(); + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/SortedSetFactory.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/SortedSetFactory.java new file mode 100644 index 00000000..ee8bb9fd --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/SortedSetFactory.java @@ -0,0 +1,603 @@ +/****************************************************************************** + * Copyright (c) 2016 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Konstantin Komissarchik - initial implementation and ongoing maintenance + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.SortedSet; +import java.util.TreeSet; +import static fish.payara.eclipse.tools.server.utils.MiscUtil.equal; + +/** + * @author <a href="mailto:konstantin@komissarchik.net">Konstantin Komissarchik</a> + */ + +public final class SortedSetFactory<E> +{ + private final Comparator<E> comparator; + private Filter<E> filter; + private E firstElement = null; + private SortedSet<E> set = null; + private boolean exported = false; + + private SortedSetFactory( final Comparator<E> comparator ) + { + this.comparator = comparator; + } + + @SuppressWarnings( "unchecked" ) + + public static <E> SortedSet<E> empty() + { + return (SortedSet<E>) EMPTY_SORTED_SET; + } + + public static <E> SortedSet<E> singleton( final E element ) + { + if( element == null ) + { + throw new IllegalArgumentException(); + } + + return new SingletonSortedSet<E>( null, element ); + } + + @SafeVarargs + + public static <E> SortedSet<E> unmodifiable( final E... elements ) + { + return SortedSetFactory.<E>start().add( elements ).result(); + } + + public static <E> SortedSet<E> unmodifiable( final Collection<E> elements ) + { + return SortedSetFactory.<E>start().add( elements ).result(); + } + + public static <E> SortedSetFactory<E> start() + { + return start( null ); + } + + public static <E> SortedSetFactory<E> start( final Comparator<E> comparator ) + { + return new SortedSetFactory<E>( comparator ); + } + + public SortedSetFactory<E> filter( final Filter<E> filter ) + { + if( this.exported ) + { + throw new IllegalStateException(); + } + + this.filter = filter; + + if( this.filter != null ) + { + if( this.set != null ) + { + for( Iterator<E> itr = this.set.iterator(); itr.hasNext(); ) + { + if( ! this.filter.allows( itr.next() ) ) + { + itr.remove(); + } + } + + final int size = this.set.size(); + + if( size == 1 ) + { + this.firstElement = this.set.first(); + this.set = null; + } + else if( size == 0 ) + { + this.set = null; + } + } + else if( this.firstElement != null ) + { + if( ! this.filter.allows( this.firstElement ) ) + { + this.firstElement = null; + } + } + } + + return this; + } + + public SortedSetFactory<E> add( final E element ) + { + if( this.exported ) + { + throw new IllegalStateException(); + } + + if( element != null && ( this.filter == null || this.filter.allows( element ) ) ) + { + if( this.set != null ) + { + this.set.add( element ); + } + else if( this.firstElement != null ) + { + this.set = new TreeSet<E>( this.comparator ); + this.set.add( this.firstElement ); + this.set.add( element ); + this.firstElement = null; + } + else + { + this.firstElement = element; + } + } + + return this; + } + + @SafeVarargs + + public final SortedSetFactory<E> add( final E... elements ) + { + if( elements != null ) + { + for( E element : elements ) + { + add( element ); + } + } + + return this; + } + + public SortedSetFactory<E> add( final Collection<E> elements ) + { + if( elements != null ) + { + for( E element : elements ) + { + add( element ); + } + } + + return this; + } + + public boolean remove( final E element ) + { + boolean removed = false; + + if( element != null ) + { + if( this.set != null ) + { + removed = this.set.remove( element ); + + if( this.set.size() == 1 ) + { + this.firstElement = this.set.iterator().next(); + this.set = null; + } + } + else if( this.firstElement != null && this.firstElement.equals( element ) ) + { + removed = true; + this.firstElement = null; + } + } + + return removed; + } + + public E first() + { + E first; + + if( this.set != null ) + { + first = this.set.first(); + } + else if( this.firstElement != null ) + { + first = this.firstElement; + } + else + { + throw new NoSuchElementException(); + } + + return first; + } + + public E last() + { + E last; + + if( this.set != null ) + { + last = this.set.last(); + } + else if( this.firstElement != null ) + { + last = this.firstElement; + } + else + { + throw new NoSuchElementException(); + } + + return last; + } + + public boolean contains( final E element ) + { + boolean contains = false; + + if( this.set != null ) + { + contains = this.set.contains( element ); + } + else if( this.firstElement != null && this.firstElement.equals( element ) ) + { + contains = true; + } + + return contains; + } + + public int size() + { + final int size; + + if( this.set != null ) + { + size = this.set.size(); + } + else if( this.firstElement != null) + { + size = 1; + } + else + { + size = 0; + } + + return size; + } + + public SortedSet<E> result() + { + if( this.exported ) + { + throw new IllegalStateException(); + } + + this.exported = true; + + if( this.set != null ) + { + return Collections.unmodifiableSortedSet( this.set ); + } + else if( this.firstElement != null ) + { + return new SingletonSortedSet<E>( this.comparator, this.firstElement ); + } + else + { + return empty(); + } + } + + private static final Iterator<Object> EMPTY_ITERATOR = new Iterator<Object>() + { + public boolean hasNext() + { + return false; + } + + public Object next() + { + throw new NoSuchElementException(); + } + + public void remove() + { + throw new UnsupportedOperationException(); + } + }; + + private static final Object[] EMPTY_ARRAY = new Object[ 0 ]; + + private static final SortedSet<Object> EMPTY_SORTED_SET = new SortedSet<Object>() + { + public int size() + { + return 0; + } + + public boolean isEmpty() + { + return true; + } + + public boolean contains( final Object object ) + { + return false; + } + + public Iterator<Object> iterator() + { + return EMPTY_ITERATOR; + } + + public Object[] toArray() + { + return EMPTY_ARRAY; + } + + public <T> T[] toArray( final T[] array ) + { + if( array.length > 0 ) + { + array[ 0 ] = null; + } + + return array; + } + + public boolean add( final Object object ) + { + throw new UnsupportedOperationException(); + } + + public boolean remove( Object object ) + { + throw new UnsupportedOperationException(); + } + + public boolean containsAll( final Collection<?> collection ) + { + return false; + } + + public boolean addAll( final Collection<? extends Object> collection ) + { + throw new UnsupportedOperationException(); + } + + public boolean retainAll( final Collection<?> collection ) + { + throw new UnsupportedOperationException(); + } + + public boolean removeAll( final Collection<?> collection ) + { + throw new UnsupportedOperationException(); + } + + public void clear() + { + throw new UnsupportedOperationException(); + } + + public Comparator<? super Object> comparator() + { + return null; + } + + public SortedSet<Object> subSet( final Object fromElement, + final Object toElement ) + { + return EMPTY_SORTED_SET; + } + + public SortedSet<Object> headSet( final Object toElement ) + { + return EMPTY_SORTED_SET; + } + + public SortedSet<Object> tailSet( final Object fromElement ) + { + return EMPTY_SORTED_SET; + } + + public Object first() + { + return new NoSuchElementException(); + } + + public Object last() + { + return new NoSuchElementException(); + } + }; + + private static final class SingletonSortedSet<E> implements SortedSet<E> + { + private final Comparator<E> comparator; + private final E entry; + + public SingletonSortedSet( final Comparator<E> comparator, + final E entry ) + { + this.comparator = comparator; + this.entry = entry; + } + + public int size() + { + return 1; + } + + public boolean isEmpty() + { + return false; + } + + @SuppressWarnings( "unchecked" ) + + public boolean contains( final Object object ) + { + return ( this.comparator == null ? equal( this.entry, object ) : this.comparator.compare( this.entry, (E) object ) == 0 ); + } + + public boolean containsAll( final Collection<?> collection ) + { + for( Object object : collection ) + { + if( ! contains( object ) ) + { + return false; + } + } + + return true; + } + + public Iterator<E> iterator() + { + return new Iterator<E>() + { + private boolean hasNext = true; + + public boolean hasNext() + { + return this.hasNext; + } + + public E next() + { + if( this.hasNext ) + { + this.hasNext = false; + return SingletonSortedSet.this.entry; + } + + throw new NoSuchElementException(); + } + + public void remove() + { + throw new UnsupportedOperationException(); + } + }; + } + + public Object[] toArray() + { + return new Object[] { this.entry }; + } + + @SuppressWarnings( "unchecked" ) + + public <T> T[] toArray( final T[] array ) + { + T[] a = array; + + if( a.length == 0 ) + { + a = (T[]) java.lang.reflect.Array.newInstance( a.getClass().getComponentType(), 1 ); + a[ 0 ] = (T) this.entry; + } + else + { + a[ 0 ] = (T) this.entry; + + if( a.length > 1 ) + { + a[ 1 ] = null; + } + } + + return a; + } + + public boolean add( final E object ) + { + throw new UnsupportedOperationException(); + } + + public boolean remove( final Object object ) + { + throw new UnsupportedOperationException(); + } + + public boolean addAll( final Collection<? extends E> collection ) + { + throw new UnsupportedOperationException(); + } + + public boolean retainAll( final Collection<?> collection ) + { + throw new UnsupportedOperationException(); + } + + public boolean removeAll( final Collection<?> collection ) + { + throw new UnsupportedOperationException(); + } + + public void clear() + { + throw new UnsupportedOperationException(); + } + + public Comparator<? super E> comparator() + { + return null; + } + + public SortedSet<E> subSet( final E fromElement, + final E toElement ) + { + return empty(); + } + + public SortedSet<E> headSet( final E toElement ) + { + return empty(); + } + + public SortedSet<E> tailSet( final E fromElement ) + { + if( contains( fromElement ) ) + { + return this; + } + + return empty(); + } + + public E first() + { + return this.entry; + } + + public E last() + { + return this.entry; + } + + @Override + public String toString() + { + return "[" + this.entry.toString() + "]"; + } + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/StreamGobbler.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/StreamGobbler.java new file mode 100644 index 00000000..0607ba77 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/StreamGobbler.java @@ -0,0 +1,67 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +/** + * @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a> + */ + +public final class StreamGobbler extends Thread { + private final InputStream stream; + private final StringBuffer output; + + public StreamGobbler(final InputStream stream) { + if (stream == null) { + throw new IllegalArgumentException(); + } + + this.stream = stream; + this.output = new StringBuffer(); + } + + @Override + public void run() { + try { + final BufferedReader br = new BufferedReader(new InputStreamReader(this.stream)); + + String line = null; + + while ((line = br.readLine()) != null) { + read(line); + } + } catch (final IOException e) { + e.printStackTrace(); + } + } + + protected void read(final String line) { + this.output.append(line); + this.output.append('\n'); + } + + public final String output() { + return this.output.toString(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/URIHelper.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/URIHelper.java new file mode 100644 index 00000000..d7d5b711 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/URIHelper.java @@ -0,0 +1,61 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import static fish.payara.eclipse.tools.server.utils.Utils.getHttpListenerProtocol; +import static java.io.File.separator; + +import java.awt.Desktop; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import org.eclipse.wst.server.core.IModule; + +import fish.payara.eclipse.tools.server.PayaraServer; +import fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour; + +public class URIHelper { + + public static final void showURI(String uriParam) throws URISyntaxException, IOException { + Desktop.getDesktop().browse(new URI(uriParam)); + } + + public static final void showURI(URI uri) throws IOException { + Desktop.getDesktop().browse(uri); + } + + public static final URI getServerAdminURI(PayaraServer server) throws URISyntaxException { + return new URI(getHttpListenerProtocol(server.getHost(), server.getAdminPort()), null, server.getHost(), + server.getAdminPort(), null, null, null); + } + + public static final URI getServerHomeURI(PayaraServer server) throws URISyntaxException { + return new File(server.getServerHome()).toURI(); + } + + public static final URI getDomainHomeURI(PayaraServer server) throws URISyntaxException { + return new File(server.getDomainsFolder() + separator + server.getDomainName()).toURI(); + } + + public static final URI getModuleDeployURI(PayaraServerBehaviour serverBehaviour, IModule module) throws URISyntaxException { + return new File(serverBehaviour.getModuleDeployPath(module)).toURI(); + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/Utils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/Utils.java new file mode 100644 index 00000000..233b097e --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/Utils.java @@ -0,0 +1,447 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.ConnectException; +import java.net.InetSocketAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.SocketException; +import java.net.SocketTimeoutException; +import java.nio.charset.StandardCharsets; +import java.util.Locale; +import java.util.logging.Level; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.Path; +import org.eclipse.jst.j2ee.application.Module; +import org.eclipse.jst.j2ee.application.WebModule; +import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualArchiveComponent; +import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; +import org.eclipse.jst.j2ee.model.IEARModelProvider; +import org.eclipse.jst.j2ee.model.ModelProviderManager; +import org.eclipse.osgi.util.NLS; +import org.eclipse.wst.common.componentcore.ComponentCore; +import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; +import org.eclipse.wst.common.componentcore.resources.IVirtualFile; +import org.eclipse.wst.common.componentcore.resources.IVirtualReference; +import org.eclipse.wst.common.project.facet.core.IFacetedProject; +import org.eclipse.wst.common.project.facet.core.IProjectFacet; +import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; +import org.eclipse.wst.server.core.IModule; +import org.eclipse.wst.server.core.internal.DeletedModule; + +import fish.payara.eclipse.tools.server.Messages; +import fish.payara.eclipse.tools.server.PayaraServerPlugin; +import fish.payara.eclipse.tools.server.sdk.logging.Logger; +import fish.payara.eclipse.tools.server.sdk.utils.OsUtils; + +/** + * + * @author Nitya Doraisamy + */ +public class Utils { + public static String simplifyModuleID(String candidateID) { + String moduleID = null; + + moduleID = candidateID.replace(' ', '_'); + if (moduleID.startsWith("/")) { //$NON-NLS-1$ + moduleID = moduleID.substring(1); + } + + // This moduleID will be later used to construct file path, + // replace the illegal characters in file name + // \ / : * ? " < > | with _ + moduleID = moduleID.replace('\\', '_').replace('/', '_'); + moduleID = moduleID.replace(':', '_').replace('*', '_'); + moduleID = moduleID.replace('?', '_').replace('"', '_'); + moduleID = moduleID.replace('<', '_').replace('>', '_'); + moduleID = moduleID.replace('|', '_'); + + // This moduleID will also be used to construct an ObjectName + // to register the module, so replace additional special + // characters , = used in property parsing with - + moduleID = moduleID.replace(',', '_').replace('=', '_'); + + return moduleID; + } + + public static boolean canWrite(File location) { + if (OsUtils.isWin()) { + boolean retVal = true; + File tmp = null; + if (!location.exists()) { + retVal = false; + } else if (location.isDirectory()) { + try { + tmp = File.createTempFile("foo", ".tmp", location); + } catch (IOException ex) { + // I hate using exceptions for flow of control + retVal = false; + } finally { + if (null != tmp) { + tmp.delete(); + } + } + } else { + FileOutputStream fos = null; + try { + fos = new FileOutputStream(location, true); + } catch (FileNotFoundException ex) { + // I hate using exceptions for flow of control + retVal = false; + } finally { + if (null != fos) { + try { + fos.close(); + } catch (java.io.IOException ioe) { + Logger.log(Level.FINEST, null, ioe); + } + } + } + } + return retVal; + } else { + return location.canWrite(); + } + } + + /** + * Determine if a local port is occupied. + * + * @param port + * @return true, if the local port is in use. + */ + public static boolean isLocalPortOccupied(int port) { + ServerSocket ss = null; + boolean retVal = true; + try { + ss = new ServerSocket(port); + retVal = false; + } catch (IOException ioe) { + // do nothing + } finally { + if (null != ss) { + try { + ss.close(); + } catch (IOException ioe) { + } + } + } + return retVal; + } + + /** + * identify the http/https protocol designator for a port + * + */ + public static String getHttpListenerProtocol(String hostname, int port) { + String retVal = "http"; + try { + if (isSecurePort(hostname, port)) { + retVal = "https"; + } + } catch (ConnectException ex) { + Logger.log(Level.INFO, null, ex); + } catch (SocketException ex) { + Logger.log(Level.FINE, null, ex); + } catch (SocketTimeoutException ex) { + Logger.log(Level.INFO, null, ex); + } catch (IOException ex) { + Logger.log(Level.INFO, null, ex); + } + return retVal; + } + + private static final int PORT_CHECK_TIMEOUT = 4000; // Port check timeout in + // ms + + /** + * Determine whether an http listener is secure or not.. + * + * This method accepts a hostname and port #. It uses this information to attempt to connect to the + * port, send a test query, analyze the result to determine if the port is secure or unsecure + * (currently only http / https is supported). it might emit a warning in the server log for + * GlassFish cases No Harm, just an annoying warning, so we need to use this call only when really + * needed + * + * @param hostname the host for the http-listener + * @param port the port for the http-listener + * @throws IOException + * @throws SocketTimeoutException + * @throws ConnectException + */ + public static boolean isSecurePort(String hostname, int port) + throws IOException, ConnectException, SocketTimeoutException { + return isSecurePort(hostname, port, 0); + } + + private static boolean isSecurePort(String hostname, int port, int depth) + throws IOException, ConnectException, SocketTimeoutException { + // Open the socket with a short timeout for connects and reads. + Socket socket = new Socket(); + try { + socket.connect(new InetSocketAddress(hostname, port), + PORT_CHECK_TIMEOUT); + socket.setSoTimeout(PORT_CHECK_TIMEOUT); + } catch (SocketException ex) { // this could be bug 70020 due to SOCKs + // proxy not having localhost + String socksNonProxyHosts = System + .getProperty("socksNonProxyHosts"); + if (socksNonProxyHosts != null + && socksNonProxyHosts.indexOf("localhost") < 0) { + String localhost = socksNonProxyHosts.length() > 0 ? "|localhost" + : "localhost"; + System.setProperty("socksNonProxyHosts", socksNonProxyHosts + + localhost); + if (depth < 1) { + socket.close(); + return isSecurePort(hostname, port, 1); + } else { + socket.close(); + ConnectException ce = new ConnectException(); + ce.initCause(ex); + throw ce; // status unknow at this point + // next call, we'll be ok and it will really detect if we + // are secure or not + } + } + } + + // Send an https query (w/ trailing http query) + java.io.OutputStream ostream = socket.getOutputStream(); + ostream.write(TEST_QUERY); + + // Get the result + java.io.InputStream istream = socket.getInputStream(); + byte[] input = new byte[8192]; + istream.read(input); + + // Determine protocol from result + // Can't read https response w/ OpenSSL (or equiv), so use as + // default & try to detect an http response. + String response = new String(input, StandardCharsets.UTF_8).toLowerCase(Locale.ENGLISH); + boolean isSecure = true; + if (response.length() == 0) { + // isSecure = false; + // Close the socket + socket.close(); + throw new ConnectException(); + } else if (response.startsWith("http/1.1 302 moved temporarily")) { + // 3.1 has started to use redirects... but 3.0 is still using the + // older strategies... + isSecure = true; + } else if (response.startsWith("http/1.")) { + isSecure = false; + } else if (response.indexOf("<html") != -1) { + isSecure = false; + } else if (response.indexOf("</html") != -1) { + // New test added to resolve 106245 + // when the user has the IDE use a proxy (like + // webcache.foo.bar.com), + // the response comes back as "d><title>....</html>". It looks like + // something eats the "<html><hea" off the front of the data that + // gets returned. + // + // This test makes an allowance for that behavior. I figure testing + // the likely "last bit" is better than testing a bit that is close + // to the data that seems to get eaten. + // + isSecure = false; + } else if (response.indexOf("connection: ") != -1) { + isSecure = false; + } + // Close the socket + socket.close(); + return isSecure; + } + + public static final boolean hasProjectFacet(IModule module, IProjectFacet facet) { + try { + if ((module == null) || (module.getProject() == null)) { + return false; // handle the case that the project is removed from workspace + } + IFacetedProject facetProject = ProjectFacetsManager.create(module.getProject()); + if (facetProject == null) { + return false; + } + return facetProject.hasProjectFacet(facet); + } catch (CoreException ce) { + return false; + } + } + + public static String getAppWebContextRoot(final IModule root, final IModule module) { + if (module instanceof DeletedModule || root instanceof DeletedModule) { + return null; + } + + if (module.getName().startsWith("lib/")) { + final IProject earProject = root.getProject(); + IVirtualComponent c = ComponentCore.createComponent(earProject); + for (IVirtualReference ref : c.getReferences()) { + IVirtualComponent comp = ref.getReferencedComponent(); + if (comp instanceof J2EEModuleVirtualArchiveComponent) { + J2EEModuleVirtualArchiveComponent archive = (J2EEModuleVirtualArchiveComponent) comp; + String aName = archive.getName(); + if (module.getName().endsWith(aName)) { + return archive.getDeploymentPath().toPortableString(); + } + } + } + + } + + String context = null; + try { + final IProject earProject = root.getProject(); + final IEARModelProvider earModel = (IEARModelProvider) ModelProviderManager.getModelProvider(earProject); + final IVirtualFile appXmlFile = ComponentCore.createFile(earProject, new Path("META-INF/application.xml")); + final IVirtualComponent c = ComponentCore.createComponent(module.getProject()); + final String uri = earModel.getModuleURI(c); + final Object model = earModel.getModelObject(); + if (J2EEProjectUtilities.isJEEProject(earProject)) { + // is 5.0 EAR + if (appXmlFile.exists()) { + if (model instanceof org.eclipse.jst.javaee.application.Application) { + final org.eclipse.jst.javaee.application.Application ee5App = (org.eclipse.jst.javaee.application.Application) model; + final org.eclipse.jst.javaee.application.Module ee5Module = ee5App.getFirstModule(uri); + if (ee5Module == null) { + PayaraServerPlugin.logMessage(NLS.bind(Messages.errorAppWebContentRootMapping, + module.getName())); + } else { + final org.eclipse.jst.javaee.application.Web ee5Web = ee5Module.getWeb(); + if (ee5Web == null) { + PayaraServerPlugin.logMessage(NLS.bind(Messages.errorAppWebContentRootMapping, + module.getName())); + } else { + final String contextRoot = ee5Web.getContextRoot(); + if (contextRoot == null) { + // if context root is empty, it should map to root (ie /) + context = ""; + } else { + context = contextRoot; + } + } + } + } else { + context = J2EEProjectUtilities.getServerContextRoot(module.getProject()); + } + } else { + // missing an application.xml, retrieve context root via J2EEProjectUtilities method + context = J2EEProjectUtilities.getServerContextRoot(module.getProject()); + } + } else { + // is 1.4 EAR + if (!appXmlFile.exists()) { + PayaraServerPlugin.logMessage("Error reading application.xml"); + } else if (model instanceof org.eclipse.jst.j2ee.application.Application) { + final org.eclipse.jst.j2ee.application.Application ee14App = (org.eclipse.jst.j2ee.application.Application) model; + final Module ee14Module = ee14App.getFirstModule(uri); + if (ee14Module == null) { + PayaraServerPlugin.logMessage(NLS.bind(Messages.errorAppWebContentRootMapping, + module.getName())); + } else if (!(ee14Module instanceof WebModule)) { + PayaraServerPlugin.logMessage(NLS.bind(Messages.errorAppWebContentRootMapping, + module.getName())); + } else { + final String contextRoot = ((WebModule) ee14Module).getContextRoot(); + if (contextRoot == null) { + // if context root is empty, it should map to root (ie /) + context = ""; + } else { + context = contextRoot; + } + } + } + } + } catch (Exception e) { + // CR302872 + PayaraServerPlugin.logMessage(NLS.bind(Messages.errorAppWebContentRootMapping, + module.getName())); + } + return context; + } + + public static boolean isEmpty(String string) { + return string == null || string.isEmpty(); + } + + /** + * This is the test query used to ping the server in an attempt to determine if it is secure or not. + */ + private static byte[] TEST_QUERY = new byte[] { + // The following SSL query is from nmap (http://www.insecure.org) + // This HTTPS request should work for most (all?) https servers + (byte) 0x16, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 'S', + (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 'O', (byte) 0x03, + (byte) 0x00, (byte) '?', (byte) 'G', (byte) 0xd7, (byte) 0xf7, + (byte) 0xba, (byte) ',', (byte) 0xee, (byte) 0xea, (byte) 0xb2, + (byte) '`', (byte) '~', (byte) 0xf3, (byte) 0x00, (byte) 0xfd, + (byte) 0x82, (byte) '{', (byte) 0xb9, (byte) 0xd5, (byte) 0x96, + (byte) 0xc8, (byte) 'w', (byte) 0x9b, (byte) 0xe6, (byte) 0xc4, + (byte) 0xdb, (byte) '<', (byte) '=', (byte) 0xdb, (byte) 'o', + (byte) 0xef, (byte) 0x10, (byte) 'n', (byte) 0x00, (byte) 0x00, + (byte) '(', (byte) 0x00, (byte) 0x16, (byte) 0x00, (byte) 0x13, + (byte) 0x00, (byte) 0x0a, (byte) 0x00, (byte) 'f', (byte) 0x00, + (byte) 0x05, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 'e', + (byte) 0x00, (byte) 'd', (byte) 0x00, (byte) 'c', (byte) 0x00, + (byte) 'b', (byte) 0x00, (byte) 'a', (byte) 0x00, (byte) '`', + (byte) 0x00, + (byte) 0x15, + (byte) 0x00, + (byte) 0x12, + (byte) 0x00, + (byte) 0x09, + (byte) 0x00, + (byte) 0x14, + (byte) 0x00, + (byte) 0x11, + (byte) 0x00, + (byte) 0x08, + (byte) 0x00, + (byte) 0x06, + (byte) 0x00, + (byte) 0x03, + (byte) 0x01, + (byte) 0x00, + // The following is a HTTP request, some HTTP servers won't + // respond unless the following is also sent + (byte) 'G', + (byte) 'E', + (byte) 'T', + (byte) ' ', + (byte) '/', + // change the detector to request something that the monitor knows + // to filter + // out. This will work-around 109891. Use the longest filtered + // prefix to + // avoid false positives.... + (byte) 'c', (byte) 'o', (byte) 'm', (byte) '_', (byte) 's', + (byte) 'u', (byte) 'n', (byte) '_', (byte) 'w', (byte) 'e', + (byte) 'b', (byte) '_', (byte) 'u', (byte) 'i', (byte) ' ', + (byte) 'H', (byte) 'T', (byte) 'T', (byte) 'P', (byte) '/', + (byte) '1', (byte) '.', (byte) '0', (byte) '\n', (byte) '\n' }; + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/Version.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/Version.java new file mode 100644 index 00000000..0ee91c70 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/Version.java @@ -0,0 +1,213 @@ +/****************************************************************************** + * Copyright (c) 2016 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Konstantin Komissarchik - initial implementation and ongoing maintenance + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import static java.lang.Math.max; + +import java.util.Collections; +import java.util.List; + +/** + * Represents a version as a sequence of long integers. In string format, it is represented as a dot-separated + * list of numeric segments, such as "1.2.3" or "5.7.3.2012070310003". + * + * @author <a href="mailto:konstantin@komissarchik.net">Konstantin Komissarchik</a> + */ + +public final class Version implements Comparable<Version> +{ + private final List<Long> segments; + private final int length; + + public Version( final long version ) + { + if( version == 0 ) + { + this.segments = Collections.emptyList(); + this.length = 0; + } + else if( version > 0 ) + { + this.segments = Collections.singletonList( version ); + this.length = 1; + } + else + { + throw new IllegalArgumentException( String.valueOf( version ) ); + } + } + + public Version( final String versionString ) throws IllegalArgumentException + { + if( versionString == null ) + { + throw new IllegalArgumentException(); + } + + final String str = versionString.trim(); + + if( str.startsWith( "." ) || str.endsWith( "." ) || str.contains( ".." ) ) + { + throw new IllegalArgumentException( str ); + } + + final ListFactory<Long> segments = ListFactory.start(); + + for( String segment : str.split( "\\." ) ) + { + final long segmentAsLong; + + try + { + segmentAsLong = Long.parseLong( segment ); + } + catch( NumberFormatException e ) + { + throw new IllegalArgumentException( str ); + } + + if( segmentAsLong < 0 ) + { + throw new IllegalArgumentException( str ); + } + + segments.add( segmentAsLong ); + } + + for( int i = segments.size() - 1; i >= 0; i-- ) + { + if( segments.get( i ) == 0 ) + { + segments.remove( i ); + } + else + { + break; + } + } + + this.segments = segments.result(); + this.length = this.segments.size(); + } + + public List<Long> segments() + { + return this.segments; + } + + public long segment( final int position ) + { + if( position < 0 ) + { + throw new IllegalArgumentException( String.valueOf( position ) ); + } + else if( position < this.length ) + { + return this.segments.get( position ); + } + else + { + return 0; + } + } + + public int length() + { + return this.length; + } + + public boolean matches( final String constraint ) + { + return matches( new VersionConstraint( constraint ) ); + } + + public boolean matches( final VersionConstraint constraint ) + { + return constraint.check( this ); + } + + @Override + public int compareTo( final Version version ) + { + for( int i = 0, n = max( length(), version.length ); i < n; i++ ) + { + final long res = segment( i ) - version.segment( i ); + + if( res > 0 ) + { + return 1; + } + else if( res < 0 ) + { + return -1; + } + } + + return 0; + } + + @Override + public boolean equals( final Object obj ) + { + if( obj instanceof Version ) + { + final Version version = (Version) obj; + + if( length() == version.length() ) + { + for( int i = 0, n = length(); i < n; i++ ) + { + if( segment( i ) != version.segment( i ) ) + { + return false; + } + } + + return true; + } + } + + return false; + } + + @Override + public int hashCode() + { + int hashCode = 1; + + for( int i = 0, n = length(); i < n; i++ ) + { + hashCode *= segment( i ); + } + + return hashCode; + } + + @Override + public String toString() + { + final StringBuilder buf = new StringBuilder(); + + for( long segment : this.segments ) + { + if( buf.length() > 0 ) + { + buf.append( '.' ); + } + + buf.append( segment ); + } + + return buf.toString(); + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/VersionConstraint.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/VersionConstraint.java new file mode 100644 index 00000000..68ab0535 --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/VersionConstraint.java @@ -0,0 +1,572 @@ +/****************************************************************************** + * Copyright (c) 2016 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Konstantin Komissarchik - initial implementation and ongoing maintenance + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import java.util.List; + +/** + * A version constraint is a boolean expression that can check versions for applicability. In string + * format, it is represented as a comma-separated list of specific versions, closed + * ranges (expressed using "[1.2.3-4.5)" syntax and open ranges (expressed using "[1.2.3" or "4.5)" + * syntax). The square brackets indicate that the range includes the specified version. The parenthesis + * indicate that the range goes up to, but does not actually include the specified version. + * + * @author <a href="mailto:konstantin@komissarchik.net">Konstantin Komissarchik</a> + */ + +public final class VersionConstraint +{ + private static final int SM_RANGE_STARTING = 0; + private static final int SM_RANGE_ENDED = 1; + private static final int SM_VERSION_STARTING = 2; + private static final int SM_VERSION_SEGMENT_STARTING = 3; + private static final int SM_VERSION_SEGMENT_CONTINUING = 4; + private static final int SM_VERSION_ENDED = 5; + + private final List<Range> ranges; + + public VersionConstraint( final String expr ) + { + if( expr == null ) + { + throw new IllegalArgumentException(); + } + + final ListFactory<Range> rangesListFactory = ListFactory.start(); + + int state = SM_RANGE_STARTING; + Range.Factory range = null; + StringBuilder buf = null; + + for( int position = 0, n = expr.length(); position < n; position++ ) + { + final char ch = expr.charAt( position ); + + switch( state ) + { + case SM_RANGE_STARTING: + { + if( ch == ' ' ) + { + // ignore + } + else if( ch == '[' ) + { + range = new Range.Factory(); + range.minVersionInclusive = true; + buf = new StringBuilder(); + state = SM_VERSION_STARTING; + } + else if( ch == '(' ) + { + range = new Range.Factory(); + range.minVersionInclusive = false; + buf = new StringBuilder(); + state = SM_VERSION_STARTING; + } + else if( ch >= '0' && ch <= '9' ) + { + buf = new StringBuilder(); + buf.append( ch ); + state = SM_VERSION_SEGMENT_CONTINUING; + } + else + { + throw new IllegalArgumentException(); + } + + break; + } + case SM_RANGE_ENDED: + { + if( ch == ' ' ) + { + // ignore + } + else if( ch == ',' ) + { + state = SM_RANGE_STARTING; + } + else + { + throw new IllegalArgumentException(); + } + + break; + } + case SM_VERSION_STARTING: + { + if( ch == ' ' ) + { + // ignore + } + else if( ch >= '0' && ch <= '9' ) + { + buf.append( ch ); + state = SM_VERSION_SEGMENT_CONTINUING; + } + else + { + throw new IllegalArgumentException(); + } + + break; + } + case SM_VERSION_SEGMENT_STARTING: + { + if( ch >= '0' && ch <= '9' ) + { + buf.append( ch ); + state = SM_VERSION_SEGMENT_CONTINUING; + } + else + { + throw new IllegalArgumentException(); + } + + break; + } + case SM_VERSION_SEGMENT_CONTINUING: + { + if( ch >= '0' && ch <= '9' ) + { + buf.append( ch ); + } + else if( ch == '.' ) + { + buf.append( ch ); + state = SM_VERSION_SEGMENT_STARTING; + } + else if( ch == ' ' ) + { + state = SM_VERSION_ENDED; + } + else if( ch == ']' ) + { + if( range == null ) + { + range = new Range.Factory(); + } + + range.maxVersion = new Version( buf.toString() ); + range.maxVersionInclusive = true; + + rangesListFactory.add( range.create() ); + + range = null; + buf = null; + + state = SM_RANGE_ENDED; + } + else if( ch == ')' ) + { + if( range == null ) + { + range = new Range.Factory(); + } + + range.maxVersion = new Version( buf.toString() ); + range.maxVersionInclusive = false; + + rangesListFactory.add( range.create() ); + + range = null; + buf = null; + + state = SM_RANGE_ENDED; + } + else if( ch == '-' ) + { + if( range == null ) + { + throw new IllegalArgumentException(); + } + + range.minVersion = new Version( buf.toString() ); + + buf = new StringBuilder(); + + state = SM_VERSION_STARTING; + } + else if( ch == ',' ) + { + if( range == null ) + { + range = new Range.Factory(); + range.minVersion = new Version( buf.toString() ); + range.maxVersion = range.minVersion; + range.minVersionInclusive = true; + range.maxVersionInclusive = true; + } + else + { + range.minVersion = new Version( buf.toString() ); + } + + rangesListFactory.add( range.create() ); + + range = null; + buf = null; + + state = SM_RANGE_STARTING; + } + else + { + throw new IllegalArgumentException(); + } + + break; + } + case SM_VERSION_ENDED: + { + if( ch == ' ' ) + { + // ignore + } + else if( ch == ']' ) + { + if( range == null ) + { + range = new Range.Factory(); + } + + range.maxVersion = new Version( buf.toString() ); + range.maxVersionInclusive = true; + + rangesListFactory.add( range.create() ); + + range = null; + buf = null; + + state = SM_RANGE_ENDED; + } + else if( ch == ')' ) + { + if( range == null ) + { + range = new Range.Factory(); + } + + range.maxVersion = new Version( buf.toString() ); + range.maxVersionInclusive = false; + + rangesListFactory.add( range.create() ); + + range = null; + buf = null; + + state = SM_RANGE_ENDED; + } + else if( ch == '-' ) + { + if( range == null ) + { + throw new IllegalArgumentException(); + } + + range.minVersion = new Version( buf.toString() ); + + buf = new StringBuilder(); + + state = SM_VERSION_STARTING; + } + else if( ch == ',' ) + { + if( range == null ) + { + range = new Range.Factory(); + range.minVersion = new Version( buf.toString() ); + range.maxVersion = range.minVersion; + range.minVersionInclusive = true; + range.maxVersionInclusive = true; + } + else + { + range.minVersion = new Version( buf.toString() ); + } + + rangesListFactory.add( range.create() ); + + range = null; + buf = null; + + state = SM_RANGE_STARTING; + } + else + { + throw new IllegalArgumentException(); + } + + break; + } + default: + { + throw new IllegalStateException(); + } + } + } + + if( state == SM_VERSION_SEGMENT_CONTINUING || state == SM_VERSION_ENDED ) + { + if( range == null ) + { + range = new Range.Factory(); + range.minVersion = new Version( buf.toString() ); + range.maxVersion = range.minVersion; + range.minVersionInclusive = true; + range.maxVersionInclusive = true; + } + else + { + range.minVersion = new Version( buf.toString() ); + } + + rangesListFactory.add( range.create() ); + + range = null; + buf = null; + + state = SM_RANGE_ENDED; + } + + if( state != SM_RANGE_ENDED ) + { + throw new IllegalArgumentException(); + } + + this.ranges = rangesListFactory.result(); + } + + public List<Range> ranges() + { + return this.ranges; + } + + public boolean check( final Version version ) + { + for( Range subexpr : this.ranges ) + { + if( subexpr.check( version ) ) + { + return true; + } + } + + return false; + } + + public boolean check( final String version ) + { + return check( new Version( version ) ); + } + + @Override + public boolean equals( final Object obj ) + { + if( obj instanceof VersionConstraint ) + { + final VersionConstraint constraint = (VersionConstraint) obj; + return this.ranges.equals( constraint.ranges ); + } + + return false; + } + + @Override + public int hashCode() + { + return this.ranges.hashCode(); + } + + @Override + public String toString() + { + final StringBuffer buf = new StringBuffer(); + + for( Range subexpr : this.ranges ) + { + if( buf.length() > 0 ) buf.append( ',' ); + buf.append( subexpr.toString() ); + } + + return buf.toString(); + } + + public static final class Range + { + private final Limit min; + private final Limit max; + + private Range( final Limit min, + final Limit max ) + { + if( min == null && max == null ) + { + throw new IllegalArgumentException(); + } + + this.min = min; + this.max = max; + } + + public Limit min() + { + return this.min; + } + + public Limit max() + { + return this.max; + } + + public boolean check( final Version version ) + { + if( this.min != null ) + { + final int res = version.compareTo( this.min.version() ); + + if( ! ( res > 0 || ( res == 0 && this.min.inclusive() ) ) ) + { + return false; + } + } + + if( this.max != null ) + { + final int res = version.compareTo( this.max.version() ); + + if( ! ( res < 0 || ( res == 0 && this.max.inclusive() ) ) ) + { + return false; + } + } + + return true; + } + + @Override + public boolean equals( final Object obj ) + { + if( obj instanceof Range ) + { + final Range range = (Range) obj; + return EqualsFactory.start().add( this.min, range.min ).add( this.max, range.max ).result(); + } + + return false; + } + + @Override + public int hashCode() + { + return HashCodeFactory.start().add( this.min ).add( this.max ).result(); + } + + @Override + public String toString() + { + if( this.min != null && this.max != null && + this.min.version().equals( this.max.version() ) && + (this.min.inclusive() == this.max.inclusive()) ) + { + return this.min.version().toString(); + } + else + { + final StringBuffer buf = new StringBuffer(); + + if( this.min != null ) + { + buf.append( this.min.inclusive() ? '[' : '(' ); + buf.append( this.min.version().toString() ); + } + + if( this.max != null ) + { + if( buf.length() != 0 ) + { + buf.append( '-' ); + } + + buf.append( this.max.version().toString() ); + buf.append( this.max.inclusive() ? ']' : ')' ); + } + + return buf.toString(); + } + } + + public static final class Limit + { + private final Version version; + private final boolean inclusive; + + private Limit( final Version version, + final boolean inclusive ) + { + if( version == null ) + { + throw new IllegalArgumentException(); + } + + this.version = version; + this.inclusive = inclusive; + } + + public Version version() + { + return this.version; + } + + public boolean inclusive() + { + return this.inclusive; + } + + @Override + public boolean equals( final Object obj ) + { + if( obj instanceof Limit ) + { + final Limit limit = (Limit) obj; + return this.version.equals( limit.version ) && this.inclusive == limit.inclusive; + } + + return false; + } + + @Override + public int hashCode() + { + return this.version.hashCode() ^ Boolean.valueOf( this.inclusive ).hashCode(); + } + } + + private static final class Factory + { + public Version minVersion; + public boolean minVersionInclusive; + public Version maxVersion; + public boolean maxVersionInclusive; + + public Range create() + { + final Limit min = ( this.minVersion == null ? null : new Limit( this.minVersion, this.minVersionInclusive ) ); + final Limit max = ( this.maxVersion == null ? null : new Limit( this.maxVersion, this.maxVersionInclusive ) ); + + return new Range( min, max ); + } + } + + } + +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/WizardUtil.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/WizardUtil.java new file mode 100644 index 00000000..566ceb0a --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/WizardUtil.java @@ -0,0 +1,78 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; +import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities; +import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; +import org.eclipse.wst.server.core.IRuntime; + +import fish.payara.eclipse.tools.server.PayaraServerPlugin; + +@SuppressWarnings("restriction") +public class WizardUtil { + + public static boolean isWebOrEJBProjectWithGF3Runtime(IProject project) { + try { + boolean result = project.isAccessible() && + project.hasNature(IModuleConstants.MODULE_NATURE_ID) && + (JavaEEProjectUtilities.isDynamicWebProject(project) || + JavaEEProjectUtilities.isEJBProject(project)); + + if (result) { + return hasGF3Runtime(project); + } + } catch (CoreException e) { + e.printStackTrace(); + } + + return false; + } + + public static boolean isWebProjectWithGF3Runtime(IProject project) { + try { + boolean result = (project.isAccessible() && + project.hasNature(IModuleConstants.MODULE_NATURE_ID) && + JavaEEProjectUtilities.isDynamicWebProject(project)); + + if (result) { + return hasGF3Runtime(project); + } + } catch (CoreException e) { + e.printStackTrace(); + } + + return false; + } + + public static boolean hasGF3Runtime(IProject project) { + try { + IRuntime runtime = J2EEProjectUtilities.getServerRuntime(project); + if ((runtime != null) && PayaraServerPlugin.is31OrAbove(runtime)) { + return true; + } + } catch (CoreException e) { + e.printStackTrace(); + } + + return false; + } +} diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/WtpUtil.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/WtpUtil.java new file mode 100644 index 00000000..a3aaa59d --- /dev/null +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/WtpUtil.java @@ -0,0 +1,70 @@ +/****************************************************************************** + * Copyright (c) 2018 Oracle + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +/****************************************************************************** + * Copyright (c) 2018-2019 Payara Foundation + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v20.html + * SPDX-License-Identifier: EPL-2.0 + ******************************************************************************/ + +package fish.payara.eclipse.tools.server.utils; + +import org.eclipse.wst.server.core.IModule; +import org.eclipse.wst.server.core.IRuntime; +import org.eclipse.wst.server.core.IServerAttributes; +import org.eclipse.wst.server.core.ServerCore; + +/** + * @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a> + */ + +public final class WtpUtil { + + public static final String findUniqueServerName(final String base) { + int i = 1; + String name = base; + + while (ServerCore.findServer(name) != null) { + i++; + name = base + " (" + i + ")"; + } + + return name; + } + + public static final String findUniqueRuntimeName(final String base) { + int i = 1; + String name = base; + + while (ServerCore.findRuntime(name) != null) { + i++; + name = base + " (" + i + ")"; + } + + return name; + } + + public static <T> T load(IServerAttributes server, Class<T> adapter) { + return adapter.cast(server.loadAdapter(adapter, null)); + } + + public static <T> T load(IRuntime server, Class<T> adapter) { + return adapter.cast(server.loadAdapter(adapter, null)); + } + + public static <T> T load(IModule server, Class<T> adapter) { + return adapter.cast(server.loadAdapter(adapter, null)); + } + + + +} diff --git a/bundles/pom.xml b/bundles/pom.xml index 95f5846c..48cbf80f 100644 --- a/bundles/pom.xml +++ b/bundles/pom.xml @@ -13,6 +13,7 @@ </parent> <modules> - <module>fish.payara.eclipse.micro</module> + <module>fish.payara.eclipse.tools.micro</module> + <module>fish.payara.eclipse.tools.server</module> </modules> </project> diff --git a/features/fish.payara.eclipse.micro.feature/.polyglot.build.properties b/features/fish.payara.eclipse.micro.feature/.polyglot.build.properties deleted file mode 100644 index e69de29b..00000000 diff --git a/features/fish.payara.eclipse.micro.feature/.project b/features/fish.payara.eclipse.tools.micro.feature/.project similarity index 90% rename from features/fish.payara.eclipse.micro.feature/.project rename to features/fish.payara.eclipse.tools.micro.feature/.project index c222de3f..3165f85d 100644 --- a/features/fish.payara.eclipse.micro.feature/.project +++ b/features/fish.payara.eclipse.tools.micro.feature/.project @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <projectDescription> - <name>fish.payara.eclipse.micro.feature</name> + <name>fish.payara.eclipse.tools.micro.feature</name> <comment></comment> <projects> </projects> diff --git a/features/fish.payara.eclipse.tools.micro.feature/.settings/org.eclipse.core.resources.prefs b/features/fish.payara.eclipse.tools.micro.feature/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..99f26c02 --- /dev/null +++ b/features/fish.payara.eclipse.tools.micro.feature/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/features/fish.payara.eclipse.tools.micro.feature/.settings/org.eclipse.m2e.core.prefs b/features/fish.payara.eclipse.tools.micro.feature/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 00000000..f897a7f1 --- /dev/null +++ b/features/fish.payara.eclipse.tools.micro.feature/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/features/fish.payara.eclipse.micro.feature/build.properties b/features/fish.payara.eclipse.tools.micro.feature/build.properties similarity index 100% rename from features/fish.payara.eclipse.micro.feature/build.properties rename to features/fish.payara.eclipse.tools.micro.feature/build.properties diff --git a/features/fish.payara.eclipse.micro.feature/feature.xml b/features/fish.payara.eclipse.tools.micro.feature/feature.xml similarity index 99% rename from features/fish.payara.eclipse.micro.feature/feature.xml rename to features/fish.payara.eclipse.tools.micro.feature/feature.xml index 2a6f2f48..8d7040bf 100644 --- a/features/fish.payara.eclipse.micro.feature/feature.xml +++ b/features/fish.payara.eclipse.tools.micro.feature/feature.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <feature - id="fish.payara.eclipse.micro.feature" + id="fish.payara.eclipse.tools.micro.feature" label="Payara Micro Tools" version="2.0.0.qualifier" provider-name="Payara Foundation"> @@ -103,7 +103,7 @@ </license> <plugin - id="fish.payara.eclipse.micro" + id="fish.payara.eclipse.tools.micro" download-size="0" install-size="0" version="0.0.0"/> diff --git a/features/fish.payara.eclipse.tools.server.feature/.project b/features/fish.payara.eclipse.tools.server.feature/.project new file mode 100644 index 00000000..6e6df82a --- /dev/null +++ b/features/fish.payara.eclipse.tools.server.feature/.project @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>fish.payara.eclipse.tools.server.feature</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.pde.FeatureBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + <nature>org.eclipse.pde.FeatureNature</nature> + </natures> +</projectDescription> diff --git a/features/fish.payara.eclipse.tools.server.feature/.settings/org.eclipse.core.resources.prefs b/features/fish.payara.eclipse.tools.server.feature/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..99f26c02 --- /dev/null +++ b/features/fish.payara.eclipse.tools.server.feature/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/features/fish.payara.eclipse.tools.server.feature/.settings/org.eclipse.m2e.core.prefs b/features/fish.payara.eclipse.tools.server.feature/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 00000000..f897a7f1 --- /dev/null +++ b/features/fish.payara.eclipse.tools.server.feature/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/features/fish.payara.eclipse.tools.server.feature/build.properties b/features/fish.payara.eclipse.tools.server.feature/build.properties new file mode 100644 index 00000000..64f93a9f --- /dev/null +++ b/features/fish.payara.eclipse.tools.server.feature/build.properties @@ -0,0 +1 @@ +bin.includes = feature.xml diff --git a/features/fish.payara.eclipse.tools.server.feature/feature.xml b/features/fish.payara.eclipse.tools.server.feature/feature.xml new file mode 100644 index 00000000..47a38f1f --- /dev/null +++ b/features/fish.payara.eclipse.tools.server.feature/feature.xml @@ -0,0 +1,111 @@ +<?xml version="1.0" encoding="UTF-8"?> +<feature + id="fish.payara.eclipse.tools.server.feature" + label="Payara Server Tools" + version="2.0.0.qualifier" + provider-name="Payara Foundation"> + + <description url="https://www.payara.fish/products/ecosystem-catalog/"> + Payara Server Tools + </description> + + <copyright> + Copyright (c) 2018-2022 Payara Foundation + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v2.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v20.html + SPDX-License-Identifier: EPL-2.0 + </copyright> + + <license url="http://www.eclipse.org/legal/epl-v20.html"> + Eclipse Public License - v 2.0 + THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + + 1. DEFINITIONS + "Contribution" means: + + a) in the case of the initial Contributor, the initial content Distributed under this Agreement, and + b) in the case of each subsequent Contributor: + i) changes to the Program, and + ii) additions to the Program; + where such changes and/or additions to the Program originate from and are Distributed by that particular Contributor. A Contribution "originates" from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include changes or additions to the Program that are not Modified Works. + "Contributor" means any person or entity that Distributes the Program. + + "Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + + "Program" means the Contributions Distributed in accordance with this Agreement. + + "Recipient" means anyone who receives the Program under this Agreement or any Secondary License (as applicable), including Contributors. + + "Derivative Works" shall mean any work, whether in Source Code or other form, that is based on (or derived from) the Program and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. + + "Modified Works" shall mean any work in Source Code or other form that results from an addition to, deletion from, or modification of the contents of the Program, including, for purposes of clarity any new file in Source Code form that contains any contents of the Program. Modified Works shall not include works that contain only declarations, interfaces, types, classes, structures, or files of the Program solely in each case in order to link to, bind by name, or subclass the Program or Modified Works thereof. + + "Distribute" means the acts of a) distributing or b) making available in any manner that enables the transfer of a copy. + + "Source Code" means the form of a Program preferred for making modifications, including but not limited to software source code, documentation source, and configuration files. + + "Secondary License" means either the GNU General Public License, Version 2.0, or any later versions of that license, including any exceptions or additional permissions as identified by the initial Contributor. + + 2. GRANT OF RIGHTS + a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, Distribute and sublicense the Contribution of such Contributor, if any, and such Derivative Works. + b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in Source Code or other form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to Distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. + e) Notwithstanding the terms of any Secondary License, no Contributor makes additional grants to any Recipient (other than those set forth in this Agreement) as a result of such Recipient's receipt of the Program under the terms of a Secondary License (if permitted under the terms of Section 3). + 3. REQUIREMENTS + 3.1 If a Contributor Distributes the Program in any form, then: + + a) the Program must also be made available as Source Code, in accordance with section 3.2, and the Contributor must accompany the Program with a statement that the Source Code for the Program is available under this Agreement, and informs Recipients how to obtain it in a reasonable manner on or through a medium customarily used for software exchange; and + b) the Contributor may Distribute the Program under a license different than this Agreement, provided that such license: + i) effectively disclaims on behalf of all other Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + ii) effectively excludes on behalf of all other Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + iii) does not attempt to limit or alter the recipients' rights in the Source Code under section 3.2; and + iv) requires any subsequent distribution of the Program by any party to be under a license that satisfies the requirements of this section 3. + 3.2 When the Program is Distributed as Source Code: + + a) it must be made available under this Agreement, or if the Program (i) is combined with other material in a separate file or files made available under a Secondary License, and (ii) the initial Contributor attached to the Source Code the notice described in Exhibit A of this Agreement, then the Program may be made available under the terms of such Secondary Licenses, and + b) a copy of this Agreement must be included with each copy of the Program. + 3.3 Contributors may not remove or alter any copyright, patent, trademark, attribution notices, disclaimers of warranty, or limitations of liability (‘notices’) contained within the Program from any copy of the Program which they Distribute, provided that Contributors may add their own appropriate notices. + + 4. COMMERCIAL DISTRIBUTION + Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + + For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + + 5. NO WARRANTY + EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + + 6. DISCLAIMER OF LIABILITY + EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + 7. GENERAL + If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + + If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + + All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + + Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be Distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to Distribute the Program (including its Contributions) under the new version. + + Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. Nothing in this Agreement is intended to be enforceable by any entity that is not a Contributor or Recipient. No third-party beneficiary rights are created under this Agreement. + + Exhibit A – Form of Secondary Licenses Notice + "This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), version(s), and exceptions or additional permissions here}." + + Simply including a copy of this Agreement, including this Exhibit A is not sufficient to license the Source Code under Secondary Licenses. + + If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. + + You may add additional accurate notices of copyright ownership. + </license> + + <plugin + id="fish.payara.eclipse.tools.server" + download-size="0" + install-size="0" + version="0.0.0"/> + +</feature> diff --git a/features/pom.xml b/features/pom.xml index 43eeaf38..555e86ca 100644 --- a/features/pom.xml +++ b/features/pom.xml @@ -12,6 +12,7 @@ </parent> <modules> - <module>fish.payara.eclipse.micro.feature</module> + <module>fish.payara.eclipse.tools.micro.feature</module> + <module>fish.payara.eclipse.tools.server.feature</module> </modules> </project> diff --git a/releng/fish.payara.eclipse.20229/fish.payara.eclipse.20229.target b/releng/fish.payara.eclipse.20229/fish.payara.eclipse.20229.target index 4427b133..252d7211 100644 --- a/releng/fish.payara.eclipse.20229/fish.payara.eclipse.20229.target +++ b/releng/fish.payara.eclipse.20229/fish.payara.eclipse.20229.target @@ -33,5 +33,17 @@ <unit id="org.eclipse.wst.server_adapters.sdk.feature.feature.group"/> <repository location="https://download.eclipse.org/webtools/repository/2022-09/"/> </location> + <location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit"> + <unit id="org.eclipse.sapphire.modeling.feature.group"/> + <unit id="org.eclipse.sapphire.modeling.xml.feature.group"/> + <unit id="org.eclipse.sapphire.java.feature.group"/> + <unit id="org.eclipse.sapphire.java.jdt.feature.group"/> + <unit id="org.eclipse.sapphire.osgi.feature.group"/> + <unit id="org.eclipse.sapphire.platform.feature.group"/> + <unit id="org.eclipse.sapphire.ui.feature.group"/> + <unit id="org.eclipse.sapphire.ui.swt.xml.editor.feature.group"/> + <unit id="org.eclipse.sapphire.ui.swt.gef.feature.group"/> + <repository location="https://raw.githubusercontent.com/payara/ecosystem-eclipse-plugin/release-artifacts/repository/libs/sapphire/9.1.1/"/> + </location> </locations> </target> diff --git a/releng/fish.payara.eclipse.update/category.xml b/releng/fish.payara.eclipse.update/category.xml index 1bdd50a9..60f13e6c 100644 --- a/releng/fish.payara.eclipse.update/category.xml +++ b/releng/fish.payara.eclipse.update/category.xml @@ -1,6 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <site> - <feature url="features/fish.payara.eclipse.micro.feature_2.0.0.qualifier.jar" id="fish.payara.eclipse.micro.feature" version="2.0.0.qualifier"> + <feature url="features/fish.payara.eclipse.tools.micro.feature_2.0.0.qualifier.jar" id="fish.payara.eclipse.tools.micro.feature" version="2.0.0.qualifier"> + <category name="fish.payara.category"/> + </feature> + <feature url="features/fish.payara.eclipse.tools.server.feature_2.0.0.qualifier.jar" id="fish.payara.eclipse.tools.server.feature" version="2.0.0.qualifier"> <category name="fish.payara.category"/> </feature> <category-def name="fish.payara.category" label="Payara Tools"/> From 17a7b30ef239568a624377dd340dc62f52b6eab5 Mon Sep 17 00:00:00 2001 From: Gaurav Gupta <gaurav.gupta@payara.fish> Date: Mon, 19 Dec 2022 23:39:18 +0530 Subject: [PATCH 2/6] FISH-6776 Copyright year update --- .../payara/eclipse/tools/server/Messages.java | 2 +- .../eclipse/tools/server/PayaraRuntime.java | 2 +- .../payara/eclipse/tools/server/PayaraServer.java | 2 +- .../eclipse/tools/server/PayaraServerPlugin.java | 2 +- .../payara/eclipse/tools/server/ServerStatus.java | 2 +- .../tools/server/archives/AssembleModules.java | 2 +- .../archives/EclipseToPayaraArchiveConverter.java | 2 +- .../server/archives/ExportJavaEEArchive.java | 2 +- .../server/deploying/PayaraServerBehaviour.java | 2 +- .../server/events/RuntimeLifecycleListener.java | 2 +- .../server/events/ServerLifecycleListener.java | 2 +- .../exceptions/HttpPortUpdateException.java | 2 +- .../server/exceptions/PayaraLaunchException.java | 2 +- .../server/exceptions/UniqueNameNotFound.java | 2 +- .../facets/GlassfishEjbFacetInstallDelegate.java | 2 +- .../GlassfishEjbFacetUninstallDelegate.java | 2 +- .../facets/GlassfishWebFacetInstallDelegate.java | 2 +- .../GlassfishWebFacetUninstallDelegate.java | 2 +- .../facets/IGlassfishDeploymentDescriptor.java | 2 +- .../facets/IGlassfishEjbDeploymentDescriptor.java | 2 +- .../facets/IGlassfishWebDeploymentDescriptor.java | 2 +- .../AbstractGlassfishDeploymentDescriptor.java | 2 +- .../GlassfishDeploymentDescriptorFactory.java | 2 +- .../facets/internal/GlassfishDescriptorType.java | 2 +- .../GlassfishEjbDeploymentDescriptor.java | 2 +- .../GlassfishWebDeploymentDescriptor.java | 2 +- .../handlers/AbstractPayaraSelectionHandler.java | 2 +- .../server/handlers/OpenDomainHomeHandler.java | 2 +- .../server/handlers/OpenServerHomeHandler.java | 2 +- .../tools/server/handlers/PayaraStateTester.java | 2 +- .../server/handlers/PayaraVersionTester.java | 2 +- .../tools/server/handlers/ShowURLHandler.java | 2 +- .../server/handlers/ViewAdminConsoleHandler.java | 2 +- .../tools/server/handlers/ViewLogHandler.java | 2 +- .../internal/ContainersRefresherThread.java | 2 +- .../internal/ContainsRuntimeComponentType.java | 2 +- .../tools/server/internal/InstallJAXRS.java | 2 +- .../eclipse/tools/server/internal/Library.java | 2 +- .../tools/server/internal/ManifestUtil.java | 2 +- .../server/internal/PayaraClasspathProvider.java | 2 +- .../server/internal/PayaraRuntimeBridge.java | 2 +- .../server/internal/PayaraStateResolver.java | 2 +- .../server/internal/RuntimeComponentProvider.java | 2 +- .../RuntimeComponentProvidersExtensionPoint.java | 2 +- .../server/internal/ServerStateListener.java | 2 +- .../server/internal/ServerStatusMonitor.java | 2 +- .../tools/server/internal/SystemLibraries.java | 2 +- .../server/internal/SystemLibrariesContainer.java | 2 +- .../server/internal/SystemLibrariesSetting.java | 2 +- .../tools/server/log/AbstractLogFilter.java | 2 +- .../tools/server/log/AbstractPayaraConsole.java | 2 +- .../eclipse/tools/server/log/ILogFilter.java | 2 +- .../eclipse/tools/server/log/IPayaraConsole.java | 2 +- .../eclipse/tools/server/log/LevelResolver.java | 2 +- .../tools/server/log/LogFormatterSimple.java | 2 +- .../eclipse/tools/server/log/LogReader.java | 2 +- .../eclipse/tools/server/log/LogRecord.java | 2 +- .../eclipse/tools/server/log/NoOpFilter.java | 2 +- .../tools/server/log/PatternLogFilterV4.java | 2 +- .../eclipse/tools/server/log/PayaraConsole.java | 2 +- .../tools/server/log/PayaraConsoleManager.java | 2 +- .../tools/server/log/PayaraStartupConsole.java | 2 +- .../tools/server/log/StateLogFilterV3.java | 2 +- .../eclipse/tools/server/log/V3LogFilter.java | 2 +- .../server/preferences/PreferenceConstants.java | 2 +- .../server/preferences/PreferenceInitializer.java | 2 +- .../sapphire/PayaraServerConfigServices.java | 2 +- .../eclipse/tools/server/sdk/GlassFishStatus.java | 2 +- .../tools/server/sdk/GlassFishStatusListener.java | 2 +- .../tools/server/sdk/GlassFishToolsConfig.java | 2 +- .../tools/server/sdk/PayaraIdeException.java | 2 +- .../eclipse/tools/server/sdk/TaskEvent.java | 2 +- .../eclipse/tools/server/sdk/TaskState.java | 2 +- .../tools/server/sdk/TaskStateListener.java | 2 +- .../tools/server/sdk/admin/ActionReport.java | 2 +- .../tools/server/sdk/admin/AdminFactory.java | 2 +- .../tools/server/sdk/admin/AdminFactoryHttp.java | 2 +- .../tools/server/sdk/admin/AdminFactoryRest.java | 2 +- .../eclipse/tools/server/sdk/admin/Command.java | 2 +- .../server/sdk/admin/CommandAddResources.java | 2 +- .../sdk/admin/CommandChangeAdminPassword.java | 2 +- .../sdk/admin/CommandCreateAdminObject.java | 2 +- .../server/sdk/admin/CommandCreateCluster.java | 2 +- .../server/sdk/admin/CommandCreateConnector.java | 2 +- .../CommandCreateConnectorConnectionPool.java | 2 +- .../server/sdk/admin/CommandCreateInstance.java | 2 +- .../admin/CommandCreateJDBCConnectionPool.java | 2 +- .../sdk/admin/CommandCreateJDBCResource.java | 2 +- .../server/sdk/admin/CommandDeleteCluster.java | 2 +- .../server/sdk/admin/CommandDeleteInstance.java | 2 +- .../server/sdk/admin/CommandDeleteResource.java | 2 +- .../tools/server/sdk/admin/CommandDeploy.java | 2 +- .../tools/server/sdk/admin/CommandDisable.java | 2 +- .../tools/server/sdk/admin/CommandEnable.java | 2 +- .../tools/server/sdk/admin/CommandException.java | 2 +- .../server/sdk/admin/CommandFetchLogData.java | 2 +- .../server/sdk/admin/CommandGetProperty.java | 2 +- .../tools/server/sdk/admin/CommandJava.java | 2 +- .../server/sdk/admin/CommandJavaClassPath.java | 2 +- .../server/sdk/admin/CommandListComponents.java | 2 +- .../server/sdk/admin/CommandListResources.java | 2 +- .../server/sdk/admin/CommandListWebServices.java | 2 +- .../tools/server/sdk/admin/CommandLocation.java | 2 +- .../tools/server/sdk/admin/CommandRedeploy.java | 2 +- .../tools/server/sdk/admin/CommandRestartDAS.java | 2 +- .../server/sdk/admin/CommandRestoreDomain.java | 2 +- .../server/sdk/admin/CommandSetProperty.java | 2 +- .../server/sdk/admin/CommandStartCluster.java | 2 +- .../tools/server/sdk/admin/CommandStartDAS.java | 2 +- .../server/sdk/admin/CommandStartInstance.java | 2 +- .../server/sdk/admin/CommandStopCluster.java | 2 +- .../tools/server/sdk/admin/CommandStopDAS.java | 2 +- .../server/sdk/admin/CommandStopInstance.java | 2 +- .../tools/server/sdk/admin/CommandTarget.java | 2 +- .../tools/server/sdk/admin/CommandTargetName.java | 2 +- .../tools/server/sdk/admin/CommandUndeploy.java | 2 +- .../tools/server/sdk/admin/CommandVersion.java | 2 +- .../tools/server/sdk/admin/MessagePart.java | 2 +- .../tools/server/sdk/admin/PasswordFile.java | 2 +- .../tools/server/sdk/admin/ProcessIOContent.java | 2 +- .../tools/server/sdk/admin/ProcessIOParser.java | 2 +- .../tools/server/sdk/admin/ProcessIOResult.java | 2 +- .../eclipse/tools/server/sdk/admin/Result.java | 2 +- .../tools/server/sdk/admin/ResultList.java | 2 +- .../eclipse/tools/server/sdk/admin/ResultLog.java | 2 +- .../eclipse/tools/server/sdk/admin/ResultMap.java | 2 +- .../tools/server/sdk/admin/ResultProcess.java | 2 +- .../tools/server/sdk/admin/ResultString.java | 2 +- .../eclipse/tools/server/sdk/admin/Runner.java | 2 +- .../tools/server/sdk/admin/RunnerAsadmin.java | 2 +- .../admin/RunnerAsadminChangeAdminPassword.java | 2 +- .../sdk/admin/RunnerAsadminRestoreDomain.java | 2 +- .../tools/server/sdk/admin/RunnerHttp.java | 2 +- .../server/sdk/admin/RunnerHttpAddResources.java | 2 +- .../tools/server/sdk/admin/RunnerHttpClass.java | 2 +- .../sdk/admin/RunnerHttpCreateAdminObject.java | 2 +- .../sdk/admin/RunnerHttpCreateConnector.java | 2 +- .../RunnerHttpCreateConnectorConnectionPool.java | 2 +- .../sdk/admin/RunnerHttpCreateInstance.java | 2 +- .../admin/RunnerHttpCreateJDBCConnectionPool.java | 2 +- .../sdk/admin/RunnerHttpCreateJDBCResource.java | 2 +- .../sdk/admin/RunnerHttpDeleteInstance.java | 2 +- .../sdk/admin/RunnerHttpDeleteResource.java | 2 +- .../tools/server/sdk/admin/RunnerHttpDeploy.java | 2 +- .../server/sdk/admin/RunnerHttpEnableDisable.java | 2 +- .../server/sdk/admin/RunnerHttpGetProperty.java | 2 +- .../sdk/admin/RunnerHttpListComponents.java | 2 +- .../server/sdk/admin/RunnerHttpListResources.java | 2 +- .../sdk/admin/RunnerHttpListWebServices.java | 2 +- .../server/sdk/admin/RunnerHttpLocation.java | 2 +- .../server/sdk/admin/RunnerHttpRedeploy.java | 2 +- .../server/sdk/admin/RunnerHttpRestartDAS.java | 2 +- .../server/sdk/admin/RunnerHttpSetProperty.java | 2 +- .../tools/server/sdk/admin/RunnerHttpTarget.java | 2 +- .../server/sdk/admin/RunnerHttpUndeploy.java | 2 +- .../tools/server/sdk/admin/RunnerJava.java | 2 +- .../tools/server/sdk/admin/RunnerLocal.java | 2 +- .../tools/server/sdk/admin/RunnerRest.java | 2 +- .../server/sdk/admin/RunnerRestAddResources.java | 2 +- .../tools/server/sdk/admin/RunnerRestClass.java | 2 +- .../server/sdk/admin/RunnerRestCreateCluster.java | 2 +- .../sdk/admin/RunnerRestCreateConnector.java | 2 +- .../sdk/admin/RunnerRestCreateConnectorPool.java | 2 +- .../sdk/admin/RunnerRestCreateInstance.java | 2 +- .../admin/RunnerRestCreateJDBCConnectionPool.java | 2 +- .../sdk/admin/RunnerRestCreateJDBCResource.java | 2 +- .../server/sdk/admin/RunnerRestDeleteCluster.java | 2 +- .../sdk/admin/RunnerRestDeleteInstance.java | 2 +- .../sdk/admin/RunnerRestDeleteResource.java | 2 +- .../tools/server/sdk/admin/RunnerRestDeploy.java | 2 +- .../tools/server/sdk/admin/RunnerRestDisable.java | 2 +- .../tools/server/sdk/admin/RunnerRestEnable.java | 2 +- .../server/sdk/admin/RunnerRestFetchLogData.java | 2 +- .../server/sdk/admin/RunnerRestGetProperty.java | 2 +- .../tools/server/sdk/admin/RunnerRestList.java | 2 +- .../sdk/admin/RunnerRestListApplications.java | 2 +- .../server/sdk/admin/RunnerRestListResources.java | 2 +- .../sdk/admin/RunnerRestListWebServices.java | 2 +- .../server/sdk/admin/RunnerRestLocation.java | 2 +- .../server/sdk/admin/RunnerRestSetProperty.java | 2 +- .../server/sdk/admin/RunnerRestStartCluster.java | 2 +- .../server/sdk/admin/RunnerRestStartInstance.java | 2 +- .../server/sdk/admin/RunnerRestStopCluster.java | 2 +- .../tools/server/sdk/admin/RunnerRestStopDAS.java | 2 +- .../server/sdk/admin/RunnerRestStopInstance.java | 2 +- .../server/sdk/admin/RunnerRestUndeploy.java | 2 +- .../tools/server/sdk/admin/ServerAdmin.java | 2 +- .../eclipse/tools/server/sdk/admin/ValueLog.java | 2 +- .../tools/server/sdk/admin/ValueProcess.java | 2 +- .../tools/server/sdk/admin/cloud/CloudTasks.java | 2 +- .../server/sdk/admin/cloud/CommandCloud.java | 2 +- .../sdk/admin/cloud/CommandCloudDeploy.java | 2 +- .../server/sdk/admin/cloud/RunnerHttpCloud.java | 2 +- .../server/sdk/admin/cloud/RunnerRestCloud.java | 2 +- .../sdk/admin/cloud/RunnerRestCloudDeploy.java | 2 +- .../server/sdk/admin/response/ActionReport.java | 2 +- .../server/sdk/admin/response/MessagePart.java | 2 +- .../sdk/admin/response/ResponseContentType.java | 2 +- .../server/sdk/admin/response/ResponseParser.java | 2 +- .../sdk/admin/response/ResponseParserFactory.java | 2 +- .../sdk/admin/response/RestActionReport.java | 2 +- .../sdk/admin/response/RestResponseParser.java | 2 +- .../sdk/admin/response/RestXMLResponseParser.java | 2 +- .../tools/server/sdk/data/DataException.java | 2 +- .../server/sdk/data/GlassFishAdminInterface.java | 2 +- .../tools/server/sdk/data/GlassFishConfig.java | 2 +- .../tools/server/sdk/data/GlassFishContainer.java | 2 +- .../server/sdk/data/GlassFishJavaEEConfig.java | 2 +- .../server/sdk/data/GlassFishJavaSEConfig.java | 2 +- .../tools/server/sdk/data/GlassFishLibrary.java | 2 +- .../server/sdk/data/GlassFishServerStatus.java | 2 +- .../server/sdk/data/GlassFishStatusCheck.java | 2 +- .../sdk/data/GlassFishStatusCheckResult.java | 2 +- .../server/sdk/data/GlassFishStatusTask.java | 2 +- .../eclipse/tools/server/sdk/data/IdeContext.java | 2 +- .../tools/server/sdk/data/StartupArgs.java | 2 +- .../tools/server/sdk/data/StartupArgsEntity.java | 2 +- .../eclipse/tools/server/sdk/data/ToolConfig.java | 2 +- .../tools/server/sdk/data/ToolsConfig.java | 2 +- .../server/sdk/data/cloud/GlassFishAccount.java | 2 +- .../sdk/data/cloud/GlassFishAccountEntity.java | 2 +- .../server/sdk/data/cloud/GlassFishCloud.java | 2 +- .../sdk/data/cloud/GlassFishCloudEntity.java | 2 +- .../eclipse/tools/server/sdk/logging/Logger.java | 2 +- .../eclipse/tools/server/sdk/server/FetchLog.java | 2 +- .../tools/server/sdk/server/FetchLogEvent.java | 2 +- .../server/sdk/server/FetchLogEventListener.java | 2 +- .../server/sdk/server/FetchLogException.java | 2 +- .../tools/server/sdk/server/FetchLogLocal.java | 2 +- .../tools/server/sdk/server/FetchLogPiped.java | 2 +- .../tools/server/sdk/server/FetchLogRemote.java | 2 +- .../tools/server/sdk/server/FetchLogSimple.java | 2 +- .../eclipse/tools/server/sdk/server/JDK.java | 2 +- .../tools/server/sdk/server/JpaSupport.java | 2 +- .../tools/server/sdk/server/ServerStatus.java | 2 +- .../tools/server/sdk/server/ServerTasks.java | 2 +- .../server/sdk/server/config/AsadminTool.java | 2 +- .../server/sdk/server/config/ConfigBuilder.java | 2 +- .../sdk/server/config/ConfigBuilderProvider.java | 2 +- .../server/sdk/server/config/ConfigUtils.java | 2 +- .../tools/server/sdk/server/config/FileSet.java | 2 +- .../sdk/server/config/GlassFishConfigManager.java | 2 +- .../sdk/server/config/GlassFishConfigXMLImpl.java | 2 +- .../server/sdk/server/config/GlassFishTool.java | 2 +- .../server/sdk/server/config/JavaEEProfile.java | 2 +- .../tools/server/sdk/server/config/JavaEESet.java | 2 +- .../server/sdk/server/config/JavaSEPlatform.java | 2 +- .../tools/server/sdk/server/config/JavaSESet.java | 2 +- .../tools/server/sdk/server/config/JavaSet.java | 2 +- .../server/sdk/server/config/LibraryNode.java | 2 +- .../server/sdk/server/config/ModuleType.java | 2 +- .../sdk/server/config/ServerConfigException.java | 2 +- .../tools/server/sdk/server/config/Tools.java | 2 +- .../server/sdk/server/parser/AbstractReader.java | 2 +- .../server/sdk/server/parser/ConfigReader.java | 2 +- .../sdk/server/parser/ConfigReaderClasspath.java | 2 +- .../sdk/server/parser/ConfigReaderJava.java | 2 +- .../sdk/server/parser/ConfigReaderJavaEE.java | 2 +- .../sdk/server/parser/ConfigReaderJavaSE.java | 2 +- .../sdk/server/parser/ConfigReaderJavadocs.java | 2 +- .../sdk/server/parser/ConfigReaderServer.java | 2 +- .../sdk/server/parser/ConfigReaderSources.java | 2 +- .../sdk/server/parser/ConfigReaderTools.java | 2 +- .../server/sdk/server/parser/FilesetReader.java | 2 +- .../tools/server/sdk/server/parser/HttpData.java | 2 +- .../sdk/server/parser/HttpListenerReader.java | 2 +- .../sdk/server/parser/JavaEEModuleReader.java | 2 +- .../server/parser/JavaEEProfileCheckReader.java | 2 +- .../sdk/server/parser/JavaEEProfileReader.java | 2 +- .../sdk/server/parser/JavaSEPlatformReader.java | 2 +- .../sdk/server/parser/JmxConnectorReader.java | 2 +- .../server/sdk/server/parser/JvmConfigReader.java | 2 +- .../server/sdk/server/parser/LinkReader.java | 2 +- .../server/sdk/server/parser/LookupReader.java | 2 +- .../sdk/server/parser/NetworkListenerReader.java | 2 +- .../server/sdk/server/parser/PathReader.java | 2 +- .../server/sdk/server/parser/ResourcesReader.java | 2 +- .../sdk/server/parser/TargetConfigNameReader.java | 2 +- .../sdk/server/parser/TargetConfigReader.java | 2 +- .../sdk/server/parser/ToolsAsadminReader.java | 2 +- .../server/sdk/server/parser/TreeParser.java | 2 +- .../tools/server/sdk/server/parser/XMLReader.java | 2 +- .../server/sdk/server/state/AbstractTask.java | 2 +- .../server/sdk/server/state/AdminPortTask.java | 2 +- .../sdk/server/state/GlassFishStatusEntity.java | 2 +- .../tools/server/sdk/server/state/RunnerTask.java | 2 +- .../sdk/server/state/ServerStateException.java | 2 +- .../tools/server/sdk/server/state/StatusJob.java | 2 +- .../server/sdk/server/state/StatusJobState.java | 2 +- .../server/sdk/server/state/StatusResult.java | 2 +- .../sdk/server/state/StatusResultLocations.java | 2 +- .../sdk/server/state/StatusResultVersion.java | 2 +- .../server/sdk/server/state/StatusScheduler.java | 2 +- .../server/sdk/utils/CyclicStringBuffer.java | 2 +- .../eclipse/tools/server/sdk/utils/Jar.java | 2 +- .../tools/server/sdk/utils/JarException.java | 4 ++-- .../eclipse/tools/server/sdk/utils/JavaUtils.java | 2 +- .../server/sdk/utils/JavaVersionDetector.java | 2 +- .../tools/server/sdk/utils/LinkedList.java | 2 +- .../eclipse/tools/server/sdk/utils/NetUtils.java | 2 +- .../eclipse/tools/server/sdk/utils/OsUtils.java | 2 +- .../tools/server/sdk/utils/ServerUtils.java | 2 +- .../tools/server/sdk/utils/StringPrefixTree.java | 2 +- .../eclipse/tools/server/sdk/utils/Utils.java | 2 +- .../eclipse/tools/server/serverview/AppDesc.java | 2 +- .../tools/server/serverview/ResourceDesc.java | 2 +- .../eclipse/tools/server/serverview/WSDesc.java | 2 +- .../starting/PayaraServerLaunchDelegate.java | 2 +- .../tools/server/starting/StartupArgsImpl.java | 2 +- .../tools/server/ui/PayaraToolsUIPlugin.java | 2 +- .../LaunchConfigurationTabGroup.java | 2 +- .../server/ui/editorsections/ServerSection.java | 2 +- .../server/ui/internal/JAXRSActionPanels.java | 2 +- .../PayaraRuntimeComponentLabelProvider.java | 2 +- ...ayaraRuntimeComponentLabelProviderFactory.java | 2 +- .../ui/internal/PayaraRuntimeLocatorDelegate.java | 2 +- .../eclipse/tools/server/ui/log/LogStyle.java | 2 +- .../tools/server/ui/log/PayaraConsoleTracker.java | 2 +- .../server/ui/log/PayaraLogPageParticipant.java | 2 +- .../ui/preferences/GlassFishPreferencePage.java | 2 +- .../server/ui/properties/ServerPropertyPage.java | 2 +- .../properties/SystemLibrariesVariantBlock.java | 2 +- .../tools/server/ui/resources/DriverMaps.java | 2 +- .../tools/server/ui/resources/JDBCInfo.java | 2 +- .../tools/server/ui/resources/JMSInfo.java | 2 +- .../tools/server/ui/resources/MailInfo.java | 2 +- .../tools/server/ui/resources/UrlData.java | 2 +- .../resources/wizards/JDBCResourceWizardPage.java | 2 +- .../server/ui/resources/wizards/JDBCWizard.java | 2 +- .../resources/wizards/JMSResourceWizardPage.java | 2 +- .../server/ui/resources/wizards/JMSWizard.java | 2 +- .../resources/wizards/MailResourceWizardPage.java | 2 +- .../server/ui/resources/wizards/MailWizard.java | 2 +- .../server/ui/resources/wizards/Messages.java | 2 +- .../ui/resources/wizards/ResourceWizard.java | 2 +- .../wizards/AddGenericResourceClassOperation.java | 2 +- .../AddGenericResourceDataModelProvider.java | 2 +- .../wizards/AddGenericResourceTemplateModel.java | 2 +- .../ui/rest/wizards/AddGenericResourceWizard.java | 2 +- .../wizards/AddGenericResourceWizardPage.java | 2 +- .../rest/wizards/ContainerResourceTemplate.java | 2 +- .../ui/rest/wizards/GenericResourceTemplate.java | 2 +- .../tools/server/ui/rest/wizards/Messages.java | 2 +- .../ui/serverview/GenericActionProvider.java | 2 +- .../ui/serverview/ServerModuleActionProvider.java | 2 +- .../ui/serverview/ServerViewActionProvider.java | 2 +- .../serverview/ServerViewDynamicNodeProvider.java | 2 +- .../ui/serverview/ServerViewLabelProvider.java | 2 +- .../GotoModuleProjectInExplorerAction.java | 2 +- .../serverview/actions/OpenInBrowserAction.java | 2 +- .../actions/OpenModuleInFileBrowserAction.java | 2 +- .../serverview/actions/TestWebServiceAction.java | 2 +- .../ui/serverview/actions/UndeployAction.java | 2 +- .../actions/UnregisterResourceAction.java | 2 +- .../actions/WSDLInfoWebServiceAction.java | 2 +- .../serverview/dynamicnodes/ApplicationNode.java | 2 +- .../dynamicnodes/DeployedApplicationsNode.java | 2 +- .../dynamicnodes/DeployedWebServicesNode.java | 2 +- .../ui/serverview/dynamicnodes/NodeTypes.java | 2 +- .../ui/serverview/dynamicnodes/ResourcesNode.java | 2 +- .../ui/serverview/dynamicnodes/TreeNode.java | 2 +- .../serverview/dynamicnodes/WebServiceNode.java | 2 +- .../ui/wizards/GlassfishWizardResources.java | 2 +- .../wizards/NewPayaraRuntimeWizardFragment.java | 15 +++++++++------ .../ui/wizards/NewPayaraServerWizardFragment.java | 15 +++++++++------ .../actions/TestRemotePayaraConnectionAction.java | 2 +- .../eclipse/tools/server/utils/JdtUtil.java | 2 +- .../tools/server/utils/PayaraLocationUtils.java | 2 +- .../eclipse/tools/server/utils/WtpUtil.java | 2 +- 369 files changed, 386 insertions(+), 380 deletions(-) diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/Messages.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/Messages.java index c0146c6f..eaac9312 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/Messages.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/Messages.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2021 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraRuntime.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraRuntime.java index 2a407680..730c9058 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraRuntime.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraRuntime.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraServer.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraServer.java index 68da35f0..3b2ace48 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraServer.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraServer.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraServerPlugin.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraServerPlugin.java index 2a0f10c1..78bcde34 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraServerPlugin.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/PayaraServerPlugin.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ServerStatus.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ServerStatus.java index 6d2375e9..73424fc0 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ServerStatus.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ServerStatus.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/AssembleModules.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/AssembleModules.java index 25780602..6ec56144 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/AssembleModules.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/AssembleModules.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2019-2021 Payara Foundation + * Copyright (c) 2019-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/EclipseToPayaraArchiveConverter.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/EclipseToPayaraArchiveConverter.java index e75f53b6..1b547b33 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/EclipseToPayaraArchiveConverter.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/EclipseToPayaraArchiveConverter.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/ExportJavaEEArchive.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/ExportJavaEEArchive.java index fafeecfc..e86efbd5 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/ExportJavaEEArchive.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/archives/ExportJavaEEArchive.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/deploying/PayaraServerBehaviour.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/deploying/PayaraServerBehaviour.java index 35babe2b..d86b9a23 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/deploying/PayaraServerBehaviour.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/deploying/PayaraServerBehaviour.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2021 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/events/RuntimeLifecycleListener.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/events/RuntimeLifecycleListener.java index 17edd80e..24d3d399 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/events/RuntimeLifecycleListener.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/events/RuntimeLifecycleListener.java @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/events/ServerLifecycleListener.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/events/ServerLifecycleListener.java index 3678fbea..48a23e31 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/events/ServerLifecycleListener.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/events/ServerLifecycleListener.java @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/HttpPortUpdateException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/HttpPortUpdateException.java index c022d99b..7018ed14 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/HttpPortUpdateException.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/HttpPortUpdateException.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/PayaraLaunchException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/PayaraLaunchException.java index bf80ebb4..df539e1c 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/PayaraLaunchException.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/PayaraLaunchException.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/UniqueNameNotFound.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/UniqueNameNotFound.java index 90ce335c..aa4b20de 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/UniqueNameNotFound.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/exceptions/UniqueNameNotFound.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishEjbFacetInstallDelegate.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishEjbFacetInstallDelegate.java index 7e934868..c5dcda06 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishEjbFacetInstallDelegate.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishEjbFacetInstallDelegate.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishEjbFacetUninstallDelegate.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishEjbFacetUninstallDelegate.java index d533dda1..27dbba17 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishEjbFacetUninstallDelegate.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishEjbFacetUninstallDelegate.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishWebFacetInstallDelegate.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishWebFacetInstallDelegate.java index 93585fed..60d93430 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishWebFacetInstallDelegate.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishWebFacetInstallDelegate.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishWebFacetUninstallDelegate.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishWebFacetUninstallDelegate.java index d5b467b1..dcb7c2a9 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishWebFacetUninstallDelegate.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/GlassfishWebFacetUninstallDelegate.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishDeploymentDescriptor.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishDeploymentDescriptor.java index 1c1e73d3..4e0e161d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishDeploymentDescriptor.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishDeploymentDescriptor.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishEjbDeploymentDescriptor.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishEjbDeploymentDescriptor.java index 48b298c0..07057a04 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishEjbDeploymentDescriptor.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishEjbDeploymentDescriptor.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishWebDeploymentDescriptor.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishWebDeploymentDescriptor.java index 8d4f952e..d304a907 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishWebDeploymentDescriptor.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/IGlassfishWebDeploymentDescriptor.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/AbstractGlassfishDeploymentDescriptor.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/AbstractGlassfishDeploymentDescriptor.java index 659cedbb..2cfa8119 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/AbstractGlassfishDeploymentDescriptor.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/AbstractGlassfishDeploymentDescriptor.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishDeploymentDescriptorFactory.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishDeploymentDescriptorFactory.java index a79f4ba0..4e560290 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishDeploymentDescriptorFactory.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishDeploymentDescriptorFactory.java @@ -7,7 +7,7 @@ * SPDX-License-Identifier: EPL-2.0 ***************************************************************************** */ /** **************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishDescriptorType.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishDescriptorType.java index 1b82b1c7..94e3e478 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishDescriptorType.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishDescriptorType.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishEjbDeploymentDescriptor.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishEjbDeploymentDescriptor.java index 8f786b78..670171a8 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishEjbDeploymentDescriptor.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishEjbDeploymentDescriptor.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishWebDeploymentDescriptor.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishWebDeploymentDescriptor.java index 045ea572..c738b7b7 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishWebDeploymentDescriptor.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/facets/internal/GlassfishWebDeploymentDescriptor.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/AbstractPayaraSelectionHandler.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/AbstractPayaraSelectionHandler.java index 4b1a943e..40e636c3 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/AbstractPayaraSelectionHandler.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/AbstractPayaraSelectionHandler.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/OpenDomainHomeHandler.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/OpenDomainHomeHandler.java index 5844aaa2..038754db 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/OpenDomainHomeHandler.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/OpenDomainHomeHandler.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/OpenServerHomeHandler.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/OpenServerHomeHandler.java index 00163128..2fabd378 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/OpenServerHomeHandler.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/OpenServerHomeHandler.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/PayaraStateTester.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/PayaraStateTester.java index c74e4bca..abf25c9f 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/PayaraStateTester.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/PayaraStateTester.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/PayaraVersionTester.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/PayaraVersionTester.java index 4fddf5e6..1ac88b1b 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/PayaraVersionTester.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/PayaraVersionTester.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ShowURLHandler.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ShowURLHandler.java index 60cfa437..4dc288a4 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ShowURLHandler.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ShowURLHandler.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ViewAdminConsoleHandler.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ViewAdminConsoleHandler.java index d61412a9..eea9bb9b 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ViewAdminConsoleHandler.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ViewAdminConsoleHandler.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ViewLogHandler.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ViewLogHandler.java index b98aad04..dfa98130 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ViewLogHandler.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/handlers/ViewLogHandler.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ContainersRefresherThread.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ContainersRefresherThread.java index 38cfdd38..61ab64f5 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ContainersRefresherThread.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ContainersRefresherThread.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ContainsRuntimeComponentType.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ContainsRuntimeComponentType.java index 9f1842b0..9cdd607c 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ContainsRuntimeComponentType.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ContainsRuntimeComponentType.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/InstallJAXRS.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/InstallJAXRS.java index e9d8cc07..bc1713fe 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/InstallJAXRS.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/InstallJAXRS.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/Library.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/Library.java index 295400cf..4763148a 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/Library.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/Library.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ManifestUtil.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ManifestUtil.java index c8922125..46dfe189 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ManifestUtil.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ManifestUtil.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraClasspathProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraClasspathProvider.java index 3292c512..135d58de 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraClasspathProvider.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraClasspathProvider.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraRuntimeBridge.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraRuntimeBridge.java index 3ff9403f..4263fa39 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraRuntimeBridge.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraRuntimeBridge.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraStateResolver.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraStateResolver.java index e93f77a9..8150dcd2 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraStateResolver.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/PayaraStateResolver.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/RuntimeComponentProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/RuntimeComponentProvider.java index 98770b7a..ff70dc09 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/RuntimeComponentProvider.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/RuntimeComponentProvider.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/RuntimeComponentProvidersExtensionPoint.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/RuntimeComponentProvidersExtensionPoint.java index bba2b4a3..6fe4edac 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/RuntimeComponentProvidersExtensionPoint.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/RuntimeComponentProvidersExtensionPoint.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ServerStateListener.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ServerStateListener.java index 1272aedc..cb5cb418 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ServerStateListener.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ServerStateListener.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ServerStatusMonitor.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ServerStatusMonitor.java index 8fcd9ae2..1234fece 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ServerStatusMonitor.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/ServerStatusMonitor.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibraries.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibraries.java index 4256deab..9e815e8d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibraries.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibraries.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesContainer.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesContainer.java index e04a7db9..447c6bff 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesContainer.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesContainer.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesSetting.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesSetting.java index 0e5007e1..73b49f1b 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesSetting.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/internal/SystemLibrariesSetting.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/AbstractLogFilter.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/AbstractLogFilter.java index b140b850..6e7d01ab 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/AbstractLogFilter.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/AbstractLogFilter.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/AbstractPayaraConsole.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/AbstractPayaraConsole.java index d07a6526..6168a4ce 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/AbstractPayaraConsole.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/AbstractPayaraConsole.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/ILogFilter.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/ILogFilter.java index f8ff0219..94a22d15 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/ILogFilter.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/ILogFilter.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/IPayaraConsole.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/IPayaraConsole.java index 1e177a17..a5c76ad6 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/IPayaraConsole.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/IPayaraConsole.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LevelResolver.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LevelResolver.java index 47fd94ec..39f92100 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LevelResolver.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LevelResolver.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogFormatterSimple.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogFormatterSimple.java index 6880bbe0..bd43027d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogFormatterSimple.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogFormatterSimple.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogReader.java index e57d1eba..e50b8cf2 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogRecord.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogRecord.java index d2fca6c9..02676ed9 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogRecord.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/LogRecord.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/NoOpFilter.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/NoOpFilter.java index 5a90496c..bc8daf2d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/NoOpFilter.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/NoOpFilter.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PatternLogFilterV4.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PatternLogFilterV4.java index 3d0e85c5..b09f80c0 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PatternLogFilterV4.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PatternLogFilterV4.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraConsole.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraConsole.java index bea9cbef..1656bae1 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraConsole.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraConsole.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraConsoleManager.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraConsoleManager.java index 7f49e192..106f2c5d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraConsoleManager.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraConsoleManager.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraStartupConsole.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraStartupConsole.java index 430a653d..febb2c56 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraStartupConsole.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/PayaraStartupConsole.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/StateLogFilterV3.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/StateLogFilterV3.java index 4fe167b6..c6d36421 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/StateLogFilterV3.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/StateLogFilterV3.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/V3LogFilter.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/V3LogFilter.java index 94deaa93..0bcec4df 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/V3LogFilter.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/log/V3LogFilter.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/preferences/PreferenceConstants.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/preferences/PreferenceConstants.java index e3d3254a..33645eb2 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/preferences/PreferenceConstants.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/preferences/PreferenceConstants.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/preferences/PreferenceInitializer.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/preferences/PreferenceInitializer.java index 0d74135b..c93beb50 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/preferences/PreferenceInitializer.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/preferences/PreferenceInitializer.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sapphire/PayaraServerConfigServices.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sapphire/PayaraServerConfigServices.java index af986afc..0f16b680 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sapphire/PayaraServerConfigServices.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sapphire/PayaraServerConfigServices.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishStatus.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishStatus.java index b18c8a65..917fedc4 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishStatus.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishStatus.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishStatusListener.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishStatusListener.java index f69c0f67..efefeb0b 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishStatusListener.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishStatusListener.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishToolsConfig.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishToolsConfig.java index d711b7d7..082b0777 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishToolsConfig.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/GlassFishToolsConfig.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/PayaraIdeException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/PayaraIdeException.java index 788578e6..c0214ca5 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/PayaraIdeException.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/PayaraIdeException.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskEvent.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskEvent.java index 1ab2f30e..0f277288 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskEvent.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskEvent.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskState.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskState.java index d1c52ebc..80d95613 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskState.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskState.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskStateListener.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskStateListener.java index 4ad86c0a..c1e07e64 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskStateListener.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/TaskStateListener.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ActionReport.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ActionReport.java index a8f6ca98..b295d030 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ActionReport.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ActionReport.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactory.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactory.java index 24b27a55..e8f0ecf2 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactory.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactory.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactoryHttp.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactoryHttp.java index 21adeff9..042caf3c 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactoryHttp.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactoryHttp.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactoryRest.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactoryRest.java index 39b3aa9e..496b92e6 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactoryRest.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/AdminFactoryRest.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Command.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Command.java index 055f5635..b3294781 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Command.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Command.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandAddResources.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandAddResources.java index 45167e48..7988c021 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandAddResources.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandAddResources.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandChangeAdminPassword.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandChangeAdminPassword.java index 6bd196db..2a5fa392 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandChangeAdminPassword.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandChangeAdminPassword.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateAdminObject.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateAdminObject.java index 7a2e1316..d04e9146 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateAdminObject.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateAdminObject.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateCluster.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateCluster.java index 6880d1fb..8acddc30 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateCluster.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateCluster.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateConnector.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateConnector.java index f372b3ae..f475c3d2 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateConnector.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateConnector.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateConnectorConnectionPool.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateConnectorConnectionPool.java index 5d17dd35..9626f078 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateConnectorConnectionPool.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateConnectorConnectionPool.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateInstance.java index de5d644a..d796b0a6 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateInstance.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateInstance.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateJDBCConnectionPool.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateJDBCConnectionPool.java index 29a204e1..9dc3c70e 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateJDBCConnectionPool.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateJDBCConnectionPool.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateJDBCResource.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateJDBCResource.java index 92a2470c..7f1c7c86 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateJDBCResource.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandCreateJDBCResource.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteCluster.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteCluster.java index 1d06bfd1..782ead62 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteCluster.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteCluster.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteInstance.java index 13fe8fb5..be91f046 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteInstance.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteInstance.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteResource.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteResource.java index b5b15f5e..832c5657 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteResource.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeleteResource.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeploy.java index dc2a0c6a..0b883319 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeploy.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDeploy.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2021 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDisable.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDisable.java index f6cd130d..82ec1d02 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDisable.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandDisable.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandEnable.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandEnable.java index c18278aa..e0032f38 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandEnable.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandEnable.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandException.java index da4402dc..a31f3d4a 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandException.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandException.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandFetchLogData.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandFetchLogData.java index 38720423..4524ed5f 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandFetchLogData.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandFetchLogData.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandGetProperty.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandGetProperty.java index 602f7a6e..f706f91d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandGetProperty.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandGetProperty.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandJava.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandJava.java index 01ecaab3..68983c9b 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandJava.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandJava.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandJavaClassPath.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandJavaClassPath.java index 335d776d..3eb853f7 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandJavaClassPath.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandJavaClassPath.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListComponents.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListComponents.java index 29570bd7..b2306e37 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListComponents.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListComponents.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListResources.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListResources.java index 022b8a04..ae04c22b 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListResources.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListResources.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListWebServices.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListWebServices.java index c13dc1b8..74d3d242 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListWebServices.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandListWebServices.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandLocation.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandLocation.java index 32acfc71..6f941227 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandLocation.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandLocation.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRedeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRedeploy.java index f7a9aa65..7a90e550 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRedeploy.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRedeploy.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2021 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRestartDAS.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRestartDAS.java index c09754e5..ff1400a5 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRestartDAS.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRestartDAS.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRestoreDomain.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRestoreDomain.java index b1233e0c..0f645282 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRestoreDomain.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandRestoreDomain.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandSetProperty.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandSetProperty.java index da30e7d5..4d579b53 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandSetProperty.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandSetProperty.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartCluster.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartCluster.java index 43988f88..b52776fe 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartCluster.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartCluster.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartDAS.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartDAS.java index 61651294..c52a9f2d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartDAS.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartDAS.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartInstance.java index f55b07f5..0da6b263 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartInstance.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStartInstance.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopCluster.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopCluster.java index ef5613a6..3f75084e 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopCluster.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopCluster.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopDAS.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopDAS.java index d2b39023..58092a95 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopDAS.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopDAS.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopInstance.java index ed547eab..824fc78a 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopInstance.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandStopInstance.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandTarget.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandTarget.java index 33e08fa1..0bdd1f9d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandTarget.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandTarget.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandTargetName.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandTargetName.java index 3eb030ca..f3597b88 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandTargetName.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandTargetName.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandUndeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandUndeploy.java index b1f14960..021a6cad 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandUndeploy.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandUndeploy.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandVersion.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandVersion.java index 41ff13b6..6e06a9f0 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandVersion.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/CommandVersion.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/MessagePart.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/MessagePart.java index 53f33ff9..621d04fc 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/MessagePart.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/MessagePart.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/PasswordFile.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/PasswordFile.java index 0f17b05b..dfe8cdf2 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/PasswordFile.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/PasswordFile.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOContent.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOContent.java index d9fbd146..3417f59b 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOContent.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOContent.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOParser.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOParser.java index f1fb0c92..78beb1c6 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOParser.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOParser.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOResult.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOResult.java index 508df669..3e3cd6d6 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOResult.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ProcessIOResult.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Result.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Result.java index 03dd4459..aebd3958 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Result.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Result.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultList.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultList.java index d902863c..2cadc88e 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultList.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultList.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultLog.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultLog.java index 2f774bfa..d41be54c 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultLog.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultLog.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultMap.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultMap.java index 36c6b1f8..b3c63000 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultMap.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultMap.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultProcess.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultProcess.java index 7f120464..d5b21a8f 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultProcess.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultProcess.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultString.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultString.java index 3ecfe5f2..ff0d9d4c 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultString.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ResultString.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Runner.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Runner.java index fcb8e41b..4f1bc504 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Runner.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/Runner.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadmin.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadmin.java index 9e8ee488..7c280212 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadmin.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadmin.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadminChangeAdminPassword.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadminChangeAdminPassword.java index 46219394..7a80c356 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadminChangeAdminPassword.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadminChangeAdminPassword.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadminRestoreDomain.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadminRestoreDomain.java index 7b6c01b6..f63352be 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadminRestoreDomain.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerAsadminRestoreDomain.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttp.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttp.java index 061fdf0c..c4efb4d0 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttp.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttp.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpAddResources.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpAddResources.java index 975c96dd..84eb044a 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpAddResources.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpAddResources.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpClass.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpClass.java index 6f293eba..a8f0d722 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpClass.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpClass.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateAdminObject.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateAdminObject.java index e58dc8b3..03464711 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateAdminObject.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateAdminObject.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateConnector.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateConnector.java index 6c6bac91..724a3926 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateConnector.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateConnector.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateConnectorConnectionPool.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateConnectorConnectionPool.java index c733976b..2fb690e5 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateConnectorConnectionPool.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateConnectorConnectionPool.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateInstance.java index b5ee9281..de48ca1b 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateInstance.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateInstance.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateJDBCConnectionPool.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateJDBCConnectionPool.java index c3ad5ed5..dfdc969e 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateJDBCConnectionPool.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateJDBCConnectionPool.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateJDBCResource.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateJDBCResource.java index edc820c3..a7e8f31b 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateJDBCResource.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpCreateJDBCResource.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeleteInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeleteInstance.java index 93b21005..36064aca 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeleteInstance.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeleteInstance.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeleteResource.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeleteResource.java index 217ac61b..c8309efe 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeleteResource.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeleteResource.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeploy.java index f34bf432..9659ecf7 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeploy.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpDeploy.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2021 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpEnableDisable.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpEnableDisable.java index 99063091..6fa320ca 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpEnableDisable.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpEnableDisable.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpGetProperty.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpGetProperty.java index e932da0f..448d471b 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpGetProperty.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpGetProperty.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListComponents.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListComponents.java index 8eeda192..01f92313 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListComponents.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListComponents.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListResources.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListResources.java index 6bcd2609..161146a0 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListResources.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListResources.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListWebServices.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListWebServices.java index e829f765..c7e41b75 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListWebServices.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpListWebServices.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpLocation.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpLocation.java index 9812025f..a833e521 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpLocation.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpLocation.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpRedeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpRedeploy.java index d356c54d..102291db 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpRedeploy.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpRedeploy.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2021 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpRestartDAS.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpRestartDAS.java index 0d0c4c51..c60e7f90 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpRestartDAS.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpRestartDAS.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpSetProperty.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpSetProperty.java index a12e564b..6191f270 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpSetProperty.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpSetProperty.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpTarget.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpTarget.java index 56714911..fe2fb32d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpTarget.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpTarget.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpUndeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpUndeploy.java index 47cecdba..c7594a1c 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpUndeploy.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerHttpUndeploy.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerJava.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerJava.java index 49693d0b..ca3d7e69 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerJava.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerJava.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerLocal.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerLocal.java index 358bdf9d..4ef7897b 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerLocal.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerLocal.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRest.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRest.java index 9e699651..4cf78b03 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRest.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRest.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestAddResources.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestAddResources.java index 7f25cc57..7677f2a3 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestAddResources.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestAddResources.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestClass.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestClass.java index 6afb58f3..ec2728a4 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestClass.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestClass.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateCluster.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateCluster.java index 54ac3091..929b6f54 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateCluster.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateCluster.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateConnector.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateConnector.java index 3335e6dd..b1ec0d5f 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateConnector.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateConnector.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateConnectorPool.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateConnectorPool.java index cbd30ff2..367c3e61 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateConnectorPool.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateConnectorPool.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateInstance.java index f18ebafc..fc104fd7 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateInstance.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateInstance.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateJDBCConnectionPool.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateJDBCConnectionPool.java index ccbf08dd..db4bb295 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateJDBCConnectionPool.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateJDBCConnectionPool.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateJDBCResource.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateJDBCResource.java index 9d7a9262..eaf80ab9 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateJDBCResource.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestCreateJDBCResource.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteCluster.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteCluster.java index 448663eb..41dc050e 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteCluster.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteCluster.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteInstance.java index e8f8a191..4279a3bf 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteInstance.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteInstance.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteResource.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteResource.java index e7e9ee98..e27ece2a 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteResource.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeleteResource.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeploy.java index 175c0ff2..eb125ac2 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeploy.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDeploy.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDisable.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDisable.java index 1b257f2c..48323e7d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDisable.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestDisable.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestEnable.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestEnable.java index 5c299de4..e858674a 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestEnable.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestEnable.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestFetchLogData.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestFetchLogData.java index 9f492759..fd7a33e8 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestFetchLogData.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestFetchLogData.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestGetProperty.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestGetProperty.java index a94ab88a..75dea720 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestGetProperty.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestGetProperty.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestList.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestList.java index 6c71eca2..89946df4 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestList.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestList.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListApplications.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListApplications.java index 92d1db43..85ebe3eb 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListApplications.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListApplications.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListResources.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListResources.java index 10062973..b3ae4ab5 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListResources.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListResources.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListWebServices.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListWebServices.java index 53914a7e..d8426a4a 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListWebServices.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestListWebServices.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestLocation.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestLocation.java index 2479b7c3..b550fbd9 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestLocation.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestLocation.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestSetProperty.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestSetProperty.java index 35007c16..e1d8e03d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestSetProperty.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestSetProperty.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStartCluster.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStartCluster.java index 6bd8fc7d..cb7ba701 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStartCluster.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStartCluster.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStartInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStartInstance.java index a2d01571..c8f0b4c6 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStartInstance.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStartInstance.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopCluster.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopCluster.java index bdcceb4a..2fdfc65a 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopCluster.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopCluster.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopDAS.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopDAS.java index 9cb76ad2..f3f12c6d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopDAS.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopDAS.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopInstance.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopInstance.java index fa45905c..edb64755 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopInstance.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestStopInstance.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestUndeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestUndeploy.java index 0d1820c5..906872fd 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestUndeploy.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/RunnerRestUndeploy.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ServerAdmin.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ServerAdmin.java index e0533282..22c88c2d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ServerAdmin.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ServerAdmin.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ValueLog.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ValueLog.java index 96234101..25aef9ea 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ValueLog.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ValueLog.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ValueProcess.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ValueProcess.java index f91e49b0..2c521611 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ValueProcess.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/ValueProcess.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CloudTasks.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CloudTasks.java index f2a5951f..f9c290e3 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CloudTasks.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CloudTasks.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CommandCloud.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CommandCloud.java index 20a882be..1af8b3a4 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CommandCloud.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CommandCloud.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CommandCloudDeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CommandCloudDeploy.java index 008bb3e1..59f3aae8 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CommandCloudDeploy.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/CommandCloudDeploy.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerHttpCloud.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerHttpCloud.java index d7c0a8d2..2eb1161a 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerHttpCloud.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerHttpCloud.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerRestCloud.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerRestCloud.java index 0294e2e0..1ad6fa78 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerRestCloud.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerRestCloud.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerRestCloudDeploy.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerRestCloudDeploy.java index 715cad85..eb5ad98d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerRestCloudDeploy.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/cloud/RunnerRestCloudDeploy.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ActionReport.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ActionReport.java index 1e09fc2d..4e6e765e 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ActionReport.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ActionReport.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/MessagePart.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/MessagePart.java index a055b022..a6b16845 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/MessagePart.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/MessagePart.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseContentType.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseContentType.java index 09a522c2..3f22a6e6 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseContentType.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseContentType.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseParser.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseParser.java index 3c27bd35..1f2fc87a 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseParser.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseParser.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseParserFactory.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseParserFactory.java index ad83ae55..35370ab7 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseParserFactory.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/ResponseParserFactory.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestActionReport.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestActionReport.java index 6834e36e..a29af6bb 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestActionReport.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestActionReport.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestResponseParser.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestResponseParser.java index b4dc4a3f..98bd10bd 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestResponseParser.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestResponseParser.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestXMLResponseParser.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestXMLResponseParser.java index a64e087a..a029e153 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestXMLResponseParser.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/admin/response/RestXMLResponseParser.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/DataException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/DataException.java index e1117491..a778478d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/DataException.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/DataException.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishAdminInterface.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishAdminInterface.java index aa01ce48..5e664e4c 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishAdminInterface.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishAdminInterface.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishConfig.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishConfig.java index 4453fda8..b0fe560f 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishConfig.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishConfig.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishContainer.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishContainer.java index 9479ca6b..aa091fd5 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishContainer.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishContainer.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishJavaEEConfig.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishJavaEEConfig.java index 4296f18d..1b9130ee 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishJavaEEConfig.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishJavaEEConfig.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishJavaSEConfig.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishJavaSEConfig.java index 100a994c..563cddf4 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishJavaSEConfig.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishJavaSEConfig.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishLibrary.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishLibrary.java index 3fd7a11d..e7f28a58 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishLibrary.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishLibrary.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishServerStatus.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishServerStatus.java index 0100949b..fdc39064 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishServerStatus.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishServerStatus.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusCheck.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusCheck.java index b5438a8a..5d8e791a 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusCheck.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusCheck.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusCheckResult.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusCheckResult.java index 0af00bf1..01bbbe79 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusCheckResult.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusCheckResult.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusTask.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusTask.java index 8d00a7ff..7ba568a2 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusTask.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/GlassFishStatusTask.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/IdeContext.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/IdeContext.java index 711d9983..77349d11 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/IdeContext.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/IdeContext.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/StartupArgs.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/StartupArgs.java index d547280a..af8f710e 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/StartupArgs.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/StartupArgs.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/StartupArgsEntity.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/StartupArgsEntity.java index 1cd182c0..5f749375 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/StartupArgsEntity.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/StartupArgsEntity.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ToolConfig.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ToolConfig.java index 7b532e5c..6080cdab 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ToolConfig.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ToolConfig.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ToolsConfig.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ToolsConfig.java index b9984d6e..073669e5 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ToolsConfig.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/ToolsConfig.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishAccount.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishAccount.java index 260ce4ba..285d396a 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishAccount.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishAccount.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishAccountEntity.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishAccountEntity.java index 80e23267..b8247cf9 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishAccountEntity.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishAccountEntity.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishCloud.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishCloud.java index 8f86e4d4..e85ffd5d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishCloud.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishCloud.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishCloudEntity.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishCloudEntity.java index b63dd2d3..d3c5a8aa 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishCloudEntity.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/data/cloud/GlassFishCloudEntity.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/logging/Logger.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/logging/Logger.java index 09caacf6..57d02dea 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/logging/Logger.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/logging/Logger.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLog.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLog.java index 88646dd9..1bf596af 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLog.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLog.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogEvent.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogEvent.java index 7781f228..4c7b49a9 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogEvent.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogEvent.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogEventListener.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogEventListener.java index 01e46566..f792d03f 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogEventListener.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogEventListener.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogException.java index 17e8af5a..55543125 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogException.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogException.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogLocal.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogLocal.java index 38ed01d1..669b3917 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogLocal.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogLocal.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogPiped.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogPiped.java index 7610b62b..ea3c6ece 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogPiped.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogPiped.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogRemote.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogRemote.java index 6e5829a3..d06e3443 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogRemote.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogRemote.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogSimple.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogSimple.java index e0fa28fb..81b6b5d2 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogSimple.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/FetchLogSimple.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/JDK.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/JDK.java index ee02d9e6..d7d984e9 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/JDK.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/JDK.java @@ -15,7 +15,7 @@ */ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/JpaSupport.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/JpaSupport.java index ee7bfabe..8356b87e 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/JpaSupport.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/JpaSupport.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ServerStatus.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ServerStatus.java index 611a827f..2f39e8dc 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ServerStatus.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ServerStatus.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ServerTasks.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ServerTasks.java index cbfa5f68..3cb44129 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ServerTasks.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/ServerTasks.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/AsadminTool.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/AsadminTool.java index aa6345e8..0e3699d2 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/AsadminTool.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/AsadminTool.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigBuilder.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigBuilder.java index 0c7e59d6..c2f5fa14 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigBuilder.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigBuilder.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigBuilderProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigBuilderProvider.java index 2a897222..5da2148e 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigBuilderProvider.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigBuilderProvider.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigUtils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigUtils.java index 25579ffe..fa61827c 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigUtils.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ConfigUtils.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/FileSet.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/FileSet.java index cdf54997..c11392ec 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/FileSet.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/FileSet.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishConfigManager.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishConfigManager.java index ae9724c9..9c660d6e 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishConfigManager.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishConfigManager.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishConfigXMLImpl.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishConfigXMLImpl.java index 480dda7a..75241f2e 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishConfigXMLImpl.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishConfigXMLImpl.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishTool.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishTool.java index 13072cab..c3444128 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishTool.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/GlassFishTool.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaEEProfile.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaEEProfile.java index bc90e9ce..86ea5677 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaEEProfile.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaEEProfile.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaEESet.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaEESet.java index 2aa11f83..5f6acfd2 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaEESet.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaEESet.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSEPlatform.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSEPlatform.java index 3d9e6f4e..bdea961c 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSEPlatform.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSEPlatform.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSESet.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSESet.java index 869912d0..874922e2 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSESet.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSESet.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSet.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSet.java index 024eb0e9..445d1f08 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSet.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/JavaSet.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/LibraryNode.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/LibraryNode.java index 94a1f7fb..2408e4af 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/LibraryNode.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/LibraryNode.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ModuleType.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ModuleType.java index 04fba0ed..47c7369b 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ModuleType.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ModuleType.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ServerConfigException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ServerConfigException.java index 224563a6..879bc1a4 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ServerConfigException.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/ServerConfigException.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/Tools.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/Tools.java index 88a8726c..1d278d67 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/Tools.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/config/Tools.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/AbstractReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/AbstractReader.java index c111b16f..014c2db4 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/AbstractReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/AbstractReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReader.java index 1ab9e8e0..59d58bb5 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderClasspath.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderClasspath.java index 1e6e60b8..9001eb60 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderClasspath.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderClasspath.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJava.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJava.java index 9b5eddc2..af3fdf89 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJava.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJava.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavaEE.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavaEE.java index 4241beb9..ceae50ec 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavaEE.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavaEE.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavaSE.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavaSE.java index 2c4ecc33..80cbedfd 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavaSE.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavaSE.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavadocs.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavadocs.java index 32be4836..0cb3b98c 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavadocs.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderJavadocs.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderServer.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderServer.java index 1f2e46da..3327c93e 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderServer.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderServer.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderSources.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderSources.java index 63ac2407..82382b62 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderSources.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderSources.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderTools.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderTools.java index 9e9966d9..1b3151b1 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderTools.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ConfigReaderTools.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/FilesetReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/FilesetReader.java index adc00f09..54cc1dc5 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/FilesetReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/FilesetReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/HttpData.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/HttpData.java index 75d9daab..fedce846 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/HttpData.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/HttpData.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/HttpListenerReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/HttpListenerReader.java index 055aae18..73fd5b16 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/HttpListenerReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/HttpListenerReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEModuleReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEModuleReader.java index dc61fe91..7ac79299 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEModuleReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEModuleReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEProfileCheckReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEProfileCheckReader.java index 2ea5911b..6bf77f32 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEProfileCheckReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEProfileCheckReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEProfileReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEProfileReader.java index 6ccd222a..76e3c0db 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEProfileReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaEEProfileReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaSEPlatformReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaSEPlatformReader.java index 665e07e1..514aa650 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaSEPlatformReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JavaSEPlatformReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JmxConnectorReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JmxConnectorReader.java index 845c9f9b..72b8a09f 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JmxConnectorReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JmxConnectorReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JvmConfigReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JvmConfigReader.java index c9959944..b64eb15a 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JvmConfigReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/JvmConfigReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LinkReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LinkReader.java index 1f72df3a..37cfff66 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LinkReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LinkReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LookupReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LookupReader.java index e5aa09ab..ead804c2 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LookupReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/LookupReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/NetworkListenerReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/NetworkListenerReader.java index 2ad5d2cc..ee62a239 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/NetworkListenerReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/NetworkListenerReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/PathReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/PathReader.java index cb509ae8..25b08adf 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/PathReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/PathReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ResourcesReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ResourcesReader.java index 3e290ac8..71df1220 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ResourcesReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ResourcesReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TargetConfigNameReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TargetConfigNameReader.java index bd42314d..c4109775 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TargetConfigNameReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TargetConfigNameReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TargetConfigReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TargetConfigReader.java index daf4c35d..64bbdcc1 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TargetConfigReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TargetConfigReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ToolsAsadminReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ToolsAsadminReader.java index 10809c64..04aa1ef1 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ToolsAsadminReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/ToolsAsadminReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TreeParser.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TreeParser.java index 1925e6f7..01023cec 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TreeParser.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/TreeParser.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/XMLReader.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/XMLReader.java index e4e026f1..8be54096 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/XMLReader.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/parser/XMLReader.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/AbstractTask.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/AbstractTask.java index 2e7668b3..76626079 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/AbstractTask.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/AbstractTask.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/AdminPortTask.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/AdminPortTask.java index 79f77cf1..8feecc0e 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/AdminPortTask.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/AdminPortTask.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/GlassFishStatusEntity.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/GlassFishStatusEntity.java index 7fad561e..3874d877 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/GlassFishStatusEntity.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/GlassFishStatusEntity.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/RunnerTask.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/RunnerTask.java index 102e19b2..94091f20 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/RunnerTask.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/RunnerTask.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/ServerStateException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/ServerStateException.java index 96e2b4b7..ca8965d2 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/ServerStateException.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/ServerStateException.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusJob.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusJob.java index db3e1af7..e466d60d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusJob.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusJob.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusJobState.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusJobState.java index 59dc420e..7a4f27a9 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusJobState.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusJobState.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResult.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResult.java index c370486a..cb5fa2eb 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResult.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResult.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResultLocations.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResultLocations.java index 10a61aa6..e0ec36c4 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResultLocations.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResultLocations.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResultVersion.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResultVersion.java index a41a90b2..b2a8f81c 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResultVersion.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusResultVersion.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusScheduler.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusScheduler.java index 19e7fedc..c7fcd8ba 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusScheduler.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/server/state/StatusScheduler.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/CyclicStringBuffer.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/CyclicStringBuffer.java index 784edf14..c8ef9184 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/CyclicStringBuffer.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/CyclicStringBuffer.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/Jar.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/Jar.java index a23a965c..0d6987af 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/Jar.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/Jar.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JarException.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JarException.java index a1ca6961..81845275 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JarException.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JarException.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -26,7 +26,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JavaUtils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JavaUtils.java index ddd3367d..faa179cb 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JavaUtils.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JavaUtils.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JavaVersionDetector.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JavaVersionDetector.java index 18d9924d..0f241b59 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JavaVersionDetector.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/JavaVersionDetector.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/LinkedList.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/LinkedList.java index dcb45c54..9694fba4 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/LinkedList.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/LinkedList.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/NetUtils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/NetUtils.java index c0abc47b..75a6bd8e 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/NetUtils.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/NetUtils.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/OsUtils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/OsUtils.java index c3e72ea6..d1224e30 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/OsUtils.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/OsUtils.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/ServerUtils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/ServerUtils.java index 5de40d68..dee254c5 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/ServerUtils.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/ServerUtils.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/StringPrefixTree.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/StringPrefixTree.java index d17796e7..0f5619bc 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/StringPrefixTree.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/StringPrefixTree.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/Utils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/Utils.java index b3ceee80..532dc712 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/Utils.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/sdk/utils/Utils.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/AppDesc.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/AppDesc.java index f7c2d873..10d0004d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/AppDesc.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/AppDesc.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/ResourceDesc.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/ResourceDesc.java index 353f5483..8bfea137 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/ResourceDesc.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/ResourceDesc.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/WSDesc.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/WSDesc.java index 9c72be5d..9731f4e4 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/WSDesc.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/serverview/WSDesc.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/PayaraServerLaunchDelegate.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/PayaraServerLaunchDelegate.java index ae0b56e8..69d932ea 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/PayaraServerLaunchDelegate.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/PayaraServerLaunchDelegate.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2020 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/StartupArgsImpl.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/StartupArgsImpl.java index a53f3ab5..38cac43d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/StartupArgsImpl.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/starting/StartupArgsImpl.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/PayaraToolsUIPlugin.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/PayaraToolsUIPlugin.java index 23288309..2c0fb315 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/PayaraToolsUIPlugin.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/PayaraToolsUIPlugin.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/editorsections/LaunchConfigurationTabGroup.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/editorsections/LaunchConfigurationTabGroup.java index a655e385..1cdfe739 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/editorsections/LaunchConfigurationTabGroup.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/editorsections/LaunchConfigurationTabGroup.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/editorsections/ServerSection.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/editorsections/ServerSection.java index 521bd202..a1f92297 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/editorsections/ServerSection.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/editorsections/ServerSection.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/JAXRSActionPanels.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/JAXRSActionPanels.java index b4027817..10962789 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/JAXRSActionPanels.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/JAXRSActionPanels.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProvider.java index 5dede4b2..15489908 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProvider.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProvider.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProviderFactory.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProviderFactory.java index eb607e15..3f2eee59 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProviderFactory.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeComponentLabelProviderFactory.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeLocatorDelegate.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeLocatorDelegate.java index 468d3346..58801792 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeLocatorDelegate.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/internal/PayaraRuntimeLocatorDelegate.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/LogStyle.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/LogStyle.java index 9ca272ca..a68a5475 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/LogStyle.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/LogStyle.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/PayaraConsoleTracker.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/PayaraConsoleTracker.java index 444c126f..ea319629 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/PayaraConsoleTracker.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/PayaraConsoleTracker.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/PayaraLogPageParticipant.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/PayaraLogPageParticipant.java index 5dcd1189..d684fa20 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/PayaraLogPageParticipant.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/log/PayaraLogPageParticipant.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/preferences/GlassFishPreferencePage.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/preferences/GlassFishPreferencePage.java index 84f9d1ed..f05ac7a5 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/preferences/GlassFishPreferencePage.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/preferences/GlassFishPreferencePage.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/ServerPropertyPage.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/ServerPropertyPage.java index 31575a74..cf2e6dae 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/ServerPropertyPage.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/ServerPropertyPage.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/SystemLibrariesVariantBlock.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/SystemLibrariesVariantBlock.java index 94d1c827..96d5e965 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/SystemLibrariesVariantBlock.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/properties/SystemLibrariesVariantBlock.java @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/DriverMaps.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/DriverMaps.java index 9fbccc5f..f2be544a 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/DriverMaps.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/DriverMaps.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/JDBCInfo.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/JDBCInfo.java index a8edab05..f05f502d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/JDBCInfo.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/JDBCInfo.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/JMSInfo.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/JMSInfo.java index fddc8a64..f0eb0ce1 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/JMSInfo.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/JMSInfo.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/MailInfo.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/MailInfo.java index 4677468c..5508cac0 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/MailInfo.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/MailInfo.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/UrlData.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/UrlData.java index f44f8d96..c75a82b9 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/UrlData.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/UrlData.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JDBCResourceWizardPage.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JDBCResourceWizardPage.java index 513d29c1..cc9506a9 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JDBCResourceWizardPage.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JDBCResourceWizardPage.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JDBCWizard.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JDBCWizard.java index f979f015..4127b0fd 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JDBCWizard.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JDBCWizard.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JMSResourceWizardPage.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JMSResourceWizardPage.java index d7e9a4bc..cbba4c39 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JMSResourceWizardPage.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JMSResourceWizardPage.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JMSWizard.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JMSWizard.java index ea40746b..a70c4d90 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JMSWizard.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/JMSWizard.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/MailResourceWizardPage.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/MailResourceWizardPage.java index d9c2955f..830e6a69 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/MailResourceWizardPage.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/MailResourceWizardPage.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/MailWizard.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/MailWizard.java index ca083e95..dd648ef4 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/MailWizard.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/MailWizard.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/Messages.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/Messages.java index 35042684..d3d800b5 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/Messages.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/Messages.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/ResourceWizard.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/ResourceWizard.java index 3921514a..5b69b36b 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/ResourceWizard.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/resources/wizards/ResourceWizard.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceClassOperation.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceClassOperation.java index 23480070..b2def5c0 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceClassOperation.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceClassOperation.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceDataModelProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceDataModelProvider.java index 480ca1d0..1c71f0b6 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceDataModelProvider.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceDataModelProvider.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceTemplateModel.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceTemplateModel.java index e85f4a50..85523b0b 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceTemplateModel.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceTemplateModel.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceWizard.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceWizard.java index e475381b..ec0d4595 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceWizard.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceWizard.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceWizardPage.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceWizardPage.java index 0bc47dc1..f2b0aeec 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceWizardPage.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/AddGenericResourceWizardPage.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/ContainerResourceTemplate.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/ContainerResourceTemplate.java index 141959e8..7991d9ea 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/ContainerResourceTemplate.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/ContainerResourceTemplate.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/GenericResourceTemplate.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/GenericResourceTemplate.java index e3f5d863..05606ecd 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/GenericResourceTemplate.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/GenericResourceTemplate.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/Messages.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/Messages.java index f65513b3..d50f65cd 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/Messages.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/rest/wizards/Messages.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/GenericActionProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/GenericActionProvider.java index afb6bccf..f6a75c4c 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/GenericActionProvider.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/GenericActionProvider.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerModuleActionProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerModuleActionProvider.java index 3ef0efcb..efa0ecdd 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerModuleActionProvider.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerModuleActionProvider.java @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewActionProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewActionProvider.java index 03fa8a77..bf649f74 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewActionProvider.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewActionProvider.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewDynamicNodeProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewDynamicNodeProvider.java index ea798a55..2b58cd4b 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewDynamicNodeProvider.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewDynamicNodeProvider.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewLabelProvider.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewLabelProvider.java index fbff21ac..9a356938 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewLabelProvider.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/ServerViewLabelProvider.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/GotoModuleProjectInExplorerAction.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/GotoModuleProjectInExplorerAction.java index 5d1db3d0..8acd6783 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/GotoModuleProjectInExplorerAction.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/GotoModuleProjectInExplorerAction.java @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/OpenInBrowserAction.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/OpenInBrowserAction.java index 5c1017ce..2dddbec2 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/OpenInBrowserAction.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/OpenInBrowserAction.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/OpenModuleInFileBrowserAction.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/OpenModuleInFileBrowserAction.java index bca58556..f3e525a8 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/OpenModuleInFileBrowserAction.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/OpenModuleInFileBrowserAction.java @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/TestWebServiceAction.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/TestWebServiceAction.java index 9b7d36ec..dadcdada 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/TestWebServiceAction.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/TestWebServiceAction.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/UndeployAction.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/UndeployAction.java index d2bd88e5..8b68a31c 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/UndeployAction.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/UndeployAction.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/UnregisterResourceAction.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/UnregisterResourceAction.java index c6f824d1..34d3b240 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/UnregisterResourceAction.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/UnregisterResourceAction.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/WSDLInfoWebServiceAction.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/WSDLInfoWebServiceAction.java index 4f92575d..0696716d 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/WSDLInfoWebServiceAction.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/actions/WSDLInfoWebServiceAction.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/ApplicationNode.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/ApplicationNode.java index 2066d775..6c5ad2c2 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/ApplicationNode.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/ApplicationNode.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/DeployedApplicationsNode.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/DeployedApplicationsNode.java index 1587e024..2c2f66a8 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/DeployedApplicationsNode.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/DeployedApplicationsNode.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/DeployedWebServicesNode.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/DeployedWebServicesNode.java index 6645f5e9..d60799c2 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/DeployedWebServicesNode.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/DeployedWebServicesNode.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/NodeTypes.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/NodeTypes.java index 3b8041d4..fdf9fb12 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/NodeTypes.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/NodeTypes.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/ResourcesNode.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/ResourcesNode.java index 9ebd3798..2d0c1967 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/ResourcesNode.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/ResourcesNode.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/TreeNode.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/TreeNode.java index 923e3c8e..e09c2138 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/TreeNode.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/TreeNode.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/WebServiceNode.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/WebServiceNode.java index f637991f..3a377433 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/WebServiceNode.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/serverview/dynamicnodes/WebServiceNode.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/GlassfishWizardResources.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/GlassfishWizardResources.java index c243dd84..80e97ef0 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/GlassfishWizardResources.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/GlassfishWizardResources.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraRuntimeWizardFragment.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraRuntimeWizardFragment.java index 6e314212..2ee8b8f0 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraRuntimeWizardFragment.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraRuntimeWizardFragment.java @@ -357,17 +357,20 @@ public void setTaskModel(TaskModel taskModel) { public void performFinish(IProgressMonitor monitor) throws CoreException { super.performFinish(monitor); - RuntimeWorkingCopy runtime = (RuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); - runtime.save(true, monitor); - runtime.dispose(); + if (getTaskModel().getObject(TASK_RUNTIME) instanceof RuntimeWorkingCopy) { + RuntimeWorkingCopy runtime = (RuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); + runtime.save(true, monitor); + runtime.dispose(); + } } @Override public void performCancel(final IProgressMonitor monitor) throws CoreException { super.performCancel(monitor); - - RuntimeWorkingCopy runtime = (RuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); - runtime.dispose(); + if (getTaskModel().getObject(TASK_RUNTIME) instanceof RuntimeWorkingCopy) { + RuntimeWorkingCopy runtime = (RuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); + runtime.dispose(); + } } protected boolean validate(IWizardHandle wizard) { diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraServerWizardFragment.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraServerWizardFragment.java index 610a4b17..9a15ef50 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraServerWizardFragment.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraServerWizardFragment.java @@ -476,17 +476,20 @@ public void setTaskModel(TaskModel taskModel) { public void performFinish(IProgressMonitor monitor) throws CoreException { super.performFinish(monitor); - RuntimeWorkingCopy runtime = (RuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); - runtime.save(true, monitor); - runtime.dispose(); + if (getTaskModel().getObject(TASK_RUNTIME) instanceof RuntimeWorkingCopy) { + RuntimeWorkingCopy runtime = (RuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); + runtime.save(true, monitor); + runtime.dispose(); + } } @Override public void performCancel(final IProgressMonitor monitor) throws CoreException { super.performCancel(monitor); - - RuntimeWorkingCopy runtime = (RuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); - runtime.dispose(); + if (getTaskModel().getObject(TASK_RUNTIME) instanceof RuntimeWorkingCopy) { + RuntimeWorkingCopy runtime = (RuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); + runtime.dispose(); + } } protected boolean validate(IWizardHandle wizard) { diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/actions/TestRemotePayaraConnectionAction.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/actions/TestRemotePayaraConnectionAction.java index 74c0a29b..c458da31 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/actions/TestRemotePayaraConnectionAction.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/actions/TestRemotePayaraConnectionAction.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/JdtUtil.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/JdtUtil.java index c338acde..a38d090c 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/JdtUtil.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/JdtUtil.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/PayaraLocationUtils.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/PayaraLocationUtils.java index f832f34f..c40abe88 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/PayaraLocationUtils.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/PayaraLocationUtils.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/WtpUtil.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/WtpUtil.java index a3aaa59d..2a8a4788 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/WtpUtil.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/utils/WtpUtil.java @@ -8,7 +8,7 @@ ******************************************************************************/ /****************************************************************************** - * Copyright (c) 2018-2019 Payara Foundation + * Copyright (c) 2018-2022 Payara Foundation * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at From 4f54784f4b0923cb24afea3538e1ef592b49ecf1 Mon Sep 17 00:00:00 2001 From: Gaurav Gupta <gaurav.gupta@payara.fish> Date: Tue, 20 Dec 2022 11:34:29 +0530 Subject: [PATCH 3/6] FISH-6905 View Admin Console, Domain Directory are disabled --- .../plugin.xml | 918 +++++++++--------- 1 file changed, 459 insertions(+), 459 deletions(-) diff --git a/bundles/fish.payara.eclipse.tools.server/plugin.xml b/bundles/fish.payara.eclipse.tools.server/plugin.xml index 97f8885a..d448a513 100644 --- a/bundles/fish.payara.eclipse.tools.server/plugin.xml +++ b/bundles/fish.payara.eclipse.tools.server/plugin.xml @@ -4,39 +4,39 @@ <extension point="org.eclipse.wst.server.core.serverTypes"> <serverType - id="payara.server" - class="fish.payara.eclipse.tools.server.PayaraServer" - behaviourClass="fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour" - name="%serverTypeNameglassfish" - description="%serverTypeDescriptionPayara" - hasConfiguration="false" - launchConfigId="org.payara.jst.server.GlassfishServerLaunchConfigurationType" - launchModes="run,debug" - runtime="true" - runtimeTypeId="payara.runtime" - startBeforePublish="true" - supportsRemoteHosts="true"> - </serverType> + id="payara.server" + class="fish.payara.eclipse.tools.server.PayaraServer" + behaviourClass="fish.payara.eclipse.tools.server.deploying.PayaraServerBehaviour" + name="%serverTypeNameglassfish" + description="%serverTypeDescriptionPayara" + hasConfiguration="false" + launchConfigId="org.payara.jst.server.GlassfishServerLaunchConfigurationType" + launchModes="run,debug" + runtime="true" + runtimeTypeId="payara.runtime" + startBeforePublish="true" + supportsRemoteHosts="true"> + </serverType> </extension> <extension point="org.eclipse.wst.server.core.runtimeTypes"> <runtimeType - id="payara.runtime" - class="fish.payara.eclipse.tools.server.PayaraRuntime" - name="%runtimeTypeNameglassfish" - description="%runtimeTypeDescriptionglassfish" - vendor="%runtimeTypeGlassFishVendor"> + id="payara.runtime" + class="fish.payara.eclipse.tools.server.PayaraRuntime" + name="%runtimeTypeNameglassfish" + description="%runtimeTypeDescriptionglassfish" + vendor="%runtimeTypeGlassFishVendor"> <moduleType types="jst.web" versions="2.2, 2.3, 2.4, 2.5, 3.0, 3.1, 4.0"/> <moduleType types="jst.ejb" versions="1.1, 2.0, 2.1, 3.0, 3.1, 3.2"/> <moduleType types="jst.connector" versions="1.0, 1.5, 1.6, 1.7"/> <moduleType types="jst.ear" versions="1.2, 1.3, 1.4, 5.0, 6.0, 7.0, 8.0"/> <moduleType types="jst.utility" versions="1.0"/> <moduleType types="jst.appclient" versions="1.2, 1.3, 1.4, 5.0, 6.0, 7.0, 8.0"/> - </runtimeType> + </runtimeType> </extension> <extension point="org.eclipse.wst.server.core.launchableAdapters"> - <launchableAdapter + <launchableAdapter id="org.payara.launchableAdapter" class="fish.payara.eclipse.tools.server.archives.EclipseToPayaraArchiveConverter" priority="999" @@ -54,20 +54,20 @@ </extension> <extension-point id="runtimeComponentProviders" - name="%runtimeComponentProvidersExtensionPoint" - schema="schema/runtimeComponentProviders.exsd" + name="%runtimeComponentProvidersExtensionPoint" + schema="schema/runtimeComponentProviders.exsd" /> <!-- - System Libraries - --> + System Libraries + --> <extension point="org.eclipse.jdt.core.classpathContainerInitializer"> <classpathContainerInitializer - id="fish.payara.eclipse.tools.server.lib.system" - class="fish.payara.eclipse.tools.server.internal.SystemLibrariesContainer$Initializer"/> + id="fish.payara.eclipse.tools.server.lib.system" + class="fish.payara.eclipse.tools.server.internal.SystemLibrariesContainer$Initializer"/> </extension> <extension point="org.eclipse.jst.j2ee.classpathdep"> @@ -144,9 +144,9 @@ <extension point="org.eclipse.wst.common.project.facet.core.runtimes"> <adapter> - <runtime-component id="payara.runtime"/> - <factory class="fish.payara.eclipse.tools.server.internal.PayaraClasspathProvider$Factory"/> - <type class="org.eclipse.jst.common.project.facet.core.IClasspathProvider"/> + <runtime-component id="payara.runtime"/> + <factory class="fish.payara.eclipse.tools.server.internal.PayaraClasspathProvider$Factory"/> + <type class="org.eclipse.jst.common.project.facet.core.IClasspathProvider"/> </adapter> </extension> @@ -293,45 +293,45 @@ - <!-- - JST Facets - --> + <!-- + JST Facets + --> <extension point="org.eclipse.jst.common.project.facet.core.libraryProviders"> <provider id="GlassFish-4-SystemLibrary-JSF" extends="no-op-library-provider"> - <label>%GF4.SystemLibrary.JSF.Label</label> - <priority>1000</priority> - <param name="message" value="%GF4.SystemLibrary.JSF.Message"/> - <enablement> - <with variable="requestingProjectFacet"> - <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jst.jsf" forcePluginActivation="true"/> - </with> - <with variable="targetedRuntimes"> - <count value="+"/> - <iterate operator="and"> - <test property="fish.payara.eclipse.tools.server.internal.containsRuntimeComponentType" value="payara.runtime:4,5" forcePluginActivation="true"/> - </iterate> - </with> - </enablement> + <label>%GF4.SystemLibrary.JSF.Label</label> + <priority>1000</priority> + <param name="message" value="%GF4.SystemLibrary.JSF.Message"/> + <enablement> + <with variable="requestingProjectFacet"> + <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jst.jsf" forcePluginActivation="true"/> + </with> + <with variable="targetedRuntimes"> + <count value="+"/> + <iterate operator="and"> + <test property="fish.payara.eclipse.tools.server.internal.containsRuntimeComponentType" value="payara.runtime:4,5" forcePluginActivation="true"/> + </iterate> + </with> + </enablement> </provider> </extension> <extension point="org.eclipse.jst.common.project.facet.core.libraryProviders"> <provider id="GlassFish-4-SystemLibrary-JPA" extends="no-op-library-provider"> - <label>%GF4.SystemLibrary.JPA.Label</label> - <priority>1000</priority> - <param name="message" value="%GF4.SystemLibrary.JPA.Message"/> - <enablement> - <with variable="requestingProjectFacet"> - <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jpt.jpa" forcePluginActivation="true"/> - </with> - <with variable="targetedRuntimes"> - <count value="+"/> - <iterate operator="and"> - <test property="fish.payara.eclipse.tools.server.internal.containsRuntimeComponentType" value="payara.runtime:4,5" forcePluginActivation="true"/> - </iterate> - </with> - </enablement> + <label>%GF4.SystemLibrary.JPA.Label</label> + <priority>1000</priority> + <param name="message" value="%GF4.SystemLibrary.JPA.Message"/> + <enablement> + <with variable="requestingProjectFacet"> + <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jpt.jpa" forcePluginActivation="true"/> + </with> + <with variable="targetedRuntimes"> + <count value="+"/> + <iterate operator="and"> + <test property="fish.payara.eclipse.tools.server.internal.containsRuntimeComponentType" value="payara.runtime:4,5" forcePluginActivation="true"/> + </iterate> + </with> + </enablement> </provider> </extension> @@ -341,35 +341,35 @@ <priority>1000</priority> <param name="message" value="%GF31.SystemLibrary.JSF.Message"/> <enablement> - <with variable="requestingProjectFacet"> - <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jst.jsf" forcePluginActivation="true"/> - </with> - <with variable="targetedRuntimes"> - <count value="+"/> - <iterate operator="and"> - <test property="fish.payara.eclipse.tools.server.internal.containsRuntimeComponentType" value="payara.runtime:3.1" forcePluginActivation="true"/> - </iterate> - </with> + <with variable="requestingProjectFacet"> + <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jst.jsf" forcePluginActivation="true"/> + </with> + <with variable="targetedRuntimes"> + <count value="+"/> + <iterate operator="and"> + <test property="fish.payara.eclipse.tools.server.internal.containsRuntimeComponentType" value="payara.runtime:3.1" forcePluginActivation="true"/> + </iterate> + </with> </enablement> </provider> </extension> <extension point="org.eclipse.jst.common.project.facet.core.libraryProviders"> <provider id="GlassFish-3.1-SystemLibrary-JPA" extends="no-op-library-provider"> - <label>%GF31.SystemLibrary.JPA.Label</label> - <priority>1000</priority> - <param name="message" value="%GF31.SystemLibrary.JPA.Message"/> - <enablement> - <with variable="requestingProjectFacet"> - <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jpt.jpa" forcePluginActivation="true"/> - </with> - <with variable="targetedRuntimes"> - <count value="+"/> - <iterate operator="and"> - <test property="fish.payara.eclipse.tools.server.internal.containsRuntimeComponentType" value="payara.runtime:3.1" forcePluginActivation="true"/> - </iterate> - </with> - </enablement> + <label>%GF31.SystemLibrary.JPA.Label</label> + <priority>1000</priority> + <param name="message" value="%GF31.SystemLibrary.JPA.Message"/> + <enablement> + <with variable="requestingProjectFacet"> + <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jpt.jpa" forcePluginActivation="true"/> + </with> + <with variable="targetedRuntimes"> + <count value="+"/> + <iterate operator="and"> + <test property="fish.payara.eclipse.tools.server.internal.containsRuntimeComponentType" value="payara.runtime:3.1" forcePluginActivation="true"/> + </iterate> + </with> + </enablement> </provider> </extension> @@ -380,15 +380,15 @@ <enablement> <with variable="requestingProjectFacet"> <test - property="org.eclipse.wst.common.project.facet.core.projectFacet" - value="jst.jaxrs:1.1" forcePluginActivation="true"/> + property="org.eclipse.wst.common.project.facet.core.projectFacet" + value="jst.jaxrs:1.1" forcePluginActivation="true"/> </with> <with variable="projectFacets"> <count value="+"/> <iterate operator="or"> <test - property="org.eclipse.wst.common.project.facet.core.projectFacet" - value="jst.web:[3.0" forcePluginActivation="true"/> + property="org.eclipse.wst.common.project.facet.core.projectFacet" + value="jst.web:[3.0" forcePluginActivation="true"/> </iterate> </with> <with variable="targetedRuntimes"> @@ -409,8 +409,8 @@ <extension point="org.eclipse.jst.ws.jaxrs.core.jaxrsLibraryProvider" id="MyJAXRSLibraryProvider" > <jaxrsLibraryprovider - libraryProviderID="fish.payara.eclipse.tools.server.jaxrsLibraryproviderID" - showUpdateDD="true" + libraryProviderID="fish.payara.eclipse.tools.server.jaxrsLibraryproviderID" + showUpdateDD="true" updateDDSelected="true" sevletClassName="com.sun.jersey.spi.container.servlet.ServletContainer"/> </extension> @@ -418,9 +418,9 @@ - <!-- - DTDs - --> + <!-- + DTDs + --> <extension point = "org.eclipse.wst.xml.core.catalogContributions"> <catalogContribution id="default"> @@ -676,123 +676,123 @@ <extension point="org.eclipse.core.runtime.preferences"> <initializer - class="fish.payara.eclipse.tools.server.preferences.PreferenceInitializer"> + class="fish.payara.eclipse.tools.server.preferences.PreferenceInitializer"> </initializer> </extension> <extension point="org.eclipse.core.expressions.propertyTesters"> - <propertyTester - class="fish.payara.eclipse.tools.server.handlers.PayaraStateTester" - id="fish.payara.eclipse.tools.server.PayaraStateTester" - namespace="fish.payara.eclipse.tools" - properties="isRunning,isRemote" - type="org.eclipse.wst.server.core.IServer"> - </propertyTester> - <propertyTester - class="fish.payara.eclipse.tools.server.handlers.PayaraVersionTester" - id="fish.payara.eclipse.tools.server.PayaraVersionTester" - namespace="fish.payara.eclipse.tools" - properties="v3Test" - type="org.eclipse.wst.server.core.IServer"> - </propertyTester> - </extension> + <propertyTester + class="fish.payara.eclipse.tools.server.handlers.PayaraStateTester" + id="fish.payara.eclipse.tools.server.PayaraStateTester" + namespace="fish.payara.eclipse.tools.server" + properties="isRunning,isRemote" + type="org.eclipse.wst.server.core.IServer"> + </propertyTester> + <propertyTester + class="fish.payara.eclipse.tools.server.handlers.PayaraVersionTester" + id="fish.payara.eclipse.tools.server.PayaraVersionTester" + namespace="fish.payara.eclipse.tools" + properties="v3Test" + type="org.eclipse.wst.server.core.IServer"> + </propertyTester> + </extension> - <extension point="org.eclipse.core.expressions.propertyTesters"> - <propertyTester - id="fish.payara.eclipse.tools.server.internal.ContainsRuntimeComponentTypeForRuntime" - type="org.eclipse.wst.common.project.facet.core.runtime.IRuntime" - namespace="fish.payara.eclipse.tools" - properties="containsRuntimeComponentType" - class="fish.payara.eclipse.tools.server.internal.ContainsRuntimeComponentType"> - </propertyTester> - <propertyTester - id="fish.payara.eclipse.tools.server.internal.ContainsRuntimeComponentTypeForCollection" - type="java.util.Collection" - namespace="fish.payara.eclipse.tools" - properties="containsRuntimeComponentType" - class="fish.payara.eclipse.tools.server.internal.ContainsRuntimeComponentType"> - </propertyTester> - </extension> + <extension point="org.eclipse.core.expressions.propertyTesters"> + <propertyTester + id="fish.payara.eclipse.tools.server.internal.ContainsRuntimeComponentTypeForRuntime" + type="org.eclipse.wst.common.project.facet.core.runtime.IRuntime" + namespace="fish.payara.eclipse.tools.server.internal" + properties="containsRuntimeComponentType" + class="fish.payara.eclipse.tools.server.internal.ContainsRuntimeComponentType"> + </propertyTester> + <propertyTester + id="fish.payara.eclipse.tools.server.internal.ContainsRuntimeComponentTypeForCollection" + type="java.util.Collection" + namespace="fish.payara.eclipse.tools.server.internal" + properties="containsRuntimeComponentType" + class="fish.payara.eclipse.tools.server.internal.ContainsRuntimeComponentType"> + </propertyTester> + </extension> - <extension point="org.eclipse.core.expressions.definitions"> - <definition - id="fish.payara.eclipse.tools.server.oneGlassfishSelected"> - <and> - <count value="1"/> - <iterate ifEmpty="false"> - <or> - <reference definitionId="fish.payara.eclipse.tools.server.isGlassfish"/> - </or> - </iterate> - </and> - </definition> + <extension point="org.eclipse.core.expressions.definitions"> + <definition + id="fish.payara.eclipse.tools.server.oneGlassfishSelected"> + <and> + <count value="1"/> + <iterate ifEmpty="false"> + <or> + <reference definitionId="fish.payara.eclipse.tools.server.isGlassfish"/> + </or> + </iterate> + </and> + </definition> - <definition id="fish.payara.eclipse.tools.server.isGlassfish"> - <adapt type="org.eclipse.wst.server.core.IServer"> - <and> - <test - property="org.eclipse.wst.server.ui.serverType" - value="payara.server"> - </test> - </and> - </adapt> - </definition> + <definition id="fish.payara.eclipse.tools.server.isGlassfish"> + <adapt type="org.eclipse.wst.server.core.IServer"> + <and> + <test + property="org.eclipse.wst.server.ui.serverType" + value="payara.server"> + </test> + </and> + </adapt> + </definition> - <definition id="fish.payara.eclipse.tools.server.moreGlassfishSelected"> - <iterate ifEmpty="false"> - <or> - <reference definitionId="fish.payara.eclipse.tools.server.isGlassfish"/> - </or> - </iterate> - </definition> + <definition id="fish.payara.eclipse.tools.server.moreGlassfishSelected"> + <iterate ifEmpty="false"> + <or> + <reference definitionId="fish.payara.eclipse.tools.server.isGlassfish"/> + </or> + </iterate> + </definition> - <definition id="fish.payara.eclipse.tools.server.oneRunningGlassfishSelected"> - <and> - <count value="1"/> - <iterate ifEmpty="false"> - <and> - <or> - <reference definitionId="fish.payara.eclipse.tools.server.isGlassfish"/> - </or> - <test property="fish.payara.eclipse.tools.server.isRunning"/> - </and> - </iterate> - </and> - </definition> + <definition id="fish.payara.eclipse.tools.server.oneRunningGlassfishSelected"> + <and> + <count value="1"/> + <iterate ifEmpty="false"> + <and> + <or> + <reference definitionId="fish.payara.eclipse.tools.server.isGlassfish"/> + </or> + <test property="fish.payara.eclipse.tools.server.isRunning"/> + </and> + </iterate> + </and> + </definition> - <definition id="fish.payara.eclipse.tools.server.isRemoteGlassfish"> - <and> - <count value="1"/> - <iterate ifEmpty="false"> - <and> - <or> - <reference definitionId="fish.payara.eclipse.tools.server.isGlassfish"/> - </or> - <test property="fish.payara.eclipse.tools.server.isRemote"/> - </and> - </iterate> - </and> - </definition> - </extension> + <definition id="fish.payara.eclipse.tools.server.isRemoteGlassfish"> + <and> + <count value="1"/> + <iterate ifEmpty="false"> + <and> + <or> + <reference definitionId="fish.payara.eclipse.tools.server.isGlassfish"/> + </or> + <test property="fish.payara.eclipse.tools.server.isRemote"/> + </and> + </iterate> + </and> + </definition> + </extension> <!-- - This wizard fragment plugs-in the wizard flow when Servers - New Server - Payara -> Payara - is selected and subsequently the next button is pressed when no runtime exists yet, - or the add button next to Server runtime environment is pressed. - --> + This wizard fragment plugs-in the wizard flow when Servers - New Server - Payara -> Payara + is selected and subsequently the next button is pressed when no runtime exists yet, + or the add button next to Server runtime environment is pressed. + --> <extension point="org.eclipse.wst.server.ui.wizardFragments"> - <fragment - id="fish.payara.NewPayaraRuntimeWizardFragment" - class="fish.payara.eclipse.tools.server.ui.wizards.NewPayaraRuntimeWizardFragment" - typeIds="payara.runtime"> - </fragment> - <fragment - id="fish.payara.NewPayaraServerWizardFragment" - class="fish.payara.eclipse.tools.server.ui.wizards.NewPayaraServerWizardFragment" - typeIds="payara.server"> - </fragment> + <fragment + id="fish.payara.NewPayaraRuntimeWizardFragment" + class="fish.payara.eclipse.tools.server.ui.wizards.NewPayaraRuntimeWizardFragment" + typeIds="payara.runtime"> + </fragment> + <fragment + id="fish.payara.NewPayaraServerWizardFragment" + class="fish.payara.eclipse.tools.server.ui.wizards.NewPayaraServerWizardFragment" + typeIds="payara.server"> + </fragment> </extension> @@ -800,18 +800,18 @@ The images associated with the Payara runtime and server --> <extension point="org.eclipse.wst.server.ui.serverImages"> - <image - id="org.eclipse.jst.server.glassfish.image" - typeIds="payara.runtime,payara.server" - icon="icons/obj16/payara-blue.png"> - </image> + <image + id="org.eclipse.jst.server.glassfish.image" + typeIds="payara.runtime,payara.server" + icon="icons/obj16/payara-blue.png"> + </image> </extension> <extension point="org.eclipse.wst.common.project.facet.ui.images"> - <image - path="icons/obj16/payara-blue.png" - runtime-component-type="payara.runtime"> - </image> + <image + path="icons/obj16/payara-blue.png" + runtime-component-type="payara.runtime"> + </image> </extension> @@ -839,11 +839,11 @@ The global preferenes for all Payara server instances in Eclipse menu - preferences - Payara Preferences --> <extension point="org.eclipse.ui.preferencePages"> - <page - id="fish.payara.eclipse.tools.server.preferences.GlassFishPreferencePage" - class="fish.payara.eclipse.tools.server.ui.preferences.GlassFishPreferencePage" - name="Payara Preferences"> - </page> + <page + id="fish.payara.eclipse.tools.server.preferences.GlassFishPreferencePage" + class="fish.payara.eclipse.tools.server.ui.preferences.GlassFishPreferencePage" + name="Payara Preferences"> + </page> </extension> @@ -852,18 +852,18 @@ which is the editor being opened when a server in the Servers view is double clicked. --> <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups"> - <launchConfigurationTabGroup - id="org.payara.jst.server.launchConfigurationTabGroup" - class="fish.payara.eclipse.tools.server.ui.editorsections.LaunchConfigurationTabGroup" - type="org.payara.jst.server.GlassfishServerLaunchConfigurationType"> - </launchConfigurationTabGroup> + <launchConfigurationTabGroup + id="org.payara.jst.server.launchConfigurationTabGroup" + class="fish.payara.eclipse.tools.server.ui.editorsections.LaunchConfigurationTabGroup" + type="org.payara.jst.server.GlassfishServerLaunchConfigurationType"> + </launchConfigurationTabGroup> </extension> <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages"> - <launchConfigurationTypeImage - id="fish.payara.eclipse.tools.server.ui.launchConfigurationTypeImage" - configTypeID="org.payara.jst.server.GlassfishServerLaunchConfigurationType" - icon="icons/obj16/payara-blue.png"> - </launchConfigurationTypeImage> + <launchConfigurationTypeImage + id="fish.payara.eclipse.tools.server.ui.launchConfigurationTypeImage" + configTypeID="org.payara.jst.server.GlassfishServerLaunchConfigurationType" + icon="icons/obj16/payara-blue.png"> + </launchConfigurationTypeImage> </extension> @@ -872,13 +872,13 @@ the Payara / GlassFish server in the Servers views. The content itself is a link to the properties page. --> <extension point="org.eclipse.wst.server.ui.editorPageSections"> - <section - id="fish.payara.eclipse.tools.server.ServerSection" - class="fish.payara.eclipse.tools.server.ui.editorsections.ServerSection" - typeIds="payara.server" - insertionId="org.eclipse.wst.server.editor.overview.left" - order="10"> - </section> + <section + id="fish.payara.eclipse.tools.server.ServerSection" + class="fish.payara.eclipse.tools.server.ui.editorsections.ServerSection" + typeIds="payara.server" + insertionId="org.eclipse.wst.server.editor.overview.left" + order="10"> + </section> </extension> @@ -891,134 +891,134 @@ <extension point="org.eclipse.ui.commands"> <category - id="fish.payara.eclipse.tools.server.commands.category" - name="glassfish-commands"> + id="fish.payara.eclipse.tools.server.commands.category" + name="glassfish-commands"> </category> <command - id="fish.payara.eclipse.tools.server.commands.ViewLogCommand" - name="%menu.viewlogfile" - description="%menu.viewlogfile"> + id="fish.payara.eclipse.tools.server.commands.ViewLogCommand" + name="%menu.viewlogfile" + description="%menu.viewlogfile"> </command> <command - id="fish.payara.eclipse.tools.server.commands.ViewAdminConsoleCommand" - name="%menu.viewadminconsole" - description="%menu.viewadminconsole"> + id="fish.payara.eclipse.tools.server.commands.ViewAdminConsoleCommand" + name="%menu.viewadminconsole" + description="%menu.viewadminconsole"> </command> <command - id="fish.payara.eclipse.tools.server.commands.OpenUrlCommand" - name="OpenUrlCommand"> - <commandParameter - id="fish.payara.eclipse.tools.server.commands.urlParam" - name="url" - optional="false"> - </commandParameter> + id="fish.payara.eclipse.tools.server.commands.OpenUrlCommand" + name="OpenUrlCommand"> + <commandParameter + id="fish.payara.eclipse.tools.server.commands.urlParam" + name="url" + optional="false"> + </commandParameter> </command> <command - id="fish.payara.eclipse.tools.server.commands.OpenServerHomeCommand" - name="OpenServerHomeCommand"> + id="fish.payara.eclipse.tools.server.commands.OpenServerHomeCommand" + name="OpenServerHomeCommand"> </command> <command - id="fish.payara.eclipse.tools.server.commands.OpenDomainHomeCommand" - name="OpenDomainHomeCommand"> + id="fish.payara.eclipse.tools.server.commands.OpenDomainHomeCommand" + name="OpenDomainHomeCommand"> </command> - </extension> + </extension> - <!-- 2. Handlers corresponding to the commands defined above --> + <!-- 2. Handlers corresponding to the commands defined above --> - <extension point="org.eclipse.ui.handlers"> - <handler - class="fish.payara.eclipse.tools.server.handlers.ViewLogHandler" - commandId="fish.payara.eclipse.tools.server.commands.ViewLogCommand"> - <enabledWhen> - <or> - <not> - <reference definitionId="fish.payara.eclipse.tools.server.isRemoteGlassfish"/> - </not> - <reference definitionId="fish.payara.eclipse.tools.server.oneRunningGlassfishSelected"/> - </or> - </enabledWhen> - </handler> + <extension point="org.eclipse.ui.handlers"> + <handler + class="fish.payara.eclipse.tools.server.handlers.ViewLogHandler" + commandId="fish.payara.eclipse.tools.server.commands.ViewLogCommand"> + <enabledWhen> + <or> + <not> + <reference definitionId="fish.payara.eclipse.tools.server.isRemoteGlassfish"/> + </not> + <reference definitionId="fish.payara.eclipse.tools.server.oneRunningGlassfishSelected"/> + </or> + </enabledWhen> + </handler> - <handler - commandId="fish.payara.eclipse.tools.server.commands.ViewAdminConsoleCommand" - class="fish.payara.eclipse.tools.server.handlers.ViewAdminConsoleHandler" - > - <enabledWhen> - <reference definitionId="fish.payara.eclipse.tools.server.oneRunningGlassfishSelected"/> - </enabledWhen> - </handler> + <handler + commandId="fish.payara.eclipse.tools.server.commands.ViewAdminConsoleCommand" + class="fish.payara.eclipse.tools.server.handlers.ViewAdminConsoleHandler" + > + <enabledWhen> + <reference definitionId="fish.payara.eclipse.tools.server.oneRunningGlassfishSelected"/> + </enabledWhen> + </handler> - <handler - commandId="fish.payara.eclipse.tools.server.commands.OpenUrlCommand" - class="fish.payara.eclipse.tools.server.handlers.ShowURLHandler"> + <handler + commandId="fish.payara.eclipse.tools.server.commands.OpenUrlCommand" + class="fish.payara.eclipse.tools.server.handlers.ShowURLHandler"> </handler> - <handler + <handler commandId="fish.payara.eclipse.tools.server.commands.OpenServerHomeCommand" - class="fish.payara.eclipse.tools.server.handlers.OpenServerHomeHandler" - > - <enabledWhen> - <reference definitionId="fish.payara.eclipse.tools.server.oneGlassfishSelected"/> - </enabledWhen> - </handler> + class="fish.payara.eclipse.tools.server.handlers.OpenServerHomeHandler" + > + <enabledWhen> + <reference definitionId="fish.payara.eclipse.tools.server.oneGlassfishSelected"/> + </enabledWhen> + </handler> - <handler - commandId="fish.payara.eclipse.tools.server.commands.OpenDomainHomeCommand" - class="fish.payara.eclipse.tools.server.handlers.OpenDomainHomeHandler" - > - <enabledWhen> - <and> - <not> - <reference definitionId="fish.payara.eclipse.tools.server.isRemoteGlassfish"/> - </not> - <reference definitionId="fish.payara.eclipse.tools.server.oneGlassfishSelected"/> - </and> - </enabledWhen> - </handler> + <handler + commandId="fish.payara.eclipse.tools.server.commands.OpenDomainHomeCommand" + class="fish.payara.eclipse.tools.server.handlers.OpenDomainHomeHandler" + > + <enabledWhen> + <and> + <not> + <reference definitionId="fish.payara.eclipse.tools.server.isRemoteGlassfish"/> + </not> + <reference definitionId="fish.payara.eclipse.tools.server.oneGlassfishSelected"/> + </and> + </enabledWhen> + </handler> </extension> <!-- 3. Definitions of the menu entries putting the above defined commands in --> <extension point="org.eclipse.ui.menus"> <menuContribution - allPopups="false" - locationURI="popup:org.eclipse.wst.server.ui.ServersView?after=additions"> + allPopups="false" + locationURI="popup:org.eclipse.wst.server.ui.ServersView?after=additions"> <menu - id="fish.payara.eclipse.tools.server.actions.subMenu" - icon="icons/obj16/payara-blue.png" - label="%menu.payaratopmenu"> - <separator name="group1"/> - <visibleWhen checkEnabled="false"> - <reference definitionId="fish.payara.eclipse.tools.server.moreGlassfishSelected"/> - </visibleWhen> + id="fish.payara.eclipse.tools.server.actions.subMenu" + icon="icons/obj16/payara-blue.png" + label="%menu.payaratopmenu"> + <separator name="group1"/> + <visibleWhen checkEnabled="false"> + <reference definitionId="fish.payara.eclipse.tools.server.moreGlassfishSelected"/> + </visibleWhen> - <command - commandId="fish.payara.eclipse.tools.server.commands.ViewAdminConsoleCommand" - icon="icons/obj16/payara-blue.png" - style="push"> - </command> - <command - commandId="fish.payara.eclipse.tools.server.commands.ViewLogCommand" - icon="icons/obj16/logfile.png" - style="push"> - </command> - <command - commandId="fish.payara.eclipse.tools.server.commands.OpenServerHomeCommand" - icon="icons/obj16/folder_open.png" - label="%menu.openserverhome" - style="push"> - <visibleWhen checkEnabled="false"> - <reference definitionId="fish.payara.eclipse.tools.server.oneGlassfishSelected"/> - </visibleWhen> - </command> - <command - commandId="fish.payara.eclipse.tools.server.commands.OpenDomainHomeCommand" - icon="icons/obj16/folder_open.png" - label="%menu.opendomainhome" - style="push"> - </command> - </menu> + <command + commandId="fish.payara.eclipse.tools.server.commands.ViewAdminConsoleCommand" + icon="icons/obj16/payara-blue.png" + style="push"> + </command> + <command + commandId="fish.payara.eclipse.tools.server.commands.ViewLogCommand" + icon="icons/obj16/logfile.png" + style="push"> + </command> + <command + commandId="fish.payara.eclipse.tools.server.commands.OpenServerHomeCommand" + icon="icons/obj16/folder_open.png" + label="%menu.openserverhome" + style="push"> + <visibleWhen checkEnabled="false"> + <reference definitionId="fish.payara.eclipse.tools.server.oneGlassfishSelected"/> + </visibleWhen> + </command> + <command + commandId="fish.payara.eclipse.tools.server.commands.OpenDomainHomeCommand" + icon="icons/obj16/folder_open.png" + label="%menu.opendomainhome" + style="push"> + </command> + </menu> </menuContribution> </extension> @@ -1031,16 +1031,16 @@ --> <extension point="org.eclipse.ui.propertyPages"> <page - id="fish.payara.eclipse.tools.server.ui.server.properties.payara" - name="Payara" - class="fish.payara.eclipse.tools.server.ui.properties.ServerPropertyPage"> - <enabledWhen> - <and> + id="fish.payara.eclipse.tools.server.ui.server.properties.payara" + name="Payara" + class="fish.payara.eclipse.tools.server.ui.properties.ServerPropertyPage"> + <enabledWhen> + <and> <adapt type="org.eclipse.wst.server.core.IServer" /> <reference definitionId="fish.payara.eclipse.tools.server.isGlassfish"/> - </and> - </enabledWhen> - </page> + </and> + </enabledWhen> + </page> </extension> @@ -1058,79 +1058,79 @@ a running Payara / GlassFish server node in the Servers view. --> <extension point="org.eclipse.ui.navigator.viewer"> - <viewerContentBinding viewerId="org.eclipse.wst.server.ui.ServersView"> - <includes> - <contentExtension pattern="payara.serverview.contentprovider"/> - </includes> - </viewerContentBinding> + <viewerContentBinding viewerId="org.eclipse.wst.server.ui.ServersView"> + <includes> + <contentExtension pattern="payara.serverview.contentprovider"/> + </includes> + </viewerContentBinding> - <viewerActionBinding viewerId="org.eclipse.wst.server.ui.ServersView"> - <includes> - <actionExtension pattern="fish.payara.eclipse.tools.server.ui.serverview.ServerModuleActionProvider" /> - </includes> - </viewerActionBinding> + <viewerActionBinding viewerId="org.eclipse.wst.server.ui.ServersView"> + <includes> + <actionExtension pattern="fish.payara.eclipse.tools.server.ui.serverview.ServerModuleActionProvider" /> + </includes> + </viewerActionBinding> </extension> <extension point="org.eclipse.ui.navigator.navigatorContent"> - <navigatorContent - id="payara.serverview.contentprovider" - contentProvider="fish.payara.eclipse.tools.server.ui.serverview.ServerViewDynamicNodeProvider" - labelProvider="fish.payara.eclipse.tools.server.ui.serverview.ServerViewLabelProvider" - name="Payara Management Nodes" - icon="icons/obj16/payara-blue.png" - activeByDefault="true" - priority="highest"> - <triggerPoints> + <navigatorContent + id="payara.serverview.contentprovider" + contentProvider="fish.payara.eclipse.tools.server.ui.serverview.ServerViewDynamicNodeProvider" + labelProvider="fish.payara.eclipse.tools.server.ui.serverview.ServerViewLabelProvider" + name="Payara Management Nodes" + icon="icons/obj16/payara-blue.png" + activeByDefault="true" + priority="highest"> + <triggerPoints> <instanceof value="org.eclipse.wst.server.core.IServer"/> - </triggerPoints> - <possibleChildren> + </triggerPoints> + <possibleChildren> <instanceof value="fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.TreeNode"/> - </possibleChildren> + </possibleChildren> - <!-- This adds for example the "unregister" action when you right click on a resource such as a JDBC data source --> - <actionProvider + <!-- This adds for example the "unregister" action when you right click on a resource such as a JDBC data source --> + <actionProvider id="fish.payara.eclipse.tools.server.ui.serverview.ServerViewActionProvider" class="fish.payara.eclipse.tools.server.ui.serverview.ServerViewActionProvider" priority="highest"> - <enablement> + <enablement> + <or> + <instanceof value="org.eclipse.wst.server.core.IServer"/> + <instanceof value="fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.TreeNode"/> + <adapt type="java.util.Collection"><count value="0"/></adapt> + </or> + </enablement> + </actionProvider> + </navigatorContent> + + <actionProvider + id="fish.payara.eclipse.tools.server.ui.serverview.ServerModuleActionProvider" + class="fish.payara.eclipse.tools.server.ui.serverview.ServerModuleActionProvider" + dependsOn="org.eclipse.wst.server.ui.ServersView.ServerActionProvider" + priority="higher"> + <enablement> <or> - <instanceof value="org.eclipse.wst.server.core.IServer"/> - <instanceof value="fish.payara.eclipse.tools.server.ui.serverview.dynamicnodes.TreeNode"/> - <adapt type="java.util.Collection"><count value="0"/></adapt> + <instanceof value="org.eclipse.wst.server.core.IServer"> + </instanceof> + <instanceof + value="org.eclipse.wst.server.ui.internal.view.servers.ModuleServer"> + </instanceof> </or> - </enablement> - </actionProvider> - </navigatorContent> - - <actionProvider - id="fish.payara.eclipse.tools.server.ui.serverview.ServerModuleActionProvider" - class="fish.payara.eclipse.tools.server.ui.serverview.ServerModuleActionProvider" - dependsOn="org.eclipse.wst.server.ui.ServersView.ServerActionProvider" - priority="higher"> - <enablement> - <or> - <instanceof value="org.eclipse.wst.server.core.IServer"> - </instanceof> - <instanceof - value="org.eclipse.wst.server.ui.internal.view.servers.ModuleServer"> - </instanceof> - </or> - </enablement> - </actionProvider> + </enablement> + </actionProvider> - <commonWizard - menuGroupId="fish.payara.eclipse.tools.server.v3.wizards" - type="new" - wizardId="fish.payara.eclipse.tools.server.v3.wizards.AddGenericResourceWizard"> - <enablement> - <adapt type="org.eclipse.core.resources.IResource"> - <test - property="org.eclipse.wst.common.project.facet.core.projectFacet" - value="glassfish.web"> - </test> - </adapt> - </enablement> - </commonWizard> + <commonWizard + menuGroupId="fish.payara.eclipse.tools.server.v3.wizards" + type="new" + wizardId="fish.payara.eclipse.tools.server.v3.wizards.AddGenericResourceWizard"> + <enablement> + <adapt type="org.eclipse.core.resources.IResource"> + <test + property="org.eclipse.wst.common.project.facet.core.projectFacet" + value="glassfish.web"> + </test> + </adapt> + </enablement> + </commonWizard> </extension> @@ -1138,22 +1138,22 @@ This adds hyper links to the console that shows Payara's server logging --> <extension point="org.eclipse.ui.console.consolePageParticipants"> - <consolePageParticipant - id="fish.payara.eclipse.tools.server.log.PayaraLogPageParticipant" - class="fish.payara.eclipse.tools.server.ui.log.PayaraLogPageParticipant"> - <enablement> - <instanceof value="fish.payara.eclipse.tools.server.log.PayaraConsole"/> - </enablement> - </consolePageParticipant> + <consolePageParticipant + id="fish.payara.eclipse.tools.server.log.PayaraLogPageParticipant" + class="fish.payara.eclipse.tools.server.ui.log.PayaraLogPageParticipant"> + <enablement> + <instanceof value="fish.payara.eclipse.tools.server.log.PayaraConsole"/> + </enablement> + </consolePageParticipant> </extension> <extension point="org.eclipse.ui.console.consolePatternMatchListeners"> <consolePatternMatchListener - id="fish.payara.eclipse.tools.server.ui.consolePatternMatchListener" - class="fish.payara.eclipse.tools.server.ui.log.PayaraConsoleTracker" - qualifier="${java_extensions_regex}" - regex="\(\S*${java_extensions_regex}\S*\)"> - <enablement></enablement> + id="fish.payara.eclipse.tools.server.ui.consolePatternMatchListener" + class="fish.payara.eclipse.tools.server.ui.log.PayaraConsoleTracker" + qualifier="${java_extensions_regex}" + regex="\(\S*${java_extensions_regex}\S*\)"> + <enablement></enablement> </consolePatternMatchListener> </extension> @@ -1164,67 +1164,67 @@ </extension> <extension point="org.eclipse.ui.newWizards"> - <category - id="fish.payara.eclipse.tools" - name="%payara.wizardcategory"> - </category> - <wizard - id="fish.payara.eclipse.tools.server.ui.resources.wizards.JDBCWizard" - category="fish.payara.eclipse.tools" - class="fish.payara.eclipse.tools.server.ui.resources.wizards.JDBCWizard" - icon="icons/obj16/payara-blue.png" - name="%payara.sunresourceslabel"> - <description> - %payara.sunresources.BeanWebRegionWizard.description - </description> - <selection + <category + id="fish.payara.eclipse.tools" + name="%payara.wizardcategory"> + </category> + <wizard + id="fish.payara.eclipse.tools.server.ui.resources.wizards.JDBCWizard" + category="fish.payara.eclipse.tools" + class="fish.payara.eclipse.tools.server.ui.resources.wizards.JDBCWizard" + icon="icons/obj16/payara-blue.png" + name="%payara.sunresourceslabel"> + <description> + %payara.sunresources.BeanWebRegionWizard.description + </description> + <selection class="org.eclipse.core.resources.IResource"> - </selection> - </wizard> - <wizard - id="fish.payara.eclipse.tools.server.ui.resources.wizards.MailWizard" - category="fish.payara.eclipse.tools" - class="fish.payara.eclipse.tools.server.ui.resources.wizards.MailWizard" - icon="icons/obj16/payara-blue.png" - name="%payara.mailresourceslabel"> - <description> - %payara.mailresources.BeanWebRegionWizard.description - </description> - <selection + </selection> + </wizard> + <wizard + id="fish.payara.eclipse.tools.server.ui.resources.wizards.MailWizard" + category="fish.payara.eclipse.tools" + class="fish.payara.eclipse.tools.server.ui.resources.wizards.MailWizard" + icon="icons/obj16/payara-blue.png" + name="%payara.mailresourceslabel"> + <description> + %payara.mailresources.BeanWebRegionWizard.description + </description> + <selection class="org.eclipse.core.resources.IResource"> - </selection> - </wizard> - <wizard - id="fish.payara.eclipse.tools.server.ui.resources.wizards.JMSWizard" - category="fish.payara.eclipse.tools" - class="fish.payara.eclipse.tools.server.ui.resources.wizards.JMSWizard" - icon="icons/obj16/payara-blue.png" - name="%payara.jmsresourceslabel"> - <description> - %payara.jmsresources.BeanWebRegionWizard.description - </description> - <selection + </selection> + </wizard> + <wizard + id="fish.payara.eclipse.tools.server.ui.resources.wizards.JMSWizard" + category="fish.payara.eclipse.tools" + class="fish.payara.eclipse.tools.server.ui.resources.wizards.JMSWizard" + icon="icons/obj16/payara-blue.png" + name="%payara.jmsresourceslabel"> + <description> + %payara.jmsresources.BeanWebRegionWizard.description + </description> + <selection class="org.eclipse.core.resources.IResource"> - </selection> - </wizard> - <wizard - id="fish.payara.eclipse.tools.server.v3.wizards.AddGenericResourceWizard" - category="fish.payara.eclipse.tools" - class="fish.payara.eclipse.tools.server.ui.rest.wizards.AddGenericResourceWizard" - icon="icons/obj16/payara-blue.png" - name="%payara.restfulfrompatternlabel"> - <description> - %payara.restfulfrompattern.BeanWebRegionWizard.description - </description> - </wizard> + </selection> + </wizard> + <wizard + id="fish.payara.eclipse.tools.server.v3.wizards.AddGenericResourceWizard" + category="fish.payara.eclipse.tools" + class="fish.payara.eclipse.tools.server.ui.rest.wizards.AddGenericResourceWizard" + icon="icons/obj16/payara-blue.png" + name="%payara.restfulfrompatternlabel"> + <description> + %payara.restfulfrompattern.BeanWebRegionWizard.description + </description> + </wizard> </extension> <extension point="org.eclipse.jst.common.project.facet.ui.libraryProviderActionPanels"> - <panel - class="fish.payara.eclipse.tools.server.ui.internal.JAXRSActionPanels" - provider="fish.payara.eclipse.tools.server.jaxrsLibraryproviderID"> - </panel> + <panel + class="fish.payara.eclipse.tools.server.ui.internal.JAXRSActionPanels" + provider="fish.payara.eclipse.tools.server.jaxrsLibraryproviderID"> + </panel> </extension> </plugin> From ffe1cfb5903befd957d8d717511fe7db831ae081 Mon Sep 17 00:00:00 2001 From: Gaurav Gupta <gaurav.gupta@payara.fish> Date: Tue, 20 Dec 2022 13:19:16 +0530 Subject: [PATCH 4/6] FISH-6776 Update Payara Micro default version to 6.2022.2 --- .../eclipse/tools/micro/ui/wizards/MicroProjectWizard.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/MicroProjectWizard.java b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/MicroProjectWizard.java index 4e9d033c..52cacde0 100644 --- a/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/MicroProjectWizard.java +++ b/bundles/fish.payara.eclipse.tools.micro/src/fish/payara/eclipse/tools/micro/ui/wizards/MicroProjectWizard.java @@ -79,7 +79,7 @@ public MicroProjectWizard() { private static final String ARCHETYPE_JDK_VERSION = "jdkVersion"; //$NON-NLS-1$ private static final String ARCHETYPE_JDK_VERSION_DEFAULT_VALUE = "1.8"; //$NON-NLS-1$ public static final String ARCHETYPE_MICRO_VERSION = "payaraMicroVersion"; //$NON-NLS-1$ - private static final String ARCHETYPE_MICRO_VERSION_DEFAULT_VALUE = "5.2020.5"; //$NON-NLS-1$ + private static final String ARCHETYPE_MICRO_VERSION_DEFAULT_VALUE = "6.2022.2"; //$NON-NLS-1$ public static final String ARCHETYPE_AUTOBIND_HTTP = "autoBindHttp"; //$NON-NLS-1$ private static final String ARCHETYPE_CONCURRENT_API = "addConcurrentApi"; //$NON-NLS-1$ private static final String ARCHETYPE_RESOURCE_API = "addResourceApi"; //$NON-NLS-1$ From 007f47254b29ef37b320ae8a91db1741f15b42ee Mon Sep 17 00:00:00 2001 From: Gaurav Gupta <gaurav.gupta@payara.fish> Date: Mon, 26 Dec 2022 18:52:31 +0530 Subject: [PATCH 5/6] FISH-6932 Fixes ClassCastException: class org.eclipse.wst.server.core.internal.Runtime cannot be cast to class org.eclipse.wst.server.core.IRuntimeWorkingCopy --- .../NewPayaraRuntimeWizardFragment.java | 19 +++++++-------- .../NewPayaraServerWizardFragment.java | 23 +++++++++++-------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraRuntimeWizardFragment.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraRuntimeWizardFragment.java index 2ee8b8f0..a2b5ada8 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraRuntimeWizardFragment.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraRuntimeWizardFragment.java @@ -252,7 +252,7 @@ protected void updateJREs(JdkFilter jdkFilter) { int size2 = vmInstalls.length; for (int j = 0; j < size2; j++) { // if (jdkFilter == null || jdkFilter.allows(vmInstalls[j])) { - installedJREs.add(vmInstalls[j]); + installedJREs.add(vmInstalls[j]); // } } } @@ -341,14 +341,15 @@ protected String getDescription() { @Override public void setTaskModel(TaskModel taskModel) { super.setTaskModel(taskModel); - - IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); - if (runtime.getOriginal() == null) { - try { - runtime.setName(createUniqueRuntimeName(runtime.getRuntimeType().getName())); - } catch (UniqueNameNotFound e) { - // Set the type name and let the user handle validation error - runtime.setName(runtime.getRuntimeType().getName()); + if (getTaskModel().getObject(TASK_RUNTIME) instanceof RuntimeWorkingCopy) { + IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); + if (runtime.getOriginal() == null) { + try { + runtime.setName(createUniqueRuntimeName(runtime.getRuntimeType().getName())); + } catch (UniqueNameNotFound e) { + // Set the type name and let the user handle validation error + runtime.setName(runtime.getRuntimeType().getName()); + } } } } diff --git a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraServerWizardFragment.java b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraServerWizardFragment.java index 9a15ef50..c7c6a3fc 100644 --- a/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraServerWizardFragment.java +++ b/bundles/fish.payara.eclipse.tools.server/src/fish/payara/eclipse/tools/server/ui/wizards/NewPayaraServerWizardFragment.java @@ -51,6 +51,7 @@ import org.eclipse.swt.widgets.Spinner; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.PlatformUI; +import org.eclipse.wst.server.core.IRuntime; import org.eclipse.wst.server.core.IRuntimeWorkingCopy; import org.eclipse.wst.server.core.IServerWorkingCopy; import org.eclipse.wst.server.core.TaskModel; @@ -63,6 +64,7 @@ import fish.payara.eclipse.tools.server.PayaraServerPlugin; import fish.payara.eclipse.tools.server.exceptions.UniqueNameNotFound; import fish.payara.eclipse.tools.server.utils.WtpUtil; +import org.eclipse.wst.server.core.internal.Runtime; /** * This wizard fragment plugs-in the wizard flow when @@ -411,8 +413,8 @@ private IServerWorkingCopy getServer() { return (IServerWorkingCopy) getTaskModel().getObject(TaskModel.TASK_SERVER); } - private IRuntimeWorkingCopy getServerRuntime() { - return (IRuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); + private IRuntime getServerRuntime() { + return (IRuntime) getTaskModel().getObject(TASK_RUNTIME); } private void updateServerName() { @@ -460,14 +462,15 @@ protected String getDescription() { @Override public void setTaskModel(TaskModel taskModel) { super.setTaskModel(taskModel); - - IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); - if (runtime.getOriginal() == null) { - try { - runtime.setName(createUniqueRuntimeName(runtime.getRuntimeType().getName())); - } catch (UniqueNameNotFound e) { - // Set the type name and let the user handle validation error - runtime.setName(runtime.getRuntimeType().getName()); + if (getTaskModel().getObject(TASK_RUNTIME) instanceof RuntimeWorkingCopy) { + IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TASK_RUNTIME); + if (runtime.getOriginal() == null) { + try { + runtime.setName(createUniqueRuntimeName(runtime.getRuntimeType().getName())); + } catch (UniqueNameNotFound e) { + // Set the type name and let the user handle validation error + runtime.setName(runtime.getRuntimeType().getName()); + } } } } From d677a084113fa83885bca267fd3c69b8772f5acd Mon Sep 17 00:00:00 2001 From: Gaurav Gupta <gaurav.gupta@payara.fish> Date: Mon, 2 Jan 2023 16:14:03 +0530 Subject: [PATCH 6/6] FISH-6928 Release Payara Eclipse tools 2.0.0.Beta1 --- bundles/fish.payara.eclipse.tools.micro/META-INF/MANIFEST.MF | 2 +- bundles/fish.payara.eclipse.tools.micro/pom.xml | 2 +- bundles/fish.payara.eclipse.tools.server/META-INF/MANIFEST.MF | 2 +- bundles/fish.payara.eclipse.tools.server/pom.xml | 2 +- bundles/pom.xml | 2 +- features/fish.payara.eclipse.tools.micro.feature/feature.xml | 2 +- features/fish.payara.eclipse.tools.server.feature/feature.xml | 2 +- features/pom.xml | 2 +- pom.xml | 4 ++-- releng/fish.payara.eclipse.20229/pom.xml | 2 +- releng/fish.payara.eclipse.update/category.xml | 4 ++-- releng/fish.payara.eclipse.update/pom.xml | 2 +- releng/pom.xml | 2 +- 13 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bundles/fish.payara.eclipse.tools.micro/META-INF/MANIFEST.MF b/bundles/fish.payara.eclipse.tools.micro/META-INF/MANIFEST.MF index 5dc4794d..7a899caa 100644 --- a/bundles/fish.payara.eclipse.tools.micro/META-INF/MANIFEST.MF +++ b/bundles/fish.payara.eclipse.tools.micro/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Payara Micro Tools Bundle-SymbolicName: fish.payara.eclipse.tools.micro;singleton:=true -Bundle-Version: 2.0.0.qualifier +Bundle-Version: 2.0.0.Beta1 Bundle-ClassPath: . Bundle-Localization: plugin Bundle-Activator: fish.payara.eclipse.tools.micro.PayaraMicroPlugin diff --git a/bundles/fish.payara.eclipse.tools.micro/pom.xml b/bundles/fish.payara.eclipse.tools.micro/pom.xml index 2d4475d7..eb1a261b 100644 --- a/bundles/fish.payara.eclipse.tools.micro/pom.xml +++ b/bundles/fish.payara.eclipse.tools.micro/pom.xml @@ -9,7 +9,7 @@ <parent> <groupId>fish.payara.eclipse</groupId> <artifactId>fish.payara.eclipse.bundles</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.0.Beta1</version> </parent> <build> <sourceDirectory>src</sourceDirectory> diff --git a/bundles/fish.payara.eclipse.tools.server/META-INF/MANIFEST.MF b/bundles/fish.payara.eclipse.tools.server/META-INF/MANIFEST.MF index 83a3d846..a55bb89e 100644 --- a/bundles/fish.payara.eclipse.tools.server/META-INF/MANIFEST.MF +++ b/bundles/fish.payara.eclipse.tools.server/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Payara Server Tools Bundle-SymbolicName: fish.payara.eclipse.tools.server;singleton:=true -Bundle-Version: 2.0.0.qualifier +Bundle-Version: 2.0.0.Beta1 Bundle-ClassPath: . Bundle-Localization: plugin Bundle-Activator: fish.payara.eclipse.tools.server.PayaraServerPlugin diff --git a/bundles/fish.payara.eclipse.tools.server/pom.xml b/bundles/fish.payara.eclipse.tools.server/pom.xml index d7c3fd41..2d04d4f2 100644 --- a/bundles/fish.payara.eclipse.tools.server/pom.xml +++ b/bundles/fish.payara.eclipse.tools.server/pom.xml @@ -9,7 +9,7 @@ <parent> <groupId>fish.payara.eclipse</groupId> <artifactId>fish.payara.eclipse.bundles</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.0.Beta1</version> </parent> <build> <sourceDirectory>src</sourceDirectory> diff --git a/bundles/pom.xml b/bundles/pom.xml index 48cbf80f..acdca04c 100644 --- a/bundles/pom.xml +++ b/bundles/pom.xml @@ -9,7 +9,7 @@ <parent> <groupId>fish.payara.eclipse</groupId> <artifactId>fish.payara.eclipse.root</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.0.Beta1</version> </parent> <modules> diff --git a/features/fish.payara.eclipse.tools.micro.feature/feature.xml b/features/fish.payara.eclipse.tools.micro.feature/feature.xml index 8d7040bf..985c6d7f 100644 --- a/features/fish.payara.eclipse.tools.micro.feature/feature.xml +++ b/features/fish.payara.eclipse.tools.micro.feature/feature.xml @@ -2,7 +2,7 @@ <feature id="fish.payara.eclipse.tools.micro.feature" label="Payara Micro Tools" - version="2.0.0.qualifier" + version="2.0.0.Beta1" provider-name="Payara Foundation"> <description url="https://www.payara.fish/products/ecosystem-catalog/"> diff --git a/features/fish.payara.eclipse.tools.server.feature/feature.xml b/features/fish.payara.eclipse.tools.server.feature/feature.xml index 47a38f1f..62617c1b 100644 --- a/features/fish.payara.eclipse.tools.server.feature/feature.xml +++ b/features/fish.payara.eclipse.tools.server.feature/feature.xml @@ -2,7 +2,7 @@ <feature id="fish.payara.eclipse.tools.server.feature" label="Payara Server Tools" - version="2.0.0.qualifier" + version="2.0.0.Beta1" provider-name="Payara Foundation"> <description url="https://www.payara.fish/products/ecosystem-catalog/"> diff --git a/features/pom.xml b/features/pom.xml index 555e86ca..bb9a17f7 100644 --- a/features/pom.xml +++ b/features/pom.xml @@ -8,7 +8,7 @@ <parent> <groupId>fish.payara.eclipse</groupId> <artifactId>fish.payara.eclipse.root</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.0.Beta1</version> </parent> <modules> diff --git a/pom.xml b/pom.xml index 2bd287a8..8e8a785b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>fish.payara.eclipse</groupId> <artifactId>fish.payara.eclipse.root</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.0.Beta1</version> <packaging>pom</packaging> <prerequisites> @@ -13,7 +13,7 @@ </prerequisites> <properties> - <tycho.version>3.0.0</tycho.version> + <tycho.version>3.0.1</tycho.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <eclipse.target>20229</eclipse.target> <eclipse-repo.url>https://download.eclipse.org/releases/2022-09</eclipse-repo.url> diff --git a/releng/fish.payara.eclipse.20229/pom.xml b/releng/fish.payara.eclipse.20229/pom.xml index 573cc8f9..2d39cfcf 100644 --- a/releng/fish.payara.eclipse.20229/pom.xml +++ b/releng/fish.payara.eclipse.20229/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>fish.payara.eclipse</groupId> <artifactId>fish.payara.eclipse.releng</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.0.Beta1</version> </parent> <artifactId>fish.payara.eclipse.20229</artifactId> diff --git a/releng/fish.payara.eclipse.update/category.xml b/releng/fish.payara.eclipse.update/category.xml index 60f13e6c..11725337 100644 --- a/releng/fish.payara.eclipse.update/category.xml +++ b/releng/fish.payara.eclipse.update/category.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <site> - <feature url="features/fish.payara.eclipse.tools.micro.feature_2.0.0.qualifier.jar" id="fish.payara.eclipse.tools.micro.feature" version="2.0.0.qualifier"> + <feature url="features/fish.payara.eclipse.tools.micro.feature_2.0.0.Beta1.jar" id="fish.payara.eclipse.tools.micro.feature" version="2.0.0.Beta1"> <category name="fish.payara.category"/> </feature> - <feature url="features/fish.payara.eclipse.tools.server.feature_2.0.0.qualifier.jar" id="fish.payara.eclipse.tools.server.feature" version="2.0.0.qualifier"> + <feature url="features/fish.payara.eclipse.tools.server.feature_2.0.0.Beta1.jar" id="fish.payara.eclipse.tools.server.feature" version="2.0.0.Beta1"> <category name="fish.payara.category"/> </feature> <category-def name="fish.payara.category" label="Payara Tools"/> diff --git a/releng/fish.payara.eclipse.update/pom.xml b/releng/fish.payara.eclipse.update/pom.xml index 92d7881f..f77ed42f 100644 --- a/releng/fish.payara.eclipse.update/pom.xml +++ b/releng/fish.payara.eclipse.update/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>fish.payara.eclipse</groupId> <artifactId>fish.payara.eclipse.releng</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.0.Beta1</version> </parent> <artifactId>fish.payara.eclipse.update</artifactId> <packaging>eclipse-repository</packaging> diff --git a/releng/pom.xml b/releng/pom.xml index 4ff84f73..082f84f2 100644 --- a/releng/pom.xml +++ b/releng/pom.xml @@ -9,7 +9,7 @@ <parent> <groupId>fish.payara.eclipse</groupId> <artifactId>fish.payara.eclipse.root</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.0.Beta1</version> </parent> <modules>