delete obsolete crud

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@501 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
sjfink 2006-12-06 15:09:06 +00:00
parent cde753f154
commit 7159e9eb9e
8 changed files with 7 additions and 281 deletions

View File

@ -56,10 +56,8 @@ Export-Package: .,
com.ibm.wala.util.graph.impl,
com.ibm.wala.util.graph.traverse,
com.ibm.wala.util.heapTrace,
com.ibm.wala.util.internationalization,
com.ibm.wala.util.intset,
com.ibm.wala.util.io,
com.ibm.wala.util.logging,
com.ibm.wala.util.math,
com.ibm.wala.util.perf,
com.ibm.wala.util.scope,

View File

@ -11,7 +11,6 @@
package com.ibm.wala.ipa.cha;
import com.ibm.wala.util.internationalization.StringBundle;
/**
* Exception class that indicates that construction of class hierarchy has been
@ -24,7 +23,7 @@ public final class CancelCHAConstructionException extends ClassHierarchyExceptio
private static final long serialVersionUID = -1987107302523285889L;
public CancelCHAConstructionException() {
super(StringBundle.getInstance().get("CancelCHAConstructionException.cancelation_message")); //$NON-NLS-1$
super("class hierarchy construction was cancelled");
}
}

View File

@ -20,7 +20,6 @@ import java.util.Properties;
import com.ibm.wala.util.config.FileProvider;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.internationalization.StringBundle;
import com.ibm.wala.util.warnings.WalaException;
public final class WalaProperties {
@ -34,7 +33,7 @@ public final class WalaProperties {
public final static String J2SE_DIR = "java_runtime_dir"; //$NON-NLS-1$
public final static String J2EE_DIR = "j2ee_runtime_dir"; //$NON-NLS-1$
public final static String ECLIPSE_PLUGINS_DIR = "eclipse_plugins_dir"; //$NON-NLS-1$
/**
@ -114,13 +113,13 @@ public final class WalaProperties {
public static Properties loadProperties() throws WalaException {
try {
Properties result = loadPropertiesFromFile(PROPERTY_FILENAME);
String outputDir = result.getProperty(OUTPUT_DIR, DefaultPropertiesValues.DEFAULT_OUTPUT_DIR);
result.setProperty(OUTPUT_DIR, convertToAbsolute(outputDir));
String walaReport = result.getProperty(WALA_REPORT, DefaultPropertiesValues.DEFAULT_WALA_REPORT_FILENAME);
result.setProperty(WALA_REPORT, convertToAbsolute(walaReport));
return result;
} catch (Exception e) {
e.printStackTrace();
@ -136,8 +135,7 @@ public final class WalaProperties {
public static Properties loadPropertiesFromFile(String fileName) throws IOException {
final InputStream propertyStream = WalaProperties.class.getClassLoader().getResourceAsStream(fileName);
if (propertyStream == null) {
throw new IOException(StringBundle.getInstance().get("PersistentPropertiesManager.property_file_unreadable", //$NON-NLS-1$
fileName));
throw new IOException("property_file_unreadable " + fileName);
}
Properties result = new Properties();
result.load(propertyStream);
@ -148,7 +146,7 @@ public final class WalaProperties {
final String envProperty = System.getProperty("WALA_HOME"); //$NON-NLS-1$
if (envProperty != null)
return envProperty;
final URL url = WalaProperties.class.getClassLoader().getResource("wala.properties"); //$NON-NLS-1$
if (url == null) {
return System.getProperty("user.dir"); //$NON-NLS-1$

View File

@ -1,62 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.wala.util.internationalization;
import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;
public final class GenericStringBundle implements IStringBundle {
public GenericStringBundle(final String resourceBundleName, final ClassLoader classLoader) {
this.resourceBundle = ResourceBundle.getBundle(resourceBundleName, Locale.getDefault(), classLoader);
}
// --- Interface methods implementation
public String get(final String messageID) {
return this.resourceBundle.getString(messageID);
}
public String get(final String messageID, final Object argument) {
return get(messageID, new Object[] { argument });
}
public String get(final String messageID, final Object[] arguments) {
return MessageFormat.format(get(messageID), arguments);
}
public String get(final Class clazz, final String secondPartOfID) {
return get(concat(clazz, secondPartOfID));
}
public String get(final Class clazz, final String secondPartOfID, final Object argument) {
return get(concat(clazz, secondPartOfID), new Object[] { argument });
}
public String get(final Class clazz, final String secondPartOfID, final Object[] arguments) {
return get(concat(clazz, secondPartOfID), arguments);
}
// --- Private code
private String concat(final Class clazz, final String secondPartOfID) {
return shortName(clazz.getName()).concat(".").concat(secondPartOfID); //$NON-NLS-1$
}
private String shortName(final String className) {
final int index = className.lastIndexOf('.');
return (index != -1) ? className.substring(index + 1) : className;
}
private final ResourceBundle resourceBundle;
}

View File

@ -1,83 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.wala.util.internationalization;
/**
* Implementation of this interface can read messages in a resource bundle with the appropriate key.
*
* @author egeay
*/
public interface IStringBundle {
/**
* Returns the message related to the given ID transmitted by parameter.
*
* @param messageID The ID for the message in the resource bundle.
*/
public String get( final String messageID );
/**
* Returns the parameterized message related to the ID and argument transmitted by parameters.
*
* @param messageID The ID for the message in the resource bundle.
* @param argument The argument for this parameterized message.
*/
public String get( final String messageID, final Object argument );
/**
* Returns the parameterized message related to the ID and arguments transmitted by parameters.
*
* @param messageID The ID for the message in the resource bundle.
* @param arguments The arguments for this parameterized message.
*/
public String get( final String messageID, final Object[] arguments );
/**
* Returns the message related to the ID which is a concatenation of next expression:
* <code>
* clazz.getName() + '.' + secondPartOfID
* </code>
*
* @param clazz The class in which the externalized message is present. Represents the first part
* of the ID construction.
* @param secondPartOfID The second part of the ID used for the final ID construction.
*/
public String get( final Class clazz, final String secondPartOfID );
/**
* Returns the parameterized message related to the argument passed by parameter and the ID
* which is a concatenation of next expression:
* <code>
* clazz.getName() + '.' + secondPartOfID
* </code>
*
* @param clazz The class in which the externalized message is present. Represents the first part
* of the ID construction.
* @param secondPartOfID The second part of the ID used for the final ID construction.
* @param argument The argument for this parameterized message.
*/
public String get( final Class clazz, final String secondPartOfID, final Object argument );
/**
* Returns the parameterized message related to the arguments passed by parameter and the ID
* which is a concatenation of next expression:
* <code>
* clazz.getName() + '.' + secondPartOfID
* </code>
*
* @param clazz The class in which the externalized message is present. Represents the first part
* of the ID construction.
* @param secondPartOfID The second part of the ID used for the final ID construction.
* @param arguments The arguments for this parameterized message.
*/
public String get( final Class clazz, final String secondPartOfID, final Object[] arguments );
}

