[jbosstools-commits] JBoss Tools SVN: r24075 - in trunk: runtime and 13 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Wed Aug 11 19:09:57 EDT 2010
Author: dgolovin
Date: 2010-08-11 19:09:56 -0400 (Wed, 11 Aug 2010)
New Revision: 24075
Added:
trunk/runtime/
trunk/runtime/features/
trunk/runtime/features/org.jboss.tools.runtime.feature/
trunk/runtime/features/org.jboss.tools.runtime.feature/.project
trunk/runtime/features/org.jboss.tools.runtime.feature/build.properties
trunk/runtime/features/org.jboss.tools.runtime.feature/feature.properties
trunk/runtime/features/org.jboss.tools.runtime.feature/feature.xml
trunk/runtime/plugins/
trunk/runtime/plugins/org.jboss.tools.runtime/
trunk/runtime/plugins/org.jboss.tools.runtime/.classpath
trunk/runtime/plugins/org.jboss.tools.runtime/.project
trunk/runtime/plugins/org.jboss.tools.runtime/.settings/
trunk/runtime/plugins/org.jboss.tools.runtime/.settings/org.eclipse.jdt.core.prefs
trunk/runtime/plugins/org.jboss.tools.runtime/META-INF/
trunk/runtime/plugins/org.jboss.tools.runtime/META-INF/MANIFEST.MF
trunk/runtime/plugins/org.jboss.tools.runtime/about.html
trunk/runtime/plugins/org.jboss.tools.runtime/build.properties
trunk/runtime/plugins/org.jboss.tools.runtime/plugin.properties
trunk/runtime/plugins/org.jboss.tools.runtime/plugin.xml
trunk/runtime/plugins/org.jboss.tools.runtime/src/
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/Activator.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeLocator.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeStartup.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/Messages.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/ServerDefinition.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/bean/
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/bean/ServerBean.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/bean/ServerBeanLoader.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/bean/ServerType.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/messages.properties
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/JBossRuntimePreferencesInitializer.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java
Log:
runtime configuration feature and plugin is moved to jbosstools repo as runtime component
Added: trunk/runtime/features/org.jboss.tools.runtime.feature/.project
===================================================================
--- trunk/runtime/features/org.jboss.tools.runtime.feature/.project (rev 0)
+++ trunk/runtime/features/org.jboss.tools.runtime.feature/.project 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.runtime.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/runtime/features/org.jboss.tools.runtime.feature/build.properties
===================================================================
--- trunk/runtime/features/org.jboss.tools.runtime.feature/build.properties (rev 0)
+++ trunk/runtime/features/org.jboss.tools.runtime.feature/build.properties 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,2 @@
+bin.includes = feature.xml,\
+ feature.properties
Added: trunk/runtime/features/org.jboss.tools.runtime.feature/feature.properties
===================================================================
--- trunk/runtime/features/org.jboss.tools.runtime.feature/feature.properties (rev 0)
+++ trunk/runtime/features/org.jboss.tools.runtime.feature/feature.properties 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,28 @@
+###############################################################################
+# Copyright (c) 2009-2010 JBoss by Red Hat and others.
+# 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:
+# JBoss by Red Hat - Initial implementation.
+##############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName=Runtime Initialization
+
+# "providerName" property - name of the company that provides the feature
+providerName=JBoss by Red Hat
+
+# "updateSiteName" property - label for the update/discovery sites
+updateSiteName=JBoss Developer Studio Updates
+JBossToolsUpdatesSiteName=JBoss Tools Updates
+
+# "description" property - description of the feature
+description=This feature provides runtime initialization
Added: trunk/runtime/features/org.jboss.tools.runtime.feature/feature.xml
===================================================================
--- trunk/runtime/features/org.jboss.tools.runtime.feature/feature.xml (rev 0)
+++ trunk/runtime/features/org.jboss.tools.runtime.feature/feature.xml 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,446 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.jboss.tools.runtime.feature"
+ label="%featureName"
+ version="1.1.0.qualifier"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ JBoss by Red Hat
+Copyright 2009-2010, JBoss by Red Hat, and individual contributors as indicated
+by the @authors tag. See the copyright.txt in the distribution
+for a full listing of individual contributors.
+ </copyright>
+
+ <license url="http://osdn.dl.sourceforge.net/sourceforge/jboss/LGPL.html">
+ JBossTools is under the LGPL Licence
+GNU LESSER GENERAL PUBLIC LICENSE
+Version 2.1, February 1999
+Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+[This is the first released version of the Lesser GPL. It also
+counts
+as the successor of the GNU Library Public License, version 2,
+hence
+the version number 2.1.]
+Preamble
+The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General
+Public Licenses are intended to guarantee your freedom to share
+and change free software--to make sure the software is free for
+all its users.
+This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of
+the Free Software Foundation and other authors who decide to
+use it. You can use it too, but we suggest you first think carefully
+about whether this license or the ordinary General Public License
+is the better strategy to use in any particular case, based on
+the explanations below.
+When we speak of free software, we are referring to freedom of
+use, not price. Our General Public Licenses are designed to make
+sure that you have the freedom to distribute copies of free software
+(and charge for this service if you wish); that you receive source
+code or can get it if you want it; that you can change the software
+and use pieces of it in new free programs; and that you are informed
+that you can do these things.
+To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender
+these rights. These restrictions translate to certain responsibilities
+for you if you distribute copies of the library or if you modify
+it.
+For example, if you distribute copies of the library, whether
+gratis or for a fee, you must give the recipients all the rights
+that we gave you. You must make sure that they, too, receive
+or can get the source code. If you link other code with the library,
+you must provide complete object files to the recipients, so
+that they can relink them with the library after making changes
+to the library and recompiling it. And you must show them these
+terms so they know their rights.
+We protect your rights with a two-step method: (1) we copyright
+the library, and (2) we offer you this license, which gives you
+legal permission to copy, distribute and/or modify the library.
+To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library
+is modified by someone else and passed on, the recipients should
+know that what they have is not the original version, so that
+the original author's reputation will not be affected by problems
+that might be introduced by others.
+Finally, software patents pose a constant threat to the existence
+of any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining
+a restrictive license from a patent holder. Therefore, we insist
+that any patent license obtained for a version of the library
+must be consistent with the full freedom of use specified in
+this license.
+Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries,
+and is quite different from the ordinary General Public License.
+We use this license for certain libraries in order to permit
+linking those libraries into non-free programs.
+When a program is linked with a library, whether statically or
+using a shared library, the combination of the two is legally
+speaking a combined work, a derivative of the original library.
+The ordinary General Public License therefore permits such linking
+only if the entire combination fits its criteria of freedom.
+The Lesser General Public License permits more lax criteria for
+linking other code with the
+ library.
+We call this license the "Lesser" General Public License because
+it does Less to protect the user's freedom than the ordinary
+General Public License. It also provides other free software
+developers Less of an advantage over competing non-free programs.
+These disadvantages are the reason we use the ordinary General
+Public License for many libraries. However, the Lesser license
+provides advantages in certain special circumstances.
+For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that
+it becomes a de-facto standard. To achieve this, non-free programs
+must be allowed to use the library. A more frequent case is that
+a free library does the same job as widely used non-free libraries.
+In this case, there is little to gain by limiting the free library
+to free software only, so we use the Lesser General Public License.
+In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body
+of free software. For example, permission to use the GNU C Library
+in non-free programs enables many more people to use the whole
+GNU operating system, as well as its variant, the GNU/Linux operating
+system.
+Although the Lesser General Public License is Less protective
+of the users' freedom, it does ensure that the user of a program
+that is linked with the Library has the freedom and the wherewithal
+to run that program using a modified version of the Library.
+The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between
+a "work based on the library" and a "work that uses the library".
+The former contains code derived from the library, whereas the
+latter must be combined with the library in order to run.
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+0. This License Agreement applies to any software library or
+other program which contains a notice placed by the copyright
+holder or other authorized party saying it may be distributed
+under the terms of this Lesser General Public License (also called
+"this License"). Each licensee is addressed as "you".
+A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+The "Library", below, refers to any such software library or
+work which has been distributed under these terms. A "work based
+on the Library" means either the Library or any derivative work
+under copyright law: that is to say, a work containing the Library
+or a portion of it, either verbatim or with modifications and/or
+translated straightforwardly into another language. (Hereinafter,
+translation is included without limitation in the term "modification".)
+"Source code" for a work means the preferred form of the work
+for making modifications to it. For a library, complete source
+code means all the source code for all modules it contains, plus
+any associated interface definition files, plus the scripts used
+to control compilation and installation of the library.
+Activities other than copying, distribution and modification
+are not covered by this License; they are outside its scope.
+The act of running a program using the Library is not restricted,
+and output from such a program is covered only if its contents
+constitute a work based on the Library (independent of the use
+of the Library in a tool for writing it). Whether that is true
+depends on what the Library does and what the program that uses
+the Library does.
+1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided
+that you conspicuously and appropriately publish on each copy
+an appropriate copyright notice and disclaimer of warranty; keep
+intact all the notices that refer to this License and to the
+absence of any warranty; and distribute a copy of this License
+along with the Library.
+You may charge a fee for the physical act of transferring a copy,
+and
+you may at your option offer warranty protection in exchange
+for a fee.
+2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section
+1 above, provided that you also meet all of these conditions:
+a) The modified work must itself be a software library.
+b) You must cause the files modified to carry prominent notices
+stating that you changed the files and the date of any change.
+c) You must cause the whole of the work to be licensed at no
+charge to all third parties under the terms of this License.
+d) If a facility in the modified Library refers to a function
+or a table of data to be supplied by an application program that
+uses the facility, other than as an argument passed when the
+facility is invoked, then you must make a good faith effort to
+ensure that, in the event an application does not supply such
+function or table, the facility still operates, and performs
+whatever part of its purpose remains meaningful.
+(For example, a function in a library to compute square roots
+has a purpose that is entirely well-defined independent of the
+application. Therefore, Subsection 2d requires that any application-supplied
+function or table used by this function must be optional: if
+the application does not supply it, the square root function
+must still compute square roots.)
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works
+in themselves, then this License, and its terms, do not apply
+to those sections when you distribute them as separate works.
+But when you distribute the same sections as part of a whole
+which is a work based on the Library, the distribution of the
+whole must be on the terms of this License, whose permissions
+for other licensees extend to the entire whole, and thus to each
+and every part regardless of who wrote it.
+Thus, it is not the intent of this section to claim rights or
+contest your rights to work written entirely by you; rather,
+the intent is to exercise the right to control the distribution
+of derivative or collective works based on the Library.
+In addition, mere aggregation of another work not based on the
+Library with the Library (or with a work based on the Library)
+on a volume of a storage or distribution medium does not bring
+the other work under the scope of this License.
+3. You may opt to apply the terms of the ordinary GNU General
+Public License instead of this License to a given copy of the
+Library. To do this, you must alter all the notices that refer
+to this License, so that they refer to the ordinary GNU General
+Public License, version 2, instead of to this License. (If a
+newer version than version 2 of the ordinary GNU General Public
+License has appeared, then you can specify that version instead
+if you wish.) Do not make any other change in these notices.
+Once this change is made in a given copy, it is irreversible
+for that copy, so the ordinary GNU General Public License applies
+to all subsequent copies and derivative works made from that
+copy.
+This option is useful when you wish to copy part of the code
+of the Library into a program that is not a library.
+4. You may copy and distribute the Library (or a portion or derivative
+of it, under Section 2) in object code or executable form under
+the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code,
+which must be distributed under the terms of Sections 1 and 2
+above on a medium customarily used for software interchange.
+If distribution of object code is made by offering access to
+copy from a designated place, then offering equivalent access
+to copy the source code from the same place satisfies the requirement
+to distribute the source code, even though third parties are
+not compelled to copy the source along with the object code.
+5. A program that contains no derivative of any portion of the
+Library
+, but is designed to work with the Library by being compiled
+or linked with it, is called a "work that uses the Library".
+Such a work, in isolation, is not a derivative work of the Library,
+and therefore falls outside the scope of this License.
+However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because
+it contains portions of the Library), rather than a "work that
+uses the library". The executable is therefore covered by this
+License. Section 6 states terms for distribution of such executables.
+When a "work that uses the Library" uses material from a header
+file that is part of the Library, the object code for the work
+may be a derivative work of the Library even though the source
+code is not. Whether this is true is especially significant if
+the work can be linked without the Library, or if the work is
+itself a library. The threshold for this to be true is not precisely
+defined by law.
+If such an object file uses only numerical parameters, data structure
+layouts and accessors, and small macros and small inline functions
+(ten lines or less in length), then the use of the object file
+is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions
+of the Library will still fall under Section 6.)
+Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section
+6. Any executables containing that work also fall under Section
+6, whether or not they are linked directly with the Library itself.
+6. As an exception to the Sections above, you may also combine
+or link a "work that uses the Library" with the Library to produce
+a work containing portions of the Library, and distribute that
+work under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+You must give prominent notice with each copy of the work that
+the Library is used in it and that the Library and its use are
+covered by this License. You must supply a copy of this License.
+If the work during execution displays copyright notices, you
+must include the copyright notice for the Library among them,
+as well as a reference directing the user to the copy of this
+License. Also, you must do one of these things:
+a) Accompany the work with the complete corresponding machine-readable
+source code for the Library including whatever changes were used
+in the work (which must be distributed under Sections 1 and 2
+above); and, if the work is an executable linked with the Library,
+with the complete machine-readable "work that uses the Library",
+as object code and/or source code, so that the user can modify
+the Library and then relink to produce a modified executable
+containing the modified Library. (It is understood that the user
+who changes the contents of definitions files in the Library
+will not necessarily be able to recompile the application to
+use the modified definitions.)
+b) Use a suitable shared library mechanism for linking with the
+Library. A suitable mechanism is one that (1) uses at run time
+a copy of the library already present on the user's computer
+system, rather than copying library functions into the executable,
+and (2) will operate properly with a modified version of the
+library, if the user installs one, as long as the modified version
+is interface-compatible with the version that the work was made
+with.
+c) Accompany the work with a written offer, valid for at least
+three years, to give the same user the materials specified in
+Subsection 6a, above, for a charge no more than the cost of performing
+this distribution.
+d) If distribution of the work is made by offering access to
+copy from a designated place, offer equivalent access to copy
+the above specified materials from the same place.
+e) Verify that the user has already received a copy of these
+materials or that you have already sent this user a copy.
+For an executable, the required form of the "work t
+hat uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that
+is normally distributed (in either source or binary form) with
+the major components (compiler, kernel, and so on) of the operating
+system on which the executable runs, unless that component itself
+accompanies the executable.
+It may happen that this requirement contradicts the license restrictions
+of other proprietary libraries that do not normally accompany
+the operating system. Such a contradiction means you cannot use
+both them and the Library together in an executable that you
+distribute.
+7. You may place library facilities that are a work based on
+the Library side-by-side in a single library together with other
+library facilities not covered by this License, and distribute
+such a combined library, provided that the separate distribution
+of the work based on the Library and of the other library facilities
+is otherwise permitted, and provided that you do these two things:
+a) Accompany the combined library with a copy of the same work
+based on the Library, uncombined with any other library facilities.
+This must be distributed under the terms of the Sections above.
+b) Give prominent notice with the combined library of the fact
+that part of it is a work based on the Library, and explaining
+where to find the accompanying uncombined form of the same work.
+8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.
+Any attempt otherwise to copy, modify, sublicense, link with,
+or distribute the Library is void, and will automatically terminate
+your rights under this License. However, parties who have received
+copies, or rights, from you under this License will not have
+their licenses terminated so long as such parties remain in full
+compliance.
+9. You are not required to accept this License, since you have
+not signed it. However, nothing else grants you permission to
+modify or distribute the Library or its derivative works. These
+actions are prohibited by law if you do not accept this License.
+Therefore, by modifying or distributing the Library (or any work
+based on the Library), you indicate your acceptance of this License
+to do so, and all its terms and conditions for copying, distributing
+or modifying the Library or works based on it.
+10. Each time you redistribute the Library (or any work based
+on the Library), the recipient automatically receives a license
+from the original licensor to copy, distribute, link with or
+modify the Library subject to these terms and conditions. You
+may not impose any further restrictions on the recipients' exercise
+of the rights granted herein. You are not responsible for enforcing
+compliance by third parties with this License.
+11. If, as a consequence of a court judgment or allegation of
+patent infringement or for any other reason (not limited to patent
+issues), conditions are imposed on you (whether by court order,
+agreement or otherwise) that contradict the conditions of this
+License, they do not excuse you from the conditions of this License.
+If you cannot distribute so as to satisfy simultaneously your
+obligations under this License and any other pertinent obligations,
+then as a consequence you may not distribute the Library at all.
+For example, if a patent license would not permit royalty-free
+redistribution of the Library by all those who receive copies
+directly or indirectly through you, then the only way you could
+satisfy both it and this License would be to refrain entirely
+from distribution of the Library.
+If any portion of this section is held invalid or unenforceable
+under any particular circumstance, the balance of the section
+is intended to apply, and the section as a whole is intended
+to apply in other circumstances.
+It is not the purpose of this section to induce you to infringe
+any patents or other property right claims or to contest validity
+of any such claims; this section has the sole purpose of
+ protecting
+the integrity of the free software distribution system which
+is implemented by public license practices. Many people have
+made generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of
+that system; it is up to the author/donor to decide if he or
+she is willing to distribute software through any other system
+and a licensee cannot impose that choice.
+This section is intended to make thoroughly clear what is believed
+to be a consequence of the rest of this License.
+12. If the distribution and/or use of the Library is restricted
+in certain countries either by patents or by copyrighted interfaces,
+the original copyright holder who places the Library under this
+License may add an explicit geographical distribution limitation
+excluding those countries, so that distribution is permitted
+only in or among countries not thus excluded. In such case, this
+License incorporates the limitation as if written in the body
+of this License.
+13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+Each version is given a distinguishing version number. If the
+Library specifies a version number of this License which applies
+to it and "any later version", you have the option of following
+the terms and conditions either of that version or of any later
+version published by the Free Software Foundation. If the Library
+does not specify a license version number, you may choose any
+version ever published by the Free Software Foundation.
+14. If you wish to incorporate parts of the Library into other
+free programs whose distribution conditions are incompatible
+with these, write to the author to ask for permission. For software
+which is copyrighted by the Free Software Foundation, write to
+the Free Software Foundation; we sometimes make exceptions for
+this. Our decision will be guided by the two goals of preserving
+the free status of all derivatives of our free software and of
+promoting the sharing and reuse of software generally.
+NO WARRANTY
+15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS
+NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE
+LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS
+AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE
+DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR
+OR CORRECTION.
+16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO
+IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO
+MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE,
+BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
+INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
+INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS
+OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED
+BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE
+WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY
+HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+END OF TERMS AND CONDITIONS
+ </license>
+
+
+ <!-- url element commented out because of
+ https://jira.jboss.org/jira/browse/JBDS-1187 Configuration plugin errors in feature.xml file -->
+ <!--url-->
+ <!-- A password is required for this site. See the Customer Support Portal (CSP) or contact your rep for more information -->
+ <!-- <update label="%updateSiteName" url="https://devstudio.jboss.com/updates/3.0/"/> -->
+ <!-- You can also get *unsupported* community-tested updates to JBDS from the JBoss Tools site.
+ These updates generally become part of JBDS in the same way that Fedora content eventually becomes RHEL. -->
+ <!-- <discovery label="%JBossToolsUpdatesSiteName" url="http://download.jboss.org/jbosstools/updates/stable/galileo/"/> -->
+ <!-- url -->
+
+ <plugin
+ id="org.jboss.tools.runtime"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
Added: trunk/runtime/plugins/org.jboss.tools.runtime/.classpath
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/.classpath (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/.classpath 2010-08-11 23:09:56 UTC (rev 24075)
@@ -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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/runtime/plugins/org.jboss.tools.runtime/.project
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/.project (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/.project 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.runtime</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>
Added: trunk/runtime/plugins/org.jboss.tools.runtime/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/.settings/org.eclipse.jdt.core.prefs 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,7 @@
+#Thu Dec 04 23:27:23 CET 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/runtime/plugins/org.jboss.tools.runtime/META-INF/MANIFEST.MF
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/META-INF/MANIFEST.MF (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/META-INF/MANIFEST.MF 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %BundleName
+Bundle-SymbolicName: org.jboss.tools.runtime;singleton:=true
+Bundle-Version: 1.1.0.qualifier
+Bundle-Activator: org.jboss.tools.runtime.Activator
+Bundle-Vendor: %BundleVendor
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.jboss.tools.seam.core,
+ org.drools.eclipse;resolution:=optional,
+ org.eclipse.ui,
+ org.eclipse.wst.server.core,
+ org.eclipse.ui.navigator,
+ org.eclipse.jdt.launching,
+ org.eclipse.ui.workbench,
+ org.eclipse.datatools.connectivity;visibility:=reexport,
+ org.eclipse.datatools.connectivity.db.generic,
+ org.jboss.tools.common,
+ org.jboss.ide.eclipse.as.core,
+ org.jboss.tools.jbpm.common
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+
Added: trunk/runtime/plugins/org.jboss.tools.runtime/about.html
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/about.html (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/about.html 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,34 @@
+<!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">
+
+<H3>About This Content</H3>
+
+<P>©2007 Red Hat, Inc. All rights reserved</P>
+
+<H3>License</H3>
+
+<P>Red Hat Inc., through its JBoss division, 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 Red Hat Inc., 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.jboss.org/tools">http://www.jboss.org/tools</A>.</P>
+
+</BODY>
+</HTML>
\ No newline at end of file
Property changes on: trunk/runtime/plugins/org.jboss.tools.runtime/about.html
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/runtime/plugins/org.jboss.tools.runtime/build.properties
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/build.properties (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/build.properties 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
Added: trunk/runtime/plugins/org.jboss.tools.runtime/plugin.properties
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/plugin.properties (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/plugin.properties 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,4 @@
+#Properties file for org.jboss.tools.runtime
+BundleVendor = JBoss by Red Hat
+BundleName = JBoss Runtime Initializer
+JBoss_Runtimes = JBoss Runtimes
\ No newline at end of file
Added: trunk/runtime/plugins/org.jboss.tools.runtime/plugin.xml
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/plugin.xml (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/plugin.xml 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup
+ class="org.jboss.tools.runtime.JBossRuntimeStartup">
+ </startup>
+ </extension>
+
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.jboss.tools.runtime.preferences.JBossRuntimePreferencesInitializer"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.jboss.tools.common.model.ui.MainPreferencePage"
+ class="org.jboss.tools.runtime.preferences.RuntimePreferencePage"
+ id="org.jboss.tools.runtime.preferences.RuntimePreferencePage"
+ name="%JBoss_Runtimes"/>
+ </extension>
+
+ <!--
+ <extension
+ point="org.eclipse.wst.server.core.runtimeLocators">
+ <runtimeLocator
+ class="org.jboss.tools.runtime.JBossRuntimeLocator"
+ id="org.jboss.ide.eclipse.as.ui.wizards.jboss.runtimeLocator"
+ typeIds="org.jboss.ide.eclipse.as.*">
+ </runtimeLocator>
+ </extension>
+ -->
+
+</plugin>
Added: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/Activator.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/Activator.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/Activator.java 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,59 @@
+package org.jboss.tools.runtime;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.runtime"; //$NON-NLS-1$
+
+ public static final String FIRST_START = "firstStart"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ public static void log(Throwable e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, e
+ .getLocalizedMessage(), e);
+ Activator.getDefault().getLog().log(status);
+ }
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeLocator.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeLocator.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeLocator.java 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.runtime;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.server.core.model.RuntimeLocatorDelegate;
+import org.jboss.tools.runtime.bean.ServerBean;
+import org.jboss.tools.runtime.bean.ServerBeanLoader;
+import org.jboss.tools.runtime.bean.ServerType;
+
+public class JBossRuntimeLocator extends RuntimeLocatorDelegate {
+
+ public JBossRuntimeLocator() {
+ }
+
+ @Override
+ public void searchForRuntimes(IPath path, IRuntimeSearchListener listener,
+ IProgressMonitor monitor) {
+ ServerBeanLoader loader = new ServerBeanLoader();
+ List<ServerDefinition> serverDefinitions = new ArrayList<ServerDefinition>();
+ searchForRuntimes(serverDefinitions, path, loader, 4, monitor);
+ JBossRuntimeStartup runtimeStartup = new JBossRuntimeStartup();
+ runtimeStartup.initializeRuntimes(serverDefinitions);
+ }
+
+ public void searchForRuntimes(String path, IProgressMonitor monitor) {
+ searchForRuntimes(new Path(path), null, monitor);
+ }
+
+ private void searchForRuntimes(List<ServerDefinition> serverDefinitions, IPath path, ServerBeanLoader loader, int depth, IProgressMonitor monitor) {
+ File[] children = null;
+ if (path != null) {
+ File root = path.toFile();
+ ServerBean serverBean = loader.loadFromLocation(root);
+
+ if (!ServerType.UNKNOWN.equals(serverBean.getType())) {
+ serverDefinitions.add(new ServerDefinition(serverBean));
+ } else {
+ children = root.listFiles();
+ }
+ } else {
+ children = File.listRoots();
+ }
+ if (depth == 0) {
+ return;
+ }
+ if( children != null ) {
+ monitor.beginTask("Searching for JBoss runtime...", children.length); //$NON-NLS-1$
+ for( int i = 0; i < children.length; i++ ) {
+ if( children[i].isDirectory()) {
+ searchForRuntimes(serverDefinitions, new Path(children[i].getAbsolutePath()), loader, --depth, monitor);
+ }
+ }
+ }
+ monitor.done();
+ }
+
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeStartup.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeStartup.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/JBossRuntimeStartup.java 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,716 @@
+package org.jboss.tools.runtime;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import org.drools.eclipse.util.DroolsRuntime;
+import org.drools.eclipse.util.DroolsRuntimeManager;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.datatools.connectivity.ConnectionProfileConstants;
+import org.eclipse.datatools.connectivity.ConnectionProfileException;
+import org.eclipse.datatools.connectivity.ProfileManager;
+import org.eclipse.datatools.connectivity.db.generic.IDBConnectionProfileConstants;
+import org.eclipse.datatools.connectivity.db.generic.IDBDriverDefinitionConstants;
+import org.eclipse.datatools.connectivity.drivers.DriverInstance;
+import org.eclipse.datatools.connectivity.drivers.DriverManager;
+import org.eclipse.datatools.connectivity.drivers.IDriverMgmtConstants;
+import org.eclipse.datatools.connectivity.drivers.IPropertySet;
+import org.eclipse.datatools.connectivity.drivers.PropertySetImpl;
+import org.eclipse.datatools.connectivity.drivers.models.TemplateDescriptor;
+import org.eclipse.osgi.service.datalocation.Location;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IStartup;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.navigator.CommonNavigator;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerType;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
+import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
+import org.jboss.ide.eclipse.as.core.util.JBossServerType;
+import org.jboss.ide.eclipse.as.core.util.ServerBeanLoader;
+import org.jboss.tools.jbpm.preferences.PreferencesManager;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.SeamUtil;
+import org.jboss.tools.seam.core.project.facet.SeamRuntime;
+import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
+import org.jboss.tools.seam.core.project.facet.SeamVersion;
+import org.osgi.framework.Bundle;
+
+public class JBossRuntimeStartup implements IStartup {
+
+ private static final String RUNTIME = Messages.JBossRuntimeStartup_Runtime;
+
+ private static final String EAP = "EAP"; //$NON-NLS-1$
+
+ private static final String SOA_P = "SOA-P"; //$NON-NLS-1$
+
+ private static final String SOA_P_STD = "SOA-P-STD"; //$NON-NLS-1$
+
+ private static final String EPP = "EPP"; //$NON-NLS-1$
+
+ private static final String EWP = "EWP"; //$NON-NLS-1$
+
+ public static final String JBOSS_EAP_HOME = "../../../../jboss-eap/jboss-as"; // JBoss AS home directory (relative to plugin)- <RHDS_HOME>/jbossas. //$NON-NLS-1$
+
+ public static final String JBOSS_EAP_HOME_CONFIGURATION = "../../jboss-eap/jboss-as"; // JBoss AS home directory (relative to plugin)- <RHDS_HOME>/jbossas. //$NON-NLS-1$
+
+ public static final String SERVERS_FILE_NAME = "application_platforms.properties"; //$NON-NLS-1$
+
+ public static final String SERVERS_FILE = "../../../../studio/" + SERVERS_FILE_NAME; //$NON-NLS-1$
+
+ public static final String SERVERS_FILE_CONFIGURATION = "../../studio/" + SERVERS_FILE_NAME; //$NON-NLS-1$
+
+ public static String RUNTIME_CONFIG_FORMAT_VERSION = "1.0"; //$NON-NLS-1$
+
+ public static final String SEAM_1_2_HOME = "../../../../jboss-eap/seam"; //$NON-NLS-1$
+ public static final String SEAM_1_2_HOME_CONFIGURATION = "../../jboss-eap/seam"; //$NON-NLS-1$
+ public static final String SEAM_1_2_HOME_CP = "../../../../jboss-eap/seam1"; //$NON-NLS-1$
+ public static final String SEAM_1_2_HOME_CONFIGURATION_CP = "../../jboss-eap/seam1"; //$NON-NLS-1$
+
+ public static final String SEAM_2_0_HOME = "../../../../jboss-eap/seamfp"; //$NON-NLS-1$
+ public static final String SEAM_2_0_HOME_CONFIGURATION = "../../jboss-eap/seamfp"; //$NON-NLS-1$
+ public static final String SEAM_2_0_HOME_CP = "../../../../jboss-eap/seam2"; //$NON-NLS-1$
+ public static final String SEAM_2_0_HOME_CONFIGURATION_CP = "../../jboss-eap/seam2"; //$NON-NLS-1$
+
+ public static final String[] SEAM_HOME_FOLDER_OPTIONS = {"seam","seam1","seam2","seamfp"};
+
+
+
+ private static final String JBPM_VERSION="jBPM3"; //$NON-NLS-1$
+
+ // This constants are made to avoid dependency with org.jboss.ide.eclipse.as.core plugin
+ public static final String JBOSS_AS_RUNTIME_TYPE_ID[] = {
+ "org.jboss.ide.eclipse.as.runtime.32", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.runtime.40", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.runtime.42", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.runtime.50", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.runtime.51", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.runtime.60", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.runtime.eap.43", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.runtime.eap.50" //$NON-NLS-1$
+ };
+
+ public static final String HSQLDB_DRIVER_JAR_NAME = "hsqldb.jar"; //$NON-NLS-1$
+
+ public static final String HSQLDB_DRIVER_3X_4X_LOCATION = "/server/default/lib/" + HSQLDB_DRIVER_JAR_NAME; //$NON-NLS-1$
+
+ public static final String HSQLDB_DRIVER_5X_LOCATION = "/common/lib/" + HSQLDB_DRIVER_JAR_NAME; //$NON-NLS-1$
+
+ // This constants are made to avoid dependency with org.jboss.ide.eclipse.as.core plugin
+ public static final String JBOSS_AS_HSQL_DRIVER_LOCATION[] = {
+ HSQLDB_DRIVER_3X_4X_LOCATION,
+ HSQLDB_DRIVER_3X_4X_LOCATION,
+ HSQLDB_DRIVER_3X_4X_LOCATION,
+ HSQLDB_DRIVER_5X_LOCATION,
+ HSQLDB_DRIVER_5X_LOCATION,
+ HSQLDB_DRIVER_5X_LOCATION,
+ HSQLDB_DRIVER_3X_4X_LOCATION,
+ HSQLDB_DRIVER_5X_LOCATION
+ };
+
+ public static final String JBOSS_AS_TYPE_ID[] = {
+ "org.jboss.ide.eclipse.as.32", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.40", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.42", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.50", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.51", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.60", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.eap.43", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.eap.50", //$NON-NLS-1$
+ };
+
+ public static final String JBOSS_AS_NAME[] = {
+ Messages.JBossRuntimeStartup_JBoss_Application_Server_3_2,
+ Messages.JBossRuntimeStartup_JBoss_Application_Server_4_0,
+ Messages.JBossRuntimeStartup_JBoss_Application_Server_4_2,
+ Messages.JBossRuntimeStartup_JBoss_Application_Server_5_0,
+ Messages.JBossRuntimeStartup_JBoss_Application_Server_5_1,
+ Messages.JBossRuntimeStartup_JBoss_Application_Server_6_0,
+ Messages.JBossRuntimeStartup_JBoss_EAP_Server_4_3,
+ Messages.JBossRuntimeStartup_JBoss_EAP_Server_5_0
+ };
+
+ public static final String JBOSS_AS_HOST = "localhost"; //$NON-NLS-1$
+
+ public static final String JBOSS_AS_DEFAULT_CONFIGURATION_NAME = "default"; //$NON-NLS-1$
+
+ //public static final String FIRST_START_PREFERENCE_NAME = "FIRST_START";
+
+ public static final String HSQL_DRIVER_DEFINITION_ID
+ = "DriverDefn.Hypersonic DB"; //$NON-NLS-1$
+
+ public static final String HSQL_DRIVER_NAME = "Hypersonic DB"; //$NON-NLS-1$
+
+ public static final String HSQL_DRIVER_TEMPLATE_ID
+ = "org.eclipse.datatools.enablement.hsqldb.1_8.driver"; //$NON-NLS-1$
+
+ public static final String DTP_DB_URL_PROPERTY_ID
+ = "org.eclipse.datatools.connectivity.db.URL"; //$NON-NLS-1$
+
+ private static final String HSQL_PROFILE_ID = "org.eclipse.datatools.enablement.hsqldb.connectionProfile";
+
+ private List<ServerDefinition> serverDefinitions = new ArrayList<ServerDefinition>();
+
+ public void earlyStartup() {
+ if (!isJBDS()) {
+ return;
+ }
+ boolean firstStart = Activator.getDefault().getPreferenceStore().getBoolean(Activator.FIRST_START);
+ if (!firstStart) {
+ return;
+ }
+ Activator.getDefault().getPreferenceStore().setValue(Activator.FIRST_START, false);
+ parseServerFile();
+ initializeRuntimes(serverDefinitions);
+ }
+
+ private boolean isJBDS() {
+ Bundle jbdsProduct = Platform.getBundle("com.jboss.jbds.product");
+ return jbdsProduct != null;
+ }
+
+ public void initializeRuntimes(List<ServerDefinition> serverDefinitions) {
+ initializeJbpmRuntime(serverDefinitions);
+ initializeDroolsRuntime(serverDefinitions);
+ try {
+ String pluginLocation = FileLocator.resolve(Activator.getDefault().getBundle().getEntry("/")).getPath(); //$NON-NLS-1$
+ File jbossASDir = new File(pluginLocation, JBOSS_EAP_HOME);
+ if (!jbossASDir.isDirectory()) {
+ Location configLocation = Platform.getConfigurationLocation();
+ URL configURL = configLocation.getURL();
+ String configuration = FileLocator.resolve(configURL).getPath();
+ jbossASDir = new File(configuration, JBOSS_EAP_HOME_CONFIGURATION).getCanonicalFile();
+ } else {
+ jbossASDir = jbossASDir.getCanonicalFile();
+ }
+ if (jbossASDir.isDirectory()) {
+ int index = getJBossASVersion(jbossASDir);
+ createJBossServer(jbossASDir,index, "jboss-eap", "jboss-eap " + RUNTIME); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ } catch (IOException e) {
+ log(e,Messages.JBossRuntimeStartup_Cannot_create_new_JBoss_Server);
+ }
+ createJBossServer(serverDefinitions);
+
+ initializeSeam(serverDefinitions);
+ // https://jira.jboss.org/jira/browse/JBDS-1091
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ IViewPart view = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView("org.eclipse.wst.server.ui.ServersView");
+ if (view instanceof CommonNavigator) {
+ CommonNavigator navigator = (CommonNavigator) view;
+ navigator.getCommonViewer().refresh();
+ }
+ }
+ });
+ }
+
+ public void initializeSeam(List<ServerDefinition> serverDefinitions) {
+ IEclipsePreferences node = (IEclipsePreferences)
+ Platform.getPreferencesService()
+ .getRootNode()
+ .node(InstanceScope.SCOPE)
+ .node(SeamCorePlugin.PLUGIN_ID);
+ Map<String, SeamRuntime> map = new HashMap<String,SeamRuntime>();
+
+ // to fix https://jira.jboss.org/jira/browse/JBDS-682
+ // seam runtime initialization goes throug added servers first and
+ // then process seam runtimes from bundled servers
+ for(ServerDefinition serverDefinition:serverDefinitions) {
+ String type = serverDefinition.getType();
+ if (SOA_P.equals(type) || EAP.equals(type) || EPP.equals(type) || EWP.equals(type)) {
+ for (String folder : SEAM_HOME_FOLDER_OPTIONS) {
+ File seamFile = new File(serverDefinition.getLocation(),folder); //$NON-NLS-1$
+ addSeam(map, serverDefinition, seamFile);
+ }
+ }
+ }
+
+ // Initialize Seam Runtime from JBoss EAP
+ String seamGenBuildPath = getSeamGenBuildPath(SEAM_1_2_HOME, SEAM_1_2_HOME_CONFIGURATION);
+ SeamVersion seamVersion = getSeamVersion(seamGenBuildPath);
+ addSeam1(map, seamGenBuildPath, seamVersion);
+
+ // fix for https://jira.jboss.org/jira/browse/JBDS-1215 The installer could not find EAP 4.3 Seam runtimes in recent CP
+ seamGenBuildPath = getSeamGenBuildPath(SEAM_1_2_HOME_CP, SEAM_1_2_HOME_CONFIGURATION_CP);
+ seamVersion = getSeamVersion(seamGenBuildPath);
+ addSeam1(map, seamGenBuildPath, seamVersion);
+
+ // Initialize Seam 2.0 Runtime from JBoss EAP
+ seamGenBuildPath = getSeamGenBuildPath(SEAM_2_0_HOME, SEAM_2_0_HOME_CONFIGURATION);
+ seamVersion = getSeamVersion(seamGenBuildPath);
+ addSeam2(map, seamGenBuildPath, seamVersion);
+
+ // fix for https://jira.jboss.org/jira/browse/JBDS-1215 The installer could not find EAP 4.3 Seam runtimes in recent CPs
+ seamGenBuildPath = getSeamGenBuildPath(SEAM_2_0_HOME_CP, SEAM_2_0_HOME_CONFIGURATION_CP);
+ seamVersion = getSeamVersion(seamGenBuildPath);
+ addSeam2(map, seamGenBuildPath, seamVersion);
+ }
+
+ private void addSeam1(Map<String, SeamRuntime> map,
+ String seamGenBuildPath, SeamVersion seamVersion) {
+ if (seamVersion != null) {
+ StringBuffer name = new StringBuffer("Seam ").append(seamVersion); //$NON-NLS-1$
+ if(seamVersion.compareTo(SeamVersion.SEAM_1_2)==0) {
+ name.append(".EAP_4.3"); //$NON-NLS-1$
+ } else {
+ name.append(".EAP5"); //$NON-NLS-1$
+ }
+ addSeam(map, seamGenBuildPath,seamVersion,name.toString());
+ }
+ }
+
+ private void addSeam2(Map<String, SeamRuntime> map,
+ String seamGenBuildPath, SeamVersion seamVersion) {
+ if (seamVersion != null) {
+ String name = "Seam " + seamVersion + ".FP"; //$NON-NLS-1$ //$NON-NLS-2$
+ addSeam(map, seamGenBuildPath, seamVersion,name);
+ }
+ }
+
+ private void addSeam(Map<String, SeamRuntime> map,
+ ServerDefinition serverDefinition, File seamFile) {
+ if (seamFile.exists() && seamFile.canRead() && seamFile.isDirectory()) {
+ SeamVersion seamVersion = getSeamVersion(seamFile.getAbsolutePath());
+ if (seamVersion != null) {
+ String name = "Seam " + serverDefinition.getName() + " " + seamVersion; //$NON-NLS-1$ //$NON-NLS-2$
+ addSeam(map, seamFile.getAbsolutePath(), seamVersion, name);
+ }
+ }
+ }
+
+ private SeamVersion getSeamVersion(String seamGenBuildPath) {
+ if (seamGenBuildPath == null || seamGenBuildPath.trim().length() <= 0) {
+ return null;
+ }
+ String fullVersion = SeamUtil.getSeamVersionFromManifest(seamGenBuildPath);
+ if (fullVersion == null) {
+ return null;
+ }
+ String version = fullVersion.substring(0,3);
+ SeamVersion seamVersion = null;
+ if (version != null) {
+ seamVersion = SeamVersion.findByString(version);
+ }
+ return seamVersion;
+ }
+
+ private void addSeam(Map<String, SeamRuntime> map, String seamPath,SeamVersion seamVersion, String name) {
+ File seamFolder = new File(seamPath);
+ if(seamFolder.exists() && seamFolder.isDirectory()) {
+ SeamRuntime rt = new SeamRuntime();
+ rt.setHomeDir(seamPath);
+ rt.setName(name);
+ rt.setDefault(true);
+ rt.setVersion(seamVersion);
+ SeamRuntimeManager.getInstance().addRuntime(rt);
+ }
+ }
+
+ private String getSeamGenBuildPath(String seamHomePath,
+ String seamHomePathConfiguration) {
+ try {
+ Location configLocation = Platform.getConfigurationLocation();
+ URL configURL = configLocation.getURL();
+ String configuration = FileLocator.resolve(configURL).getPath();
+ File seamGenDir = new File(configuration, seamHomePathConfiguration);
+ if (!seamGenDir.isDirectory()) {
+ String pluginLocation = null;
+ pluginLocation = FileLocator
+ .resolve(
+ Activator.getDefault().getBundle()
+ .getEntry("/")).getFile(); //$NON-NLS-1$
+ seamGenDir = new File(pluginLocation, seamHomePath);
+ }
+ Path p = new Path(seamGenDir.getPath());
+ p.makeAbsolute();
+ if (p.toFile().exists()) {
+ return p.toOSString();
+ }
+ } catch (IOException e) {
+ log(e);
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ public void createJBossServer(List<ServerDefinition> serverDefinitions) {
+ for (ServerDefinition serverDefinition:serverDefinitions) {
+ String type = serverDefinition.getType();
+ if (SOA_P.equals(type) || EAP.equals(type) || EPP.equals(type) || SOA_P_STD.equals(type) || EWP.equals(type)) {
+ File asLocation = new File(serverDefinition.getLocation(), "jboss-as");
+ if(SOA_P_STD.equals(type)) {
+ asLocation = new File(serverDefinition.getLocation(),"jboss-esb"); //$NON-NLS-1$
+ } else if(EWP.equals(type)){
+ asLocation = new File(serverDefinition.getLocation(),"jboss-as-web"); //$NON-NLS-1$
+ }
+ if (asLocation.isDirectory()) {
+ String name = serverDefinition.getName();
+ String runtimeName = name + " " + RUNTIME; //$NON-NLS-1$
+ int index = getJBossASVersion(asLocation);
+ createJBossServer(asLocation,index,name, runtimeName);
+ }
+ } else {
+ String version = serverDefinition.getVersion();
+ int index = 2;
+ if ("3.2".equals(version)) { //$NON-NLS-1$
+ index = 0;
+ } else if ("4.0".equals(version)) { //$NON-NLS-1$
+ index = 1;
+ } else if ("4.2".equals(version)) { //$NON-NLS-1$
+ index = 2;
+ } else if ("5.0".equals(version)) { //$NON-NLS-1$
+ index = 3;
+ } else if ("5.1".equals(version)) { //$NON-NLS-1$
+ index = 4;
+ } else if ("6.0".equals(version)) { //$NON-NLS-1$
+ index = 5;
+ }
+ createJBossServer(serverDefinition.getLocation(),index,serverDefinition.getName(),serverDefinition.getName() + " " + RUNTIME); //$NON-NLS-1$
+ }
+ }
+ }
+
+ private int getJBossASVersion(File asLocation) {
+ int index = -1;
+ String fullVersion = new ServerBeanLoader().getFullServerVersion(new File(asLocation, JBossServerType.AS.getSystemJarPath()));
+ if(fullVersion != null ) {
+ String version = fullVersion.substring(0, 3);
+ if ("4.3".equals(version)) { //$NON-NLS-1$
+ index = 6;
+ } else if ("5.0".equals(version)) { //$NON-NLS-1$
+ index = 7;
+ }
+ }
+ return index;
+ }
+
+ private void createJBossServer(File asLocation, int index, String name, String runtimeName) {
+ if (!asLocation.isDirectory() || index==-1) {
+ return;
+ }
+ IPath jbossAsLocationPath = new Path(asLocation.getAbsolutePath());
+
+ IServer[] servers = ServerCore.getServers();
+ for (int i = 0; i < servers.length; i++) {
+ IRuntime runtime = servers[i].getRuntime();
+ if(runtime != null && runtime.getLocation().equals(jbossAsLocationPath)) {
+ return;
+ }
+ }
+
+ IRuntime runtime = null;
+ IRuntime[] runtimes = ServerCore.getRuntimes();
+ for (int i = 0; i < runtimes.length; i++) {
+ if (runtimes[0].getLocation().equals(jbossAsLocationPath)) {
+ runtime = runtimes[0].createWorkingCopy();
+ break;
+ }
+ }
+
+ IProgressMonitor progressMonitor = new NullProgressMonitor();
+ try {
+ if (runtime == null) {
+ runtime = createRuntime(runtimeName, asLocation.getAbsolutePath(), progressMonitor, index);
+ }
+ if (runtime != null) {
+ createServer(progressMonitor, runtime, index, name);
+ }
+
+ createDriver(asLocation.getAbsolutePath(), index);
+ } catch (CoreException e) {
+ log(e,Messages.JBossRuntimeStartup_Cannot_create_new_JBoss_Server);
+ } catch (ConnectionProfileException e) {
+ log(e,Messages.JBossRuntimeStartup_Cannott_create_new_DTP_Connection_Profile);
+ }
+ }
+
+ private void parseServerFile() {
+
+ try {
+ String pluginLocation = FileLocator.resolve(Activator.getDefault().getBundle().getEntry("/")).getPath(); //$NON-NLS-1$
+ File serversFile = new File(pluginLocation, SERVERS_FILE);
+
+ if (!serversFile.isFile()) {
+ Location configLocation = Platform.getConfigurationLocation();
+ URL configURL = configLocation.getURL();
+ String configuration = FileLocator.resolve(configURL).getPath();
+ serversFile = new File(configuration, SERVERS_FILE_CONFIGURATION).getCanonicalFile();
+ } else {
+ serversFile = serversFile.getCanonicalFile();
+ }
+ if (!serversFile.isFile()) {
+ serversFile = new File(pluginLocation,SERVERS_FILE_NAME);
+ }
+ if (serversFile.isFile()) {
+ //String str = FileUtil.readFile(serversFile);
+ Properties servers = new Properties();
+ servers.load(new BufferedInputStream(new FileInputStream(serversFile)));
+ Enumeration<Object> elements = servers.elements();
+ while (elements.hasMoreElements()) {
+ String str = (String) elements.nextElement();
+ StringTokenizer lineTokenizer = new StringTokenizer(str,
+ "\n\r\f"); //$NON-NLS-1$
+ while (lineTokenizer.hasMoreTokens()) {
+ String lineToken = lineTokenizer.nextToken();
+ StringTokenizer tokenizer = new StringTokenizer(
+ lineToken, ","); //$NON-NLS-1$
+ if (tokenizer.countTokens() == 4) {
+ String name = tokenizer.nextToken();
+ /*int index = name.indexOf('=');
+ if (index < 0) {
+ continue;
+ }
+ name = name.substring(index + 1);*/
+ String type = tokenizer.nextToken();
+ String version = tokenizer.nextToken();
+ String location = tokenizer.nextToken();
+ File locationFile = new File(location);
+ if (locationFile.isDirectory()) {
+ serverDefinitions.add(new ServerDefinition(
+ name, version, type, locationFile));
+ }
+ }
+ }
+ }
+ }
+ } catch (FileNotFoundException e) {
+ log(e);
+ } catch (IOException e) {
+ log(e);
+ }
+ }
+
+ private static void log(Throwable e) {
+ IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e
+ .getLocalizedMessage(), e);
+ Activator.getDefault().getLog().log(status);
+ }
+
+ private static void log(Throwable e, String message) {
+ IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message, e);
+ Activator.getDefault().getLog().log(status);
+ }
+
+ /**
+ * Creates new JBoss AS Runtime, Server and hsqldb driver
+ * @param jbossASLocation location of JBoss Server
+ * @param progressMonitor to report progress
+ * @return server working copy
+ * @throws CoreException
+ * @throws ConnectionProfileException
+ */
+// public static IServerWorkingCopy initJBossAS(String jbossASLocation, IProgressMonitor progressMonitor) throws CoreException, ConnectionProfileException {
+// IRuntime runtime = createRuntime(null, jbossASLocation, progressMonitor, 2);
+// IServerWorkingCopy server = null;
+// if (runtime != null) {
+// server = createServer(progressMonitor, runtime, 2, null);
+// }
+// createDriver(jbossASLocation);
+// return server;
+// }
+
+ /**
+ * Creates new JBoss AS Runtime
+ * @param jbossASLocation location of JBoss AS
+ * @param progressMonitor
+ * @return runtime working copy
+ * @throws CoreException
+ */
+ private static IRuntime createRuntime(String runtimeName, String jbossASLocation, IProgressMonitor progressMonitor, int index) throws CoreException {
+ IRuntimeWorkingCopy runtime = null;
+ String type = null;
+ String version = null;
+ String runtimeId = null;
+ IPath jbossAsLocationPath = new Path(jbossASLocation);
+ IRuntimeType[] runtimeTypes = ServerUtil.getRuntimeTypes(type, version, JBOSS_AS_RUNTIME_TYPE_ID[index]);
+ if (runtimeTypes.length > 0) {
+ runtime = runtimeTypes[0].createRuntime(runtimeId, progressMonitor);
+ runtime.setLocation(jbossAsLocationPath);
+ if(runtimeName!=null) {
+ runtime.setName(runtimeName);
+ }
+// to fix https://jira.jboss.org/jira/browse/JBDS-852 VM attributes initialization below was commented
+// IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall();
+ // IJBossServerRuntime.PROPERTY_VM_ID
+// ((RuntimeWorkingCopy) runtime).setAttribute("PROPERTY_VM_ID", defaultVM.getId()); //$NON-NLS-1$
+ // IJBossServerRuntime.PROPERTY_VM_TYPE_ID
+// ((RuntimeWorkingCopy) runtime).setAttribute("PROPERTY_VM_TYPE_ID", defaultVM.getVMInstallType().getId()); //$NON-NLS-1$
+ // IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME
+ ((RuntimeWorkingCopy) runtime).setAttribute("org.jboss.ide.eclipse.as.core.runtime.configurationName", JBOSS_AS_DEFAULT_CONFIGURATION_NAME); //$NON-NLS-1$
+
+ return runtime.save(false, progressMonitor);
+ }
+ return runtime;
+ }
+
+ /**
+ * Creates new JBoss Server
+ * @param progressMonitor
+ * @param runtime parent JBoss AS Runtime
+ * @return server working copy
+ * @throws CoreException
+ */
+ private static IServerWorkingCopy createServer(IProgressMonitor progressMonitor, IRuntime runtime, int index, String name) throws CoreException {
+ IServerType serverType = ServerCore.findServerType(JBOSS_AS_TYPE_ID[index]);
+ IServerWorkingCopy server = serverType.createServer(null, null, runtime, progressMonitor);
+
+ server.setHost(JBOSS_AS_HOST);
+ if(name != null)
+ server.setName(name);
+ else
+ server.setName(JBOSS_AS_NAME[index]);
+
+ // JBossServer.DEPLOY_DIRECTORY
+ String deployVal = runtime.getLocation().append("server").append(JBOSS_AS_DEFAULT_CONFIGURATION_NAME).append("deploy").toOSString(); //$NON-NLS-1$ //$NON-NLS-2$
+ ((ServerWorkingCopy) server).setAttribute("org.jboss.ide.eclipse.as.core.server.deployDirectory", deployVal); //$NON-NLS-1$
+
+ // IDeployableServer.TEMP_DEPLOY_DIRECTORY
+ String deployTmpFolderVal = runtime.getLocation().append("server").append(JBOSS_AS_DEFAULT_CONFIGURATION_NAME).append("tmp").append("jbosstoolsTemp").toOSString(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ((ServerWorkingCopy) server).setAttribute("org.jboss.ide.eclipse.as.core.server.tempDeployDirectory", deployTmpFolderVal); //$NON-NLS-1$
+
+ // If we'd need to set up a username / pw for JMX, do it here.
+// ((ServerWorkingCopy)serverWC).setAttribute(JBossServer.SERVER_USERNAME, authUser);
+// ((ServerWorkingCopy)serverWC).setAttribute(JBossServer.SERVER_PASSWORD, authPass);
+
+ server.save(false, progressMonitor);
+ return server;
+ }
+
+ private static boolean driverIsCreated = false;
+
+ /**
+ * Creates HSQL DB Driver
+ * @param jbossASLocation location of JBoss AS
+ * @param index
+ * @throws ConnectionProfileException
+ * @return driver instance
+ */
+ private static void createDriver(String jbossASLocation, int index) throws ConnectionProfileException {
+ if(driverIsCreated) {
+ // Don't create the driver a few times
+ return;
+ }
+ String driverPath;
+ try {
+ driverPath = new File(jbossASLocation + JBOSS_AS_HSQL_DRIVER_LOCATION[index]).getCanonicalPath(); //$NON-NLS-1$
+ } catch (IOException e) {
+ Activator.getDefault().getLog().log(new Status(IStatus.ERROR,
+ Activator.PLUGIN_ID, Messages.JBossRuntimeStartup_Cannott_create_new_HSQL_DB_Driver, e));
+ return;
+ }
+
+ DriverInstance driver = DriverManager.getInstance().getDriverInstanceByName(HSQL_DRIVER_NAME);
+ if (driver == null) {
+ TemplateDescriptor descr = TemplateDescriptor.getDriverTemplateDescriptor(HSQL_DRIVER_TEMPLATE_ID);
+ IPropertySet instance = new PropertySetImpl(HSQL_DRIVER_NAME, HSQL_DRIVER_DEFINITION_ID);
+ instance.setName(HSQL_DRIVER_NAME);
+ instance.setID(HSQL_DRIVER_DEFINITION_ID);
+ Properties props = new Properties();
+
+ IConfigurationElement[] template = descr.getProperties();
+ for (int i = 0; i < template.length; i++) {
+ IConfigurationElement prop = template[i];
+ String id = prop.getAttribute("id"); //$NON-NLS-1$
+
+ String value = prop.getAttribute("value"); //$NON-NLS-1$
+ props.setProperty(id, value == null ? "" : value); //$NON-NLS-1$
+ }
+ props.setProperty(DTP_DB_URL_PROPERTY_ID, "jdbc:hsqldb:."); //$NON-NLS-1$
+ props.setProperty(IDriverMgmtConstants.PROP_DEFN_TYPE, descr.getId());
+ props.setProperty(IDriverMgmtConstants.PROP_DEFN_JARLIST, driverPath);
+
+ instance.setBaseProperties(props);
+ DriverManager.getInstance().removeDriverInstance(instance.getID());
+ System.gc();
+ DriverManager.getInstance().addDriverInstance(instance);
+ }
+
+ driver = DriverManager.getInstance().getDriverInstanceByName(HSQL_DRIVER_NAME);
+ if (driver != null && ProfileManager.getInstance().getProfileByName("DefaultDS") == null) { //$NON-NLS-1$
+ // create profile
+ Properties props = new Properties();
+ props.setProperty(ConnectionProfileConstants.PROP_DRIVER_DEFINITION_ID, HSQL_DRIVER_DEFINITION_ID);
+ props.setProperty(IDBConnectionProfileConstants.CONNECTION_PROPERTIES_PROP_ID, ""); //$NON-NLS-1$
+ props.setProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.DRIVER_CLASS_PROP_ID));
+ props.setProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.DATABASE_VENDOR_PROP_ID));
+ props.setProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.DATABASE_VERSION_PROP_ID));
+ props.setProperty(IDBDriverDefinitionConstants.DATABASE_NAME_PROP_ID, "Default"); //$NON-NLS-1$
+ props.setProperty(IDBDriverDefinitionConstants.PASSWORD_PROP_ID, ""); //$NON-NLS-1$
+ props.setProperty(IDBConnectionProfileConstants.SAVE_PASSWORD_PROP_ID, "false"); //$NON-NLS-1$
+ props.setProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.USERNAME_PROP_ID));
+ props.setProperty(IDBDriverDefinitionConstants.URL_PROP_ID, driver.getProperty(IDBDriverDefinitionConstants.URL_PROP_ID));
+
+ ProfileManager.getInstance().createProfile("DefaultDS", Messages.JBossRuntimeStartup_The_JBoss_AS_Hypersonic_embedded_database, HSQL_PROFILE_ID, props, "", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ if(driver!=null) {
+ driverIsCreated = true;
+ }
+ }
+
+ public void initializeDroolsRuntime(List<ServerDefinition> serverDefinitions) {
+ List<DroolsRuntime> droolsRuntimes = new ArrayList<DroolsRuntime>();
+ for (ServerDefinition serverDefinition : serverDefinitions) {
+ String type = serverDefinition.getType();
+ if (SOA_P.equals(type)) {
+ File droolsRoot = serverDefinition.getLocation(); //$NON-NLS-1$
+ if (droolsRoot.isDirectory()) {
+ DroolsRuntime runtime = new DroolsRuntime();
+ runtime.setName("Drools - " + serverDefinition.getName()); //$NON-NLS-1$
+ runtime.setPath(droolsRoot.getAbsolutePath());
+ DroolsRuntimeManager.recognizeJars(runtime);
+ runtime.setDefault(true);
+ droolsRuntimes.add(runtime);
+ }
+ }
+ }
+ if (droolsRuntimes.size() > 0) {
+ DroolsRuntime[] dra = droolsRuntimes.toArray(new DroolsRuntime[0]);
+ DroolsRuntimeManager.setDroolsRuntimes(dra);
+ }
+
+ }
+
+ public void initializeJbpmRuntime(List<ServerDefinition> serverDefinitions) {
+ for (ServerDefinition serverDefinition : serverDefinitions) {
+ String type = serverDefinition.getType();
+ if (SOA_P.equals(type)) {
+ File jbpmRoot = new File(serverDefinition.getLocation(),"jbpm-jpdl"); //$NON-NLS-1$
+ if (jbpmRoot.isDirectory()) {
+ PreferencesManager.getInstance().initializeDefaultJbpmInstallation(serverDefinition.getName(), jbpmRoot.getAbsolutePath(), JBPM_VERSION);
+ }
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
Added: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/Messages.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/Messages.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/Messages.java 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,27 @@
+package org.jboss.tools.runtime;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.runtime.messages"; //$NON-NLS-1$
+ public static String JBossRuntimeStartup_JBoss_Application_Server_6_0;
+ public static String JBossRuntimeStartup_Cannot_create_new_JBoss_Server;
+ public static String JBossRuntimeStartup_Cannott_create_new_DTP_Connection_Profile;
+ public static String JBossRuntimeStartup_Cannott_create_new_HSQL_DB_Driver;
+ public static String JBossRuntimeStartup_JBoss_Application_Server_3_2;
+ public static String JBossRuntimeStartup_JBoss_Application_Server_4_0;
+ public static String JBossRuntimeStartup_JBoss_Application_Server_4_2;
+ public static String JBossRuntimeStartup_JBoss_Application_Server_5_0;
+ public static String JBossRuntimeStartup_JBoss_Application_Server_5_1;
+ public static String JBossRuntimeStartup_JBoss_EAP_Server_4_3;
+ public static String JBossRuntimeStartup_JBoss_EAP_Server_5_0;
+ public static String JBossRuntimeStartup_Runtime;
+ public static String JBossRuntimeStartup_The_JBoss_AS_Hypersonic_embedded_database;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/ServerDefinition.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/ServerDefinition.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/ServerDefinition.java 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,122 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2009 JBoss by Red Hat and others.
+ * 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime;
+
+import java.io.File;
+
+import org.jboss.tools.runtime.bean.ServerBean;
+
+/**
+ * @author Snjeza
+ *
+ */
+public class ServerDefinition {
+
+ private String name;
+ private String version;
+ private String type;
+ private File location;
+
+ public ServerDefinition(String name, String version, String type,
+ File location) {
+ super();
+ this.name = name;
+ this.version = version;
+ this.type = type;
+ this.location = location;
+ }
+
+ /**
+ * @param serverBean
+ */
+ public ServerDefinition(ServerBean serverBean) {
+ this.name = serverBean.getName();
+ this.version = serverBean.getVersion();
+ this.type = serverBean.getType().getId();
+ this.location = new File(serverBean.getLocation());
+ }
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getVersion() {
+ return version;
+ }
+ public void setVersion(String version) {
+ this.version = version;
+ }
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+ public File getLocation() {
+ return location;
+ }
+ public void setLocation(File location) {
+ this.location = location;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((location == null) ? 0 : location.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ result = prime * result + ((version == null) ? 0 : version.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ServerDefinition other = (ServerDefinition) obj;
+ if (location == null) {
+ if (other.location != null)
+ return false;
+ } else if (!location.equals(other.location))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (type == null) {
+ if (other.type != null)
+ return false;
+ } else if (!type.equals(other.type))
+ return false;
+ if (version == null) {
+ if (other.version != null)
+ return false;
+ } else if (!version.equals(other.version))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "ServerDefinition [name=" + name + ", version=" + version
+ + ", type=" + type + ", location=" + location + "]";
+ }
+
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/bean/ServerBean.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/bean/ServerBean.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/bean/ServerBean.java 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.runtime.bean;
+
+import java.io.File;
+
+public class ServerBean {
+
+ public static final String EMPTY = "";
+
+ public ServerBean() {
+
+ }
+
+ public ServerBean(String location, String name, ServerType type,
+ String version) {
+ super();
+ this.location = location;
+ this.name = name;
+ this.type = type;
+ this.version = version;
+ }
+
+ public ServerBean(ServerBean bean) {
+ this(bean.getLocation(),bean.getName(), bean.getType(),bean.getVersion());
+ }
+
+ private String location=EMPTY;
+ private ServerType type = ServerType.UNKNOWN;
+ private String name = EMPTY;
+ private String version = EMPTY;
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public ServerType getType() {
+ return type;
+ }
+
+ public void setType(ServerType type) {
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String toString() {
+ return name + "," + type + "," + version + "," + location;
+ }
+
+ public boolean equals(Object obj) {
+ if(obj == null) return false;
+ if(this == obj) return true;
+ return this.toString().equals(obj.toString());
+ }
+}
\ No newline at end of file
Added: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/bean/ServerBeanLoader.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/bean/ServerBeanLoader.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/bean/ServerBeanLoader.java 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.runtime.bean;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+/**
+ * @author eskimo
+ *
+ */
+public class ServerBeanLoader {
+
+ public static final String SOAP_JBPM_JPDL_PATH = "jbpm-jpdl";
+
+ public ServerBean loadFromLocation(File location) {
+ ServerType type = getServerType(location);
+ String version = getServerVersion(getFullServerVersion(new File(location,type.getSystemJarPath())));
+ ServerBean server = new ServerBean(location.getPath(),getName(location),type,version);
+ return server;
+ }
+
+ public ServerType getServerType(File location) {
+ if(ServerType.AS.isServerRoot(location)) {
+ return ServerType.AS;
+ } else if(ServerType.EAP.isServerRoot(location) && ServerType.SOAP.isServerRoot(location)) {
+ return ServerType.SOAP;
+ } else if(ServerType.SOAP_STD.isServerRoot(location)) {
+ return ServerType.SOAP_STD;
+ } else if(ServerType.EAP.isServerRoot(location) && ServerType.EPP.isServerRoot(location)) {
+ return ServerType.EPP;
+ } else if(ServerType.EAP.isServerRoot(location)) {
+ return ServerType.EAP;
+ } else if(ServerType.EWP.isServerRoot(location)) {
+ return ServerType.EWP;
+ }
+ return ServerType.UNKNOWN;
+ }
+
+ public String getName(File location) {
+ return location.getName();
+ }
+
+ public String getFullServerVersion(File systemJarFile) {
+ String version = null;
+ if(systemJarFile.canRead()) {
+ try {
+ ZipFile jar = new ZipFile(systemJarFile);
+ ZipEntry manifest = jar.getEntry("META-INF/MANIFEST.MF");
+ Properties props = new Properties();
+ props.load(jar.getInputStream(manifest));
+ version = (String)props.get("Specification-Version");
+ } catch (IOException e) {
+ // version = ""
+ }
+ }
+ return version;
+ }
+
+ public String getServerVersion(String version) {
+ if(version==null) return "";
+ String[] versions = ServerType.UNKNOWN.getVersions();
+ String adapterVersion = "";
+ // trying to match adapter version by X.X version
+ for (String currentVersion : versions) {
+ String pattern = currentVersion.replace(".", "\\.") + ".*";
+ if(version.matches(pattern)) {
+ adapterVersion = currentVersion;
+ break;
+ }
+ }
+
+ if("".equals(adapterVersion)) {
+ // trying to match by major version
+ for (String currentVersion : versions) {
+ String pattern = currentVersion.substring(0, 2).replace(".", "\\.") + ".*";
+ if(version.matches(pattern)) {
+ adapterVersion = currentVersion;
+ break;
+ }
+ }
+ }
+ return adapterVersion;
+ }
+
+ public String getAdapterVersion(String version) {
+ String[] versions = ServerType.UNKNOWN.getVersions();
+ String adapterVersion = "";
+ // trying to match adapter version by X.X version
+ for (String currentVersion : versions) {
+ String pattern = currentVersion.replace(".", "\\.") + ".*";
+ if(version.matches(pattern)) {
+ adapterVersion = currentVersion;
+ break;
+ }
+ }
+
+ if("".equals(adapterVersion)) {
+ // trying to match by major version
+ for (String currentVersion : versions) {
+ String pattern = currentVersion.substring(0, 2).replace(".", "\\.") + ".*";
+ if(version.matches(pattern)) {
+ adapterVersion = currentVersion;
+ break;
+ }
+ }
+ }
+ return adapterVersion;
+ }
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/bean/ServerType.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/bean/ServerType.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/bean/ServerType.java 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,190 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.runtime.bean;
+
+import java.io.File;
+
+public class ServerType {
+
+ private static final String JBOSS_AS_PATH = "jboss-as";
+ private static final String BIN_PATH = "bin";
+ private static final String TWIDDLE_JAR_NAME = "twiddle.jar";
+ private static final String RUN_JAR_NAME = "run.jar";
+ private static final String JBOSS_ESB_PATH = "jboss-esb";
+ private static final String SOAP_JBPM_JPDL_PATH = "jbpm-jpdl";
+ private static final String JBOSS_AS_WEB_PATH = "jboss-as-web";
+ private static final String JBOSS_PORTLETBRIDGE_PATH = "portletbridge";
+
+ private static String UNKNOWN_STR = "UNKNOWN";
+
+ private String name;
+ private String jbossSystemJarPath;
+ private String[] versions = new String[0];
+
+ private ServerType.Condition condition = null;
+ private String id=UNKNOWN_STR;
+
+ protected ServerType(String id, String name, String jbossSystemJarPath, String[] versions, Condition condition) {
+ this.id = id;
+ this.name = name;
+ this.jbossSystemJarPath = jbossSystemJarPath;
+ this.versions = versions;
+ this.condition = condition;
+ }
+
+ public static final ServerType AS = new ServerType(
+ "AS",
+ "Application Server",
+ BIN_PATH+File.separatorChar + TWIDDLE_JAR_NAME,
+ new String[]{"6.0","5.1", "5.0", "4.2", "4.0", "3.2"}, new ASServerTypeCondition());
+
+ public static final ServerType EAP = new ServerType(
+ "EAP",
+ "Enterprise Application Platform",
+ JBOSS_AS_PATH + File.separatorChar + BIN_PATH+ File.separatorChar + TWIDDLE_JAR_NAME,
+ new String[]{"4.2","4.3","5.0"}, new EAPServerTypeCondition());
+
+ public static final ServerType SOAP = new ServerType(
+ "SOA-P",
+ "SOA Platform",
+ JBOSS_AS_PATH + File.separatorChar + BIN_PATH+ File.separatorChar + TWIDDLE_JAR_NAME,
+ new String[]{"4.3","5.0"}, new SOAPServerTypeCondition());
+
+ public static final ServerType SOAP_STD = new ServerType(
+ "SOA-P-STD",
+ "SOA Platform Standalone",
+ JBOSS_ESB_PATH + File.separatorChar + BIN_PATH+ File.separatorChar + RUN_JAR_NAME,
+ new String[]{"4.3","5.0"}, new SOAPStandaloneServerTypeCondition());
+
+ public static final ServerType EWP = new ServerType(
+ "EWP",
+ "Enterprise Web Platform",
+ JBOSS_AS_WEB_PATH + File.separatorChar + BIN_PATH + File.separatorChar + RUN_JAR_NAME,
+ new String[]{"5.0"}, new EWPTypeCondition());
+
+ public static final ServerType EPP = new ServerType(
+ "EPP",
+ "Enterprise Portal Platform",
+ JBOSS_AS_PATH + File.separatorChar + BIN_PATH + File.separatorChar + RUN_JAR_NAME,
+ new String[]{"4.3","5.0"}, new EPPTypeCondition());
+
+ public static final ServerType UNKNOWN = new ServerType(
+ UNKNOWN_STR,
+ UNKNOWN_STR,
+ "",
+ new String[]{"6.0", "5.1", "5.0", "4.3", "4.2", "4.0", "3.2"}, null);
+
+ public String toString() {
+ return id;
+ }
+
+ public static ServerType getType(String name) {
+ if(AS.name.equals(name)) {
+ return AS;
+ } else if(EAP.name.equals(name)) {
+ return EAP;
+ } else if(SOAP.name.equals(name)) {
+ return SOAP;
+ } else if(SOAP_STD.name.equals(name)) {
+ return SOAP_STD;
+ } else if(EWP.name.equals(name)) {
+ return EWP;
+ } else if(EPP.name.equals(name)) {
+ return EPP;
+ }
+
+ throw new IllegalArgumentException("Name '" + name + "' cannot be converted to ServerType");
+ }
+
+ public String[] getVersions() {
+ return versions;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getSystemJarPath() {
+ return jbossSystemJarPath;
+ }
+
+ public boolean isServerRoot(File location) {
+ return this.condition.isServerRoot(location);
+ }
+
+ public static final ServerType[] KNOWN_TYPES = {AS, EAP, SOAP, SOAP_STD, EWP, EPP};
+
+ static interface Condition {
+ public boolean isServerRoot(File location);
+ }
+
+
+ public static class EAPServerTypeCondition implements Condition {
+ public boolean isServerRoot(File location) {
+ File asSystemJar = new File(location, ServerType.EAP.getSystemJarPath());
+ return asSystemJar.exists() && asSystemJar.isFile();
+ }
+ }
+
+ public static class ASServerTypeCondition implements Condition {
+
+ public boolean isServerRoot(File location) {
+ File asSystemJar = new File(location, ServerType.AS.getSystemJarPath());
+ return asSystemJar.exists() && asSystemJar.isFile();
+ }
+ }
+
+ public static class SOAPServerTypeCondition extends EAPServerTypeCondition{
+
+ public boolean isServerRoot(File location) {
+ File jbpmFolder = new File(location, SOAP_JBPM_JPDL_PATH);
+ return super.isServerRoot(location) && jbpmFolder.exists() && jbpmFolder.isDirectory();
+ }
+ }
+
+ public static class SOAPStandaloneServerTypeCondition implements Condition {
+
+ public boolean isServerRoot(File location) {
+ File jbpmFolder = new File(location, SOAP_JBPM_JPDL_PATH);
+ File soaStdSystemJar = new File(location,JBOSS_ESB_PATH + File.separatorChar + BIN_PATH + File.separatorChar + RUN_JAR_NAME);
+ return
+ jbpmFolder.exists() && jbpmFolder.isDirectory()
+ &&
+ soaStdSystemJar.exists() && soaStdSystemJar.isFile();
+ }
+ }
+
+ public static class EWPTypeCondition implements Condition {
+ public boolean isServerRoot(File location) {
+ File ewpSystemJar = new File(location,ServerType.EWP.getSystemJarPath());
+ return ewpSystemJar.exists() && ewpSystemJar.isFile();
+ }
+ }
+
+ public static class EPPTypeCondition implements Condition {
+ public boolean isServerRoot(File location) {
+ File portletBridgeFolder = new File(location, JBOSS_PORTLETBRIDGE_PATH);
+ File portlalSarFolder = new File(location, JBOSS_AS_PATH + File.separatorChar + "server" + File.separatorChar + "default" + File.separatorChar + "deploy" + File.separatorChar + "jboss-portal.sar" );
+ File asStdSystemJar = new File(location,JBOSS_AS_PATH + File.separatorChar + BIN_PATH + File.separatorChar + RUN_JAR_NAME);
+ return
+ (portletBridgeFolder.exists() && portletBridgeFolder.isDirectory()
+ ||
+ portlalSarFolder.exists() && portlalSarFolder.isDirectory())
+ &&
+ asStdSystemJar.exists() && asStdSystemJar.isFile();
+ }
+ }
+
+ public String getId() {
+ return id;
+ }
+}
\ No newline at end of file
Added: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/messages.properties
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/messages.properties (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/messages.properties 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,13 @@
+JBossRuntimeStartup_Cannot_create_new_JBoss_Server=Can''t create new JBoss Server
+JBossRuntimeStartup_Cannott_create_new_DTP_Connection_Profile=Can''t create new DTP Connection Profile for JBoss AS Hypersonic embedded database
+JBossRuntimeStartup_Cannott_create_new_HSQL_DB_Driver=Can''t create new HSQL DB Driver.
+JBossRuntimeStartup_JBoss_Application_Server_3_2=JBoss Application Server 3.2
+JBossRuntimeStartup_JBoss_Application_Server_4_0=JBoss Application Server 4.0
+JBossRuntimeStartup_JBoss_Application_Server_4_2=JBoss Application Server 4.2
+JBossRuntimeStartup_JBoss_Application_Server_5_0=JBoss Application Server 5.0
+JBossRuntimeStartup_JBoss_Application_Server_5_1=JBoss Application Server 5.1
+JBossRuntimeStartup_JBoss_Application_Server_6_0=JBoss Application Server 6.0
+JBossRuntimeStartup_JBoss_EAP_Server_4_3=JBoss EAP Server 4.3
+JBossRuntimeStartup_JBoss_EAP_Server_5_0=JBoss EAP Server 5.0
+JBossRuntimeStartup_Runtime=Runtime
+JBossRuntimeStartup_The_JBoss_AS_Hypersonic_embedded_database=The JBoss AS Hypersonic embedded database
Added: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/JBossRuntimePreferencesInitializer.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/JBossRuntimePreferencesInitializer.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/JBossRuntimePreferencesInitializer.java 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,18 @@
+package org.jboss.tools.runtime.preferences;
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.jboss.tools.runtime.Activator;
+
+public class JBossRuntimePreferencesInitializer extends
+ AbstractPreferenceInitializer {
+
+ @Override
+ public void initializeDefaultPreferences() {
+ Preferences preferences = Activator.getDefault().getPluginPreferences();
+ preferences.setDefault(
+ Activator.FIRST_START,
+ true);
+ }
+
+}
Added: trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/preferences/RuntimePreferencePage.java 2010-08-11 23:09:56 UTC (rev 24075)
@@ -0,0 +1,221 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2009 JBoss by Red Hat and others.
+ * 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.runtime.preferences;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.layout.PixelConverter;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.jboss.tools.runtime.Activator;
+import org.jboss.tools.runtime.JBossRuntimeLocator;
+
+/**
+ * @author Snjeza
+ *
+ */
+public class RuntimePreferencePage extends PreferencePage implements
+ IWorkbenchPreferencePage {
+
+ private static final String LASTPATH = "lastPath";
+ public static final String SEAM_PREFERENCES_ID = "org.jboss.tools.common.model.ui.seam"; //$NON-NLS-1$
+ public static final String WTP_PREFERENCES_ID = "org.eclipse.wst.server.ui.runtime.preferencePage"; //$NON-NLS-1$
+ private static final String DROOLS_PREFERENCES_ID = "org.drools.eclipse.preferences.DroolsRuntimesPreferencePage";
+ private static final String JBPM_PREFERENCES_ID = "org.jboss.tools.jbpm.locations";
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse
+ * .swt.widgets.Composite)
+ */
+ @Override
+ protected Control createContents(Composite parent) {
+ noDefaultAndApplyButton();
+ initializeDialogUnits(parent);
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(1, false);
+
+ //layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ //layout.marginWidth= 0;
+ //layout.verticalSpacing= convertVerticalDLUsToPixels(10);
+ //layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ composite.setLayout(layout);
+
+ createLink(composite, "See <a>WTP Runtime</a>", WTP_PREFERENCES_ID);
+ createLink(composite, "See <a>Seam Runtime</a>", SEAM_PREFERENCES_ID);
+ createLink(composite, "See <a>Drools Runtime</a>", DROOLS_PREFERENCES_ID);
+ createLink(composite, "See <a>JBPM Runtime</a>", JBPM_PREFERENCES_ID);
+
+ new Label(composite, SWT.NONE);
+
+ Label searchLabel = new Label(composite, SWT.NONE);
+ searchLabel.setText("JBoss AS, Seam, JBPM and Drools Runtimes wiil be configured based on the entered path.\nYou can also export/import configured JBoss runtimes.");
+
+ Group runtimeGroup = new Group(composite, SWT.NONE);
+ layout = new GridLayout(1, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ runtimeGroup.setLayout(layout);
+ runtimeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ runtimeGroup.setText("JBoss Runtimes");
+ Button searchButton = createButton(runtimeGroup, "Search for JBoss Runtimes", "Search...");
+ searchButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ search();
+ }
+
+ });
+
+ Button exportButton = createButton(runtimeGroup, "Export JBoss Runtimes", "Export...");
+ exportButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ exportRuntimes();
+ }
+
+ });
+
+ Button importButton = createButton(runtimeGroup, "Import JBoss Runtimes", "Import...");
+ importButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ importRuntimes();
+ }
+
+ });
+
+ setButtonDimensionHint(searchButton);
+ setButtonDimensionHint(exportButton);
+ setButtonDimensionHint(importButton);
+ Dialog.applyDialogFont(composite);
+ return composite;
+ }
+
+ private void exportRuntimes() {
+ // TODO Auto-generated method stub
+ }
+
+ private void importRuntimes() {
+ // TODO Auto-generated method stub
+ }
+
+ private Button createButton(Composite parent, String labelText, String buttonText) {
+ GridLayout layout;
+ Composite composite = new Composite(parent,SWT.NONE);
+ layout = new GridLayout(2, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(labelText);
+ GridData data= new GridData(GridData.FILL, GridData.CENTER, true, false);
+ data.widthHint= convertVerticalDLUsToPixels(50);
+ label.setLayoutData(data);
+
+ Button button = new Button(composite, SWT.PUSH);
+ button.setText(buttonText);
+ data = new GridData(GridData.FILL, GridData.BEGINNING, false, false);
+ //data.widthHint= convertVerticalDLUsToPixels(60);
+ button.setLayoutData(data);
+ return button;
+ }
+
+ private void createLink(Composite composite, String text, final String preferencesId) {
+ Link wtpRuntime = new Link(composite, SWT.NONE);
+ wtpRuntime.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
+ wtpRuntime.setText(text);
+ wtpRuntime.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(),preferencesId, new String[] {preferencesId},null);
+ if (dialog != null) {
+ dialog.open();
+ }
+ }
+ });
+ }
+
+ public void init(IWorkbench workbench) {
+ }
+
+ private void search() {
+ IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings();
+ String lastUsedPath= dialogSettings.get(LASTPATH);
+ if (lastUsedPath == null) {
+ lastUsedPath= ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
+ }
+ DirectoryDialog dialog = new DirectoryDialog(getShell());
+ dialog.setMessage("Search for JBoss Runtimes");
+ dialog.setFilterPath(lastUsedPath);
+ String path = dialog.open();
+ if (path == null) {
+ return;
+ }
+ dialogSettings.put(LASTPATH, path);
+ JBossRuntimeLocator locator = new JBossRuntimeLocator();
+ locator.searchForRuntimes(path, new NullProgressMonitor());
+ }
+
+ /**
+ * Returns a width hint for a button control.
+ * @param button the button
+ * @return the width hint
+ */
+ public static int getButtonWidthHint(Button button) {
+ button.setFont(JFaceResources.getDialogFont());
+ PixelConverter converter= new PixelConverter(button);
+ int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
+ }
+
+ /**
+ * Sets width and height hint for the button control.
+ * <b>Note:</b> This is a NOP if the button's layout data is not
+ * an instance of <code>GridData</code>.
+ *
+ * @param button the button for which to set the dimension hint
+ */
+ public static void setButtonDimensionHint(Button button) {
+ Assert.isNotNull(button);
+ Object gd= button.getLayoutData();
+ if (gd instanceof GridData) {
+ ((GridData)gd).widthHint= getButtonWidthHint(button);
+ ((GridData)gd).horizontalAlignment = GridData.FILL;
+ }
+ }
+
+}
More information about the jbosstools-commits
mailing list