Skip to content

Commit

Permalink
Replace use of TeiidException with TeiidDesignerException
Browse files Browse the repository at this point in the history
* Instead of using the teiid class TeiidException, replace all usage with a
  new TeiidDesignerException
  • Loading branch information
Paul Richardson committed Oct 12, 2012
1 parent cbc7ed6 commit ecd5a0e
Show file tree
Hide file tree
Showing 35 changed files with 198 additions and 153 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.teiid.core.TeiidException;
import org.teiid.core.designer.TeiidDesignerException;
import org.teiid.core.util.EquivalenceUtil;
import org.teiid.core.util.ExternalizeUtil;

Expand Down Expand Up @@ -274,7 +274,7 @@ public boolean matches( int severityMask ) {
*/
public static void writeThrowable( ObjectOutput out,
Throwable t ) throws IOException {
if (t == null || !(t instanceof CoreException) || (t instanceof TeiidException)) {
if (t == null || !(t instanceof CoreException) || (t instanceof TeiidDesignerException)) {
out.writeBoolean(false);
out.writeObject(t);
} else {
Expand Down Expand Up @@ -319,7 +319,7 @@ public static IStatus readIStatus( ObjectInput in ) throws IOException, ClassNot
}

/**
* Serializable implementation of IStatus used to serialize instances of CoreException and TeiidException
* Serializable implementation of IStatus used to serialize instances of CoreException and TeiidDesignerException
*/
public static class StatusImpl implements IStatus, Externalizable {
public static final long serialVersionUID = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* JBoss, Home of Professional Open Source.
*
* See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing.
*
* See the AUTHORS.txt file distributed with this work for a full listing of individual contributors.
*/
package org.teiid.core.designer;

/**
* @since 8.0
*/
public class TeiidDesignerException extends Exception {

private static final long serialVersionUID = 1L;

/**
* Default constructor
*/
public TeiidDesignerException() {
super();
}

/**
* @param message
*/
public TeiidDesignerException(String message) {
super(message);
}

/**
* @param childException
*/
public TeiidDesignerException(Throwable childException) {
super(childException);
}

/**
* @param childException
* @param message
*/
public TeiidDesignerException(Throwable childException, String message) {
super(message, childException);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

package org.teiid.core.designer.event;

import org.teiid.core.TeiidException;
import org.teiid.core.designer.TeiidDesignerException;

/**
* Subclasses of this exception typically only need to implement whatever constructors they need.
* <p>
*
* @since 8.0
*/
public class EventSourceException extends TeiidException {
public class EventSourceException extends TeiidDesignerException {

/**
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
package org.teiid.core.designer.id;

import org.teiid.core.CorePlugin;
import org.teiid.core.TeiidException;
import org.teiid.core.designer.TeiidDesignerException;

/**
* Exception which occurs if an error occurs within the server that is not
Expand All @@ -32,7 +32,7 @@
*
* @since 8.0
*/
public class InvalidIDException extends TeiidException {
public class InvalidIDException extends TeiidDesignerException {
private static final String INVALID_ID_MESSAGE = CorePlugin.Util.getString("InvalidIDException.Invalid_ID_1"); //$NON-NLS-1$

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import org.teiid.core.TeiidException;
import org.teiid.core.designer.TeiidDesignerException;
import org.teiid.core.designer.CoreModelerPlugin;
import org.teiid.core.designer.util.OperationUtil.Unreliable;

Expand Down Expand Up @@ -294,10 +294,10 @@ public static void removeDirectoryAndChildren( final File directory ) {
* Test whether it's possible to read and write files in the specified directory.
*
* @param dirPath Name of the directory to test
* @throws TeiidException
* @throws TeiidDesignerException
* @since 4.3
*/
public static void testDirectoryPermissions( final String dirPath ) throws TeiidException {
public static void testDirectoryPermissions( final String dirPath ) throws TeiidDesignerException {

// try to create a file
final File tmpFile = new File(dirPath + File.separatorChar + TEMP_FILE);
Expand All @@ -308,19 +308,19 @@ public static void testDirectoryPermissions( final String dirPath ) throws Teiid
}
if (!success) {
final String msg = CoreModelerPlugin.Util.getString("FileUtils.Unable_to_create_file_in", dirPath); //$NON-NLS-1$
throw new TeiidException(msg);
throw new TeiidDesignerException(msg);
}

// test if file can be written to
if (!tmpFile.canWrite()) {
final String msg = CoreModelerPlugin.Util.getString("FileUtils.Unable_to_write_file_in", dirPath); //$NON-NLS-1$
throw new TeiidException(msg);
throw new TeiidDesignerException(msg);
}

// test if file can be read
if (!tmpFile.canRead()) {
final String msg = CoreModelerPlugin.Util.getString("FileUtils.Unable_to_read_file_in", dirPath); //$NON-NLS-1$
throw new TeiidException(msg);
throw new TeiidDesignerException(msg);
}

// test if file can be renamed
Expand All @@ -332,7 +332,7 @@ public static void testDirectoryPermissions( final String dirPath ) throws Teiid
}
if (!success) {
final String msg = CoreModelerPlugin.Util.getString("FileUtils.Unable_to_rename_file_in", dirPath); //$NON-NLS-1$
throw new TeiidException(msg);
throw new TeiidDesignerException(msg);
}

// test if file can be deleted
Expand All @@ -343,7 +343,7 @@ public static void testDirectoryPermissions( final String dirPath ) throws Teiid
}
if (!success) {
final String msg = CoreModelerPlugin.Util.getString("FileUtils.Unable_to_delete_file_in", dirPath); //$NON-NLS-1$
throw new TeiidException(msg);
throw new TeiidDesignerException(msg);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.jdom.Document;
import org.jdom.output.XMLOutputter;
import org.osgi.framework.BundleContext;
import org.teiid.core.TeiidException;
import org.teiid.core.designer.TeiidDesignerException;
import org.teiid.core.designer.PluginUtil;
import org.teiid.core.designer.util.CoreArgCheck;
import org.teiid.core.designer.util.PluginUtilImpl;
Expand Down Expand Up @@ -77,7 +77,7 @@ public static TransformerFactory createFactory() throws TransformerFactoryConfig
* as the root of the fragment to be transformed; may be null if the whole document is to be transformed.
* @param output the stream to which the transformed
*/
public static Source createSource(final Document sourceDoc) throws TeiidException {
public static Source createSource(final Document sourceDoc) throws TeiidDesignerException {
CoreArgCheck.isNotNull(sourceDoc);

/*
Expand All @@ -103,7 +103,7 @@ public static Source createSource(final Document sourceDoc) throws TeiidExceptio
return new StreamSource(transformSource);
} catch ( Throwable e ) {
final String msg = CoreXsltPlugin.Util.getString("CoreXsltPlugin.Error_loading_the_XSLT_transform"); //$NON-NLS-1$
throw new TeiidException(e,msg);
throw new TeiidDesignerException(e,msg);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.io.IOException;
import java.io.InputStream;
import javax.xml.transform.stream.StreamSource;
import org.teiid.core.TeiidException;
import org.teiid.core.designer.TeiidDesignerException;

/**
* Style
Expand All @@ -23,7 +23,7 @@ public interface Style {

public String getDescription();

public InputStream getInputStream() throws IOException, TeiidException;
public InputStream getInputStream() throws IOException, TeiidDesignerException;

public StreamSource getStreamSource() throws IOException, TeiidException;
public StreamSource getStreamSource() throws IOException, TeiidDesignerException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.io.InputStream;
import java.net.URL;
import javax.xml.transform.stream.StreamSource;
import org.teiid.core.TeiidException;
import org.teiid.core.designer.TeiidDesignerException;
import org.teiid.core.designer.util.CoreArgCheck;

/**
Expand Down Expand Up @@ -76,7 +76,7 @@ public URL getUrl() {
* @see Style#getInputStream()
*/
@Override
public InputStream getInputStream() throws IOException, TeiidException {
public InputStream getInputStream() throws IOException, TeiidDesignerException {
// first, try to load them out of a jar
final URL xsltURL = getUrl();
InputStream stylesheetStream = xsltURL.openStream();
Expand All @@ -89,7 +89,7 @@ public InputStream getInputStream() throws IOException, TeiidException {
if (stylesheetStream.available() == 0) {
final Object[] params = new Object[] {xsltURL};
final String msg = CoreXsltPlugin.Util.getString("StyleFromResource.empty_xslt", params); //$NON-NLS-1$
throw new TeiidException(msg);
throw new TeiidDesignerException(msg);
}

return stylesheetStream;
Expand All @@ -99,7 +99,7 @@ public InputStream getInputStream() throws IOException, TeiidException {
* @see Style#getStreamSource()
*/
@Override
public StreamSource getStreamSource() throws IOException, TeiidException {
public StreamSource getStreamSource() throws IOException, TeiidDesignerException {
final InputStream stream = getInputStream();
return new StreamSource(stream);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.io.InputStream;
import java.net.URL;
import javax.xml.transform.stream.StreamSource;
import org.teiid.core.TeiidException;
import org.teiid.core.designer.TeiidDesignerException;
import org.teiid.core.designer.util.CoreArgCheck;

/**
Expand Down Expand Up @@ -78,7 +78,7 @@ public String getXsltUrl() {
* @see Style#getInputStream()
*/
@Override
public InputStream getInputStream() throws IOException, TeiidException {
public InputStream getInputStream() throws IOException, TeiidDesignerException {
// first, try to load them out of a jar
final String xsltURL = getXsltUrl();
final URL url = new URL(this.xsltUrl);
Expand All @@ -92,7 +92,7 @@ public InputStream getInputStream() throws IOException, TeiidException {
if (stylesheetStream.available() == 0) {
final Object[] params = new Object[] {xsltURL};
final String msg = CoreXsltPlugin.Util.getString("StyleFromUrlStream.empty_xslt", params); //$NON-NLS-1$
throw new TeiidException(msg);
throw new TeiidDesignerException(msg);
}

return stylesheetStream;
Expand All @@ -102,7 +102,7 @@ public InputStream getInputStream() throws IOException, TeiidException {
* @see Style#getStreamSource()
*/
@Override
public StreamSource getStreamSource() throws IOException, TeiidException {
public StreamSource getStreamSource() throws IOException, TeiidDesignerException {
final InputStream stream = getInputStream();
return new StreamSource(stream);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.jdom.Document;
import org.teiid.core.TeiidException;
import org.teiid.core.designer.TeiidDesignerException;
import org.teiid.core.designer.util.CoreArgCheck;

/**
Expand All @@ -40,7 +40,7 @@ public XsltTransform( final Style style) {
this.style = style;
}

protected static Templates getTemplates( final Style style ) throws IOException, TeiidException,
protected static Templates getTemplates( final Style style ) throws IOException, TeiidDesignerException,
TransformerConfigurationException {
CoreArgCheck.isNotNull(style);
// Create a source for the stylesheet ...
Expand All @@ -62,7 +62,7 @@ protected static Templates getTemplates( final Style style ) throws IOException,
* as the root of the fragment to be transformed; may be null if the whole document is to be transformed.
* @param output the stream to which the transformed
*/
protected Transformer createTransformer() throws TeiidException, TransformerConfigurationException, IOException {
protected Transformer createTransformer() throws TeiidDesignerException, TransformerConfigurationException, IOException {

// Obtain the Templates object (precompiled stylesheet)
final Templates templates = getTemplates(this.style); // may throw exception
Expand All @@ -79,7 +79,7 @@ protected Transformer createTransformer() throws TeiidException, TransformerConf
* @param output the OutputStream to which the transformed content is to be written
*/
public void transform(final Document sourceDoc, final OutputStream output) throws IOException,
TeiidException,
TeiidDesignerException,
TransformerException,
TransformerConfigurationException {
CoreArgCheck.isNotNull(sourceDoc);
Expand All @@ -94,7 +94,7 @@ public void transform(final Document sourceDoc, final OutputStream output) throw
transformer.transform(source, result);
} catch ( Throwable e ) {
final String msg = CoreXsltPlugin.Util.getString("XsltTransform.Error_applying_the_XSLT_transform"); //$NON-NLS-1$
throw new TeiidException(e,msg);
throw new TeiidDesignerException(e,msg);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
import org.eclipse.xsd.impl.XSDSchemaImpl;
import org.eclipse.xsd.util.XSDConstants;
import org.eclipse.xsd.util.XSDResourceImpl;
import org.teiid.core.TeiidException;
import org.teiid.core.designer.TeiidDesignerException;
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.designer.ModelerCoreException;
import org.teiid.core.designer.ModelerCoreRuntimeException;
Expand Down Expand Up @@ -3905,7 +3905,7 @@ public static XMIHeader getXmiHeader( final Resource resource ) {
if (resourceFile.exists()) {
try {
header = XMIHeaderReader.readHeader(resourceFile);
} catch (TeiidException e) {
} catch (TeiidDesignerException e) {
ModelerCore.Util.log(IStatus.ERROR, e, e.getLocalizedMessage());
}
}
Expand Down

0 comments on commit ecd5a0e

Please sign in to comment.