Skip to content

Commit

Permalink
Cleanup in i18n related to previous commit and it's PR
Browse files Browse the repository at this point in the history
- removed unused properties
- moved properties in incorrect files
- deleted one file and it's content was set where appropriate
- properties with the same key on other places were checked too.

Signed-off-by: David Matějček <david.matejcek@omnifish.ee>
  • Loading branch information
dmatej committed Sep 11, 2022
1 parent 2e8aa74 commit a4c8d9c
Show file tree
Hide file tree
Showing 14 changed files with 135 additions and 178 deletions.
Expand Up @@ -18,13 +18,15 @@ CommandSuccessful=Command {0} executed successfully.
CommandUnSuccessful=Command {0} failed.
CommandUnSuccessfulWithArg=Command {0} failed: {1}
no.console=Not connected to console, giving up

###################
internal.error=Internal Error: {0}
###################
## start-database, stop-database command
DatabaseNotInstalled=The database is not installed. Please download and install the database from the Update Center.
DatabaseStartMsg=Starting database in the background.
DatabaseNotStarted=Database not started.
InvalidPortNumber=Port {0} should be a numeric value.
LogRedirectedTo=Log redirected to {0}.
StartDatabaseStatus=Database already started on host {0}, port {1}.
StopDatabaseStatus=Unable to stop database on host {0}, port {1}.
Expand Down
Expand Up @@ -44,17 +44,12 @@ NewPasswordDescriptionDefaultPrompt={0} [Enter to accept default password "{1}"]
MasterPasswordConfirmationPrompt=Enter the master password again>\u0020
MasterPasswordConfirmationWithDefaultPrompt=Enter master password again [Enter to accept default]>\u0020
MasterPasswordWithDefaultPrompt=Enter master password [Enter to accept default]>\u0020
PortNotSpecified=Port for {0} is not specified. Using {1}
PortInUseError=Port for {0} ({1}) is in use. Try a different port number.
PortInUseWarning=Warning: Port {0} is in use. Ignoring since the checkports option is set to false.
NoPermissionForPortError=You do not have permission to use port {0} for {1}. Try a different port number or login to a more privileged account.
NoPermissionForPortMsg=You do not have permission to use port {0} for {1}. Try a different port number or login to a more privileged account.
NoPermissionForPortWarning=Warning: You do not have permission to use port {0} for {1}. Ignoring since the checkports option is set to false.
UnknownPortMsg=Unknown error when trying port {0}. Try a different port number.
DefaultPortInUse=Default port {1} for {0} is in use. Using {2}
UsingDefaultPort=Using default port {1} for {0}.
UsingPort=Using port {1} for {0}.
PortPrivilege=On Unix platform, port numbers below 1024 may require special privileges.
RequireEitherOrOption=Option {0} or {1} must be specified.
UsingProfile=Domain being created with profile:{0}, as specified {1}.
LoginInfoStored=Login information relevant to admin user name [{0}] for host [{1}] and admin port [{2}] stored at [{3}] successfully.\nMake sure that this file remains protected. Information stored in this file will be used by administration commands to manage associated domain.
Expand Down
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -14,29 +15,16 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

/*
* RepositoryManager.java
*
* Created on August 19, 2003, 2:29 PM
*/
package com.sun.enterprise.admin.servermgmt;

import com.sun.enterprise.admin.servermgmt.pe.PEDomainsManager;
import com.sun.enterprise.admin.servermgmt.pe.PEFileLayout;
import com.sun.enterprise.admin.util.LineTokenReplacer;
import com.sun.enterprise.admin.util.TokenValue;
import com.sun.enterprise.admin.util.TokenValueSet;
import com.sun.enterprise.admin.util.LineTokenReplacer;
import com.sun.enterprise.util.*;
import com.sun.enterprise.util.io.FileUtils;
import com.sun.enterprise.admin.servermgmt.pe.PEFileLayout;
import com.sun.enterprise.admin.servermgmt.pe.PEDomainsManager;
import com.sun.enterprise.util.i18n.StringManager;
import com.sun.enterprise.security.store.PasswordAdapter;

//import com.sun.enterprise.admin.common.Status;
//import com.sun.enterprise.util.system.GFSystem;
import java.io.*;

import java.util.*;
import com.sun.enterprise.util.zip.ZipFile;
import com.sun.enterprise.util.OS;
import com.sun.enterprise.util.ProcessExecutor;

//import javax.management.remote.JMXAuthenticator;
//import com.sun.enterprise.admin.server.core.jmx.auth.ASJMXAuthenticator;
Expand All @@ -49,12 +37,26 @@

import com.sun.enterprise.util.SystemPropertyConstants;
//import com.sun.enterprise.util.ExecException;
import com.sun.enterprise.util.i18n.StringManager;
import com.sun.enterprise.util.io.FileUtils;
import com.sun.enterprise.util.zip.ZipFile;

