From 7a3e690035be626e899b029bfd78cf56eadb38da Mon Sep 17 00:00:00 2001 From: Piotrek Zygielo Date: Wed, 18 Jan 2023 13:04:29 +0100 Subject: [PATCH] Remove unused classes (server-mgmt/c.s.e.a.s.pe) --- .../admin/servermgmt/pe/InstanceTimer.java | 60 --------- .../servermgmt/pe/LocalStrings.properties | 1 - .../pe/ProfileTransformationException.java | 36 ----- .../servermgmt/pe/ProfileTransformer.java | 127 ------------------ .../admin/servermgmt/pe/TimerCallback.java | 21 --- 5 files changed, 245 deletions(-) delete mode 100644 nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/InstanceTimer.java delete mode 100644 nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/ProfileTransformationException.java delete mode 100644 nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/ProfileTransformer.java delete mode 100755 nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/TimerCallback.java diff --git a/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/InstanceTimer.java b/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/InstanceTimer.java deleted file mode 100644 index 274d0fba4be..00000000000 --- a/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/InstanceTimer.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 1997, 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 - */ - -package com.sun.enterprise.admin.servermgmt.pe; - -public final class InstanceTimer implements Runnable { - private final int timeOutSeconds; - private final TimerCallback callBack; - private final int startAfterSeconds; - private boolean timeOutReached; - private long startTime; - - public InstanceTimer(int timeOutSeconds, int startAfterSeconds, TimerCallback callBack) { - this.timeOutSeconds = timeOutSeconds; - this.startAfterSeconds = startAfterSeconds; - this.callBack = callBack; - this.timeOutReached = false; - } - - public void run() { - startTime = System.currentTimeMillis(); - try { - Thread.sleep(startAfterSeconds * 1000L); - while (!timeOutReached() && !callBack.check()) { - try { - Thread.sleep(1000); - computeTimeOut(); - } catch (InterruptedException ie) { - //sLogger.warning(ie.toString()); - timeOutReached = true; - } - } - } catch (Exception e) { - //sLogger.warning(e.toString()); - timeOutReached = true; - } - } - - private boolean timeOutReached() { - return timeOutReached; - } - - private void computeTimeOut() { - long currentTime = System.currentTimeMillis(); - timeOutReached = ((currentTime - startTime) >= (timeOutSeconds * 1000L)); - } -} diff --git a/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/LocalStrings.properties b/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/LocalStrings.properties index 746823c44bc..c0409dafdd2 100644 --- a/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/LocalStrings.properties +++ b/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/LocalStrings.properties @@ -57,7 +57,6 @@ genericProfileHandlingStarts=------ Using Profile [{0}] to create the domain --- profilePropertiesMissing=The file [{0}] \ncontaining the properties of profile - either does not exist or could not be read.\nRetry after creating it.\n styleSheetNotFound=A style sheet [{0}] was specified as [{1}] in properties file, but it does not exist.\nRetry after creating the stylesheet.\n genericXmlProcessing=XML processing for custom profile: Base document [{0}]. Profile name [{1}]. Processing property [{2}].\n -xformPhaseComplete=XML processing for custom profile: Style-sheet [{0}] processed successfully. Result is stored at: [{1}]. \n processingToken=Processing token name: [{0}], value: [{1}].\n invalidToken=Invalid token encountered [{0}], valid form is name=value\n noPidsToKill=No valid PID(s) found. This may be because the pid file has stale data. To avoid killing processes with wrong PID this force kill attempt has been aborted. diff --git a/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/ProfileTransformationException.java b/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/ProfileTransformationException.java deleted file mode 100644 index b7a3fdc516c..00000000000 --- a/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/ProfileTransformationException.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 1997, 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 - */ - -package com.sun.enterprise.admin.servermgmt.pe; - -public class ProfileTransformationException extends Exception { - - public ProfileTransformationException() { - } - - /** - * Constructs an instance of ProfleTransformationException with the specified detail message. - * - * @param msg the detail message. - */ - public ProfileTransformationException(String msg) { - super(msg); - } - - public ProfileTransformationException(final Exception e) { - super(e); - } -} diff --git a/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/ProfileTransformer.java b/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/ProfileTransformer.java deleted file mode 100644 index d27457b2a3d..00000000000 --- a/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/ProfileTransformer.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 1997, 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 - */ - -package com.sun.enterprise.admin.servermgmt.pe; - -import com.sun.enterprise.util.i18n.StringManager; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.URI; -import java.util.Collections; -import java.util.List; -import java.util.Locale; -import java.util.Properties; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.*; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; -import org.w3c.dom.Document; -import org.xml.sax.EntityResolver; - -final class ProfileTransformer { - - private final File baseXml; - private final List styleSheets; - private final File destDir; - private final EntityResolver er; - private final Properties op; - private static final StringManager sm = StringManager.getManager(ProfileTransformer.class); - - ProfileTransformer(final File baseXml, final List styleSheets, final File destDir, final EntityResolver er, final Properties op) { - if (baseXml == null || styleSheets == null || destDir == null) { - throw new IllegalArgumentException("null arguments"); - } - this.baseXml = baseXml; - this.styleSheets = Collections.unmodifiableList(styleSheets); - this.destDir = destDir; - this.er = er; - this.op = new Properties(op); - } - - File transform() throws ProfileTransformationException { - if (styleSheets.isEmpty()) { - return (baseXml); - } - BufferedOutputStream bos = null; - try { - final String fn = baseXml.getName(); - final DocumentBuilderFactory bf = DocumentBuilderFactory.newInstance(); - // it is OK to keep this as a non-validating parser. - final DocumentBuilder builder = bf.newDocumentBuilder(); - builder.setEntityResolver(er); - final TransformerFactory tf = TransformerFactory.newInstance(); - Document doc = null; - DOMSource src; - int cnt = 0; - File rfn = null; - for (final File ss : styleSheets) { - //System.out.println("ss = " + ss.getAbsolutePath()); - if (cnt == 0) - doc = builder.parse(baseXml); - src = new DOMSource(doc); - rfn = new File(destDir, fn + "transformed" + cnt); - bos = new BufferedOutputStream(new FileOutputStream(rfn)); - final StreamResult result = new StreamResult(bos); - final StreamSource sss = new StreamSource(ss); - final Transformer xf = tf.newTransformer(sss); - xf.setURIResolver(new TemplateUriResolver()); - xf.setOutputProperties(op); - xf.transform(src, result); - doc = builder.parse(rfn); - cnt++; - final String msg = sm.getString("xformPhaseComplete", ss.getAbsolutePath(), rfn.getAbsolutePath()); - System.out.println(msg); - } - return (rfn); - } catch (final Exception e) { - throw new ProfileTransformationException(e); - } finally { - try { - if (bos != null) - bos.close(); - } catch (IOException eee) { - //Have to squelch - } - } - } - - private static class TemplateUriResolver implements URIResolver { - - @Override - public Source resolve(final String href, final String base) throws TransformerException { - try { - StreamSource source = null; - final URI baseUri = new URI(base); - final URI tbResolved = baseUri.resolve(href); - final boolean isFileUri = tbResolved.toString().toLowerCase(Locale.ENGLISH).startsWith("file:"); - if (isFileUri) { - final File f = new File(tbResolved); - if (f.exists()) { - //System.out.println("File Exists: " + f.toURI()); - source = new StreamSource(f); - } - } // in all other cases, let the processor take care of it - return (source); - } catch (final Exception e) { - throw new TransformerException(e); - } - } - } -} diff --git a/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/TimerCallback.java b/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/TimerCallback.java deleted file mode 100755 index cb6cae97047..00000000000 --- a/nucleus/admin/server-mgmt/src/main/java/com/sun/enterprise/admin/servermgmt/pe/TimerCallback.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 1997, 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 - */ - -package com.sun.enterprise.admin.servermgmt.pe; - -public interface TimerCallback { - boolean check() throws Exception; -}