Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Pinčuk <alexander.v.pinchuk@gmail.com>
  • Loading branch information
avpinchuk committed Feb 19, 2024
1 parent f9a70ec commit 3aac2e9
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 251 deletions.
1 change: 0 additions & 1 deletion nucleus/core/kernel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@
<includes>
<include>com/sun/enterprise/deployment/backend/*.properties</include>
<include>com/sun/enterprise/v3/**/*.properties</include>
<include>com/sun/enterprise/v3/**/downloadgui.html</include>
<include>com/sun/enterprise/v3/**/status.html</include>
<include>com/sun/enterprise/v3/**/statusNotDAS.html</include>
<include>com/sun/enterprise/v3/**/statusDisabled.html</include>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ enum AdapterState {
APPLICATION_BACKUP_FALED("state.backupFailed", "Cannot backup previous version of __admingui"),
APPLICATION_CLEANUP_FALED("state.cleanupFailed", "Exception while cleaning previous instance of admin GUI"),
APPLICATION_BACKUP_CLEANING("state.cleaningBackup", "Cleaning up temporary backup file..."),
APPLICATION_BACKUP_CLEANED("state.cleanupFailed", "Temporary backup file removed"),
APPLICATION_BACKUP_CLEANED("state.backupCleaned", "Temporary backup file removed"),
APPLICATION_RESTORE("state.restore", "Restoring previously deployed Admin Console..."),
APPLICATION_UPGRADE_FALED("state.upgradeFailed", "Cannot upgrade Admin Console."),
WELCOME_TO("status.welcometo", "Welcome to ");
WELCOME_TO("state.welcometo", "Welcome to ");


private final String desc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
import org.glassfish.grizzly.http.util.HttpStatus;
import org.glassfish.hk2.api.PostConstruct;
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.internal.data.ApplicationRegistry;
import org.glassfish.kernel.KernelLoggerInfo;
import org.glassfish.server.ServerEnvironmentImpl;
import org.jvnet.hk2.annotations.Service;
Expand Down Expand Up @@ -110,12 +109,9 @@ public final class AdminConsoleAdapter extends HttpHandler implements Adapter, P
private File warFile; // GF Admin Console War File Location
private volatile AdapterState stateMsg = AdapterState.UNINITIAZED;
private volatile boolean installing;
private boolean isOK = false; // FIXME: initialize this with previous user choice
private AdminConsoleConfigUpgrade adminConsoleConfigUpgrade = null;
private final CountDownLatch latch = new CountDownLatch(1);
@Inject
ApplicationRegistry appRegistry;
@Inject
Domain domain;
@Inject
ServiceLocator habitat;
Expand All @@ -127,13 +123,10 @@ public final class AdminConsoleAdapter extends HttpHandler implements Adapter, P
AdminEndpointDecider epd;
private static final Logger logger = KernelLoggerInfo.getLogger();
private String statusHtml;
private String initHtml;
private boolean isRegistered = false;
private ResourceBundle bundle;
//don't change the following without changing the html pages
private static final String MYURL_TOKEN = "%%%MYURL%%%";
private static final String STATUS_TOKEN = "%%%STATUS%%%";
private static final String REDIRECT_TOKEN = "%%%LOCATION%%%";
private static final String RESOURCE_PACKAGE = "com/sun/enterprise/v3/admin/adapter";
private static final String INSTALL_ROOT = SystemPropertyConstants.INSTALL_ROOT_PROPERTY;
static final String ADMIN_APP_NAME = ServerEnvironmentImpl.DEFAULT_ADMIN_CONSOLE_APP_NAME;
Expand All @@ -145,7 +138,6 @@ public final class AdminConsoleAdapter extends HttpHandler implements Adapter, P
* Constructor.
*/
public AdminConsoleAdapter() throws IOException {
initHtml = Utils.packageResource2String("downloadgui.html");
statusHtml = Utils.packageResource2String("status.html");
}

Expand Down Expand Up @@ -478,7 +470,6 @@ public void event(@RestrictTo(EventTypes.SERVER_READY_NAME) Event<?> event) {
*/
private void init() {
// Get loading option
// FIXME : Use ServerTags, when this is finalized.
Property loadingOptionProperty = adminService.getProperty(ServerTags.ADMIN_CONSOLE_STARTUP);
if (loadingOptionProperty != null) {
String loadingOptionValue = loadingOptionProperty.getValue();
Expand Down Expand Up @@ -557,14 +548,12 @@ void initRest() {
private void initState() {
// It is a given that the application is NOT loaded to begin with
if (appExistsInConfig()) {
isOK = true; // FIXME: I don't think this is good enough
setStateMsg(AdapterState.APPLICATION_INSTALLED_BUT_NOT_LOADED);
} else if (new File(warFile.getParentFile(), ADMIN_APP_NAME).exists() || warFile.exists()) {
// The exploded dir, or the .war exists... mark as downloded
if (logger.isLoggable(Level.FINE)) {
setStateMsg(AdapterState.DOWNLOADED);
}
isOK = true;
} else {
setStateMsg(AdapterState.APPLICATION_NOT_INSTALLED);
}
Expand Down Expand Up @@ -601,69 +590,13 @@ private void logRequest(Request req) {
}
}

/**
*
*/
enum InteractionResult {

OK,
CANCEL,
FIRST_TIMER;
}

/**
* <p> Determines if the user has permission.</p>
*/
private boolean hasPermission(InteractionResult ir) {
//do this quickly as this is going to block the grizzly worker thread!
//check for returning user?
if (ir == InteractionResult.OK) {
isOK = true;
}
return isOK;
}

/**
*
*/
private void startThread() {
new InstallerThread(this, habitat, domain, env, contextRoot, epd.getGuiHosts()).start();
}

/**
*
*/
/*
private synchronized InteractionResult getUserInteractionResult(GrizzlyRequest req) {
if (req.getParameter(OK_PARAM) != null) {
proxyHost = req.getParameter(PROXY_HOST_PARAM);
if ((proxyHost != null) && !proxyHost.equals("")) {
String ps = req.getParameter(PROXY_PORT_PARAM);
try {
proxyPort = Integer.parseInt(ps);
} catch (NumberFormatException nfe) {
throw new IllegalArgumentException(
"The specified proxy port (" + ps
+ ") must be a valid port integer!", nfe);
}
}
// FIXME: I need to "remember" this answer in a persistent way!! Or it will popup this message EVERY time after the server restarts.
setStateMsg(AdapterState.PERMISSION_GRANTED);
isOK = true;
return InteractionResult.OK;
} else if (req.getParameter(CANCEL_PARAM) != null) {
// Canceled
// FIXME: I need to "remember" this answer in a persistent way!! Or it will popup this message EVERY time after the server restarts.
setStateMsg(AdapterState.CANCELED);
isOK = false;
return InteractionResult.CANCEL;
}
// This is a first-timer
return InteractionResult.FIRST_TIMER;
}
*
*/
private OutputBuffer getOutputBuffer(Response res) {
res.setStatus(HttpStatus.ACCEPTED_202);
res.setContentType("text/html");
Expand Down Expand Up @@ -693,7 +626,6 @@ private void sendStatusPage(Request req, Response res) {
String locationUrl = req.getScheme()
+ "://" + req.getServerName()
+ ':' + req.getServerPort() + "/login.jsf";
localHtml = localHtml.replace(REDIRECT_TOKEN, locationUrl);
bytes = localHtml.replace(STATUS_TOKEN, status).getBytes("UTF-8");
res.setContentLength(bytes.length);
ob.write(bytes, 0, bytes.length);
Expand Down Expand Up @@ -805,10 +737,6 @@ private String replaceTokens(String text, ResourceBundle bundle) {
return buf.toString();
}

public AdminService getAdminService() {
return adminService;
}

private void writeAdminServiceProp(final String propName, final String propValue) {
try {
ConfigSupport.apply(new SingleConfigCode<AdminService>() {
Expand All @@ -835,7 +763,6 @@ private void handleLoadedState() {
//System.out.println(" Handle Loaded State!!");
// do nothing
statusHtml = null;
initHtml = null;
}

@Override
Expand All @@ -852,35 +779,7 @@ public InetAddress getListenAddress() {
public List<String> getVirtualServers() {
return epd.getGuiHosts();
}
// enum HttpMethod {
// OPTIONS ("OPTIONS"),
// GET ("GET"),
// HEAD ("HEAD"),
// POST ("POST"),
// PUT ("PUT"),
// DELETE ("DELETE"),
// TRACE ("TRACE"),
// CONNECT ("CONNECT");
//
// private String method;
//
// HttpMethod(String method) {
// this.method = method;
// }
//
// static HttpMethod getHttpMethod(String httpMethod) {
// for (HttpMethod hh: HttpMethod.values()) {
// if (hh.method.equalsIgnoreCase(httpMethod)) {
// return hh;
// }
// }
// return null;
// }
//
// String method() {
// return method;
// }
// }

private final Method[] allowedHttpMethods = {Method.GET, Method.POST, Method.HEAD,
Method.DELETE, Method.PUT};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package com.sun.enterprise.v3.admin.adapter;

import com.sun.enterprise.config.serverbeans.*;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
Expand All @@ -35,18 +34,12 @@
@RunLevel(PostStartupRunLevel.VAL)
public class AdminConsoleStartupService implements PostConstruct {

@Inject
private AdminService adminService;

@Inject @Optional
private AdminConsoleAdapter adminConsoleAdapter = null;

@Inject
private ServerEnvironmentImpl env;

@Inject
private Domain domain;

private static final Logger logger = KernelLoggerInfo.getLogger();
private final long ONE_DAY = 24 * 60 * 60 * 1000;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,12 @@
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
#


button.ok=OK
button.cancel=Cancel
connection.direct=Direct
connection.proxy=Through a Proxy
connection.proxy.host=Proxy Host:
connection.proxy.port=Proxy Port:
connection.title=Internet Connection
connection.helpText=If your GlassFish Application Server requires a proxy to reach the Internet, you will need to supply your proxy host and port information.
console.moreInfo.link=https://glassfish.dev.java.net/
console.moreInfo.linkText=More about the console
install.pageTitle=GlassFish Administration Console - Installation
install.text=The GlassFish Administration Console is not installed. To install the console, specify an Internet connection and click OK.
product.title=GlassFish Server Administration Console

status.pageTitle=GlassFish Server Administration Console
status.current=Status:
status.loading=The console is starting. Please wait.
status.spin.alt=Status indicator image.
status.pageTitle=GlassFish Server Administration Console
status.text=If the browser does not refresh the page automatically please reload the page.
status.welcometo=Welcome to\u0020
thankYou=Welcome to GlassFish !!

state.uninitialized=The Admin Console Adapter is not yet initialized.
Expand All @@ -55,10 +41,10 @@ state.prepareRedeploy=Preparing to upgrade Admin Console Application...
state.cleanupFailed=Exception while cleaning previous instance of admin console
state.backupFailed=Cannot rename __admingui to __admingui.backup
state.cleaningBackup=Cleaning up temporary backup file...
state.cleanupFailed=Temporary backup file removed
state.backupCleaned=Temporary backup file removed
state.restore=Restoring previously deployed Admin Console...
state.upgradeFailed=Upgrade of Admin Console failed. Check file or directory permission.

state.welcometo=Welcome to\u0020

statusNotAvailable.pageTitle=Administration Console Not Available
statusNotAvailable.notDas=The Administration Console is available only from the Domain Administration Server. It is not accessible from a Server Instance.
Expand Down

This file was deleted.

0 comments on commit 3aac2e9

Please sign in to comment.