//import com.sun.enterprise.admin.common.Status;
//import com.sun.enterprise.util.system.GFSystem;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* The RepositoryManager serves as a common base class for the following PEDomainsManager, PEInstancesManager,
* AgentManager (the SE Node Agent). Its purpose is to abstract out any shared functionality related to lifecycle
* management of domains, instances and node agents. This includes creation, deletion, listing, and starting and
* stopping.
* The RepositoryManager serves as a common base class for the following PEDomainsManager,
* PEInstancesManager, AgentManager (the SE Node Agent).
* It's purpose is to abstract out any shared functionality related to lifecycle management of
* domains, instances and node agents.
* This includes creation, deletion, listing, and starting and stopping.
*
* @author kebbs
*/
Expand All @@ -64,25 +66,25 @@ public class RepositoryManager extends MasterPasswordFileManager {
* node-agent, or server instance.
*/
protected static class RepositoryManagerMessages {
private StringManager _strMgr;
private String _badNameMessage;
private String _repositoryNameMessage;
private String _repositoryRootMessage;
private String _existsMessage;
private String _noExistsMessage;
private String _repositoryNotValidMessage;
private String _cannotDeleteMessage;
private String _invalidPathMessage;
private String _listRepositoryElementMessage;
private String _cannotDeleteInstance_invalidState;
private String _instanceStartupExceptionMessage;
private String _cannotStartInstance_invalidStateMessage;
private String _startInstanceTimeOutMessage;
private String _portConflictMessage;
private String _startupFailedMessage;
private String _cannotStopInstance_invalidStateMessage;
private String _cannotStopInstanceMessage;
private String _timeoutStartingMessage;
private final StringManager _strMgr;
private final String _badNameMessage;
private final String _repositoryNameMessage;
private final String _repositoryRootMessage;
private final String _existsMessage;
private final String _noExistsMessage;
private final String _repositoryNotValidMessage;
private final String _cannotDeleteMessage;
private final String _invalidPathMessage;
private final String _listRepositoryElementMessage;
private final String _cannotDeleteInstance_invalidState;
private final String _instanceStartupExceptionMessage;
private final String _cannotStartInstance_invalidStateMessage;
private final String _startInstanceTimeOutMessage;
private final String _portConflictMessage;
private final String _startupFailedMessage;
private final String _cannotStopInstance_invalidStateMessage;
private final String _cannotStopInstanceMessage;
private final String _timeoutStartingMessage;
private String _cannotDeleteJmsProviderInstance;

public RepositoryManagerMessages(StringManager strMgr, String badNameMessage, String repositoryNameMessage,
Expand Down Expand Up @@ -323,7 +325,7 @@ protected void setPermissions(RepositoryConfig repositoryConfig) throws Reposito
try {
chmod("-R 755", domainDir);
} catch (Exception e) {
throw new RepositoryException(_strMgr.getString("setPermissionError"), e);
throw new RepositoryException("Error setting permissions.", e);
}
}

Expand Down Expand Up @@ -615,7 +617,7 @@ protected void createMQInstance(RepositoryConfig config) throws RepositoryExcept
final File mqVarHome = layout.getImqVarHome();
try {
FileUtils.mkdirsMaybe(mqVarHome);
final List<String> cmdInput = new ArrayList<String>();
final List<String> cmdInput = new ArrayList<>();
cmdInput.add(broker.getAbsolutePath());
cmdInput.add("-init");
cmdInput.add("-varhome");
Expand Down
Expand Up @@ -52,7 +52,6 @@ domain.fileinuse=A file or folder within domain {0} at {1} is in use. Stop using
## create-domain
InvalidCharInDomain=CLI129: Invalid character in domain name, {0}
CouldNotCreateDomain=CLI130: Could not create domain, {0}
InvalidPortNumber=CLI136: Port {0} should be a numeric value.
RequireEitherOrOption=Option {0} or {1} must be specified.
AdminPassword=Enter the admin password
AdminPasswordAgain=Enter the admin password again
Expand All @@ -66,18 +65,13 @@ NoPermissionForPortError=You do not have permission to use port {0} for {1}. Try
NoPermissionForPortWarning=Warning: You do not have permission to use port {0} for {1}. Ignoring since the checkports option is set to false.
UnknownPortMsg=Unknown error when trying port {0}. Try a different port number.
InvalidPortBaseRange=CLI211: Invalid Port {0} for {1}, should be between 1 and 65535. Choose a portbase value such that the resulting port number doesn''t exceed 65535.
UsingPort=Using port {1} for {0}.
DomainExists=Domain exists: {0}
OverwriteLoginMsgCreateDomain=Admin login information for host [{0}] and port [{1}]\nis being overwritten with credentials provided because the\n--savelogin option was used during the create-domain command.
LoginInfoNotStoredCreateDomain=Login information relevant to the admin user name [{0}] for this domain [{1}] could not be stored.\nThe .gfclient/pass file in the home directory may be corrupt.\nCheck the format of this file.

DefaultPortInUse=Default port {1} for {0} is in use. Using {2}
PortNotSpecified=Port for {0} is not specified. Using {1}
InvalidPortRangeMsg=Invalid Port for {0}, should be between 1 and 65535. Using {1}
InvalidPortNumber=CLI136: Port {0} should be a numeric value.
PortInUse=Port {1} for {0} is in use. Using {2}
UsingDefaultPort=Using default port {1} for {0}.
MutuallyExclusiveOption=CLI169: Options {0} and {1} are mutually exclusive. You must specify one or the other but not both.
PortPrivilege=On Unix platforms, port numbers below 1024 may require special privileges.
PasswordMissing=Value for {0} was not specified.
PasswordLimit=CLI128: Value for {0} must have 8 or more characters.
InvalidPropertySyntax=Invalid property syntax: {0}
Expand Down
Empty file.
Expand Up @@ -24,7 +24,6 @@
import com.sun.enterprise.config.modularity.customization.CustomizationTokensProvider;
import com.sun.enterprise.config.modularity.customization.FileTypeDetails;
import com.sun.enterprise.config.modularity.customization.PortTypeDetails;
import com.sun.enterprise.universal.i18n.LocalStringsImpl;
import com.sun.enterprise.util.SystemPropertyConstants;
import com.sun.enterprise.util.net.NetUtils;

Expand All @@ -36,12 +35,13 @@
import java.util.Properties;
import java.util.Set;

import static java.text.MessageFormat.format;

/**
* Client class to retrieve customize tokens.
*/
public class CustomTokenClient {

private static final LocalStringsImpl _strings = new LocalStringsImpl(DomainBuilder.class);
/** Place holder for the PORT BASE value in domain.xml */
public static final String PORTBASE_PLACE_HOLDER = "PORT_BASE";

Expand All @@ -64,7 +64,7 @@ public CustomTokenClient(DomainConfig domainConfig) {
public Map<String, String> getSubstitutableTokens() throws DomainException {
CustomizationTokensProvider provider = CustomizationTokensProviderFactory.createCustomizationTokensProvider();
Map<String, String> generatedTokens = new HashMap<>();
String lineSeparator = System.getProperty("line.separator");
String lineSeparator = System.lineSeparator();
int noOfTokens = 0;
try {
List<ConfigCustomizationToken> customTokens = provider.getPresentConfigCustomizationTokens();
Expand All @@ -78,25 +78,27 @@ public Map<String, String> getSubstitutableTokens() throws DomainException {

Map<String, String> filePaths = new HashMap<>(3, 1);
filePaths.put(SystemPropertyConstants.INSTALL_ROOT_PROPERTY,
System.getProperty(SystemPropertyConstants.INSTALL_ROOT_PROPERTY));
System.getProperty(SystemPropertyConstants.INSTALL_ROOT_PROPERTY));
filePaths.put(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY,
System.getProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY));
filePaths.put(SystemPropertyConstants.JAVA_ROOT_PROPERTY, System.getProperty(SystemPropertyConstants.JAVA_ROOT_PROPERTY));
System.getProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY));
filePaths.put(SystemPropertyConstants.JAVA_ROOT_PROPERTY,
System.getProperty(SystemPropertyConstants.JAVA_ROOT_PROPERTY));
noOfTokens = customTokens.size();
for (ConfigCustomizationToken token : customTokens) {
String name = token.getName();
// Check for valid custom token parameters.
if (isNullOrEmpty(name) || isNullOrEmpty(token.getValue()) || isNullOrEmpty(token.getDescription())) {
throw new IllegalArgumentException(
_strings.get("invalidTokenParameters", name, token.getValue(), token.getDescription()));
throw new IllegalArgumentException(format(
"Invalid token, Empty/null values are not allowed for token name/value/description: {0}/{1}/{2}",
name, token.getValue(), token.getDescription()));
}
switch (token.getCustomizationType()) {
case PORT:
Integer port = null;
if (domainProps.containsKey(name)) {
port = Integer.valueOf(domainProps.getProperty(token.getName()));
if (!NetUtils.isPortFree(port)) {
throw new DomainException(_strings.get("unavailablePort", port));
throw new DomainException(format("Given port {0} is not free.", port));
}
} else {
if (portBase != null && token.getTokenTypeDetails() instanceof PortTypeDetails) {
Expand Down Expand Up @@ -135,12 +137,13 @@ public Map<String, String> getSubstitutableTokens() throws DomainException {
switch (details.getExistCondition()) {
case MUST_EXIST:
if (!file.exists()) {
throw new DomainException(_strings.get("missingFile", file.getAbsolutePath()));
throw new DomainException(format("Missing file : {0}", file));
}
break;
case MUST_NOT_EXIST:
if (file.exists()) {
throw new DomainException(_strings.get("filePresenceNotDesired", file.getAbsolutePath()));
throw new DomainException(format(
"File {0} must not exist for the domain creation process to succeed", file));
}
break;
case NO_OP:
Expand Down

0 comments on commit a4c8d9c

Please sign in to comment.