View File

@ -1,39 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.wala.util.internationalization;
/**
* Main utility class used as an entry point to access an
* {@link com.ibm.wala.util.internationalization.IStringBundle} instance.
* Each project has to define its own StringBundle class to get access to their own properties file.
*
* @author egeay
*/
public final class StringBundle {
/**
* Returns an unique instance of {@link com.ibm.wala.util.internationalization.IStringBundle}
* implementation.
*/
public static IStringBundle getInstance() {
return INSTANCE;
}
//--- Private code
private static final IStringBundle INSTANCE = new GenericStringBundle(
"WalaUtilMessages", //$NON-NLS-1$
StringBundle.class.getClassLoader() );
private StringBundle() {}
}

View File

@ -1,5 +0,0 @@
<html>
<body>
Defines interface and access point for externalized strings management.
</body>
</html>

View File

@ -1,80 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.wala.util.logging;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
import com.ibm.wala.util.internationalization.StringBundle;
/**
* Specific formatter used for every messages coming from logging activities wanted
* on standard output and logging file.
* <p>
* Used by default by 'log.properties'.
* <p>
* You can define your own logging properties file using default formatters, or your
* own dedicated handlers and formatters.
* <p>
* To use those specific logging properties, identity location of 'log.properties' file via
* next VM argument: -Djava.util.logging.config.file=[your path]/log.properties
*
* @author egeay
*/
public final class SimplifiedFormatter extends Formatter {
//--- Abstract method implementation
/**
* Formats the given log record and returns the formatted string.
* This specific formatter do not show the time and shows the source information
* only if they are differents from the root logger ones.
*/
public String format( final LogRecord logRecord ) {
final StringBuffer buf = new StringBuffer();
final String lineSeparator = System.getProperty( "line.separator" ); //$NON-NLS-1$
if( ! ROOT_LOGGER_NAME.equals( logRecord.getSourceClassName() ) ) {
buf.append( StringBundle.getInstance().get( getClass(), "source_location", //$NON-NLS-1$
new Object[] {
logRecord.getSourceClassName(),
logRecord.getSourceMethodName() } ) );
buf.append( lineSeparator );
}
buf.append( logRecord.getLevel().getLocalizedName() );
buf.append( ": " ); //$NON-NLS-1$
buf.append( formatMessage( logRecord ) );
buf.append( lineSeparator );
if ( logRecord.getThrown() != null ) {
buf.append( getStackStrace( logRecord.getThrown() ) );
}
return buf.toString();
}
//--- Private code
private String getStackStrace( final Throwable exception ) {
final StringWriter strWriter = new StringWriter();
final PrintWriter printWriter = new PrintWriter( strWriter );
exception.printStackTrace( printWriter );
printWriter.close();
return strWriter.toString();
}
private static final String ROOT_LOGGER_NAME = "java.util.logging.LogManager$RootLogger"; //$NON-NLS-1$
}