summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-02-07 07:11:10 (EST)
committer Stephan Born2012-04-27 06:56:02 (EDT)
commit9aee18bd8a1ed240dd9008b50e5a89944ac1f07d (patch)
tree57ea540d1e19604b8c4771b7b8dc58dc66ac54a7
parentc442d044ded570736615a567fe3b76b8962dd1e5 (diff)
downloadorg.eclipse.stardust.reporting.ui-9aee18bd8a1ed240dd9008b50e5a89944ac1f07d.zip
org.eclipse.stardust.reporting.ui-9aee18bd8a1ed240dd9008b50e5a89944ac1f07d.tar.gz
org.eclipse.stardust.reporting.ui-9aee18bd8a1ed240dd9008b50e5a89944ac1f07d.tar.bz2
Jira-ID: CRNT-22383 Merge changes done on b_dev_6_0_x after 6.0.2.GA (6.0.2.2-r49368) through 6.0.3.GA (6.0.3.6-r50668) and beyond (6.0.x HEAD) to 7.0 (trunk) - moonglow / simulation / tate / tds (org.eclipse.stardust.reporting.ide.integration)
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/reporting.ui@53448 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--org.eclipse.stardust.reporting.ide.integration/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--org.eclipse.stardust.reporting.ide.integration/ReportRunner.java286
-rw-r--r--org.eclipse.stardust.reporting.ide.integration/ReportingPlugin.java62
3 files changed, 0 insertions, 351 deletions
diff --git a/org.eclipse.stardust.reporting.ide.integration/.settings/org.eclipse.core.resources.prefs b/org.eclipse.stardust.reporting.ide.integration/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index b9f3bd4..0000000
--- a/org.eclipse.stardust.reporting.ide.integration/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue Nov 08 07:55:02 CET 2011
-eclipse.preferences.version=1
-encoding//src/org/eclipse/stardust/reporting/ide/integration/messages.properties=8859_1
diff --git a/org.eclipse.stardust.reporting.ide.integration/ReportRunner.java b/org.eclipse.stardust.reporting.ide.integration/ReportRunner.java
deleted file mode 100644
index 0c4b239..0000000
--- a/org.eclipse.stardust.reporting.ide.integration/ReportRunner.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * $Id: ReportRunner.java 49556 2011-09-28 13:21:53Z rainer.pielmann $
- * (C) 2000 - 2006 CARNOT AG
- */
-package ag.carnot.workflow.model.reporting;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.text.MessageFormat;
-import java.util.Arrays;
-import java.util.Enumeration;
-
-import org.eclipse.birt.report.designer.core.model.SessionHandleAdapter;
-import org.eclipse.birt.report.model.api.ModuleHandle;
-import org.eclipse.birt.report.model.elements.Library;
-import org.eclipse.birt.report.model.elements.OdaDataSource;
-import org.eclipse.birt.report.viewer.utilities.WebViewer;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Platform;
-import org.osgi.framework.Bundle;
-
-import ag.carnot.base.StringUtils;
-import ag.carnot.error.InternalException;
-import ag.carnot.error.PublicException;
-import ag.carnot.reporting.default_reports.DefaultReportsPlugin;
-
-public class ReportRunner
-{
- private static final String HOME = "HOME"; //$NON-NLS-1$
-
- private static final String DEFINITION_OVERVIEW_RPTDESIGN = "DefinitionOverview.rptdesign"; //$NON-NLS-1$
-
- private static final String CARNOT_DS_LIBRARY_RPTLIBRARY = "CARNOT-ds-library.rptlibrary"; //$NON-NLS-1$
-
- private static final String TEMP_FOLDER_OFFSET = "CARNOT/reports/"; //$NON-NLS-1$
-
- private static final int STREAM_BUFFER_SIZE = 1024;
-
- private final String dataSourceslibFileName;
-
- private final String designFileName;
-
- private static ReportRunner runner;
-
- private String tempFolder;
-
- public static ReportRunner instance()
- {
- if (null == runner)
- {
- runner = new ReportRunner();
- }
-
- return runner;
- }
-
- void startReportOnModel(String modelFileName, String modelId)
- {
- startReportOnModel(modelFileName, modelId, WebViewer.HTML);
- }
-
- void startReportOnModel(String modelFileName, String modelId, String format)
- {
- try
- {
- prepareReports(tempFolder);
- }
- catch (CoreException e)
- {
- throw new PublicException(Reporting_Model_Messages.EXP_CouldNotCreateCopyOfReportingFiles, e);
- }
- catch (IOException e)
- {
- throw new PublicException(Reporting_Model_Messages.EXP_CouldNotCreateCopyOfReportingFiles, e);
- }
-
- SessionHandleAdapter adapter = SessionHandleAdapter.getInstance();
-
- InputStream stream = null;
- try
- {
- stream = new FileInputStream(dataSourceslibFileName);
- ModuleHandle handle = adapter.init(dataSourceslibFileName, stream);// ,
- // SessionHandleAdapter.LIBRARYFILE);
-
- // ModuleHandle handle = adapter.getReportDesignHandle();
- Library library = (Library) handle.getModule();
- OdaDataSource dataSource = (OdaDataSource) library
- .findDataSource("CARNOT Process Model"); //$NON-NLS-1$
-
- String fileName = (String) dataSource.getProperty(library, HOME);
- modelFileName = ";" + modelFileName; //$NON-NLS-1$
- if (StringUtils.isEmpty(fileName) || !fileName.equals(modelFileName))
- {
- dataSource.setProperty(HOME, modelFileName);
- handle.saveAs(dataSourceslibFileName);
- }
-
- stream.close();
- stream = null;
-
- stream = new FileInputStream(designFileName);
- adapter.init(designFileName, stream);
-
- // TODO: !!! DIRTY HACK !!!
- // This was the easiest way to append additional parameters.
- // Find a better way!
- String parameterCarryingFormat = format + "&__overwrite=true&hideMenu=true"; //$NON-NLS-1$
- if (!StringUtils.isEmpty(modelId))
- {
- parameterCarryingFormat = parameterCarryingFormat + "&ModelID=" + modelId; //$NON-NLS-1$
- }
- WebViewer.display(designFileName, parameterCarryingFormat, true);
- }
- catch (Exception e)
- {
- throw new InternalException(MessageFormat.format(
- Reporting_Model_Messages.EXP_CannotStartReportForModel, new Object[] {modelFileName}), e);
- }
- finally
- {
- if (null != stream)
- {
- try
- {
- stream.close();
- }
- catch (IOException e)
- {
- throw new InternalException("", e); //$NON-NLS-1$
- }
- }
- }
- }
-
- private ReportRunner()
- {
- try
- {
- tempFolder = getTempFolder() + TEMP_FOLDER_OFFSET;
- }
- catch (IOException e)
- {
- throw new PublicException(Reporting_Model_Messages.EXP_CouldNotCreateCopyOfReportingFiles, e);
- }
-
- dataSourceslibFileName = tempFolder + CARNOT_DS_LIBRARY_RPTLIBRARY;
- designFileName = tempFolder + DEFINITION_OVERVIEW_RPTDESIGN;
-
- touchReportFiles();
- WebViewer.startup("viewer"); //$NON-NLS-1$
- }
-
- private static void prepareReports(String destinationPath) throws CoreException,
- IOException
- {
- String overviewDesign = getSystemPath(DefaultReportsPlugin.PLUGIN_ID,
- new String[] {"reports/carnot/DefinitionOverview.rptdesign"}); //$NON-NLS-1$
- String sourcePath = overviewDesign
- .substring(0, overviewDesign.lastIndexOf("/") + 1); //$NON-NLS-1$
-
- // copy all files non-recursively from sourcePath to destinationPath
- new File(destinationPath).mkdirs();
- File folder = new File(sourcePath);
- File[] files = folder.listFiles();
- for (int idx = 0; idx < files.length; ++idx)
- {
- if (!files[idx].isDirectory())
- {
- File target = new File(destinationPath + "/" + files[idx].getName()); //$NON-NLS-1$
- copy(files[idx], target);
- }
- }
- }
-
- private static String getTempFolder() throws IOException
- {
- File temp = File.createTempFile("CARNOT", ".tmp"); //$NON-NLS-1$ //$NON-NLS-2$
- temp.deleteOnExit();
- String path = StringUtils.replace(temp.getAbsolutePath(), "\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
- return path.substring(0, path.lastIndexOf("/") + 1); //$NON-NLS-1$
- }
-
- private static void touchReportFiles()
- {
- String pluginId = DefaultReportsPlugin.PLUGIN_ID;
-
- try
- {
- Bundle bundle = Platform.getBundle(pluginId);
- if (null == bundle)
- {
- throw new InternalException((MessageFormat.format(
- Reporting_Model_Messages.EXP_BundleHasNotBeenLoadedYet, new Object[] {pluginId})));
- }
-
- Enumeration enumerator = bundle.getEntryPaths("reports/carnot"); //$NON-NLS-1$
- while (enumerator.hasMoreElements())
- {
- String elem = (String) enumerator.nextElement();
- URL entryUrl = bundle.getEntry(elem);
- if (null != entryUrl)
- {
- Platform.asLocalURL(entryUrl).getPath();
- }
- }
- }
- catch (IOException e)
- {
- throw new PublicException(Reporting_Model_Messages.EXP_CouldNotCreateCopyOfReportingFiles, e);
- }
-
- }
-
- private static String getSystemPath(String pluginId, String[] entryNames)
- throws IOException
- {
- Bundle bundle = Platform.getBundle(pluginId);
- if (null == bundle)
- {
- throw new InternalException((MessageFormat.format(
- Reporting_Model_Messages.EXP_BundleHasNotBeenLoadedYet, new Object[] {pluginId})));
- }
-
- String systemPath = ""; //$NON-NLS-1$
-
- boolean found = false;
- for (int idx = 0; idx < entryNames.length; ++idx)
- {
- URL entryUrl = bundle.getEntry(entryNames[idx]);
- if (null != entryUrl)
- {
- found = true;
- systemPath = Platform.asLocalURL(entryUrl).getPath();
- break;
- }
- }
-
- if (!found)
- {
- throw new InternalException((MessageFormat.format(
- Reporting_Model_Messages.EXP_BundleDoesNotContain, new Object[] {
- pluginId,
- StringUtils.join(Arrays.asList(entryNames).iterator(), ", ")}))); //$NON-NLS-1$
- }
-
- return StringUtils.replace(systemPath, "\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- private static void copy(File source, File dest) throws IOException
- {
- InputStream in = null;
- OutputStream out = null;
-
- try
- {
- in = new FileInputStream(source);
- out = new FileOutputStream(dest);
-
- // Transfer bytes from in to out
- byte[] buffer = new byte[STREAM_BUFFER_SIZE];
- int length;
- while ((length = in.read(buffer)) > 0)
- {
- out.write(buffer, 0, length);
- }
- }
- finally
- {
- if (null != in)
- {
- in.close();
- }
-
- if (null != out)
- {
- out.close();
- }
- }
- }
-}
diff --git a/org.eclipse.stardust.reporting.ide.integration/ReportingPlugin.java b/org.eclipse.stardust.reporting.ide.integration/ReportingPlugin.java
deleted file mode 100644
index 51c6a56..0000000
--- a/org.eclipse.stardust.reporting.ide.integration/ReportingPlugin.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package ag.carnot.workflow.model.reporting;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class ReportingPlugin extends AbstractUIPlugin
-{
- public static final String PLUGIN_ID = "ag.carnot.workflow.model.reporting"; //$NON-NLS-1$
-
- // The shared instance.
- private static ReportingPlugin plugin;
-
- /**
- * The constructor.
- */
- public ReportingPlugin()
- {
- plugin = this;
- }
-
- /**
- * This method is called upon plug-in activation
- */
- public void start(BundleContext context) throws Exception
- {
- super.start(context);
- }
-
- /**
- * This method is called when the plug-in is stopped
- */
- public void stop(BundleContext context) throws Exception
- {
- super.stop(context);
- plugin = null;
- }
-
- /**
- * Returns the shared instance.
- */
- public static ReportingPlugin getDefault()
- {
- return plugin;
- }
-
- /**
- * Returns an image descriptor for the image file at the given plug-in relative path.
- *
- * @param path
- * the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path)
- {
- return AbstractUIPlugin.imageDescriptorFromPlugin(
- "ag.carnot.workflow.model.reporting", path); //$NON-NLS-1$
- }
-}