Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortle2011-02-01 22:27:36 +0000
committertle2011-02-01 22:27:36 +0000
commitdaf46239e078a44338d3f6232390a82649d13e84 (patch)
treefc5d5977f67764fb5bb178c51ee709c578f6ef70 /jaxb/plugins
parentb266f05cdac814f1fbfe739ff6b9526d73a42c87 (diff)
downloadwebtools.dali-daf46239e078a44338d3f6232390a82649d13e84.tar.gz
webtools.dali-daf46239e078a44338d3f6232390a82649d13e84.tar.xz
webtools.dali-daf46239e078a44338d3f6232390a82649d13e84.zip
Initial check-in.
Diffstat (limited to 'jaxb/plugins')
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.classpath7
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.cvsignore1
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.project28
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/META-INF/MANIFEST.MF10
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/about.html47
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/build.properties19
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/plugin.properties24
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/Main.java241
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/JptDbwsCoreMessages.java44
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/Tools.java110
-rw-r--r--jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/jpt_dbws_core.properties17
12 files changed, 556 insertions, 0 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.classpath b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.classpath
new file mode 100644
index 0000000000..ad32c83a78
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.cvsignore b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.cvsignore
new file mode 100644
index 0000000000..c5e82d7458
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.cvsignore
@@ -0,0 +1 @@
+bin \ No newline at end of file
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.project b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.project
new file mode 100644
index 0000000000..4c657b1ec5
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jpt.dbws.eclipselink.core.gen</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.settings/org.eclipse.jdt.core.prefs b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..f4cc6fa199
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Jan 31 14:51:15 EST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..01c98e014b
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-SymbolicName: org.eclipse.jpt.dbws.eclipselink.core.gen;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.eclipse.persistence.dbws;bundle-version="[2.3.0,3.0.0)",
+ javax.wsdl;bundle-version="[1.6.2,2.0.0)"
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/about.html b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/about.html
new file mode 100644
index 0000000000..071f586b21
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/about.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+
+<BODY lang="EN-US">
+
+<H2>About This Content</H2>
+
+<P>May 02, 2008</P>
+
+<H3>License</H3>
+
+<P>The Eclipse Foundation makes available all content in this plug-in
+("Content"). Unless otherwise indicated below, the Content is provided to you
+under the terms and conditions of the Eclipse Public License Version 1.0
+("EPL"). A copy of the EPL is available at
+<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
+For purposes of the EPL, "Program" will mean the Content.</P>
+
+<P>If you did not receive this Content directly from the Eclipse Foundation, the
+Content is being redistributed by another party ("Redistributor") and different
+terms and conditions may apply to your use of any object code in the Content.
+Check the Redistributor's license that was provided with the Content. If no such
+license exists, contact the Redistributor. Unless otherwise indicated below, the
+terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at
+<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
+
+<h3>Third Party Content</h3>
+<p>The Content includes items that have been sourced from third parties as set
+ out below. If you did not receive this Content directly from the Eclipse Foundation,
+ the following is provided for informational purposes only, and you should look
+ to the Redistributor&#8217;s license for terms and conditions of use.</p>
+
+<h4><a name="JPA" id="JPA"></a>Java Persistence API (JPA) v1.0</h4>
+
+<blockquote>
+ <p>The Java Persistence API (JPA) which is distributed under <a href="https://glassfish.dev.java.net/public/CDDLv1.0.html">CDDL
+ v1.0</a> is required by the Dali Java Persistence Tools Project in order
+ to support this standard.</p>
+</blockquote>
+</BODY>
+</HTML>
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/build.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/build.properties
new file mode 100644
index 0000000000..a00641b71c
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/build.properties
@@ -0,0 +1,19 @@
+###############################################################################
+# Copyright (c) 2010, 2011 Oracle.
+# 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:
+# Oracle. - initial API and implementation
+###############################################################################
+javacSource=1.6
+javacTarget=1.6
+source.. = src/
+output.. = bin/
+bin.includes = .,\
+ META-INF/,\
+ about.html,\
+ plugin.properties
+jars.compile.order = .
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/plugin.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/plugin.properties
new file mode 100644
index 0000000000..5d537fcf12
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/plugin.properties
@@ -0,0 +1,24 @@
+###############################################################################
+# Copyright (c) 2006, 2008 Oracle.
+# 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:
+# Oracle. - initial API and implementation
+###############################################################################
+# ====================================================================
+# To code developer:
+# Do NOT change the properties between this line and the
+# "%%% END OF TRANSLATED PROPERTIES %%%" line.
+# Make a new property name, append to the end of the file and change
+# the code to use the new property.
+# ====================================================================
+
+# ====================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# ====================================================================
+
+pluginName = Dali Java Persistence Tools - DBWS Support - Web Services Generation
+providerName = Eclipse Web Tools Platform
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/Main.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/Main.java
new file mode 100644
index 0000000000..4f6f4451a6
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/Main.java
@@ -0,0 +1,241 @@
+/*******************************************************************************
+* Copyright (c) 2010, 2011 Oracle. 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:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.dbws.eclipselink.core.gen;
+
+import static java.util.logging.Level.INFO;
+import static java.util.logging.Level.SEVERE;
+import static org.eclipse.persistence.tools.dbws.DBWSPackager.ArchiveUse.ignore;
+
+import java.io.File;
+import java.util.logging.Level;
+
+import javax.wsdl.WSDLException;
+
+import org.eclipse.jpt.dbws.eclipselink.core.gen.internal.JptDbwsCoreMessages;
+import org.eclipse.jpt.dbws.eclipselink.core.gen.internal.Tools;
+import org.eclipse.persistence.oxm.XMLContext;
+import org.eclipse.persistence.oxm.XMLUnmarshaller;
+import org.eclipse.persistence.tools.dbws.DBWSBuilder;
+import org.eclipse.persistence.tools.dbws.DBWSBuilderModel;
+import org.eclipse.persistence.tools.dbws.DBWSBuilderModelProject;
+import org.eclipse.persistence.tools.dbws.DBWSPackager;
+import org.eclipse.persistence.tools.dbws.EclipsePackager;
+
+/**
+ * Generate DBWS content
+ *
+ * Current command-line arguments:
+ * [-builderFile dbws-builder.xml] - specifies source builder file
+ * [-stageDir .\Output_Dir] - specifies destination directory
+ * [-packageAs eclipse] - specifies the source package
+ */
+public class Main
+{
+ private String builderFile;
+ private String stageDir;
+ private String packageAs;
+ @SuppressWarnings("unused")
+ private boolean isDebugMode;
+
+ // ********** static methods **********
+
+ public static void main(String[] args) {
+ new Main().execute(args);
+ }
+
+ // ********** constructors **********
+
+ private Main() {
+ super();
+ }
+
+ // ********** behavior **********
+
+ protected void execute(String[] args) {
+
+ this.initializeWith(args);
+
+ this.generate();
+ }
+
+ private void generate() {
+
+ DBWSBuilder builder = new DBWSBuilder();
+
+ DBWSBuilderModel model = this.buildBuilderModel(this.builderFile);
+ if(model == null) {
+ this.logMessage(INFO, JptDbwsCoreMessages.NO_GENERATION_PERFORMED);
+ return;
+ }
+
+ builder.setProperties(model.properties);
+ builder.setOperations(model.operations);
+
+ if( ! this.jdbcDriverIsOnClasspath(builder.getDriver())) {
+ return;
+ }
+
+ DBWSPackager packager = this.buildEclipsePackager();
+
+ this.initializePackager(packager, builder, this.buildStageDir(this.stageDir));
+ builder.setPackager(packager);
+
+ try {
+ builder.start();
+ }
+ catch(WSDLException e) {
+ this.logMessage(SEVERE, JptDbwsCoreMessages.WSDL_EXCEPTION, e.getMessage());
+ return;
+ }
+ catch(Exception e) {
+ //TODO Clean-up Stage dir. ?
+ this.logMessage(SEVERE, JptDbwsCoreMessages.GENERATION_FAILED, e.getMessage());
+ e.printStackTrace();
+ return;
+ }
+ this.logMessage(INFO, JptDbwsCoreMessages.GENERATION_COMPLETED);
+ return;
+
+ }
+
+ // ********** internal methods **********
+
+ private void initializeWith(String[] args) {
+
+ this.builderFile = this.getArgumentBuilderFile(args);
+ this.stageDir = this.getArgumentStageDir(args);
+ this.packageAs = this.getArgumentPackageAs(args);
+
+ this.isDebugMode = this.getArgumentDebugMode(args);
+ }
+
+ private void initializePackager(DBWSPackager packager, DBWSBuilder builder, File stageDir) {
+
+ packager.setDBWSBuilder(builder);
+ packager.setArchiveUse(ignore);
+ packager.setAdditionalArgs(null);
+ packager.setStageDir(stageDir);
+ packager.setSessionsFileName(builder.getSessionsFileName());
+ }
+
+ private DBWSBuilderModel buildBuilderModel(String builderFileName) {
+
+ File builderFile = this.getBuilderFile(builderFileName);
+ return this.unmarshal(builderFile);
+ }
+
+ private DBWSBuilderModel unmarshal(File builderFile) {
+ if((builderFile == null) || ( ! builderFile.exists())) {
+ return null;
+ }
+ XMLContext context = new XMLContext(new DBWSBuilderModelProject());
+ XMLUnmarshaller unmarshaller = context.createUnmarshaller();
+
+ DBWSBuilderModel model = (DBWSBuilderModel)unmarshaller.unmarshal(builderFile);
+ if(model.properties.size() == 0) {
+ this.logMessage(SEVERE, JptDbwsCoreMessages.NO_OPERATIONS_SPECIFIED);
+ return null;
+ }
+ return model;
+ }
+
+ private File getBuilderFile(String builderFileName) {
+
+ File builderFile = new File(builderFileName);
+ if( ! (builderFile.exists() && builderFile.isFile())) {
+ this.logMessage(SEVERE,
+ JptDbwsCoreMessages.UNABLE_TO_LOCATE_BUILDER_XML, builderFileName); //$NON-NLS-1$
+ return null;
+ }
+ return builderFile;
+ }
+
+ private File buildStageDir(String stageDirName) {
+ File dir = new File(stageDirName);
+ if(( ! dir.exists()) || ( ! dir.isDirectory())) {
+ dir = Tools.buildDirectory(stageDirName);
+ }
+ return dir;
+ }
+
+ private EclipsePackager buildEclipsePackager() {
+ return new EclipsePackager() {
+ @Override
+ public void start() {
+ // no need to check for the existence of stageDir, everything is in-memory
+ }
+ };
+ }
+
+ private boolean jdbcDriverIsOnClasspath(String jdbcDriverName) {
+ try {
+ Class.forName(jdbcDriverName);
+ }
+ catch (ClassNotFoundException cnfe) {
+ this.logMessage(SEVERE, JptDbwsCoreMessages.DRIVER_NOT_ON_CLASSPATH, jdbcDriverName);
+ return false;
+ }
+ return true;
+ }
+
+ private void logMessage(Level level, String key, Object argument) {
+ Tools.logMessage(level, Tools.bind(key, argument));
+ }
+
+ private void logMessage(Level level, String key) {
+ Tools.logMessage(level, Tools.getString(key));
+ }
+
+ // ********** argument queries **********
+
+ private String getArgumentBuilderFile(String[] args) {
+
+ return this.getArgumentValue("-builderFile", args); //$NON-NLS-1$
+ }
+
+ private String getArgumentStageDir(String[] args) {
+
+ return this.getArgumentValue("-stageDir", args); //$NON-NLS-1$
+ }
+
+ private String getArgumentPackageAs(String[] args) {
+
+ return this.getArgumentValue("-packageAs", args); //$NON-NLS-1$
+ }
+
+ private boolean getArgumentDebugMode(String[] args) {
+
+ return this.argumentExists("-debug", args); //$NON-NLS-1$
+ }
+
+ private String getArgumentValue(String argName, String[] args) {
+ for (int i = 0; i < args.length; i++) {
+ String arg = args[i];
+ if (arg.equals(argName)) {
+ int j = i + 1;
+ if (j < args.length) {
+ return args[j];
+ }
+ }
+ }
+ return null;
+ }
+
+ private boolean argumentExists(String argName, String[] args) {
+ for (int i = 0; i < args.length; i++) {
+ String arg = args[i];
+ if (arg.toLowerCase().equals(argName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/JptDbwsCoreMessages.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/JptDbwsCoreMessages.java
new file mode 100644
index 0000000000..ff3fa9b9fb
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/JptDbwsCoreMessages.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+* Copyright (c) 2010, 2011 Oracle. 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:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.dbws.eclipselink.core.gen.internal;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Localized messages used by Dali DBWS generation core.
+ */
+public class JptDbwsCoreMessages
+{
+
+ public static final String GENERATION_COMPLETED = "GENERATION_COMPLETED";
+ public static final String GENERATION_FAILED = "GENERATION_FAILED";
+ public static final String NO_GENERATION_PERFORMED = "NO_GENERATION_PERFORMED";
+ public static final String WSDL_EXCEPTION = "WSDL_EXCEPTION";
+ public static final String NO_OPERATIONS_SPECIFIED = "NO_OPERATIONS_SPECIFIED";
+ public static final String UNABLE_TO_LOCATE_BUILDER_XML = "UNABLE_TO_LOCATE_BUILDER_XML";
+ public static final String DRIVER_NOT_ON_CLASSPATH = "DRIVER_NOT_ON_CLASSPATH";
+
+
+ private static final String BUNDLE_NAME = "org.eclipse.jpt.dbws.eclipselink.core.gen.internal.jpt_dbws_core"; //$NON-NLS-1$
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ private JptDbwsCoreMessages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ }
+ catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+} \ No newline at end of file
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/Tools.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/Tools.java
new file mode 100644
index 0000000000..7a49d7aaae
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/Tools.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+* Copyright (c) 2010, 2011 Oracle. 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:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.dbws.eclipselink.core.gen.internal;
+
+import static java.util.logging.Level.SEVERE;
+
+import java.io.File;
+import java.text.MessageFormat;
+import java.util.logging.Level;
+
+/**
+ * Tools
+ */
+public final class Tools
+{
+ /** empty string */
+ public static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
+ private static final String USER_DIRECTORY = System.getProperty("user.dir"); //$NON-NLS-1$
+
+ // ********** queries **********
+
+ /**
+ * Return whether the specified string is null, empty, or contains
+ * only whitespace characters.
+ */
+ public static boolean stringIsEmpty(String string) {
+ if (string == null) {
+ return true;
+ }
+ int len = string.length();
+ if (len == 0) {
+ return true;
+ }
+ return stringIsEmpty_(string.toCharArray(), len);
+ }
+
+ private static boolean stringIsEmpty_(char[] s, int len) {
+ for (int i = len; i-- > 0; ) {
+ if ( ! Character.isWhitespace(s[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ // ********** short name manipulation **********
+
+
+ public static File buildDirectory(String dirName) {
+ File currentDir = currentWorkingDirectory();
+ File dir = new File(currentDir, dirName);
+ dir.mkdir();
+ return dir;
+ }
+
+ /**
+ * Return a file representing the current working directory.
+ */
+ public static File currentWorkingDirectory() {
+ return new File(USER_DIRECTORY); //$NON-NLS-1$
+ }
+
+ /**
+ * Strip the extension from the specified file name
+ * and return the result. If the file name has no
+ * extension, it is returned unchanged
+ * File#basePath()
+ */
+ public static String stripExtension(String fileName) {
+ int index = fileName.lastIndexOf('.');
+ if (index == -1) {
+ return fileName;
+ }
+ return fileName.substring(0, index);
+ }
+
+ public static String extractDirectory(String path) {
+ if( ! path.contains(File.separator)) {
+ return EMPTY_STRING;
+ }
+ return path.substring(0, path.lastIndexOf(File.separator));
+ }
+
+ public static void logMessage(Level level, String message) {
+ if(level == SEVERE) {
+ System.err.println('\n' + message);
+ }
+ else {
+ System.out.println('\n' + message);
+ }
+ }
+
+ // ********** NLS utilities **********
+
+ public static String getString(String key) {
+ return JptDbwsCoreMessages.getString(key);
+ }
+
+ public static String bind(String key, Object argument) {
+ return MessageFormat.format(getString(key), argument);
+ }
+}
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/jpt_dbws_core.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/jpt_dbws_core.properties
new file mode 100644
index 0000000000..c49d70feb4
--- /dev/null
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/jpt_dbws_core.properties
@@ -0,0 +1,17 @@
+################################################################################
+# Copyright (c) 2010, 2011 Oracle. 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:
+# Oracle - initial API and implementation
+################################################################################
+
+GENERATION_COMPLETED = DBWSBuilder generation completed
+GENERATION_FAILED = DBWSBuilder generation failed: {0}
+NO_GENERATION_PERFORMED = DBWSBuilder no generation performed
+WSDL_EXCEPTION = WSDLException: {0}
+NO_OPERATIONS_SPECIFIED = No operations specified
+UNABLE_TO_LOCATE_BUILDER_XML = DBWSBuilder unable to locate builder XML file: {0}
+DRIVER_NOT_ON_CLASSPATH = JDBC driver not on classpath: {0}

Back to the top