[378790] - Backporting Frameworks and Editors to Indigo Branch
diff --git a/features/org.eclipse.libra.framework.editor.feature.source/.project b/features/org.eclipse.libra.framework.editor.feature.source/.project
new file mode 100644
index 0000000..6d80d06
--- /dev/null
+++ b/features/org.eclipse.libra.framework.editor.feature.source/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.libra.framework.editor.feature.source</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>
diff --git a/features/org.eclipse.libra.framework.editor.feature.source/build.properties b/features/org.eclipse.libra.framework.editor.feature.source/build.properties
new file mode 100644
index 0000000..39b0777
--- /dev/null
+++ b/features/org.eclipse.libra.framework.editor.feature.source/build.properties
@@ -0,0 +1,4 @@
+bin.includes = feature.xml,\
+ epl-v10.html,\
+ feature.properties,\
+ license.html
diff --git a/features/org.eclipse.libra.framework.editor.feature.source/epl-v10.html b/features/org.eclipse.libra.framework.editor.feature.source/epl-v10.html
new file mode 100644
index 0000000..fd39122
--- /dev/null
+++ b/features/org.eclipse.libra.framework.editor.feature.source/epl-v10.html
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<h2>Eclipse Public License - v 1.0</h2>
+
+<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
+AGREEMENT.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">where such changes and/or additions to the Program
+originate from and are distributed by that particular Contributor. A
+Contribution 'originates' from a Contributor if it was added to the
+Program by such Contributor itself or anyone acting on such
+Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii)
+are not derivative works of the Program.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"Licensed Patents" mean patent claims licensable by a
+Contributor which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the
+Contribution of such Contributor, if any, and such derivative works, in
+source code and object code form.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell,
+offer to sell, import and otherwise transfer the Contribution of such
+Contributor, if any, in source code and object code form. This patent
+license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered
+by the Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.</p>
+
+<p class="list">c) Recipient understands that although each Contributor
+grants the licenses to its Contributions set forth herein, no assurances
+are provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow Recipient
+to distribute the Program, it is Recipient's responsibility to acquire
+that license before distributing the Program.</p>
+
+<p class="list">d) Each Contributor represents that to its knowledge it
+has sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">i) effectively disclaims on behalf of all Contributors
+all warranties and conditions, express and implied, including warranties
+or conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">iv) states that source code for the Program is available
+from such Contributor, and informs licensees how to obtain it in a
+reasonable manner on or through a medium customarily used for software
+exchange.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use of
+the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create
+potential liability for other Contributors. Therefore, if a Contributor
+includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and
+indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses")
+arising from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by the
+acts or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In
+order to qualify, an Indemnified Contributor must: a) promptly notify
+the Commercial Contributor in writing of such claim, and b) allow the
+Commercial Contributor to control, and cooperate with the Commercial
+Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own
+expense.</p>
+
+<p>For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable laws,
+damage to or loss of data, programs or equipment, and unavailability or
+interruption of operations.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.</p>
+
+<p>If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the
+date such litigation is filed.</p>
+
+<p>All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of time
+after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive.</p>
+
+<p>Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions (including
+revisions) of this Agreement from time to time. No one other than the
+Agreement Steward has the right to modify this Agreement. The Eclipse
+Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a
+suitable separate entity. Each new version of the Agreement will be
+given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the
+Agreement under which it was received. In addition, after a new version
+of the Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.</p>
+
+<p>This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No party
+to this Agreement will bring a legal action under this Agreement more
+than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.</p>
+
+</body>
+
+</html>
diff --git a/features/org.eclipse.libra.framework.editor.feature.source/feature.properties b/features/org.eclipse.libra.framework.editor.feature.source/feature.properties
new file mode 100644
index 0000000..0e51943
--- /dev/null
+++ b/features/org.eclipse.libra.framework.editor.feature.source/feature.properties
@@ -0,0 +1,159 @@
+###############################################################################
+# Copyright (c) 2010, 2011 SAP AG 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:
+# Kaloyan Raev (SAP AG) - initial API and implementation
+###############################################################################
+featureName=OSGi Framework Editor SDK (Incubation)
+providerName=Eclipse Web Tools Platform
+
+description=Source code archives for OSGi Framework Editor.
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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\
+\n\
+Contributors:\n\
+ SpringSource, a division of VMware, Inc. - initial API and implementation\n\
+ SAP AG - moving to Eclipse Libra project and enhancements\n
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+February 1, 2011\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/features/org.eclipse.libra.framework.editor.feature.source/feature.xml b/features/org.eclipse.libra.framework.editor.feature.source/feature.xml
new file mode 100644
index 0000000..fd90489
--- /dev/null
+++ b/features/org.eclipse.libra.framework.editor.feature.source/feature.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.libra.framework.editor.feature.source"
+ label="%featureName"
+ version="0.1.0.qualifier"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <includes
+ id="org.eclipse.libra.framework.editor.feature"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.editor.core.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.editor.ui.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.editor.integration.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="osgi.enterprise.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/features/org.eclipse.libra.framework.editor.feature.source/license.html b/features/org.eclipse.libra.framework.editor.feature.source/license.html
new file mode 100644
index 0000000..f19c483
--- /dev/null
+++ b/features/org.eclipse.libra.framework.editor.feature.source/license.html
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>February 1, 2011</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ ("Specification").</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology
+ on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
diff --git a/features/org.eclipse.libra.framework.editor.feature.source/pom.xml b/features/org.eclipse.libra.framework.editor.feature.source/pom.xml
new file mode 100644
index 0000000..f723078
--- /dev/null
+++ b/features/org.eclipse.libra.framework.editor.feature.source/pom.xml
@@ -0,0 +1,17 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.libra_parent</artifactId>
+ <groupId>org.eclipse.libra</groupId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../development/org.eclipse.libra.releng/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.libra.framework.editor.feature.source</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <name>OSGi Framework Editor SDK Feature</name>
+ <version>0.1.0-SNAPSHOT</version>
+
+</project>
\ No newline at end of file
diff --git a/features/org.eclipse.libra.framework.editor.feature/.project b/features/org.eclipse.libra.framework.editor.feature/.project
new file mode 100644
index 0000000..ced8032
--- /dev/null
+++ b/features/org.eclipse.libra.framework.editor.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.libra.framework.editor.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>
diff --git a/features/org.eclipse.libra.framework.editor.feature/build.properties b/features/org.eclipse.libra.framework.editor.feature/build.properties
new file mode 100644
index 0000000..39b0777
--- /dev/null
+++ b/features/org.eclipse.libra.framework.editor.feature/build.properties
@@ -0,0 +1,4 @@
+bin.includes = feature.xml,\
+ epl-v10.html,\
+ feature.properties,\
+ license.html
diff --git a/features/org.eclipse.libra.framework.editor.feature/epl-v10.html b/features/org.eclipse.libra.framework.editor.feature/epl-v10.html
new file mode 100644
index 0000000..fd39122
--- /dev/null
+++ b/features/org.eclipse.libra.framework.editor.feature/epl-v10.html
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<h2>Eclipse Public License - v 1.0</h2>
+
+<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
+AGREEMENT.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">where such changes and/or additions to the Program
+originate from and are distributed by that particular Contributor. A
+Contribution 'originates' from a Contributor if it was added to the
+Program by such Contributor itself or anyone acting on such
+Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii)
+are not derivative works of the Program.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"Licensed Patents" mean patent claims licensable by a
+Contributor which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the
+Contribution of such Contributor, if any, and such derivative works, in
+source code and object code form.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell,
+offer to sell, import and otherwise transfer the Contribution of such
+Contributor, if any, in source code and object code form. This patent
+license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered
+by the Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.</p>
+
+<p class="list">c) Recipient understands that although each Contributor
+grants the licenses to its Contributions set forth herein, no assurances
+are provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow Recipient
+to distribute the Program, it is Recipient's responsibility to acquire
+that license before distributing the Program.</p>
+
+<p class="list">d) Each Contributor represents that to its knowledge it
+has sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">i) effectively disclaims on behalf of all Contributors
+all warranties and conditions, express and implied, including warranties
+or conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">iv) states that source code for the Program is available
+from such Contributor, and informs licensees how to obtain it in a
+reasonable manner on or through a medium customarily used for software
+exchange.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use of
+the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create
+potential liability for other Contributors. Therefore, if a Contributor
+includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and
+indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses")
+arising from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by the
+acts or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In
+order to qualify, an Indemnified Contributor must: a) promptly notify
+the Commercial Contributor in writing of such claim, and b) allow the
+Commercial Contributor to control, and cooperate with the Commercial
+Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own
+expense.</p>
+
+<p>For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable laws,
+damage to or loss of data, programs or equipment, and unavailability or
+interruption of operations.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.</p>
+
+<p>If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the
+date such litigation is filed.</p>
+
+<p>All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of time
+after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive.</p>
+
+<p>Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions (including
+revisions) of this Agreement from time to time. No one other than the
+Agreement Steward has the right to modify this Agreement. The Eclipse
+Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a
+suitable separate entity. Each new version of the Agreement will be
+given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the
+Agreement under which it was received. In addition, after a new version
+of the Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.</p>
+
+<p>This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No party
+to this Agreement will bring a legal action under this Agreement more
+than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.</p>
+
+</body>
+
+</html>
diff --git a/features/org.eclipse.libra.framework.editor.feature/feature.properties b/features/org.eclipse.libra.framework.editor.feature/feature.properties
new file mode 100644
index 0000000..29974f6
--- /dev/null
+++ b/features/org.eclipse.libra.framework.editor.feature/feature.properties
@@ -0,0 +1,159 @@
+###############################################################################
+# Copyright (c) 2010, 2011 SAP AG 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:
+# Kaloyan Raev (SAP AG) - initial API and implementation
+###############################################################################
+featureName=OSGi Framework Editor (Incubation)
+providerName=Eclipse Web Tools Platform
+
+description=Provides server editor parts for analyzing the bundle state and dependencies of an OSGi Framework.
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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\
+\n\
+Contributors:\n\
+ SpringSource, a division of VMware, Inc. - initial API and implementation\n\
+ SAP AG - moving to Eclipse Libra project and enhancements\n
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+February 1, 2011\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/features/org.eclipse.libra.framework.editor.feature/feature.xml b/features/org.eclipse.libra.framework.editor.feature/feature.xml
new file mode 100644
index 0000000..f2b1e92
--- /dev/null
+++ b/features/org.eclipse.libra.framework.editor.feature/feature.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.libra.framework.editor.feature"
+ label="%featureName"
+ version="0.1.0.qualifier"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <plugin
+ id="org.eclipse.libra.framework.editor.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.editor.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.editor.integration"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="osgi.enterprise"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/features/org.eclipse.libra.framework.editor.feature/license.html b/features/org.eclipse.libra.framework.editor.feature/license.html
new file mode 100644
index 0000000..f19c483
--- /dev/null
+++ b/features/org.eclipse.libra.framework.editor.feature/license.html
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>February 1, 2011</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ ("Specification").</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology
+ on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
diff --git a/features/org.eclipse.libra.framework.editor.feature/pom.xml b/features/org.eclipse.libra.framework.editor.feature/pom.xml
new file mode 100644
index 0000000..1818d6f
--- /dev/null
+++ b/features/org.eclipse.libra.framework.editor.feature/pom.xml
@@ -0,0 +1,17 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.libra_parent</artifactId>
+ <groupId>org.eclipse.libra</groupId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../development/org.eclipse.libra.releng/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.libra.framework.editor.feature</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <name>OSGi Framework Editor Feature</name>
+ <version>0.1.0-SNAPSHOT</version>
+
+</project>
\ No newline at end of file
diff --git a/features/org.eclipse.libra.framework.feature.source/.project b/features/org.eclipse.libra.framework.feature.source/.project
new file mode 100644
index 0000000..83c0a3a
--- /dev/null
+++ b/features/org.eclipse.libra.framework.feature.source/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.libra.framework.feature.source</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>
diff --git a/features/org.eclipse.libra.framework.feature.source/build.properties b/features/org.eclipse.libra.framework.feature.source/build.properties
new file mode 100644
index 0000000..8a0a77b
--- /dev/null
+++ b/features/org.eclipse.libra.framework.feature.source/build.properties
@@ -0,0 +1,4 @@
+bin.includes = feature.xml,\
+ license.html,\
+ feature.properties,\
+ epl-v10.html
diff --git a/features/org.eclipse.libra.framework.feature.source/epl-v10.html b/features/org.eclipse.libra.framework.feature.source/epl-v10.html
new file mode 100644
index 0000000..fd39122
--- /dev/null
+++ b/features/org.eclipse.libra.framework.feature.source/epl-v10.html
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<h2>Eclipse Public License - v 1.0</h2>
+
+<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
+AGREEMENT.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">where such changes and/or additions to the Program
+originate from and are distributed by that particular Contributor. A
+Contribution 'originates' from a Contributor if it was added to the
+Program by such Contributor itself or anyone acting on such
+Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii)
+are not derivative works of the Program.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"Licensed Patents" mean patent claims licensable by a
+Contributor which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the
+Contribution of such Contributor, if any, and such derivative works, in
+source code and object code form.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell,
+offer to sell, import and otherwise transfer the Contribution of such
+Contributor, if any, in source code and object code form. This patent
+license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered
+by the Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.</p>
+
+<p class="list">c) Recipient understands that although each Contributor
+grants the licenses to its Contributions set forth herein, no assurances
+are provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow Recipient
+to distribute the Program, it is Recipient's responsibility to acquire
+that license before distributing the Program.</p>
+
+<p class="list">d) Each Contributor represents that to its knowledge it
+has sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">i) effectively disclaims on behalf of all Contributors
+all warranties and conditions, express and implied, including warranties
+or conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">iv) states that source code for the Program is available
+from such Contributor, and informs licensees how to obtain it in a
+reasonable manner on or through a medium customarily used for software
+exchange.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use of
+the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create
+potential liability for other Contributors. Therefore, if a Contributor
+includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and
+indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses")
+arising from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by the
+acts or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In
+order to qualify, an Indemnified Contributor must: a) promptly notify
+the Commercial Contributor in writing of such claim, and b) allow the
+Commercial Contributor to control, and cooperate with the Commercial
+Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own
+expense.</p>
+
+<p>For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable laws,
+damage to or loss of data, programs or equipment, and unavailability or
+interruption of operations.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.</p>
+
+<p>If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the
+date such litigation is filed.</p>
+
+<p>All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of time
+after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive.</p>
+
+<p>Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions (including
+revisions) of this Agreement from time to time. No one other than the
+Agreement Steward has the right to modify this Agreement. The Eclipse
+Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a
+suitable separate entity. Each new version of the Agreement will be
+given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the
+Agreement under which it was received. In addition, after a new version
+of the Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.</p>
+
+<p>This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No party
+to this Agreement will bring a legal action under this Agreement more
+than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.</p>
+
+</body>
+
+</html>
diff --git a/features/org.eclipse.libra.framework.feature.source/feature.properties b/features/org.eclipse.libra.framework.feature.source/feature.properties
new file mode 100644
index 0000000..265ce35
--- /dev/null
+++ b/features/org.eclipse.libra.framework.feature.source/feature.properties
@@ -0,0 +1,158 @@
+###############################################################################
+# Copyright (c) 2010, 2011 Eteration A.S. 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:
+# Naci Dai (Eteration A.S.) - initial API and implementation
+###############################################################################
+featureName=OSGi Framework Launchers SDK (Incubation)
+providerName=Eclipse Web Tools Platform
+
+description=Source code archives for OSGi Framework Launchers.
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+Copyright (c) 2010, 2011 Eteration A.S.\
+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\
+\n\
+Contributors:\n\
+ Naci Dai (Eteration A.S.) - initial API and implementation\n
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+February 1, 2011\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/features/org.eclipse.libra.framework.feature.source/feature.xml b/features/org.eclipse.libra.framework.feature.source/feature.xml
new file mode 100644
index 0000000..2bf4200
--- /dev/null
+++ b/features/org.eclipse.libra.framework.feature.source/feature.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.libra.framework.feature.source"
+ label="%featureName"
+ version="0.1.0.qualifier"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <includes
+ id="org.eclipse.libra.framework.feature"
+ version="0.0.0"/>
+
+ <includes
+ id="org.eclipse.libra.framework.editor.feature.source"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.equinox.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.equinox.ui.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.felix.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.felix.ui.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.jonas.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.jonas.ui.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.knopflerfish.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.knopflerfish.ui.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.ui.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/features/org.eclipse.libra.framework.feature.source/license.html b/features/org.eclipse.libra.framework.feature.source/license.html
new file mode 100644
index 0000000..f19c483
--- /dev/null
+++ b/features/org.eclipse.libra.framework.feature.source/license.html
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>February 1, 2011</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ ("Specification").</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology
+ on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
diff --git a/features/org.eclipse.libra.framework.feature.source/pom.xml b/features/org.eclipse.libra.framework.feature.source/pom.xml
new file mode 100644
index 0000000..fcb805a
--- /dev/null
+++ b/features/org.eclipse.libra.framework.feature.source/pom.xml
@@ -0,0 +1,16 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.libra_parent</artifactId>
+ <groupId>org.eclipse.libra</groupId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../development/org.eclipse.libra.releng/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.libra.framework.feature.source</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <name>OSGi Frameworks Server Adapters SDK Feature</name>
+
+</project>
\ No newline at end of file
diff --git a/features/org.eclipse.libra.framework.feature/.project b/features/org.eclipse.libra.framework.feature/.project
new file mode 100644
index 0000000..a71e33d
--- /dev/null
+++ b/features/org.eclipse.libra.framework.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.libra.framework.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>
diff --git a/features/org.eclipse.libra.framework.feature/build.properties b/features/org.eclipse.libra.framework.feature/build.properties
new file mode 100644
index 0000000..82433ad
--- /dev/null
+++ b/features/org.eclipse.libra.framework.feature/build.properties
@@ -0,0 +1,14 @@
+###############################################################################
+# Copyright (c) 2010, 2011 SAP AG 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:
+# Kaloyan Raev (SAP AG) - initial API and implementation
+###############################################################################
+bin.includes = feature.xml,\
+ feature.properties,\
+ license.html,\
+ epl-v10.html
diff --git a/features/org.eclipse.libra.framework.feature/epl-v10.html b/features/org.eclipse.libra.framework.feature/epl-v10.html
new file mode 100644
index 0000000..fd39122
--- /dev/null
+++ b/features/org.eclipse.libra.framework.feature/epl-v10.html
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<h2>Eclipse Public License - v 1.0</h2>
+
+<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
+AGREEMENT.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">where such changes and/or additions to the Program
+originate from and are distributed by that particular Contributor. A
+Contribution 'originates' from a Contributor if it was added to the
+Program by such Contributor itself or anyone acting on such
+Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii)
+are not derivative works of the Program.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"Licensed Patents" mean patent claims licensable by a
+Contributor which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the
+Contribution of such Contributor, if any, and such derivative works, in
+source code and object code form.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell,
+offer to sell, import and otherwise transfer the Contribution of such
+Contributor, if any, in source code and object code form. This patent
+license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered
+by the Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.</p>
+
+<p class="list">c) Recipient understands that although each Contributor
+grants the licenses to its Contributions set forth herein, no assurances
+are provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow Recipient
+to distribute the Program, it is Recipient's responsibility to acquire
+that license before distributing the Program.</p>
+
+<p class="list">d) Each Contributor represents that to its knowledge it
+has sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">i) effectively disclaims on behalf of all Contributors
+all warranties and conditions, express and implied, including warranties
+or conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">iv) states that source code for the Program is available
+from such Contributor, and informs licensees how to obtain it in a
+reasonable manner on or through a medium customarily used for software
+exchange.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use of
+the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create
+potential liability for other Contributors. Therefore, if a Contributor
+includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and
+indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses")
+arising from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by the
+acts or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In
+order to qualify, an Indemnified Contributor must: a) promptly notify
+the Commercial Contributor in writing of such claim, and b) allow the
+Commercial Contributor to control, and cooperate with the Commercial
+Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own
+expense.</p>
+
+<p>For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable laws,
+damage to or loss of data, programs or equipment, and unavailability or
+interruption of operations.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.</p>
+
+<p>If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the
+date such litigation is filed.</p>
+
+<p>All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of time
+after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive.</p>
+
+<p>Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions (including
+revisions) of this Agreement from time to time. No one other than the
+Agreement Steward has the right to modify this Agreement. The Eclipse
+Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a
+suitable separate entity. Each new version of the Agreement will be
+given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the
+Agreement under which it was received. In addition, after a new version
+of the Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.</p>
+
+<p>This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No party
+to this Agreement will bring a legal action under this Agreement more
+than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.</p>
+
+</body>
+
+</html>
diff --git a/features/org.eclipse.libra.framework.feature/feature.properties b/features/org.eclipse.libra.framework.feature/feature.properties
new file mode 100644
index 0000000..e806613
--- /dev/null
+++ b/features/org.eclipse.libra.framework.feature/feature.properties
@@ -0,0 +1,158 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S 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:
+# Naci Dai (Eteration A.S.) - initial API and implementation
+###############################################################################
+featureName=OSGi Framework Launchers (Incubation)
+providerName=Eclipse Web Tools Platform
+
+description=Provides WTP server adapters for OSGi Frameworks like Eclipse Equinox, Apache Felix and Knopflerfish.
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+Copyright (c) 2010, 2011 Eteration A.S.\
+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\
+\n\
+Contributors:\n\
+ Naci Dai (Eteration A.S.) - initial API and implementation\n
+################ end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+February 1, 2011\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/features/org.eclipse.libra.framework.feature/feature.xml b/features/org.eclipse.libra.framework.feature/feature.xml
new file mode 100644
index 0000000..c521eb0
--- /dev/null
+++ b/features/org.eclipse.libra.framework.feature/feature.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.libra.framework.feature"
+ label="%featureName"
+ version="0.1.0.qualifier"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <includes
+ id="org.eclipse.libra.framework.editor.feature"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.equinox"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.equinox.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.felix"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.felix.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.jonas"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.jonas.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.knopflerfish"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.knopflerfish.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.libra.framework.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/features/org.eclipse.libra.framework.feature/license.html b/features/org.eclipse.libra.framework.feature/license.html
new file mode 100644
index 0000000..f19c483
--- /dev/null
+++ b/features/org.eclipse.libra.framework.feature/license.html
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>February 1, 2011</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ ("Specification").</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology
+ on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
diff --git a/features/org.eclipse.libra.framework.feature/pom.xml b/features/org.eclipse.libra.framework.feature/pom.xml
new file mode 100644
index 0000000..8017eba
--- /dev/null
+++ b/features/org.eclipse.libra.framework.feature/pom.xml
@@ -0,0 +1,16 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.libra_parent</artifactId>
+ <groupId>org.eclipse.libra</groupId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../development/org.eclipse.libra.releng/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.libra.framework.feature</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <name>OSGi Frameworks Server Adapters Feature</name>
+
+</project>
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.core/.classpath b/plugins/org.eclipse.libra.framework.core/.classpath
new file mode 100644
index 0000000..64c5e31
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.libra.framework.core/.project b/plugins/org.eclipse.libra.framework.core/.project
new file mode 100644
index 0000000..b729069
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.libra.framework.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.libra.framework.core/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.libra.framework.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..64203b9
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Oct 22 10:43:27 EEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+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
diff --git a/plugins/org.eclipse.libra.framework.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.libra.framework.core/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..e420d11
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/META-INF/MANIFEST.MF
@@ -0,0 +1,37 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.libra.framework.core;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.libra.framework.core.FrameworkCorePlugin
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.jdt.launching,
+ org.eclipse.debug.core,
+ org.eclipse.pde.ui,
+ org.eclipse.pde;bundle-version="3.6.100",
+ org.eclipse.wst.server.core,
+ org.eclipse.wst.server.ui,
+ org.eclipse.jst.server.core,
+ org.eclipse.jdt.core,
+ org.eclipse.jst.common.project.facet.core,
+ org.eclipse.wst.common.modulecore,
+ org.eclipse.equinox.frameworkadmin,
+ org.eclipse.wst.web,
+ org.eclipse.wst.common.project.facet.core;bundle-version="1.4.102",
+ org.eclipse.libra.framework.editor.core;bundle-version="[0.1.0,2.0.0)";visibility:=reexport
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.core.resources,
+ org.eclipse.debug.core,
+ org.eclipse.jdt.launching.sourcelookup,
+ org.eclipse.libra.framework.editor.integration.admin.osgijmx;version="[0.1.0,2.0.0)",
+ org.eclipse.libra.framework.editor.integration.console.basic;version="[0.1.0,2.0.0)",
+ org.eclipse.pde.core.plugin,
+ org.eclipse.pde.ui.launcher
+Export-Package: org.eclipse.libra.framework.core,
+ org.eclipse.libra.framework.core.internal.debug,
+ org.eclipse.libra.framework.core.launching,
+ org.eclipse.libra.framework.core.publish
diff --git a/plugins/org.eclipse.libra.framework.core/about.html b/plugins/org.eclipse.libra.framework.core/about.html
new file mode 100644
index 0000000..7d9511d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>September 21, 2011</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.core/build.properties b/plugins/org.eclipse.libra.framework.core/build.properties
new file mode 100644
index 0000000..86350ba
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/build.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2012 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/plugins/org.eclipse.libra.framework.core/plugin.properties b/plugins/org.eclipse.libra.framework.core/plugin.properties
new file mode 100644
index 0000000..374870e
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/plugin.properties
@@ -0,0 +1,12 @@
+################################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+################################################################################
+pluginName=OSGI Runtime Support
+providerName=Eteration A.S.
diff --git a/plugins/org.eclipse.libra.framework.core/plugin.xml b/plugins/org.eclipse.libra.framework.core/plugin.xml
new file mode 100644
index 0000000..0bd3892
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/plugin.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2010 Eteration A.S. 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:
+ Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ -->
+
+<plugin>
+ <extension-point id="launchBehavior" name="Libra Launch Behavior" schema="schema/launchBehavior.exsd"/>
+
+ <extension
+ point="org.eclipse.pde.ui.osgiFrameworks">
+ <framework
+ id="org.eclipse.libra.framework.meta"
+ launcherDelegate="org.eclipse.libra.framework.core.launching.LaunchConfigurationDelegate"
+ name="Libra Meta Framework" >
+ </framework>
+ </extension>
+
+ <extension
+ point="org.eclipse.wst.server.core.moduleFactories">
+ <moduleFactory
+ projects="true"
+ class="org.eclipse.libra.framework.core.module.OsgiModuleDeployableFactory"
+ id="org.eclipse.libra.runtime.internal.deployables.osgi.bundle">
+ <moduleType
+ versions="4.2"
+ types="osgi.bundle">
+ </moduleType>
+ </moduleFactory>
+ </extension>
+</plugin>
diff --git a/plugins/org.eclipse.libra.framework.core/pom.xml b/plugins/org.eclipse.libra.framework.core/pom.xml
new file mode 100644
index 0000000..f30ba54
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/pom.xml
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.libra_parent</artifactId>
+ <groupId>org.eclipse.libra</groupId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../development/org.eclipse.libra.releng/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.libra.framework.core</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSGi Frameworks Server Adapters Core Plug-in</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/plugins/org.eclipse.libra.framework.core/schema/launchBehavior.exsd b/plugins/org.eclipse.libra.framework.core/schema/launchBehavior.exsd
new file mode 100644
index 0000000..7b24863
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/schema/launchBehavior.exsd
@@ -0,0 +1,84 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.libra.framework.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.libra.framework.core" id="launchBehavior" name="OSAMI Launch Behavior"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/FrameworkCorePlugin.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/FrameworkCorePlugin.java
new file mode 100644
index 0000000..4a0bc07
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/FrameworkCorePlugin.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.pde.core.project.IBundleProjectDescription;
+import org.eclipse.pde.core.project.IBundleProjectService;
+import org.eclipse.pde.internal.core.PDECore;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+public class FrameworkCorePlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.libra.framework.core"; //$NON-NLS-1$
+
+ // The shared instance
+ private static FrameworkCorePlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public FrameworkCorePlugin() {
+ super();
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#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 FrameworkCorePlugin getDefault() {
+ return plugin;
+ }
+
+
+
+ public static String getPreference(String id) {
+ return Platform.getPreferencesService().getString(PLUGIN_ID, id, "", null);
+ }
+
+ public static void setPreference(String id, String value) {
+ (new DefaultScope()).getNode(PLUGIN_ID).put(id, value);
+ }
+
+
+ public static IBundleProjectService getBundleProjectService() {
+ PDECore instance = PDECore.getDefault();
+ if (instance == null)
+ return null;
+ return (IBundleProjectService) instance.acquireService(IBundleProjectService.class.getName());
+ }
+
+ public static IBundleProjectDescription getDescription(IProject project) throws CoreException {
+ try {
+ return getBundleProjectService().getDescription(project);
+ }
+ catch (IllegalArgumentException e) {
+ return null;
+ }
+ }
+
+
+}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/FrameworkDelegate.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/FrameworkDelegate.java
new file mode 100644
index 0000000..3cedfe1
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/FrameworkDelegate.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMInstallType;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
+
+public abstract class FrameworkDelegate extends org.eclipse.wst.server.core.model.RuntimeDelegate {
+
+ protected static final String PROP_VM_INSTALL_TYPE_ID = "vm-install-type-id";
+ protected static final String PROP_VM_INSTALL_ID = "vm-install-id";
+ protected static Map<Object, Object> sdkMap = new HashMap<Object, Object>(2);
+
+ public FrameworkDelegate() {
+ super();
+ }
+
+ protected String getVMInstallTypeId() {
+ return getAttribute(PROP_VM_INSTALL_TYPE_ID, (String) null);
+ }
+
+ protected String getVMInstallId() {
+ return getAttribute(PROP_VM_INSTALL_ID, (String) null);
+ }
+
+ public boolean isUsingDefaultJRE() {
+ return getVMInstallTypeId() == null;
+ }
+
+ public IVMInstall getVMInstall() {
+ if (getVMInstallTypeId() == null)
+ return JavaRuntime.getDefaultVMInstall();
+ try {
+ IVMInstallType vmInstallType = JavaRuntime
+ .getVMInstallType(getVMInstallTypeId());
+ IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
+ int size = vmInstalls.length;
+ String id = getVMInstallId();
+ for (int i = 0; i < size; i++) {
+ if (id.equals(vmInstalls[i].getId()))
+ return vmInstalls[i];
+ }
+ } catch (Exception e) {
+ // ignore
+ }
+ return null;
+ }
+
+ public abstract IStatus verifyLocation() ;
+ //public abstract IStatus validate();
+
+
+ public void setDefaults(IProgressMonitor monitor) {
+ IRuntimeType type = getRuntimeWorkingCopy().getRuntimeType();
+ getRuntimeWorkingCopy()
+ .setLocation(
+ new Path(FrameworkCorePlugin.getPreference("location"+ type.getId())));
+ }
+
+ public void setVMInstall(IVMInstall vmInstall) {
+ if (vmInstall == null) {
+ setVMInstall(null, null);
+ } else
+ setVMInstall(vmInstall.getVMInstallType().getId(),
+ vmInstall.getId());
+ }
+
+ protected void setVMInstall(String typeId, String id) {
+ if (typeId == null)
+ setAttribute(PROP_VM_INSTALL_TYPE_ID, (String) null);
+ else
+ setAttribute(PROP_VM_INSTALL_TYPE_ID, typeId);
+
+ if (id == null)
+ setAttribute(PROP_VM_INSTALL_ID, (String) null);
+ else
+ setAttribute(PROP_VM_INSTALL_ID, id);
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/FrameworkInstanceConfiguration.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/FrameworkInstanceConfiguration.java
new file mode 100644
index 0000000..e3d630d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/FrameworkInstanceConfiguration.java
@@ -0,0 +1,241 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+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.Status;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.pde.internal.core.target.provisional.ITargetDefinition;
+import org.eclipse.pde.internal.core.target.provisional.ITargetHandle;
+import org.eclipse.pde.internal.core.target.provisional.ITargetPlatformService;
+
+
+public class FrameworkInstanceConfiguration {
+
+ public static final String ADD_BUNDLE = "ADD_BUNDLE";
+ public static final String REMOVE_BUNDLE = "REMOVE_BUNDLE";
+
+
+ protected IFolder configPath;
+ protected ITargetDefinition targetDefinition;
+ protected FrameworkInstanceDelegate runtimeInstance;
+ private transient List<PropertyChangeListener> propertyListeners;
+
+
+ public FrameworkInstanceConfiguration(IFolder path, FrameworkInstanceDelegate runtimeInstance) {
+ super();
+ this.configPath = path;
+ this.runtimeInstance = runtimeInstance;
+ }
+
+
+
+ public ITargetDefinition getTargetDefinition() {
+ try {
+ loadTarget();
+ } catch (CoreException e) {
+ }
+ return targetDefinition;
+ }
+
+ public void setTargetDefinition(ITargetDefinition targetDefinition) {
+ this.targetDefinition = targetDefinition;
+ }
+
+ protected IFolder getFolder() {
+ return configPath;
+ }
+
+ public void load(IFolder folder, IProgressMonitor monitor)
+ throws CoreException {
+
+ targetDefinition = loadTarget();
+ if (targetDefinition == null) {
+ createDefaultTarget();
+ } else {
+ loadTarget();
+ }
+
+
+
+ }
+
+ private ITargetDefinition loadTarget() throws CoreException {
+
+ targetDefinition = null;
+ ITargetPlatformService service = TargetDefinitionUtil.getTargetPlatformService();
+
+ ITargetHandle[] targets = service.getTargets(new NullProgressMonitor());
+ String name = runtimeInstance.getServer().getName();
+ for (ITargetHandle handle : targets) {
+ if (name.equals(handle.getTargetDefinition().getName())) {
+ targetDefinition = handle.getTargetDefinition();
+ }
+ }
+ return targetDefinition;
+ }
+
+ private void createDefaultTarget() throws CoreException {
+
+ targetDefinition = runtimeInstance.createDefaultTarget();
+
+
+ }
+
+
+
+
+ protected void firePropertyChangeEvent(String propertyName,
+ Object oldValue, Object newValue) {
+ if (propertyListeners == null)
+ return;
+
+ PropertyChangeEvent event = new PropertyChangeEvent(this, propertyName,
+ oldValue, newValue);
+ try {
+ for (PropertyChangeListener listener : propertyListeners) {
+ try {
+ listener.propertyChange(event);
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE,
+ "Error firing property change event", e);
+ }
+ }
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Error in property event", e);
+ }
+ }
+
+ /**
+ * Adds a property change listener to this server.
+ *
+ * @param listener
+ * java.beans.PropertyChangeListener
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ if (propertyListeners == null)
+ propertyListeners = new ArrayList<PropertyChangeListener>();
+ propertyListeners.add(listener);
+ }
+
+ /**
+ * Removes a property change listener from this server.
+ *
+ * @param listener
+ * java.beans.PropertyChangeListener
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ if (propertyListeners != null)
+ propertyListeners.remove(listener);
+ }
+
+ public void importFromPath(IPath path, boolean isTestEnv,
+ IProgressMonitor monitor) throws CoreException {
+ load(path, monitor);
+ }
+
+ public void load(IPath path, IProgressMonitor monitor) throws CoreException {
+ try {
+ monitor = ProgressUtil.getMonitorFor(monitor);
+ monitor.beginTask(Messages.loadingTask, 7);
+
+ // InputStream in = new
+ // FileInputStream(path.append("catalina.policy")
+ // .toFile());
+ // in.read();
+ // in.close();
+ monitor.worked(1);
+ monitor.worked(1);
+
+ if (monitor.isCanceled())
+ return;
+ monitor.done();
+ } catch (Exception e) {
+ Trace.trace(
+ Trace.WARNING,
+ "Could not load Felix configuration from "
+ + path.toOSString() + ": " + e.getMessage());
+ throw new CoreException(new Status(IStatus.ERROR,
+ FrameworkCorePlugin.PLUGIN_ID, 0, NLS.bind(
+ Messages.errorCouldNotLoadConfiguration,
+ path.toOSString()), e));
+ }
+
+ }
+
+ /**
+ * Save to the given directory.
+ *
+ * @param path
+ * a path
+ * @param forceDirty
+ * boolean
+ * @param monitor
+ * a progress monitor
+ * @exception CoreException
+ */
+ protected void save(IPath path, boolean forceDirty, IProgressMonitor monitor)
+ throws CoreException {
+
+ }
+
+ /**
+ * Save to the given directory. All configuration files are forced to be
+ * saved.
+ *
+ * @param path
+ * Desination path for the configuration files.
+ * @param monitor
+ * A progress monitor
+ * @exception CoreException
+ */
+ public void save(IPath path, IProgressMonitor monitor) throws CoreException {
+ save(path, true, monitor);
+ }
+
+ /**
+ * Save the information held by this object to the given directory.
+ *
+ * @param folder
+ * a folder
+ * @param monitor
+ * a progress monitor
+ * @throws CoreException
+ */
+ public void save(IFolder folder, IProgressMonitor monitor)
+ throws CoreException {
+ }
+
+ /**
+ * Return a string representation of this object.
+ *
+ * @return java.lang.String
+ */
+ public String toString() {
+ return "FrameworkInstanceConfiguration[" + getFolder() + "]";
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/FrameworkInstanceDelegate.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/FrameworkInstanceDelegate.java
new file mode 100644
index 0000000..a5cf4a2
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/FrameworkInstanceDelegate.java
@@ -0,0 +1,306 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.libra.framework.core.internal.dependency.DependencyUtil;
+import org.eclipse.osgi.service.resolver.BundleDescription;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.pde.core.plugin.IPluginModelBase;
+import org.eclipse.pde.core.plugin.ModelEntry;
+import org.eclipse.pde.core.plugin.PluginRegistry;
+import org.eclipse.pde.internal.core.target.provisional.ITargetDefinition;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.internal.Module;
+import org.eclipse.wst.server.core.model.ServerDelegate;
+
+
+public abstract class FrameworkInstanceDelegate extends ServerDelegate implements
+ IOSGIFrameworkInstance {
+
+ public static final String DEFAULT_DEPLOYDIR = "auto";
+
+ private FrameworkInstanceConfiguration configuration;
+
+ public FrameworkInstanceDelegate() {
+ super();
+ }
+
+ @Override
+ public IModule[] getChildModules(IModule[] module) {
+ if (module == null)
+ return null;
+
+ if ("osgi.bundle".equalsIgnoreCase(module[0].getModuleType().getId())) {
+
+ IPluginModelBase modelBase = null;
+ IPluginModelBase[] plugins = PluginRegistry.getActiveModels();
+ for (IPluginModelBase iPluginModelBase : plugins) {
+ if (module[0].getName().equalsIgnoreCase(
+ iPluginModelBase.getBundleDescription().getName())) {
+ modelBase = iPluginModelBase;
+ break;
+ }
+ }
+ // get dependencies
+ if (modelBase != null) {
+ Object[] dependents = DependencyUtil.getDependencies(modelBase
+ .getBundleDescription());
+
+ List<IModule> modules = new ArrayList<IModule>();
+ for (Object dep : dependents) {
+ BundleDescription depBundle = (BundleDescription) dep;
+ ModelEntry entry = PluginRegistry.findEntry(depBundle
+ .getSymbolicName());
+ if (entry.hasWorkspaceModels()) { // isWorkspaceBundle(depBundle)){
+ IPluginModelBase base = entry.getModel();
+ IModule[] iModules = ((Module) module[0])
+ .getModuleFactory().getModules(
+ base.getUnderlyingResource()
+ .getProject(),
+ new NullProgressMonitor());
+ for (IModule iModule : iModules) {
+ modules.add(iModule);
+ }
+ // modelBase e eklemek gerek
+ // module yap liste koy
+ }
+
+ }
+ IModule[] moduleArr=new IModule[modules.size()];
+ modules.toArray(moduleArr);
+ return moduleArr;
+ }
+ }
+ return new IModule[0];
+ }
+
+ @Override
+ public IModule[] getRootModules(IModule module) throws CoreException {
+ if (module == null)
+ return null;
+
+ if ("osgi.bundle".equalsIgnoreCase(module.getModuleType().getId())) {
+
+ IPluginModelBase modelBase = null;
+ IPluginModelBase[] plugins = PluginRegistry.getActiveModels();
+ for (IPluginModelBase iPluginModelBase : plugins) {
+ if (module.getName().equalsIgnoreCase(
+ iPluginModelBase.getBundleDescription().getName())) {
+ modelBase = iPluginModelBase;
+ break;
+ }
+ }
+ // get dependencies
+ if (modelBase != null) {
+ //modelbase bu listeye çıkacaklardan herhangibirinin childimi??
+ }
+ }
+
+ // TODO - OSAMI If this module is a child composed in a composite,
+ // return the module that represents the parent
+ // if this is the parent then - no action needed. Just return the
+ // composite
+ // if ("osami.bundle".equals(module.getModuleType().getId())) {
+ // IStatus status = canModifyModules(new IModule[] { module }, null);
+ // if (status == null || !status.isOK())
+ // throw new CoreException(status);
+ return new IModule[] { module };
+ // }
+
+ // return null;
+ }
+
+ public IStatus canModifyModules(IModule[] add, IModule[] remove) {
+ if (add != null) {
+ int size = add.length;
+ for (int i = 0; i < size; i++) {
+ IModule module = add[i];
+ if (!"osgi.bundle".equals(module.getModuleType().getId()))
+ return new Status(IStatus.ERROR,
+ FrameworkCorePlugin.PLUGIN_ID, 0,
+ Messages.errorOSGiBundlesOnly, null);
+
+ // TODO - OSAMI After adding faceted projects enable this
+ // check....
+ // MUST CHECK IF THE FRAMEWORK ALLOWS REMOTE MANAGEMENT
+
+ // if (module.getProject() != null) {
+ // status = FacetUtil.verifyFacets(module.getProject(),
+ // getServer());
+ // if (status != null && !status.isOK())
+ // return status;
+ // }
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ public FrameworkInstanceConfiguration getFrameworkInstanceConfiguration()
+ throws CoreException {
+
+ if (configuration == null) {
+ IFolder folder = getServer().getServerConfiguration();
+ if (folder == null || !folder.exists()) {
+ String path = null;
+ if (folder != null) {
+ path = folder.getFullPath().toOSString();
+ IProject project = folder.getProject();
+ if (project != null && project.exists()
+ && !project.isOpen())
+ throw new CoreException(
+ new Status(
+ IStatus.ERROR,
+ FrameworkCorePlugin.PLUGIN_ID,
+ 0,
+ NLS.bind(
+ Messages.errorConfigurationProjectClosed,
+ path, project.getName()), null));
+ }
+ throw new CoreException(new Status(IStatus.ERROR,
+ FrameworkCorePlugin.PLUGIN_ID, 0, NLS.bind(
+ Messages.errorNoConfiguration, path), null));
+ }
+
+ // String id = getServer().getServerType().getId();
+ configuration = new FrameworkInstanceConfiguration(folder, this);
+
+ try {
+ configuration.load(folder, null);
+ } catch (CoreException ce) {
+ configuration = null;
+ throw ce;
+ }
+ }
+ return configuration;
+
+ }
+
+ public String getInstanceDirectory() {
+ return getAttribute(PROPERTY_INSTANCE_DIR, (String) null);
+ }
+
+ public String getDeployDirectory() {
+ // Default to value used by prior WTP versions
+ return getAttribute(PROPERTY_DEPLOY_DIR, "bundles");
+ }
+
+ public void setInstanceDirectory(String instanceDir) {
+ setAttribute(PROPERTY_INSTANCE_DIR, instanceDir);
+ }
+
+ public void setDeployDirectory(String deployDir) {
+ setAttribute(PROPERTY_DEPLOY_DIR, deployDir);
+ }
+
+ public boolean isDebug() {
+ return getAttribute(PROPERTY_DEBUG, false);
+ }
+
+ @Override
+ public void setDefaults(IProgressMonitor monitor) {
+ super.setDefaults(monitor);
+ setDeployDirectory(DEFAULT_DEPLOYDIR);
+ }
+
+ @Override
+ public void importRuntimeConfiguration(IRuntime runtime,
+ IProgressMonitor monitor) throws CoreException {
+ super.importRuntimeConfiguration(runtime, monitor);
+ }
+
+ @Override
+ public void modifyModules(IModule[] add, IModule[] remove,
+ IProgressMonitor monitor) throws CoreException {
+
+ IStatus status = canModifyModules(add, remove);
+ if (status == null || !status.isOK())
+ throw new CoreException(status);
+
+ if (add != null) {
+ int size = add.length;
+ for (int i = 0; i < size; i++) {
+ // IModule module3 = add[i];
+ // TODO - OSAMI Do something to add the module....
+ // If the framework is running this will require an install + start
+ // Also need to check if framework allows remote management
+ // If an earliver version was already deployed we need to stop+uninstall
+ }
+ }
+
+ if (remove != null) {
+ int size2 = remove.length;
+ for (int j = 0; j < size2; j++) {
+ // IModule module3 = remove[j];
+ // TODO - OSAMI Do something to remove the module....
+ // If the framework is running this will require an stop + uninstall
+ // Also need to check if framework allows remote management
+
+ }
+ }
+ // config.save(config.getFolder(), monitor);
+ }
+
+
+ public void setJavaProfile(String profileID) {
+ setAttribute(IOSGIFrameworkInstance.PROPERTY_JAVA_PROFILE, profileID);
+ }
+
+ public String getJavaPofile() {
+ return getAttribute(PROPERTY_JAVA_PROFILE, "JavaSE-1.6");
+
+ }
+
+
+ public void setJMXPort(int port) {
+ setAttribute(IOSGIFrameworkInstance.PROPERTY_JMX_PORT, ""+port);
+ }
+
+ public int getJMXPort() {
+ int port = 12345;
+ String portNo = getAttribute(PROPERTY_JMX_PORT, "12345");
+ try{
+ port = Integer.parseInt(portNo);
+ }finally{
+
+ }
+ return port;
+ }
+
+ public void setJMXEnabled(boolean isEnabled) {
+ setAttribute(IOSGIFrameworkInstance.PROPERTY_JMX_ENABLED, isEnabled);
+ }
+
+ public boolean getJMXEnabled() {
+ return getAttribute(PROPERTY_JMX_ENABLED, true);
+
+ }
+
+ public abstract ITargetDefinition createDefaultTarget()
+ throws CoreException;
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/IOSGIExecutionEnvironment.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/IOSGIExecutionEnvironment.java
new file mode 100644
index 0000000..25bc9c1
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/IOSGIExecutionEnvironment.java
@@ -0,0 +1,36 @@
+package org.eclipse.libra.framework.core;
+
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
+
+public enum IOSGIExecutionEnvironment {
+ Default, JAVASE6_SERVER;
+
+ @Override
+ public String toString() {
+ switch (this) {
+ case Default:
+ return "Default";
+ case JAVASE6_SERVER:
+ return "JavaSE-1.6-Server";
+ }
+ return this.name();
+ }
+
+ public static String[] getExecutionEnvironmentIds() {
+
+ IExecutionEnvironment environment[] = JavaRuntime
+ .getExecutionEnvironmentsManager().getExecutionEnvironments();
+ IOSGIExecutionEnvironment[] all = IOSGIExecutionEnvironment.values();
+ String[] envList = new String[environment.length + all.length];
+ int i = 0;
+ for (IOSGIExecutionEnvironment e : all) {
+ envList[i++] = e.toString();
+ }
+ for (IExecutionEnvironment e : environment) {
+ envList[i++] = e.getId();
+ }
+ return envList;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/IOSGIFramework.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/IOSGIFramework.java
new file mode 100644
index 0000000..0ac2be8
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/IOSGIFramework.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.launching.IVMInstall;
+
+public interface IOSGIFramework {
+ /**
+ * Return the VM install (installed JRE) that this runtime is using.
+ *
+ * @return the current VM install
+ */
+ public IVMInstall getVMInstall();
+
+ /**
+ * Returns <code>true</code> if the runtime is using the default JRE.
+ *
+ * @return <code>true</code> if the runtime is using the default JRE,
+ * and <code>false</code> otherwise
+ * @since 2.0
+ */
+ public boolean isUsingDefaultJRE();
+
+ /**
+ * Returns the runtime classpath that is used by this runtime.
+ *
+ * @return the runtime classpath
+ */
+ @SuppressWarnings("rawtypes")
+ public List getFrameworkClasspath(IPath configPath);
+
+ public IStatus validate() ;
+}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/IOSGIFrameworkInstance.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/IOSGIFrameworkInstance.java
new file mode 100644
index 0000000..3974579
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/IOSGIFrameworkInstance.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core;
+
+import org.eclipse.core.runtime.CoreException;
+
+public interface IOSGIFrameworkInstance {
+
+
+ public static final String PROPERTY_DEBUG = "debug";
+ public static final String PROPERTY_INSTANCE_DIR = "instanceDir";
+ public static final String PROPERTY_DEPLOY_DIR = "deployDir";
+ public static final String PROPERTY_JAVA_PROFILE = "JAVA_PROFILE";
+ public static final String PROPERTY_JMX_PORT = "jmxPort";
+ public static final String PROPERTY_JMX_ENABLED = "jmxEnabled";
+
+ /**
+ * Gets the java profile for the framework instance. If not set,
+ * the instance profile is determined from the JRE setting.
+ *
+ * @return javaProfile for the framework instance exists. Returns null
+ * if not set.
+ */
+ public String getJavaPofile();
+ public void setJavaProfile(String id);
+
+ /**
+ * Gets the jmx management port for the framework instance. If not set,
+ * the instance profile returns the default value (12345).
+ *
+ * @return jmx port for the framework instance exists. Returns null
+ * if not set.
+ */
+ public int getJMXPort();
+ public void setJMXPort(int port);
+
+ public boolean getJMXEnabled();
+ public void setJMXEnabled(boolean isEnabled);
+
+
+ /**
+ * Gets the directory where the server instance exists. If not set,
+ * the instance directory is derived from the testEnvironment setting.
+ *
+ * @return directory where the server instance exists. Returns null
+ * if not set.
+ */
+ public String getInstanceDirectory();
+
+ /**
+ * Gets the directory to which web applications are to be deployed.
+ * If relative, it is relative to the runtime base directory for the
+ * server.
+ *
+ * @return directory where web applications are deployed
+ */
+ public String getDeployDirectory();
+
+ public boolean isDebug();
+ public FrameworkInstanceConfiguration getFrameworkInstanceConfiguration() throws CoreException;
+}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/IOSGIFrameworkWorkingCopy.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/IOSGIFrameworkWorkingCopy.java
new file mode 100644
index 0000000..54ab3c3
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/IOSGIFrameworkWorkingCopy.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core;
+
+import org.eclipse.jdt.launching.IVMInstall;
+/**
+ *
+ */
+public interface IOSGIFrameworkWorkingCopy extends IOSGIFramework {
+ public void setVMInstall(IVMInstall vmInstall);
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/Messages.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/Messages.java
new file mode 100644
index 0000000..356b69b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/Messages.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ * Kaloyan Raev, SAP AG - integration with OSGi Framework Editor parts
+ *******************************************************************************/
+package org.eclipse.libra.framework.core;
+
+import org.eclipse.libra.framework.core.FrameworkCorePlugin;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Translated messages.
+ */
+public class Messages extends NLS {
+
+
+
+ public static String loadingTask;
+ public static String errorCouldNotLoadConfiguration;
+ public static String errorOSGiBundlesOnly;
+ public static String configurationEditorActionAddOsgiModule;
+ public static String errorConfigurationProjectClosed;
+ public static String errorNoConfiguration;
+
+ public static String OSGIFrameworkInstanceBehaviorDelegate_ServerNotInitialized;
+ public static String OSGIFrameworkInstanceBehaviorDelegate_ServerNotStarted;
+
+ static {
+ NLS.initializeMessages(FrameworkCorePlugin.PLUGIN_ID + ".Messages", Messages.class);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/Messages.properties b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/Messages.properties
new file mode 100644
index 0000000..06bfd3f
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/Messages.properties
@@ -0,0 +1,26 @@
+###############################################################################
+# Copyright (c) 2010, 2011 Eteration A.S. 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:
+# IBM Corporation - initial API and implementation
+# - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+# org.eclipse.jst.server.core
+# org.eclipse.jst.server.ui
+#
+# Naci Dai and Murat Yener, Eteration A.S.
+# Kaloyan Raev, SAP AG - integration with OSGi Framework Editor parts
+###############################################################################
+
+# --------------- General UI ---------------
+
+loadingTask=Loading...
+errorCouldNotLoadConfiguration=Could not load configuration
+errorOSGiBundlesOnly=Only osgi bundles are allowed
+configurationEditorActionAddOsgiModule=Add OSGI Bundles
+
+OSGIFrameworkInstanceBehaviorDelegate_ServerNotInitialized=Server not initialized.
+OSGIFrameworkInstanceBehaviorDelegate_ServerNotStarted=Server not started.
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/OSGIFrameworkInstanceBehaviorDelegate.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/OSGIFrameworkInstanceBehaviorDelegate.java
new file mode 100644
index 0000000..1f07e34
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/OSGIFrameworkInstanceBehaviorDelegate.java
@@ -0,0 +1,718 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ * Kaloyan Raev, SAP AG - integration with OSGi Framework Editor parts
+ *******************************************************************************/
+package org.eclipse.libra.framework.core;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IDebugEventSetListener;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.libra.framework.editor.core.IOSGiFrameworkAdmin;
+import org.eclipse.libra.framework.editor.core.IOSGiFrameworkConsole;
+import org.eclipse.libra.framework.editor.core.model.IBundle;
+import org.eclipse.libra.framework.editor.integration.admin.osgijmx.LaunchOSGiJMXFrameworkAdmin;
+import org.eclipse.libra.framework.editor.integration.console.basic.LaunchBasicOSGiFrameworkConsole;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.IModulePublishHelper;
+import org.eclipse.wst.server.core.model.IModuleFile;
+import org.eclipse.wst.server.core.model.IModuleResource;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
+
+
+@SuppressWarnings("restriction")
+public abstract class OSGIFrameworkInstanceBehaviorDelegate extends ServerBehaviourDelegate implements IModulePublishHelper, IOSGiFrameworkAdmin, IOSGiFrameworkConsole {
+
+ private static final String ATTR_STOP = "stop-server";
+ // the thread used to ping the server to check for startup
+ protected transient PingThread ping = null;
+ protected transient IDebugEventSetListener processListener;
+
+ private IOSGiFrameworkAdmin admin = null;
+ private IOSGiFrameworkConsole console = null;
+
+ public abstract String[] getFrameworkProgramArguments(boolean starting) ;
+ public abstract String[] getExcludedFrameworkProgramArguments(boolean starting);
+ public abstract String[] getFrameworkVMArguments();
+ public abstract String getFrameworkClass() ;
+
+ protected static int getNextToken(String s, int start) {
+ int i = start;
+ int length = s.length();
+ char lookFor = ' ';
+
+ while (i < length) {
+ char c = s.charAt(i);
+ if (lookFor == c) {
+ if (lookFor == '"')
+ return i + 1;
+ return i;
+ }
+ if (c == '"')
+ lookFor = '"';
+ i++;
+ }
+ return -1;
+ }
+
+ /**
+ * Merge the given arguments into the original argument string, replacing
+ * invalid values if they have been changed. Special handling is provided if
+ * the keepActionLast argument is true and the last vmArg is a simple
+ * string. The vmArgs will be merged such that the last vmArg is guaranteed
+ * to be the last argument in the merged string.
+ *
+ * @param originalArg
+ * String of original arguments.
+ * @param vmArgs
+ * Arguments to merge into the original arguments string
+ * @param excludeArgs
+ * Arguments to exclude from the original arguments string
+ * @param keepActionLast
+ * If <b>true</b> the vmArguments are assumed to be Framework program
+ * arguments, the last of which is the action to perform which
+ * must remain the last argument. This only has an impact if the
+ * last vmArg is a simple string argument, like
+ * "start".
+ * @return merged argument string
+ */
+ public static String mergeArguments(String originalArg, String[] vmArgs,
+ String[] excludeArgs, boolean keepActionLast) {
+ if (vmArgs == null)
+ return originalArg;
+
+ if (originalArg == null)
+ originalArg = "";
+
+ originalArg = concatArgs(originalArg, vmArgs, keepActionLast) ;
+ originalArg =excludeArgs(originalArg, excludeArgs);
+
+ return originalArg;
+ }
+
+
+ private static String concatArgs(String initialArgs, String[] newArgs, boolean keepLast) {
+ if(newArgs == null || newArgs.length <= 0)
+ return initialArgs;
+ StringBuffer args = new StringBuffer();
+ List<String> initArgsList = Arrays.asList(DebugPlugin.parseArguments(initialArgs));
+ int i= 0;
+ if (initialArgs != null && initialArgs.length() > 0) {
+ int last= (keepLast? initArgsList.size()-1 : initArgsList.size() );
+ for (i=0; i< last ; i++) {
+ if(i != 0)
+ args.append(' ');
+ args.append(initArgsList.get(i));
+ }
+ }
+
+ for (String anArg: newArgs) {
+ if(!initArgsList.contains(anArg)){
+ if(i++ != 0)
+ args.append(' ');
+ args.append(anArg);
+ }
+ }
+
+ if(keepLast && initArgsList.size() >0 ){
+ args.append(' ');
+ args.append(initArgsList.get(initArgsList.size()-1));
+ }
+ return args.toString();
+ }
+
+ private static String excludeArgs(String initialArgs, String[] excludeArgs) {
+ if(excludeArgs == null || excludeArgs.length <= 0)
+ return initialArgs;
+ StringBuffer args = new StringBuffer();
+ List<String> excludeArgsList = Arrays.asList(excludeArgs);
+ if (initialArgs != null && initialArgs.length() > 0) {
+ String[] initArgsArray = DebugPlugin.parseArguments(initialArgs);
+ int i=0;
+ for (String anArg : initArgsArray) {
+ if (!excludeArgsList.contains(anArg)) {
+ if(i++ != 0)
+ args.append(' ');
+ args.append(anArg);
+ }
+ }
+ }
+ return args.toString();
+ }
+
+ /**
+ * Replace the current JRE container classpath with the given entry.
+ *
+ * @param cp
+ * @param entry
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public static void replaceJREContainer(List cp, IRuntimeClasspathEntry entry) {
+ int size = cp.size();
+ for (int i = 0; i < size; i++) {
+ IRuntimeClasspathEntry entry2 = (IRuntimeClasspathEntry) cp.get(i);
+ if (entry2.getPath().uptoSegment(2).isPrefixOf(entry.getPath())) {
+ cp.set(i, entry);
+ return;
+ }
+ }
+
+ cp.add(0, entry);
+ }
+
+ /**
+ * Merge a single classpath entry into the classpath list.
+ *
+ * @param cp
+ * @param entry
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public static void mergeClasspath(List cp, IRuntimeClasspathEntry entry) {
+ Iterator iterator = cp.iterator();
+ while (iterator.hasNext()) {
+ IRuntimeClasspathEntry entry2 = (IRuntimeClasspathEntry) iterator
+ .next();
+
+ if (entry2.getPath().equals(entry.getPath()))
+ return;
+ }
+
+ cp.add(entry);
+ }
+
+ public OSGIFrameworkInstanceBehaviorDelegate() {
+ super();
+ }
+
+ public void setServerStarted() {
+ setServerState(IServer.STATE_STARTED);
+ }
+
+ public void stopImpl() {
+ if (ping != null) {
+ ping.stop();
+ ping = null;
+ }
+ if (processListener != null) {
+ DebugPlugin.getDefault().removeDebugEventListener(processListener);
+ processListener = null;
+ }
+ admin = null;
+ console = null;
+ setServerState(IServer.STATE_STOPPED);
+ }
+
+ /**
+ * Cleanly shuts down and terminates the server.
+ *
+ * @param force
+ * <code>true</code> to kill the server
+ */
+ public void stop(boolean force) {
+ if (force) {
+ terminate();
+ return;
+ }
+ int state = getServer().getServerState();
+ // If stopped or stopping, no need to run stop command again
+ if (state == IServer.STATE_STOPPED || state == IServer.STATE_STOPPING)
+ return;
+ else if (state == IServer.STATE_STARTING) {
+ terminate();
+ return;
+ }
+
+ try {
+ if (Trace.isTraceEnabled())
+ Trace.trace(Trace.FINER, "Stopping OSGi Framework");
+ if (state != IServer.STATE_STOPPED)
+ setServerState(IServer.STATE_STOPPING);
+
+ // ILaunchConfiguration launchConfig = ((Server)
+ // getServer()).getLaunchConfiguration(true, null);
+ // ILaunchConfigurationWorkingCopy wc =
+ // launchConfig.getWorkingCopy();
+ //
+ // String args =
+ // renderCommandLine(getRuntimeProgramArguments(false)," ");
+ // wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,args);
+ // wc.setAttribute("org.eclipse.debug.ui.private", true);
+ // wc.setAttribute(ATTR_STOP, "true");
+ // wc.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
+ this.terminate();
+
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Error stopping OSGi Framework", e);
+ }
+ }
+
+ /**
+ * Terminates the server.
+ */
+ protected void terminate() {
+ if (getServer().getServerState() == IServer.STATE_STOPPED)
+ return;
+
+ try {
+ setServerState(IServer.STATE_STOPPING);
+ if (Trace.isTraceEnabled())
+ Trace.trace(Trace.FINER, "Killing the OSGi Framework process");
+ ILaunch launch = getServer().getLaunch();
+ if (launch != null) {
+ launch.terminate();
+ stopImpl();
+ }
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Error killing the process", e);
+ }
+ }
+
+ public IPath getTempDirectory() {
+ return super.getTempDirectory(false);
+ }
+
+ public IPath getBaseDirectory() {
+
+ IPath confDir = getTempDirectory(true);
+ String instancePathStr = getFrameworkInstance().getInstanceDirectory();
+ if (instancePathStr != null) {
+ IPath instanceDir = new Path(getFrameworkInstance()
+ .getInstanceDirectory());
+ if (instanceDir != null)
+ confDir = instanceDir;
+ }
+
+ return confDir;
+ }
+
+ public void initialize(IProgressMonitor monitor) {
+ // do nothing
+ }
+
+ public IOSGIFramework getFramework() {
+ if (getServer().getRuntime() == null)
+ return null;
+
+ return (IOSGIFramework) getServer().getRuntime().loadAdapter(
+ IOSGIFramework.class, null);
+ }
+
+ public IOSGIFrameworkInstance getFrameworkInstance() {
+ return (IOSGIFrameworkInstance) getServer().loadAdapter(
+ IOSGIFrameworkInstance.class, null);
+ }
+
+ public void addProcessListener(final IProcess newProcess) {
+ if (processListener != null || newProcess == null)
+ return;
+
+ processListener = new IDebugEventSetListener() {
+ public void handleDebugEvents(DebugEvent[] events) {
+ if (events != null) {
+ int size = events.length;
+ for (int i = 0; i < size; i++) {
+ if (newProcess != null
+ && newProcess.equals(events[i].getSource())
+ && events[i].getKind() == DebugEvent.TERMINATE) {
+ stopImpl();
+ }
+ }
+ }
+ }
+ };
+ DebugPlugin.getDefault().addDebugEventListener(processListener);
+ }
+
+ /**
+ * Setup for starting the server.
+ *
+ * @param launch
+ * ILaunch
+ * @param launchMode
+ * String
+ * @param monitor
+ * IProgressMonitor
+ * @throws CoreException
+ * if anything goes wrong
+ */
+ public void setupLaunch(ILaunch launch, String launchMode,
+ IProgressMonitor monitor) throws CoreException {
+ if ("true".equals(launch.getLaunchConfiguration().getAttribute(ATTR_STOP, "false")))
+ return;
+ if (getFramework() == null)
+ throw new CoreException(new Status(IStatus.ERROR, FrameworkCorePlugin.PLUGIN_ID, "Can't launch for OSGi Framework"));
+
+ IStatus status = getFramework().validate();
+ if (status != null && status.getSeverity() == IStatus.ERROR)
+ throw new CoreException(status);
+
+ setServerRestartState(false);
+ setServerState(IServer.STATE_STARTING);
+ setMode(launchMode);
+
+ // ping server to check for startup
+ try {
+ String url = "http://" + getServer().getHost();
+ ping = new PingThread(launch, getServer(), url, -1, this);
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Can't ping for OSGi Framework startup.");
+ }
+ }
+
+
+
+
+ /**
+ * Return a string representation of this object.
+ *
+ * @return java.lang.String
+ */
+ public String toString() {
+ return "OSGiFrameworkInstance";
+ }
+
+ public void setupLaunchConfiguration(
+ ILaunchConfigurationWorkingCopy workingCopy,
+ IProgressMonitor monitor) throws CoreException {
+ String existingProgArgs = workingCopy.getAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
+ (String) null);
+ workingCopy.setAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
+ mergeArguments(existingProgArgs,
+ getFrameworkProgramArguments(true),
+ getExcludedFrameworkProgramArguments(true), true));
+
+ String existingVMArgs = workingCopy.getAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,
+ (String) null);
+ String[] parsedVMArgs = null;
+ if (null != existingVMArgs) {
+ parsedVMArgs = DebugPlugin.parseArguments(existingVMArgs);
+ }
+ String[] configVMArgs = getFrameworkVMArguments();
+
+ workingCopy.setAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,
+ mergeArguments(existingVMArgs, configVMArgs, null, false));
+
+ IOSGIFramework runtime = getFramework();
+ IVMInstall vmInstall = runtime.getVMInstall();
+ if (vmInstall != null)
+ workingCopy.setAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH,
+ JavaRuntime.newJREContainerPath(vmInstall)
+ .toPortableString());
+
+ // update classpath
+ IRuntimeClasspathEntry[] originalClasspath = JavaRuntime
+ .computeUnresolvedRuntimeClasspath(workingCopy);
+ int size = originalClasspath.length;
+ List oldCp = new ArrayList(originalClasspath.length + 2);
+ for (int i = 0; i < size; i++)
+ oldCp.add(originalClasspath[i]);
+
+ List cp2 = runtime.getFrameworkClasspath(null);
+ Iterator iterator = cp2.iterator();
+ while (iterator.hasNext()) {
+ IRuntimeClasspathEntry entry = (IRuntimeClasspathEntry) iterator
+ .next();
+ mergeClasspath(oldCp, entry);
+ }
+
+ if (vmInstall != null) {
+ try {
+ String typeId = vmInstall.getVMInstallType().getId();
+ replaceJREContainer(oldCp,
+ JavaRuntime.newRuntimeContainerClasspathEntry(new Path(
+ JavaRuntime.JRE_CONTAINER).append(typeId)
+ .append(vmInstall.getName()),
+ IRuntimeClasspathEntry.BOOTSTRAP_CLASSES));
+ } catch (Exception e) {
+ // ignore
+ }
+
+ IPath jrePath = new Path(vmInstall.getInstallLocation()
+ .getAbsolutePath());
+ if (jrePath != null) {
+ IPath toolsPath = jrePath.append("lib").append("tools.jar");
+ if (toolsPath.toFile().exists()) {
+ IRuntimeClasspathEntry toolsJar = JavaRuntime
+ .newArchiveRuntimeClasspathEntry(toolsPath);
+ // Search for index to any existing tools.jar entry
+ int toolsIndex;
+ for (toolsIndex = 0; toolsIndex < oldCp.size(); toolsIndex++) {
+ IRuntimeClasspathEntry entry = (IRuntimeClasspathEntry) oldCp
+ .get(toolsIndex);
+ if (entry.getType() == IRuntimeClasspathEntry.ARCHIVE
+ && entry.getPath().lastSegment()
+ .equals("tools.jar")) {
+ break;
+ }
+ }
+ // If existing tools.jar found, replace in case it's
+ // different. Otherwise add.
+ if (toolsIndex < oldCp.size())
+ oldCp.set(toolsIndex, toolsJar);
+ else
+ mergeClasspath(oldCp, toolsJar);
+ }
+ }
+ }
+
+ iterator = oldCp.iterator();
+ List list = new ArrayList();
+ while (iterator.hasNext()) {
+ IRuntimeClasspathEntry entry = (IRuntimeClasspathEntry) iterator
+ .next();
+ try {
+ list.add(entry.getMemento());
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Could not resolve classpath entry: "
+ + entry, e);
+ }
+ }
+
+ workingCopy.setAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, list);
+ workingCopy
+ .setAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH,
+ false);
+ }
+
+ protected IModuleResource[] getResources(IModule[] module) {
+ return super.getResources(module);
+ }
+
+ protected IModuleResourceDelta[] getPublishedResourceDelta(IModule[] module) {
+ return super.getPublishedResourceDelta(module);
+ }
+
+ /**
+ * @see ServerBehaviourDelegate#handleResourceChange()
+ */
+ public void handleResourceChange() {
+ if (getServer().getServerRestartState())
+ return;
+
+ Iterator iterator = getAllModules().iterator();
+ while (iterator.hasNext()) {
+ IModule[] module = (IModule[]) iterator.next();
+ IModuleResourceDelta[] delta = getPublishedResourceDelta(module);
+ if (delta == null || delta.length == 0)
+ continue;
+
+ if (containsNonResourceChange(delta)) {
+ setServerRestartState(true);
+ return;
+ }
+ }
+ }
+
+ protected boolean containsNonResourceChange(IModuleResourceDelta[] delta) {
+ int size = delta.length;
+ for (int i = 0; i < size; i++) {
+ IModuleResourceDelta d = delta[i];
+ if (d.getModuleRelativePath().segmentCount() == 0) {
+ if ("WEB-INF".equals(d.getModuleResource().getName())) {
+ return containsNonResourceChange(d.getAffectedChildren());
+ }
+ continue;
+ }
+ if (d.getModuleResource() instanceof IModuleFile)
+ return true;
+
+ boolean b = containsNonAddChange(d.getAffectedChildren());
+ if (b)
+ return true;
+ }
+ return false;
+ }
+
+ protected boolean containsNonAddChange(IModuleResourceDelta[] delta) {
+ if (delta == null)
+ return false;
+ int size = delta.length;
+ for (int i = 0; i < size; i++) {
+ IModuleResourceDelta d = delta[i];
+ if (d.getModuleResource() instanceof IModuleFile) {
+ if (d.getKind() != IModuleResourceDelta.ADDED)
+ return true;
+ }
+
+ boolean b = containsNonAddChange(d.getAffectedChildren());
+ if (b)
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Cleans the entire work directory for this server. This involves deleting
+ * all subdirectories of the server's work directory.
+ *
+ * @param monitor
+ * a progress monitor
+ * @return results of the clean operation
+ * @throws CoreException
+ */
+ public IStatus cleanFrameworkInstanceWorkDir(IProgressMonitor monitor)
+ throws CoreException {
+ return Status.OK_STATUS;
+ }
+
+ public IPath getPublishDirectory(IModule[] module) {
+ return getServerDeployDirectory();
+ }
+
+ /**
+ * Gets the directory to which modules should be deployed for this server.
+ *
+ * @return full path to deployment directory for the server
+ */
+ public IPath getServerDeployDirectory() {
+ return new Path(getFrameworkInstance().getInstanceDirectory());
+ }
+
+ /**
+ * Gets the directory to which to deploy a module's web application.
+ *
+ * @param module
+ * a module
+ * @return full path to deployment directory for the module
+ */
+ public IPath getModuleDeployDirectory(IModule module) {
+ return getServerDeployDirectory().append(module.getName());
+ }
+
+ public void setModulePublishState2(IModule[] module, int state) {
+ setModulePublishState(module, state);
+ }
+
+ public Properties loadModulePublishLocations() {
+ Properties p = new Properties();
+ IPath path = getTempDirectory().append("publish.txt");
+ FileInputStream fin = null;
+ try {
+ fin = new FileInputStream(path.toFile());
+ p.load(fin);
+ } catch (Exception e) {
+ // ignore
+ } finally {
+ try {
+ fin.close();
+ } catch (Exception ex) {
+ // ignore
+ }
+ }
+ return p;
+ }
+
+ public void saveModulePublishLocations(Properties p) {
+ IPath path = getTempDirectory().append("publish.txt");
+ FileOutputStream fout = null;
+ try {
+ fout = new FileOutputStream(path.toFile());
+ p.store(fout, "OSGi Framework publish data");
+ } catch (Exception e) {
+ // ignore
+ } finally {
+ try {
+ fout.close();
+ } catch (Exception ex) {
+ // ignore
+ }
+ }
+ }
+
+ public Map<Long, IBundle> getBundles(IProgressMonitor monitor) throws CoreException {
+ return getAdmin().getBundles(monitor);
+ }
+
+ public void startBundle(long bundleId) throws CoreException {
+ getAdmin().startBundle(bundleId);
+ }
+
+ public void stopBundle(long bundleId) throws CoreException {
+ getAdmin().stopBundle(bundleId);
+ }
+
+ public void refreshBundle(long bundleId) throws CoreException {
+ getAdmin().refreshBundle(bundleId);
+ }
+
+ public void updateBundle(long bundleId) throws CoreException {
+ getAdmin().updateBundle(bundleId);
+ }
+
+ public String executeCommand(String command) throws CoreException {
+ return getConsole().executeCommand(command);
+ }
+
+ private IOSGiFrameworkAdmin getAdmin() throws CoreException {
+ if (admin == null) {
+ admin = new LaunchOSGiJMXFrameworkAdmin(getLaunch());
+ }
+ return admin;
+ }
+
+ private IOSGiFrameworkConsole getConsole() throws CoreException {
+ if (console == null) {
+ console = new LaunchBasicOSGiFrameworkConsole(getLaunch());
+ }
+ return console;
+ }
+
+ private ILaunch getLaunch() throws CoreException {
+ IServer server = getServer();
+ if (server == null) {
+ throw new CoreException(new Status(IStatus.ERROR, FrameworkCorePlugin.PLUGIN_ID,
+ Messages.OSGIFrameworkInstanceBehaviorDelegate_ServerNotInitialized));
+ }
+
+ ILaunch launch = server.getLaunch();
+ if (launch == null) {
+ throw new CoreException(new Status(IStatus.ERROR, FrameworkCorePlugin.PLUGIN_ID,
+ Messages.OSGIFrameworkInstanceBehaviorDelegate_ServerNotStarted));
+ }
+
+ return launch;
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/OSGIFrameworkInstanceLocatorDelegate.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/OSGIFrameworkInstanceLocatorDelegate.java
new file mode 100644
index 0000000..85bc5cc
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/OSGIFrameworkInstanceLocatorDelegate.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+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.internal.provisional.ServerLocatorDelegate;
+
+/**
+ *
+ */
+@SuppressWarnings("restriction")
+public class OSGIFrameworkInstanceLocatorDelegate extends ServerLocatorDelegate {
+ public void searchForServers(String host, final IServerSearchListener listener, final IProgressMonitor monitor) {
+ OSGIFrameworkLocatorDelegate.IRuntimeSearchListener listener2 = new OSGIFrameworkLocatorDelegate.IRuntimeSearchListener() {
+ public void runtimeFound(IRuntimeWorkingCopy runtime) {
+ String runtimeTypeId = runtime.getRuntimeType().getId();
+ String serverTypeId = runtimeTypeId.substring(0, runtimeTypeId.length() - 8);
+ IServerType serverType = ServerCore.findServerType(serverTypeId);
+ try {
+ IServerWorkingCopy server = serverType.createServer(serverTypeId, null, runtime, monitor);
+ listener.serverFound(server);
+ } catch (Exception e) {
+ Trace.trace(Trace.WARNING, "Could not create OSGI runtime instance", e);
+ }
+ }
+ };
+ OSGIFrameworkLocatorDelegate.searchForRuntimes2(null, listener2, monitor);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/OSGIFrameworkLocatorDelegate.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/OSGIFrameworkLocatorDelegate.java
new file mode 100644
index 0000000..dd3b82b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/OSGIFrameworkLocatorDelegate.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core;
+
+import java.io.File;
+import java.io.FileFilter;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.model.RuntimeLocatorDelegate;
+
+/**
+ *
+ */
+public abstract class OSGIFrameworkLocatorDelegate extends RuntimeLocatorDelegate {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.wst.server.core.model.IRuntimeFactoryDelegate#getKnownRuntimes
+ * ()
+ */
+ public void searchForRuntimes(IPath path, IRuntimeSearchListener listener,
+ IProgressMonitor monitor) {
+ searchForRuntimes2(path, listener, monitor);
+ }
+
+ protected static void searchForRuntimes2(IPath path,
+ IRuntimeSearchListener listener, IProgressMonitor monitor) {
+ File[] files = null;
+ if (path != null) {
+ File f = path.toFile();
+ if (f.exists())
+ files = f.listFiles();
+ else
+ return;
+ } else
+ files = File.listRoots();
+
+ if (files != null) {
+ int size = files.length;
+ int work = 100 / size;
+ int workLeft = 100 - (work * size);
+ for (int i = 0; i < size; i++) {
+ if (monitor.isCanceled())
+ return;
+ if (files[i] != null && files[i].isDirectory())
+ searchDir(listener, files[i], 4, monitor);
+ monitor.worked(work);
+ }
+ monitor.worked(workLeft);
+ } else
+ monitor.worked(100);
+ }
+
+ protected static void searchDir(IRuntimeSearchListener listener, File dir,
+ int depth, IProgressMonitor monitor) {
+ if ("conf".equals(dir.getName())) {
+ IRuntimeWorkingCopy runtime = getRuntimeFromDir(
+ dir.getParentFile(), monitor);
+ if (runtime != null) {
+ listener.runtimeFound(runtime);
+ return;
+ }
+ }
+
+ if (depth == 0)
+ return;
+
+ File[] files = dir.listFiles(new FileFilter() {
+ public boolean accept(File file) {
+ return file.isDirectory();
+ }
+ });
+ if (files != null) {
+ int size = files.length;
+ for (int i = 0; i < size; i++) {
+ if (monitor.isCanceled())
+ return;
+ searchDir(listener, files[i], depth - 1, monitor);
+ }
+ }
+ }
+
+ protected static IRuntimeWorkingCopy getRuntimeFromDir(File dir, IProgressMonitor monitor) {
+ return getRuntimeFromDir(dir, null, monitor);
+ }
+
+ protected static IRuntimeWorkingCopy getRuntimeFromDir(File dir,
+ String runtimeTypes[], IProgressMonitor monitor) {
+
+ for (int i = 0; i < runtimeTypes.length; i++) {
+ try {
+ IRuntimeType runtimeType = ServerCore
+ .findRuntimeType(runtimeTypes[i]);
+ String absolutePath = dir.getAbsolutePath();
+ String id = absolutePath.replace(File.separatorChar, '_')
+ .replace(':', '-');
+ IRuntimeWorkingCopy runtime = runtimeType.createRuntime(id,
+ monitor);
+ runtime.setName(dir.getName());
+ runtime.setLocation(new Path(absolutePath));
+ IOSGIFrameworkWorkingCopy wc = (IOSGIFrameworkWorkingCopy) runtime
+ .loadAdapter(IOSGIFrameworkWorkingCopy.class, null);
+ wc.setVMInstall(JavaRuntime.getDefaultVMInstall());
+ IStatus status = runtime.validate(monitor);
+ if (status == null || status.getSeverity() != IStatus.ERROR)
+ return runtime;
+
+ Trace.trace(Trace.FINER,
+ "False runtime found at " + dir.getAbsolutePath()
+ + ": " + status.getMessage());
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Could not find runtime", e);
+ }
+ }
+ return null;
+ }
+
+ public static String[] getRuntimeTypes(){
+ return new String[]{};
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/PingThread.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/PingThread.java
new file mode 100644
index 0000000..b08f870
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/PingThread.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core;
+
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.wst.server.core.IServer;
+
+/**
+ * Thread used to ping server to test when it is started.
+ */
+public class PingThread {
+ // delay before pinging starts
+ private static final int PING_DELAY = 2000;
+
+ // delay between pings
+ private static final int PING_INTERVAL = 250;
+
+ // maximum number of pings before giving up
+ private int maxPings;
+
+ private boolean stop = false;
+ private String url;
+ private IServer server;
+ private ILaunch launch;
+ private OSGIFrameworkInstanceBehaviorDelegate behaviour;
+
+ /**
+ * Create a new PingThread.
+ *
+ * @param server
+ * @param url
+ * @param maxPings
+ * the maximum number of times to try pinging, or -1 to continue
+ * forever
+ * @param behaviour
+ */
+ public PingThread(ILaunch launch, IServer server, String url, int maxPings,
+ OSGIFrameworkInstanceBehaviorDelegate behaviour) {
+ super();
+ this.server = server;
+ this.url = url;
+ this.maxPings = maxPings;
+ this.behaviour = behaviour;
+ this.launch = launch;
+ Thread t = new Thread("OSGi Framework Launchers Ping Thread") {
+ public void run() {
+ ping();
+ }
+ };
+ t.setDaemon(true);
+ t.start();
+ }
+
+ /**
+ * Ping the server until it is started. Then set the server state to
+ * STATE_STARTED.
+ */
+ protected void ping() {
+ int count = 0;
+ try {
+ Thread.sleep(PING_DELAY);
+ } catch (Exception e) {
+ // ignore
+ }
+
+ while (!stop) {
+ try {
+ if (count == maxPings) {
+ try {
+ server.stop(false);
+ } catch (Exception e) {
+ Trace.trace(Trace.FINEST, "Ping: could not stop server");
+ }
+ stop();
+ break;
+ }
+ count++;
+
+ if (launch.isTerminated()) {
+ behaviour.stop(true);
+ server.stop(true);
+ stop = true;
+ break;
+ } else {
+ Trace.trace(Trace.FINEST, "Ping: pinging " + count);
+ IProcess[] procs = launch.getProcesses();
+ if (procs != null && procs.length > 0) {
+ if (!procs[0].isTerminated()) {
+ behaviour.setServerStarted();
+ stop();
+ break;
+ }
+ }
+ }
+
+ } catch (Exception e) {
+ Trace.trace(Trace.FINEST, "Ping: failed");
+ // pinging failed
+ if (!stop) {
+ try {
+ Thread.sleep(PING_INTERVAL);
+ } catch (InterruptedException e2) {
+
+ }
+ }
+ }
+ }
+
+ stop = true;
+
+ }
+
+ /**
+ * Tell the pinging to stop.
+ */
+ public void stop() {
+ Trace.trace(Trace.FINEST, "Ping: stopping");
+ stop = true;
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/ProgressUtil.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/ProgressUtil.java
new file mode 100644
index 0000000..1ee8859
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/ProgressUtil.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core;
+
+import org.eclipse.core.runtime.*;
+/**
+ * Progress Monitor utility.
+ */
+public class ProgressUtil {
+ /**
+ * ProgressUtil constructor comment.
+ */
+ private ProgressUtil() {
+ super();
+ }
+
+ /**
+ * Return a valid progress monitor.
+ *
+ * @param monitor org.eclipse.core.runtime.IProgressMonitor
+ * @return org.eclipse.core.runtime.IProgressMonitor
+ */
+ public static IProgressMonitor getMonitorFor(IProgressMonitor monitor) {
+ if (monitor == null)
+ return new NullProgressMonitor();
+ return monitor;
+ }
+
+ /**
+ * Return a sub-progress monitor with the given amount on the
+ * current progress monitor.
+ *
+ * @param monitor org.eclipse.core.runtime.IProgressMonitor
+ * @param ticks int
+ * @return org.eclipse.core.runtime.IProgressMonitor
+ */
+ public static IProgressMonitor getSubMonitorFor(IProgressMonitor monitor, int ticks) {
+ if (monitor == null)
+ return new NullProgressMonitor();
+ if (monitor instanceof NullProgressMonitor)
+ return monitor;
+ return new SubProgressMonitor(monitor, ticks);
+ }
+
+ /**
+ * Return a sub-progress monitor with the given amount on the
+ * current progress monitor.
+ *
+ * @param monitor org.eclipse.core.runtime.IProgressMonitor
+ * @param ticks a number of ticks
+ * @param style a style
+ * @return org.eclipse.core.runtime.IProgressMonitor
+ */
+ public static IProgressMonitor getSubMonitorFor(IProgressMonitor monitor, int ticks, int style) {
+ if (monitor == null)
+ return new NullProgressMonitor();
+ if (monitor instanceof NullProgressMonitor)
+ return monitor;
+ return new SubProgressMonitor(monitor, ticks, style);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/TargetDefinitionUtil.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/TargetDefinitionUtil.java
new file mode 100644
index 0000000..6c48c4f
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/TargetDefinitionUtil.java
@@ -0,0 +1,15 @@
+package org.eclipse.libra.framework.core;
+
+import org.eclipse.pde.internal.core.PDECore;
+import org.eclipse.pde.internal.core.target.provisional.ITargetPlatformService;
+
+@SuppressWarnings("restriction")
+public class TargetDefinitionUtil {
+
+ public static ITargetPlatformService getTargetPlatformService() {
+ ITargetPlatformService service = (ITargetPlatformService) PDECore.getDefault().acquireService(ITargetPlatformService.class.getName());
+ return service;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/Trace.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/Trace.java
new file mode 100644
index 0000000..07029f4
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/Trace.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * Helper class to route trace output.
+ */
+public class Trace {
+ public static final byte CONFIG = 0;
+ public static final byte WARNING = 1;
+ public static final byte SEVERE = 2;
+ public static final byte FINEST = 3;
+ public static final byte FINER = 4;
+
+ private static final String[] levelNames = new String[] {
+ "CONFIG ", "WARNING ", "SEVERE ", "FINER ", "FINEST "};
+ private static final String spacer = " ";
+
+ private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy HH:mm.ss.SSS");
+
+ protected static int pluginLength = -1;
+
+ /**
+ * Trace constructor comment.
+ */
+ private Trace() {
+ super();
+ }
+
+ /**
+ * Trace the given text.
+ *
+ * @param level the trace level
+ * @param s a message
+ */
+ public static void trace(byte level, String s) {
+ Trace.trace(level, s, null);
+ }
+
+ /**
+ * Trace the given message and exception.
+ *
+ * @param level the trace level
+ * @param s a message
+ * @param t a throwable
+ */
+ public static void trace(byte level, String s, Throwable t) {
+ if (!FrameworkCorePlugin.getDefault().isDebugging())
+ return;
+
+ trace(FrameworkCorePlugin.PLUGIN_ID, level, s, t);
+ }
+
+ /**
+ * Trace the given message and exception.
+ *
+ * @param level a trace level
+ * @param s a message
+ * @param t a throwable
+ */
+ private static void trace(String pluginId, int level, String s, Throwable t) {
+ if (pluginId == null || s == null)
+ return;
+
+ if (!FrameworkCorePlugin.getDefault().isDebugging())
+ return;
+
+ StringBuffer sb = new StringBuffer(pluginId);
+ if (pluginId.length() > pluginLength)
+ pluginLength = pluginId.length();
+ else if (pluginId.length() < pluginLength)
+ sb.append(spacer.substring(0, pluginLength - pluginId.length()));
+ sb.append(" ");
+ sb.append(levelNames[level]);
+ sb.append(" ");
+ sb.append(sdf.format(new Date()));
+ sb.append(" ");
+ sb.append(s);
+ //Platform.getDebugOption(ServerCore.PLUGIN_ID + "/" + "resources");
+
+ System.out.println(sb.toString());
+ if (t != null)
+ t.printStackTrace();
+ }
+
+ /**
+ * Gets state of debug flag for the plug-in.
+ *
+ * @return true if tracing is enabled
+ */
+ public static boolean isTraceEnabled() {
+ return FrameworkCorePlugin.getDefault().isDebugging();
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/internal/debug/IModuleVisitor.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/internal/debug/IModuleVisitor.java
new file mode 100644
index 0000000..6f5082d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/internal/debug/IModuleVisitor.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core.internal.debug;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+
+/**
+ * Visitor interface to process module components
+ */
+public interface IModuleVisitor {
+
+ /**
+ * Process web component
+ * @param component web component to process
+ * @throws CoreException
+ */
+ void visitWebComponent(IVirtualComponent component) throws CoreException;
+
+ /**
+ * Post process web component
+ * @param component web component to process
+ * @throws CoreException
+ */
+ void endVisitWebComponent(IVirtualComponent component) throws CoreException;
+
+ /**
+ * Process archive component.
+ * @param runtimePath path for component at runtime
+ * @param workspacePath path to component in workspace
+ */
+ void visitArchiveComponent(IPath runtimePath, IPath workspacePath);
+
+ /**
+ * Process dependent component.
+ * @param runtimePath path for component at runtime
+ * @param workspacePath path to component in workspace
+ */
+ void visitDependentComponent(IPath runtimePath, IPath workspacePath);
+
+ /**
+ * Process web resource.
+ * @param runtimePath path for resource at runtime
+ * @param workspacePath path to resource in workspace
+ */
+ void visitWebResource(IPath runtimePath, IPath workspacePath);
+
+ /**
+ * Process a content resource from dependent component.
+ * @param runtimePath path for resource at runtime
+ * @param workspacePath path to resource in workspace
+ */
+ void visitDependentContentResource(IPath runtimePath, IPath workspacePath);
+
+ /**
+ * Process EAR resource.
+ * @param runtimePath path for resource at runtime
+ * @param workspacePath path to resource in workspace
+ */
+ void visitEarResource(IPath runtimePath, IPath workspacePath);
+
+ /**
+ * Post process EAR resource.
+ * @param component EAR component to process
+ * @throws CoreException
+ */
+ void endVisitEarComponent(IVirtualComponent component) throws CoreException;
+}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/internal/debug/ModuleTraverser.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/internal/debug/ModuleTraverser.java
new file mode 100644
index 0000000..a65d451
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/internal/debug/ModuleTraverser.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core.internal.debug;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.libra.framework.core.Trace;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.server.core.IModule;
+
+
+
+public class ModuleTraverser {
+
+ /**
+ * Scans the module using the specified visitor.
+ *
+ * @param module module to traverse
+ * @param visitor visitor to handle resources
+ * @param monitor a progress monitor
+ * @throws CoreException
+ */
+ public static void traverse(IModule module, IModuleVisitor visitor,
+ IProgressMonitor monitor) throws CoreException {
+ if (module == null || module.getModuleType() == null)
+ return;
+
+ //String typeId = module.getModuleType().getId();
+ IVirtualComponent component = ComponentCore.createComponent(module.getProject());
+
+ if (component == null) {
+ // can happen if project has been closed
+ Trace.trace(Trace.WARNING, "Unable to create component for module "
+ + module.getName());
+ return;
+ }
+
+ traverseOSGIComponent(component, visitor, monitor);
+
+ }
+
+
+
+ private static void traverseOSGIComponent(IVirtualComponent component,
+ IModuleVisitor visitor, IProgressMonitor monitor)
+ throws CoreException {
+
+ visitor.visitWebComponent(component);
+
+ visitor.endVisitWebComponent(component);
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/internal/debug/OSGIRuntimeSourcePathComputerDelegate.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/internal/debug/OSGIRuntimeSourcePathComputerDelegate.java
new file mode 100644
index 0000000..531c7d9
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/internal/debug/OSGIRuntimeSourcePathComputerDelegate.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core.internal.debug;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.sourcelookup.ISourceContainer;
+import org.eclipse.debug.core.sourcelookup.ISourcePathComputerDelegate;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerUtil;
+
+
+/**
+ *
+ */
+public class OSGIRuntimeSourcePathComputerDelegate implements
+ ISourcePathComputerDelegate {
+
+ /**
+ * {@inheritDoc}
+ */
+ public ISourceContainer[] computeSourceContainers(
+ ILaunchConfiguration configuration, IProgressMonitor monitor)
+ throws CoreException {
+ IServer server = ServerUtil.getServer(configuration);
+
+ SourcePathComputerVisitor visitor = new SourcePathComputerVisitor(configuration);
+
+ IModule[] modules = server.getModules();
+ for (int i = 0; i < modules.length; i++) {
+ ModuleTraverser.traverse(modules[i], visitor, monitor);
+ }
+
+ return visitor.getSourceContainers();
+ }
+
+ class SourcePathComputerVisitor implements IModuleVisitor {
+
+ final ILaunchConfiguration configuration;
+
+ /**
+ * List<IRuntimeClasspathEntry> of unresolved IRuntimeClasspathEntries
+ */
+ List runtimeClasspath = new ArrayList();
+
+ SourcePathComputerVisitor(ILaunchConfiguration configuration) {
+ this.configuration = configuration;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void visitWebComponent(IVirtualComponent component)
+ throws CoreException {
+ IProject project = component.getProject();
+ if (project.hasNature(JavaCore.NATURE_ID)) {
+ IJavaProject javaProject = JavaCore.create(project);
+ runtimeClasspath.add(JavaRuntime
+ .newDefaultProjectClasspathEntry(javaProject));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void endVisitWebComponent(IVirtualComponent component)
+ throws CoreException {
+ // do nothing
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void visitArchiveComponent(IPath runtimePath, IPath workspacePath) {
+ // do nothing
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void visitDependentComponent(IPath runtimePath,
+ IPath workspacePath) {
+ // do nothing
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void visitWebResource(IPath runtimePath, IPath workspacePath) {
+ // do nothing
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void visitDependentContentResource(IPath runtimePath, IPath workspacePath) {
+ // do nothing
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void visitEarResource(IPath runtimePath, IPath workspacePath) {
+ // do nothing
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void endVisitEarComponent(IVirtualComponent component)
+ throws CoreException {
+ // do nothing
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void visitClasspathEntry(IPath rtFolder, IClasspathEntry entry) {
+ // do nothing
+ }
+
+ ISourceContainer[] getSourceContainers() throws CoreException {
+ runtimeClasspath.addAll(Arrays.asList(JavaRuntime
+ .computeUnresolvedSourceLookupPath(configuration)));
+ IRuntimeClasspathEntry[] entries = (IRuntimeClasspathEntry[]) runtimeClasspath
+ .toArray(new IRuntimeClasspathEntry[runtimeClasspath.size()]);
+ IRuntimeClasspathEntry[] resolved = JavaRuntime
+ .resolveSourceLookupPath(entries, configuration);
+ return JavaRuntime.getSourceContainers(resolved);
+ }
+
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/internal/dependency/DependencyUtil.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/internal/dependency/DependencyUtil.java
new file mode 100644
index 0000000..5866f35
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/internal/dependency/DependencyUtil.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core.internal.dependency;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.osgi.service.resolver.BundleDescription;
+import org.eclipse.osgi.service.resolver.BundleSpecification;
+import org.eclipse.osgi.service.resolver.ExportPackageDescription;
+
+public class DependencyUtil {
+
+ public static Object[] getDependencies(BundleDescription bundleDescription) {
+
+ if (bundleDescription == null) {
+ return new BundleDescription[0];
+ }
+
+ List<Object> c = getDescription(bundleDescription.getRequiredBundles());
+ c.addAll(getExportedDescription(bundleDescription,
+ bundleDescription.getResolvedImports()));
+
+ if (bundleDescription.getHost() != null) {
+ c.add(bundleDescription.getHost().getSupplier());
+ }
+
+ return c.toArray(new Object[c.size()]);
+ }
+
+ public static List<Object> getDescription(
+ BundleSpecification[] specifications) {
+ ArrayList<Object> descriptionList = new ArrayList<Object>();
+ for (int i = 0; i < specifications.length; i++) {
+ BundleSpecification specification = specifications[i];
+ if (specification.getSupplier() == null) {
+ // We can't get a description, so just keep the bundle
+ // specification
+ descriptionList.add(specification);
+ } else {
+ descriptionList.add(specification.getSupplier());
+ }
+ }
+ return descriptionList;
+ }
+
+ private static Set<BundleDescription> getExportedDescription(
+ BundleDescription element,
+ ExportPackageDescription[] exportedPackages) {
+ Set<BundleDescription> descriptionList = new HashSet<BundleDescription>();
+ for (int i = 0; i < exportedPackages.length; i++) {
+ ExportPackageDescription exportedPackage = exportedPackages[i];
+ if (!element.getLocation().equals(
+ exportedPackage.getExporter().getLocation())) {
+ descriptionList.add(exportedPackage.getExporter());
+ }
+ }
+ return descriptionList;
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/launching/LaunchConfigurationDelegate.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/launching/LaunchConfigurationDelegate.java
new file mode 100644
index 0000000..aedf0d5
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/launching/LaunchConfigurationDelegate.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core.launching;
+
+import java.io.File;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate;
+import org.eclipse.jdt.launching.ExecutionArguments;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMRunner;
+import org.eclipse.jdt.launching.VMRunnerConfiguration;
+import org.eclipse.jst.server.core.ServerProfilerDelegate;
+import org.eclipse.libra.framework.core.OSGIFrameworkInstanceBehaviorDelegate;
+import org.eclipse.libra.framework.core.Trace;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
+import org.eclipse.wst.server.core.ServerUtil;
+
+
+/**
+ *
+ */
+public class LaunchConfigurationDelegate extends
+ AbstractJavaLaunchConfigurationDelegate {
+
+ public void launch(ILaunchConfiguration configuration, String mode,
+ ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ IServer server = ServerUtil.getServer(configuration);
+
+ if (server == null) {
+ Trace.trace(Trace.FINEST,
+ "Launch configuration could not find runtime instance");
+ }
+
+// This should be handled by the action that starts/debugs not here
+// if (server.shouldPublish() && ServerCore.isAutoPublishing())
+// server.publish(IServer.PUBLISH_INCREMENTAL, monitor);
+
+ OSGIFrameworkInstanceBehaviorDelegate oribd = (OSGIFrameworkInstanceBehaviorDelegate) server
+ .loadAdapter(OSGIFrameworkInstanceBehaviorDelegate.class, null);
+
+ String mainTypeName = oribd.getFrameworkClass();
+
+ IVMInstall vm = verifyVMInstall(configuration);
+
+ IVMRunner runner = vm.getVMRunner(mode);
+ if (runner == null)
+ runner = vm.getVMRunner(ILaunchManager.RUN_MODE);
+
+ File workingDir = verifyWorkingDirectory(configuration);
+ String workingDirName = null;
+ if (workingDir != null)
+ workingDirName = workingDir.getAbsolutePath();
+
+ // Program & VM args
+ String pgmArgs = getProgramArguments(configuration);
+ String vmArgs = getVMArguments(configuration);
+ String[] envp = getEnvironment(configuration);
+
+ ExecutionArguments execArgs = new ExecutionArguments(vmArgs, pgmArgs);
+
+ // VM-specific attributes
+ Map vmAttributesMap = getVMSpecificAttributesMap(configuration);
+
+ // Classpath
+ String[] classpath = getClasspath(configuration);
+
+ // Create VM config
+ VMRunnerConfiguration runConfig = new VMRunnerConfiguration(
+ mainTypeName, classpath);
+ runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
+ runConfig.setVMArguments(execArgs.getVMArgumentsArray());
+ runConfig.setWorkingDirectory(workingDirName);
+ runConfig.setEnvironment(envp);
+ runConfig.setVMSpecificAttributesMap(vmAttributesMap);
+
+ // Bootpath
+ String[] bootpath = getBootpath(configuration);
+ if (bootpath != null && bootpath.length > 0)
+ runConfig.setBootClassPath(bootpath);
+
+ setDefaultSourceLocator(launch, configuration);
+
+ if (ILaunchManager.PROFILE_MODE.equals(mode)) {
+ try {
+ ServerProfilerDelegate.configureProfiling(launch, vm,
+ runConfig, monitor);
+ } catch (CoreException ce) {
+ oribd.stopImpl();
+ throw ce;
+ }
+ }
+
+ // Launch the configuration
+ oribd.setupLaunch(launch, mode, monitor);
+ try {
+ runner.run(runConfig, launch, monitor);
+ oribd.addProcessListener(launch.getProcesses()[0]);
+ } catch (Exception e) {
+ // Ensure we don't continue to think the server is starting
+ oribd.stopImpl();
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/launching/LaunchableAdapterDelegate.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/launching/LaunchableAdapterDelegate.java
new file mode 100644
index 0000000..19baf12
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/launching/LaunchableAdapterDelegate.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core.launching;
+
+import org.eclipse.libra.framework.core.IOSGIFrameworkInstance;
+import org.eclipse.libra.framework.core.Trace;
+import org.eclipse.wst.server.core.IModuleArtifact;
+import org.eclipse.wst.server.core.IServer;
+
+
+/**
+ * Launchable adapter delegate for OSGi resources.
+ */
+public class LaunchableAdapterDelegate extends
+ org.eclipse.wst.server.core.model.LaunchableAdapterDelegate {
+ /*
+ * @see LaunchableAdapterDelegate#getLaunchable(IServer, IModuleArtifact)
+ */
+ public Object getLaunchable(IServer server, IModuleArtifact moduleObject) {
+ Trace.trace(Trace.FINER, "IOSGIFrameworkInstance Launchable Adapter " + server + "-"
+ + moduleObject);
+ if (server.getAdapter(IOSGIFrameworkInstance.class) == null)
+ return null;
+ // if (!(moduleObject instanceof Servlet) &&
+ // !(moduleObject instanceof WebResource))
+ return null;
+
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/module/OsgiModuleDeployable.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/module/OsgiModuleDeployable.java
new file mode 100644
index 0000000..2d48722
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/module/OsgiModuleDeployable.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core.module;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.web.internal.deployables.FlatComponentDeployable;
+
+@SuppressWarnings("restriction")
+public class OsgiModuleDeployable extends FlatComponentDeployable {
+
+
+ IVirtualComponent component;
+
+ public OsgiModuleDeployable(IProject project, IVirtualComponent component) {
+ super(project);
+ this.component = component;
+ }
+
+ public String getVersion() {
+ IFacetedProject facetedProject = null;
+ try {
+ facetedProject = ProjectFacetsManager.create(component.getProject());
+ if (facetedProject !=null && ProjectFacetsManager.isProjectFacetDefined("osgi.bundle")) {
+ IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet("osgi.bundle");
+ return facetedProject.getInstalledVersion(projectFacet).getVersionString();
+ }
+ } catch (Exception e) {
+ //Ignore
+ }
+ return "1.0"; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/module/OsgiModuleDeployableFactory.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/module/OsgiModuleDeployableFactory.java
new file mode 100644
index 0000000..ab5fc62
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/module/OsgiModuleDeployableFactory.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core.module;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.libra.framework.core.Trace;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.StructureEdit;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.model.ModuleDelegate;
+import org.eclipse.wst.server.core.util.ProjectModuleFactoryDelegate;
+
+
+public class OsgiModuleDeployableFactory extends ProjectModuleFactoryDelegate {
+
+ List<OsgiModuleDeployable> moduleDelegates = new ArrayList<OsgiModuleDeployable>();
+
+ @Override
+ public ModuleDelegate getModuleDelegate(IModule module) {
+ for (OsgiModuleDeployable omd : moduleDelegates) {
+ if (module == omd.getModule())
+ return omd;
+ }
+ return null;
+ }
+
+ @Override
+ protected IModule[] createModules(IProject project) {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ if (component == null) {
+ component = new VirtualComponent(project, new Path("/")); //$NON-NLS-1$
+ }
+ if (component != null) {
+ return createModuleDelegates(component);
+ }
+ return null;
+ }
+
+ private IModule[] createModuleDelegates(IVirtualComponent component) {
+ if (component == null) {
+ return null;
+ }
+ OsgiModuleDeployable moduleDelegate = null;
+ IModule module = null;
+ try {
+ if (isValidModule(component.getProject())) {
+ moduleDelegate = new OsgiModuleDeployable(
+ component.getProject(), component);
+ module = createModule(component.getName(), component.getName(),
+ "osgi.bundle", moduleDelegate.getVersion(),
+ moduleDelegate.getProject());
+ moduleDelegate.initialize(module);
+
+ }
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, e.getMessage(), e);
+ } finally {
+ if (module != null) {
+ if (getModuleDelegate(module) == null)
+ moduleDelegates.add(moduleDelegate);
+ }
+ }
+ if (module == null)
+ return null;
+ return new IModule[] { module };
+ }
+
+
+ private boolean isValidModule(IProject project) {
+ try {
+ IFacetedProject facetedProject = ProjectFacetsManager
+ .create(project);
+ if (facetedProject == null)
+ return false;
+ IProjectFacet webFacet = ProjectFacetsManager
+ .getProjectFacet("osgi.bundle");
+ return facetedProject.hasProjectFacet(webFacet);
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the list of resources that the module should listen to
+ * for state changes. The paths should be project relative paths.
+ * Subclasses can override this method to provide the paths.
+ *
+ * @return a possibly empty array of paths
+ */
+ @Override
+ protected IPath[] getListenerPaths() {
+ return new IPath[] {
+ new Path(".project"), // nature //$NON-NLS-1$
+ new Path(StructureEdit.MODULE_META_FILE_NAME), // component
+ new Path(".settings/org.eclipse.wst.common.project.facet.core.xml") // facets //$NON-NLS-1$
+ };
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/publish/PublishHelper.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/publish/PublishHelper.java
new file mode 100644
index 0000000..a0984cc
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/publish/PublishHelper.java
@@ -0,0 +1,330 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core.publish;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.channels.FileChannel;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.libra.framework.core.FrameworkInstanceConfiguration;
+import org.eclipse.pde.core.IModel;
+import org.eclipse.pde.core.plugin.IPluginModelBase;
+import org.eclipse.pde.core.plugin.ModelEntry;
+import org.eclipse.pde.core.plugin.PluginRegistry;
+import org.eclipse.pde.internal.core.WorkspaceModelManager;
+import org.eclipse.pde.internal.core.exports.FeatureExportInfo;
+import org.eclipse.pde.internal.core.exports.PluginExportOperation;
+import org.eclipse.pde.internal.core.target.provisional.IResolvedBundle;
+import org.eclipse.pde.internal.core.target.provisional.ITargetDefinition;
+import org.eclipse.pde.internal.ui.PDEPluginImages;
+import org.eclipse.pde.internal.ui.PDEUIMessages;
+import org.eclipse.ui.progress.IProgressConstants;
+import org.eclipse.wst.server.core.IModule;
+
+@SuppressWarnings("restriction")
+public abstract class PublishHelper {
+
+ protected abstract IPath getPublishFolder();
+
+
+ public String getServerModules(List modules, String prefix, String spacer) {
+ StringBuilder builder = new StringBuilder();
+ for (Object object : modules) {
+ IModule[] moduleArr = (IModule[]) object;
+ for (IModule module : moduleArr) {
+ if (builder.length() > 0)
+ builder.append(spacer); //$NON-NLS-1$
+ IPluginModelBase[] models = PluginRegistry.getActiveModels();
+ IPath publishFolder = getPublishFolder();
+ for (IPluginModelBase iPluginModelBase : models) {
+ if (iPluginModelBase.getBundleDescription().getName()
+ .equalsIgnoreCase(module.getName())) {
+ if (builder.indexOf(iPluginModelBase.getPluginBase()
+ .getId()
+ + "_"
+ + iPluginModelBase.getPluginBase().getVersion()
+ + ".jar") < 0) {
+ builder.append(prefix
+ + publishFolder.append(
+ iPluginModelBase.getPluginBase()
+ .getId()
+ + "_"
+ + iPluginModelBase
+ .getPluginBase()
+ .getVersion()
+ + ".jar").toOSString());
+ break;
+ }
+ }
+ }
+ }
+ }
+ return builder.toString();
+ }
+
+ public String getTargetBundles(FrameworkInstanceConfiguration config,
+ String prefix, String spacer) {
+ StringBuffer buffer = new StringBuffer();
+ String[] paths = getTargetBundlePaths(config);
+ for (int i = 0; i < paths.length; i++) {
+ String path = paths[i];
+ if (buffer.length() > 0)
+ buffer.append(spacer); //$NON-NLS-1$
+ buffer.append(prefix + path);
+ }
+ return buffer.toString();
+ }
+
+
+
+ public String[] getTargetBundlePaths(FrameworkInstanceConfiguration config) {
+ List<String> all = new ArrayList<String>();
+ ITargetDefinition targetDefinition = config.getTargetDefinition();
+ targetDefinition.resolve(new NullProgressMonitor());
+ IResolvedBundle[] targetBundles = targetDefinition.getBundles();
+ for (IResolvedBundle b : targetBundles) {
+ if (b.getStatus().getSeverity() == IStatus.OK) {
+ all.add(b.getBundleInfo().getLocation().getRawPath());
+ }
+
+ }
+ return all.toArray(new String[all.size()]);
+ }
+
+ public IResolvedBundle[] getTargetBundles(FrameworkInstanceConfiguration config) {
+ List<String> all = new ArrayList<String>();
+ ITargetDefinition targetDefinition = config.getTargetDefinition();
+ targetDefinition.resolve(new NullProgressMonitor());
+ IResolvedBundle[] targetBundles = targetDefinition.getBundles();
+ return targetBundles;
+ }
+
+
+ public String[] getTargetBundleIds(FrameworkInstanceConfiguration config) {
+ List<String> all = new ArrayList<String>();
+ ITargetDefinition targetDefinition = config.getTargetDefinition();
+ targetDefinition.resolve(new NullProgressMonitor());
+ IResolvedBundle[] targetBundles = targetDefinition.getBundles();
+ for (IResolvedBundle b : targetBundles) {
+ if (b.getStatus().getSeverity() == IStatus.OK) {
+ all.add(b.getBundleInfo().getSymbolicName());
+ }
+
+ }
+ return all.toArray(new String[all.size()]);
+ }
+
+
+ public void exportBundles(List modules,
+ FrameworkInstanceConfiguration config, IPath location) {
+ exportBundles(modules, config, location, null);
+ }
+
+ public void exportBundles(List modules,
+ FrameworkInstanceConfiguration config, final IPath location,
+ final IPath tmpLocation) {
+
+ final FeatureExportInfo info = new FeatureExportInfo();
+ info.toDirectory = true;
+ info.useJarFormat = true;
+ info.exportSource = true;
+ info.exportSourceBundle = false;
+ info.allowBinaryCycles = true;
+ info.useWorkspaceCompiledClasses = true;
+
+ info.destinationDirectory = tmpLocation == null ? location
+ .makeAbsolute().toOSString() : tmpLocation.makeAbsolute()
+ .toOSString();
+
+ List<Object> allWsBundles = new ArrayList<Object>();
+ List<IProject> allBinBundles = new ArrayList<IProject>();
+
+ for (Object module : modules) {
+ try {
+ IModule[] moduleArr = (IModule[]) module;
+
+ for (IModule iModule : moduleArr) {
+ IProject project = iModule.getProject();
+
+ IPluginModelBase pmb = PluginRegistry.findModel(project);
+ ModelEntry entry = null;
+ if(pmb != null)
+ entry = PluginRegistry.findEntry(pmb
+ .getBundleDescription().getSymbolicName());
+ if (!WorkspaceModelManager.isBinaryProject(project)
+ && WorkspaceModelManager.isPluginProject(project)) {
+ if (entry.getModel() != null
+ && isValidModel(entry.getModel())
+ && hasBuildProperties((IPluginModelBase) entry
+ .getModel())) {
+
+ allWsBundles.add(entry.getModel());
+ } else {
+ allBinBundles.add(project);
+ }
+ } else if (WorkspaceModelManager.isBinaryProject(project)
+ && WorkspaceModelManager.isPluginProject(project)) {
+ allBinBundles.add(project);
+ }
+ }
+ } catch (SecurityException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ // } catch (NoSuchMethodException e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
+ } catch (IllegalArgumentException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ copyBinaryJars(allBinBundles, (tmpLocation == null ? location
+ : tmpLocation));
+ info.items = allWsBundles.toArray();
+ info.signingInfo = null;
+ info.qualifier = "qualifier";
+
+ final PluginExportOperation job = new PluginExportOperation(info,
+ PDEUIMessages.PluginExportJob_name);
+ job.setUser(true);
+ job.setRule(ResourcesPlugin.getWorkspace().getRoot());
+ job.setProperty(IProgressConstants.ICON_PROPERTY,
+ PDEPluginImages.DESC_PLUGIN_OBJ);
+ job.addJobChangeListener(new JobChangeAdapter() {
+ @Override
+ public void done(IJobChangeEvent event) {
+ if (event.getResult().isOK()) {
+ try {
+ if (tmpLocation != null) {
+ // MOVE ALL
+ File sourceFiles = tmpLocation.append("/plugins").toFile();
+ for (File jars : sourceFiles.listFiles()) {
+ File destFile = location.append(jars.getName()).toFile();
+
+ if (!destFile.exists()) {
+ destFile.createNewFile();
+ }
+
+ FileChannel source = null;
+ FileChannel destination = null;
+ try {
+ source = new FileInputStream(jars)
+ .getChannel();
+ destination = new FileOutputStream(destFile)
+ .getChannel();
+ destination.transferFrom(source, 0,
+ source.size());
+ } finally {
+ if (source != null) {
+ source.close();
+ }
+ if (destination != null) {
+ destination.close();
+ }
+ }
+ }
+ } else {
+ }
+ } catch (Exception e) {
+
+ }
+ }
+ }
+ });
+ job.schedule();
+
+ }
+
+ private void copyBinaryJars(List<IProject> list, IPath location) {
+ // TODO Auto-generated method stub
+ FileChannel inChannel = null;
+ FileChannel outChannel = null;
+ try {
+ for (IProject project : list) {
+ for (IResource resource : project.members(true)) {
+ if (("jar".equalsIgnoreCase(resource.getFileExtension()))) {
+ String jarId = "";
+ IPluginModelBase[] models = PluginRegistry
+ .getWorkspaceModels();
+ for (IPluginModelBase iPluginModelBase : models) {
+ if (iPluginModelBase
+ .getPluginBase()
+ .getId()
+ .equalsIgnoreCase(
+ resource.getProject().getName())) {
+ iPluginModelBase.getPluginBase().getId();
+ jarId = iPluginModelBase.getPluginBase()
+ .getId()
+ + "_"
+ + iPluginModelBase.getPluginBase()
+ .getVersion() + ".jar";
+ }
+ }
+
+ inChannel = new FileInputStream(new File(
+ resource.getLocationURI())).getChannel();
+ outChannel = new FileOutputStream(new File(location
+ .append(jarId).makeAbsolute()
+ .toPortableString())).getChannel();
+ inChannel.transferTo(0, inChannel.size(), outChannel);
+ break;
+ }
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ } finally {
+ if (inChannel != null)
+ try {
+ inChannel.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ if (outChannel != null)
+ try {
+ outChannel.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private boolean hasBuildProperties(IPluginModelBase model) {
+ File file = new File(model.getInstallLocation(), "build.properties"); //$NON-NLS-1$
+ return file.exists();
+ }
+
+ protected boolean isValidModel(IModel model) {
+ return model != null && model instanceof IPluginModelBase;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/publish/PublishTask.java b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/publish/PublishTask.java
new file mode 100644
index 0000000..93c8ffb
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.core/src/org/eclipse/libra/framework/core/publish/PublishTask.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.core.publish;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.PublishOperation;
+import org.eclipse.wst.server.core.model.PublishTaskDelegate;
+
+public class PublishTask extends PublishTaskDelegate {
+ public PublishOperation[] getTasks(IServer server, int kind, List modules, List kindList) {
+ if (modules == null)
+ return null;
+
+ List<PublishOperation> tasks = new ArrayList<PublishOperation>();
+
+ return (PublishOperation[]) tasks.toArray(new PublishOperation[tasks.size()]);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.editor.core/.classpath b/plugins/org.eclipse.libra.framework.editor.core/.classpath
new file mode 100644
index 0000000..64c5e31
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.core/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.libra.framework.editor.core/.project b/plugins/org.eclipse.libra.framework.editor.core/.project
new file mode 100644
index 0000000..f24d34e
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.core/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.libra.framework.editor.core</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>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.libra.framework.editor.core/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.libra.framework.editor.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..fae65f9
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Wed Oct 05 20:16:09 EEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+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
diff --git a/plugins/org.eclipse.libra.framework.editor.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.libra.framework.editor.core/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..de648e5
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.core/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.libra.framework.editor.core
+Bundle-Version: 0.1.0.qualifier
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.libra.framework.editor.core;version="0.1.0",
+ org.eclipse.libra.framework.editor.core.model;version="0.1.0"
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)"
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.libra.framework.editor.core/build.properties b/plugins/org.eclipse.libra.framework.editor.core/build.properties
new file mode 100644
index 0000000..aa1a008
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.core/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties
diff --git a/plugins/org.eclipse.libra.framework.editor.core/plugin.properties b/plugins/org.eclipse.libra.framework.editor.core/plugin.properties
new file mode 100644
index 0000000..98d1c57
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.core/plugin.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# Copyright (c) 2011 SAP AG.
+# 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:
+# Kaloyan Raev (SAP AG) - initial API and implementation
+###############################################################################
+Bundle-Name = OSGi Framework Editor Core (Incubation)
+Bundle-Vendor = Eclipse Web Tools Platform
diff --git a/plugins/org.eclipse.libra.framework.editor.core/pom.xml b/plugins/org.eclipse.libra.framework.editor.core/pom.xml
new file mode 100644
index 0000000..7d3ae65
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.core/pom.xml
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.libra_parent</artifactId>
+ <groupId>org.eclipse.libra</groupId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../development/org.eclipse.libra.releng/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.libra.framework.editor.core</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSGi Framework Editor Core Plug-in</name>
+ <version>0.1.0-SNAPSHOT</version>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/IOSGiFrameworkAdmin.java b/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/IOSGiFrameworkAdmin.java
new file mode 100644
index 0000000..fee0e04
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/IOSGiFrameworkAdmin.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.core;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.libra.framework.editor.core.model.IBundle;
+
+/**
+ * The methods of this interface are called by the <i>Bundle Information</i> and
+ * <i>Bundle Dependency Graph</i> editor parts to retrieve and manage the state
+ * of the bundles in the OSGi framework.
+ *
+ * <p>
+ * The editor parts get a reference to this interface by trying to adapt the
+ * {@code IServer} instance to this interface, i.e. by calling something like:
+ * {@code getServer().loadAdapter(IOSGiFrameworkAdmin.class, null)}.
+ * </p>
+ *
+ * <p>
+ * Server runtimes that integrate the <i>Bundle Information</i> and <i>Bundle
+ * Dependency Graph</i> editor parts must implement this interface in order to
+ * feed the editor with the required capabilities for this runtime. The easiest
+ * way to make this implementation available to the editor parts is to implement
+ * this interface in either the {@code ServerDelegate} or the
+ * {@code ServerBehaviorDelegate} classes.
+ * </p>
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ *
+ * @author Kaloyan Raev
+ */
+public interface IOSGiFrameworkAdmin {
+
+ /**
+ * Retrieves the bundle state of the OSGi framework.
+ *
+ * @param monitor
+ * for tracking the progress of retrieving bundle information.
+ *
+ * @return a map of the bundle state: the key is the bundle id and the value
+ * is an {@code IBundle} object that provides information about the
+ * bundle state.
+ * @throws CoreException
+ * if the operation cannot be executed successfully. The
+ * {@code IStatus} of the exception is presented to the user in
+ * a appropriate way.
+ *
+ * @see IBundle
+ */
+ public Map<Long, IBundle> getBundles(IProgressMonitor monitor) throws CoreException;
+
+ /**
+ * Starts a bundle in the OSGi framework.
+ *
+ * @param bundleId
+ * the id of the bundle to be started.
+ * @throws CoreException
+ * if the operation cannot be executed successfully. The
+ * {@code IStatus} of the exception is presented to the user in
+ * a appropriate way.
+ */
+ public void startBundle(long bundleId) throws CoreException;
+
+ /**
+ * Stops a bundle in the OSGi framework.
+ *
+ * @param bundleId
+ * the id of the bundle to be stopped.
+ * @throws CoreException
+ * if the operation cannot be executed successfully. The
+ * {@code IStatus} of the exception is presented to the user in
+ * a appropriate way.
+ */
+ public void stopBundle(long bundleId) throws CoreException;
+
+ /**
+ * Refreshes a bundle in the OSGi framework.
+ *
+ * @param bundleId
+ * the id of the bundle to be refreshed.
+ * @throws CoreException
+ * if the operation cannot be executed successfully. The
+ * {@code IStatus} of the exception is presented to the user in
+ * a appropriate way.
+ */
+ public void refreshBundle(long bundleId) throws CoreException;
+
+ /**
+ * Updates a bundle in the OSGi framework.
+ *
+ * @param bundleId
+ * the id of the bundle to be updated.
+ * @throws CoreException
+ * if the operation cannot be executed successfully. The
+ * {@code IStatus} of the exception is presented to the user in
+ * a appropriate way.
+ */
+ public void updateBundle(long bundleId) throws CoreException;
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/IOSGiFrameworkConsole.java b/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/IOSGiFrameworkConsole.java
new file mode 100644
index 0000000..e39cd73
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/IOSGiFrameworkConsole.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.core;
+
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * The methods of this interface are called by the <i>Server Console</i> editor
+ * part to execute commands in the shell of the OSGi framework.
+ *
+ * <p>
+ * The editor parts get a reference to this interface by trying to adapt the
+ * {@code IServer} instance to this interface, i.e. by calling something like:
+ * {@code getServer().loadAdapter(IOSGiFrameworkConsole.class, null)}. .
+ * </p>
+ *
+ * <p>
+ * Server runtimes that integrate the <i>Server Console</i> editor part must
+ * implement this interface in order to feed the editor with the required
+ * capabilities for this runtime. The easiest way to make this implementation
+ * available to the editor parts is to implement this interface in either the
+ * {@code ServerDelegate} or the {@code ServerBehaviorDelegate} classes.
+ * </p>
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ *
+ * @author Kaloyan Raev
+ */
+public interface IOSGiFrameworkConsole {
+
+ /**
+ * Executes a command in the shell of the OSGi framework.
+ *
+ * @param command
+ * the command line to be executed.
+ * @throws CoreException
+ * if the operation cannot be executed successfully. The
+ * {@code IStatus} of the exception is presented to the user in
+ * a appropriate way.
+ */
+ public String executeCommand(String command) throws CoreException;
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/model/IBundle.java b/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/model/IBundle.java
new file mode 100644
index 0000000..6754278
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/model/IBundle.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.core.model;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.libra.framework.editor.core.IOSGiFrameworkAdmin;
+import org.osgi.framework.Bundle;
+
+/**
+ * This interface represents a bundle and its state in an OSGi framework. It is
+ * used by the <i>Bundle Information</i> and <i>Bundle Dependency Graph</i>
+ * editor parts to display the state of the represented bundle.
+ *
+ * <p>
+ * Objects implementing this interface are returned as a map by the
+ * {@link IOSGiFrameworkAdmin#getBundles()} method that is called by the editor
+ * parts. These objects are provided by the server runtime that implements the
+ * {@link IOSGiFrameworkAdmin} interface.
+ * </p>
+ *
+ * @noextend This interface is not intended to be extended by clients.
+ *
+ * @see IOSGiFrameworkAdmin#getBundles()
+ *
+ * @author Kaloyan Raev
+ */
+public interface IBundle {
+
+ /**
+ * Returns the unique identifier of this bundle.
+ *
+ * @return The String representation of the id number.
+ *
+ * @see Bundle#getBundleId()
+ */
+ public String getId();
+
+ /**
+ * Returns the symbolic name of this bundle.
+ *
+ * @return The symbolic name of this bundle or {@code null} if this bundle
+ * does not have a symbolic name.
+ *
+ * @see Bundle#getSymbolicName()
+ */
+ public String getSymbolicName();
+
+ /**
+ * Returns the version of this bundle.
+ *
+ * @return The String representation of the version number.
+ *
+ * @see Bundle#getVersion()
+ */
+ public String getVersion();
+
+ /**
+ * Returns the current state of this bundle.
+ *
+ * @return The String representation of the state.
+ *
+ * @see Bundle#getVersion()
+ */
+ public String getState();
+
+ /**
+ * Returns the location identifier of this bundle.
+ *
+ * @return The String representation of the location identifier.
+ *
+ * @see Bundle#getLocation()
+ */
+ public String getLocation();
+
+ /**
+ * Returns the Manifest headers and values of this bundle.
+ *
+ * @return A {@code Map} object containing the Manifest headers and values.
+ * This method never returns {@code null}.
+ *
+ * @see Bundle#getHeaders()
+ */
+ public Map<String, String> getHeaders();
+
+ /**
+ * Returns all packages exported by this bundle.
+ *
+ * @return A {@code Set} object containing all exported packages represented
+ * as {@code IPackageExport} objects. This method never returns
+ * {@code null}.
+ *
+ * @see IPackageExport
+ */
+ public Set<IPackageExport> getPackageExports();
+
+ /**
+ * Returns the packages imported by this bundle.
+ *
+ * @return A {@code Set} object containing all imported packages represented
+ * as {@code IPackageImport} objects. This method never returns
+ * {@code null}.
+ *
+ * @see IPackageImport
+ */
+ public Set<IPackageImport> getPackageImports();
+
+ /**
+ * Returns all services registered by this bundle.
+ *
+ * @return A {@code Set} object containing all registered services
+ * represented as {@code IServiceReference} objects. This method
+ * never returns {@code null}.
+ *
+ * @see Bundle#getRegisteredServices()
+ * @see IServiceReference
+ */
+ public Set<IServiceReference> getRegisteredServices();
+
+ /**
+ * Returns all services this bundle is using.
+ *
+ * @return A {@code Set} object containing all services in use represented
+ * as {@code IServiceReference} objects. This method never returns
+ * {@code null}.
+ *
+ * @see Bundle#getServicesInUse()
+ * @see IServiceReference
+ */
+ public Set<IServiceReference> getServicesInUse();
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/model/IPackageExport.java b/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/model/IPackageExport.java
new file mode 100644
index 0000000..2e8d853
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/model/IPackageExport.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.core.model;
+
+/**
+ * This interface represents a package exported by an OSGi bundle represented by
+ * an {@code IBundle} object.
+ *
+ * @see IBundle
+ *
+ * @author Kaloyan Raev
+ */
+public interface IPackageExport {
+
+ /**
+ * Returns the name of the exported package.
+ *
+ * @return The fully qualified name of the package.
+ */
+ public String getName();
+
+ /**
+ * Returns the version of the exported package.
+ *
+ * @return The String representation of the version.
+ */
+ public String getVersion();
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/model/IPackageImport.java b/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/model/IPackageImport.java
new file mode 100644
index 0000000..cbe8e7d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/model/IPackageImport.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.core.model;
+
+/**
+ * This interface represents a package imported by an OSGi bundle represented by
+ * an {@code IBundle} object.
+ *
+ * @see IBundle
+ *
+ * @author Kaloyan Raev
+ */
+public interface IPackageImport {
+
+ /**
+ * Returns the name of the imported package.
+ *
+ * @return The fully qualified name of the package.
+ */
+ public String getName();
+
+ /**
+ * Returns the version of the imported package.
+ *
+ * @return The String representation of the version.
+ */
+ public String getVersion();
+
+ /**
+ * Returns the unique identifier of the bundle exporting this package.
+ *
+ * @return The String representation of the id.
+ */
+ public String getSupplierId();
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/model/IServiceReference.java b/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/model/IServiceReference.java
new file mode 100644
index 0000000..86522c1
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.core/src/org/eclipse/libra/framework/editor/core/model/IServiceReference.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.core.model;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * This interface represents an OSGi service that is either registered or in use
+ * by an OSGi bundle represented by an {@code IBundle} object.
+ *
+ * @see IBundle
+ *
+ * @author Kaloyan Raev
+ */
+public interface IServiceReference {
+
+ /**
+ * The type of the reference between the bundle and the service.
+ */
+ public enum Type {
+
+ /**
+ * Means that the service is in use by the bundle.
+ */
+ IN_USE,
+
+ /**
+ * Means that the service is registered by the bundle.
+ */
+ REGISTERED
+ }
+
+ /**
+ * Returns the type of the reference between this service and the
+ * corresponding bundle.
+ *
+ * @return An element of {@link Type#IN_USE} or {@link Type#REGISTERED}.
+ * This method never returns {@code null}.
+ *
+ * @see Type
+ */
+ public Type getType();
+
+ /**
+ * Returns the unique identifier of the bundle that registered this service.
+ *
+ * @return A {@code Long} object representing the bundle id. This method
+ * never returns {@code null}.
+ */
+ public Long getBundleId();
+
+ /**
+ * Returns the class names under which this service can be located.
+ *
+ * @return An array of String objects representing the different class
+ * names. This method never returns {@code null}.
+ */
+ public String[] getClazzes();
+
+ /**
+ * Returns the unique identifiers of the bundles that are using this
+ * service.
+ *
+ * @return A {@code Set} object containing the bundle ids represented as
+ * {@code Long} objects. This method never returns {@code null}.
+ */
+ public Set<Long> getUsingBundleIds();
+
+ /**
+ * Returns the properties that this service is registered with.
+ *
+ * @return A {@code Map} object containing the keys and values of all
+ * properties. This method never returns {@code null}.
+ */
+ public Map<String, String> getProperties();
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/.classpath b/plugins/org.eclipse.libra.framework.editor.integration/.classpath
new file mode 100644
index 0000000..64c5e31
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/.project b/plugins/org.eclipse.libra.framework.editor.integration/.project
new file mode 100644
index 0000000..a9512a0
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.libra.framework.editor.integration</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.libra.framework.editor.integration/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..6237a6a
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Wed Oct 05 20:14:59 EEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+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
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/META-INF/MANIFEST.MF b/plugins/org.eclipse.libra.framework.editor.integration/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..3550ce5
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.libra.framework.editor.integration;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.debug.core
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: org.eclipse.libra.framework.editor.core;version="0.1.0",
+ org.eclipse.libra.framework.editor.core.model;version="0.1.0",
+ org.osgi.jmx.framework;version="[1.0.0,2.0.0)"
+Bundle-Activator: org.eclipse.libra.framework.editor.integration.internal.IntegrationPlugin
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.libra.framework.editor.integration.admin.osgijmx;version="0.1.0";uses:="org.eclipse.libra.framework.editor.core",
+ org.eclipse.libra.framework.editor.integration.console.basic;version="0.1.0";uses:="org.eclipse.libra.framework.editor.core"
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/build.properties b/plugins/org.eclipse.libra.framework.editor.integration/build.properties
new file mode 100644
index 0000000..aa1a008
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/plugin.properties b/plugins/org.eclipse.libra.framework.editor.integration/plugin.properties
new file mode 100644
index 0000000..73765e4
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/plugin.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# Copyright (c) 2011 SAP AG.
+# 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:
+# Kaloyan Raev (SAP AG) - initial API and implementation
+###############################################################################
+Bundle-Name = OSGi Framework Editor Integration (Incubation)
+Bundle-Vendor = Eclipse Web Tools Platform
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/pom.xml b/plugins/org.eclipse.libra.framework.editor.integration/pom.xml
new file mode 100644
index 0000000..38bc537
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/pom.xml
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.libra_parent</artifactId>
+ <groupId>org.eclipse.libra</groupId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../development/org.eclipse.libra.releng/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.libra.framework.editor.integration</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSGi Framework Editor Integration Plug-in</name>
+ <version>0.1.0-SNAPSHOT</version>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/admin/osgijmx/AbstractOSGiJMXFrameworkAdmin.java b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/admin/osgijmx/AbstractOSGiJMXFrameworkAdmin.java
new file mode 100644
index 0000000..d56d038
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/admin/osgijmx/AbstractOSGiJMXFrameworkAdmin.java
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.integration.admin.osgijmx;
+
+import java.io.IOException;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.JMX;
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.TabularData;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.libra.framework.editor.core.IOSGiFrameworkAdmin;
+import org.eclipse.libra.framework.editor.core.model.IBundle;
+import org.eclipse.libra.framework.editor.integration.internal.IntegrationPlugin;
+import org.eclipse.libra.framework.editor.integration.internal.admin.osgijmx.Bundle;
+import org.eclipse.libra.framework.editor.integration.internal.admin.osgijmx.PackageExport;
+import org.eclipse.libra.framework.editor.integration.internal.admin.osgijmx.PackageImport;
+import org.eclipse.libra.framework.editor.integration.internal.admin.osgijmx.PackagesData;
+import org.eclipse.libra.framework.editor.integration.internal.admin.osgijmx.ServiceReference;
+import org.eclipse.libra.framework.editor.integration.internal.admin.osgijmx.ServicesData;
+import org.osgi.framework.Constants;
+import org.osgi.jmx.framework.BundleStateMBean;
+import org.osgi.jmx.framework.FrameworkMBean;
+import org.osgi.jmx.framework.PackageStateMBean;
+import org.osgi.jmx.framework.ServiceStateMBean;
+
+/**
+ * @author Kaloyan Raev
+ */
+public abstract class AbstractOSGiJMXFrameworkAdmin implements IOSGiFrameworkAdmin {
+
+ protected abstract String getHost() throws CoreException;
+
+ protected abstract String getPort() throws CoreException;
+
+ public Map<Long, IBundle> getBundles(IProgressMonitor monitor) throws CoreException {
+ Map<Long, IBundle> map = new HashMap<Long, IBundle>();
+
+ try {
+ MBeanServerConnection connection = getMBeanServerConnection();
+ BundleStateMBean bundleStateMBean = getBundleStateMBean(connection);
+ TabularData bundlesData = bundleStateMBean.listBundles();
+ PackageStateMBean packageStateMBean = getPackageStateMBean(connection);
+ PackagesData packagesData = new PackagesData(packageStateMBean);
+ ServiceStateMBean serviceStateMBean = getServiceStateMBean(connection);
+ ServicesData servicesData = new ServicesData(serviceStateMBean);
+
+ Set keys = bundlesData.keySet();
+ for (Object key : keys) {
+ CompositeData bundleInfo = bundlesData.get(((Collection) key).toArray());
+ String id = bundleInfo.get(BundleStateMBean.IDENTIFIER).toString();
+ String symbolicName = bundleInfo.get(BundleStateMBean.SYMBOLIC_NAME).toString();
+ String version = bundleInfo.get(BundleStateMBean.VERSION).toString();
+ String state = bundleInfo.get(BundleStateMBean.STATE).toString();
+ String location = bundleInfo.get(BundleStateMBean.LOCATION).toString();
+ Bundle bundle = new Bundle(id, symbolicName, version, state, location);
+
+ TabularData headers = (TabularData) bundleInfo.get(BundleStateMBean.HEADERS);
+ Set headerKeys = headers.keySet();
+ for (Object headerKey : headerKeys) {
+ CompositeData headerCData = headers.get(((Collection) headerKey).toArray());
+ String hKey = (String) headerCData.get(BundleStateMBean.KEY);
+ String hValue = (String) headerCData.get(BundleStateMBean.VALUE);
+ bundle.addHeader(hKey, hValue);
+ }
+
+ String[] exportedPackages = (String[]) bundleInfo.get(BundleStateMBean.EXPORTED_PACKAGES);
+ for (String epStr : exportedPackages) {
+ int column = epStr.indexOf(';');
+ String packageName = epStr.substring(0, column);
+ String packageVersion = epStr.substring(column + 1, epStr.length());
+ bundle.addPackageExport(new PackageExport(packageName, packageVersion));
+ }
+
+ String[] importedPackages = (String[]) bundleInfo.get(BundleStateMBean.IMPORTED_PACKAGES);
+ for (String ipStr : importedPackages) {
+ int column = ipStr.indexOf(';');
+ String packageName = ipStr.substring(0, column);
+ String packageVersion = ipStr.substring(column + 1, ipStr.length());
+ String exportingBundleId = packagesData.getExportingBundleId(packageName, packageVersion).toString();
+ bundle.addPackageImport(new PackageImport(packageName, packageVersion, exportingBundleId));
+ }
+
+ Long[] registeredServices = (Long[]) bundleInfo.get(BundleStateMBean.REGISTERED_SERVICES);
+ for (Long regService : registeredServices) {
+ ServicesData.ServiceInfo serviceInfo = servicesData.getService(regService);
+ ServiceReference sr = new ServiceReference(ServiceReference.Type.REGISTERED, serviceInfo.getBundleId(), serviceInfo.getObjectClass());
+ sr.addProperty(Constants.SERVICE_ID, serviceInfo.getServiceId().toString());
+ for (Long usingBundleId : serviceInfo.getUsingBundles()) {
+ sr.addUsingBundle(usingBundleId);
+ }
+ bundle.addRegisteredService(sr);
+ }
+
+ Long[] servicesInUse = (Long[]) bundleInfo.get(BundleStateMBean.SERVICES_IN_USE);
+ for (Long serviceInUse : servicesInUse) {
+ ServicesData.ServiceInfo serviceInfo = servicesData.getService(serviceInUse);
+ ServiceReference sr = new ServiceReference(ServiceReference.Type.IN_USE, serviceInfo.getBundleId(), serviceInfo.getObjectClass());
+ sr.addProperty(Constants.SERVICE_ID, serviceInfo.getServiceId().toString());
+ for (Long usingBundleId : serviceInfo.getUsingBundles()) {
+ sr.addUsingBundle(usingBundleId);
+ }
+ bundle.addUsingService(sr);
+ }
+
+ map.put(Long.parseLong(id), bundle);
+ }
+ } catch (UndeclaredThrowableException e) {
+ if (e.getCause() instanceof InstanceNotFoundException) {
+ throw new CoreException(IntegrationPlugin.newErrorStatus("MBean not found: " + e.getCause().getMessage(), e.getCause()));
+ }
+ throw new CoreException(IntegrationPlugin.newErrorStatus(e));
+ } catch (Exception e) {
+ throw new CoreException(IntegrationPlugin.newErrorStatus(e));
+ }
+
+ return map;
+ }
+
+ public void startBundle(long bundleId) throws CoreException {
+ try {
+ MBeanServerConnection connection = getMBeanServerConnection();
+ FrameworkMBean mbean = getFrameworkMBean(connection);
+ mbean.startBundle(bundleId);
+ } catch (Exception e) {
+ throw new CoreException(IntegrationPlugin.newErrorStatus(e));
+ }
+ }
+
+ public void stopBundle(long bundleId) throws CoreException {
+ try {
+ MBeanServerConnection connection = getMBeanServerConnection();
+ FrameworkMBean mbean = getFrameworkMBean(connection);
+ mbean.stopBundle(bundleId);
+ } catch (Exception e) {
+ throw new CoreException(IntegrationPlugin.newErrorStatus(e));
+ }
+ }
+
+ public void refreshBundle(long bundleId) throws CoreException {
+ try {
+ MBeanServerConnection connection = getMBeanServerConnection();
+ FrameworkMBean mbean = getFrameworkMBean(connection);
+ mbean.refreshBundle(bundleId);
+ } catch (Exception e) {
+ throw new CoreException(IntegrationPlugin.newErrorStatus(e));
+ }
+ }
+
+ public void updateBundle(long bundleId) throws CoreException {
+
+ try {
+ MBeanServerConnection connection = getMBeanServerConnection();
+ FrameworkMBean mbean = getFrameworkMBean(connection);
+ mbean.updateBundle(bundleId);
+ } catch (Exception e) {
+ throw new CoreException(IntegrationPlugin.newErrorStatus(e));
+ }
+ }
+
+ protected MBeanServerConnection getMBeanServerConnection() throws IOException, CoreException {
+ JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + getHost() + ":" + getPort() + "/jmxrmi"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ JMXConnector connector = JMXConnectorFactory.connect(url);
+ return connector.getMBeanServerConnection();
+ }
+
+ protected BundleStateMBean getBundleStateMBean(MBeanServerConnection connection) throws MalformedObjectNameException {
+ ObjectName objectName = new ObjectName("osgi.core:type=bundleState,version=1.5"); //$NON-NLS-1$
+ return JMX.newMBeanProxy(connection, objectName, BundleStateMBean.class);
+ }
+
+ protected PackageStateMBean getPackageStateMBean(MBeanServerConnection connection) throws MalformedObjectNameException {
+ ObjectName objectName = new ObjectName("osgi.core:type=packageState,version=1.5"); //$NON-NLS-1$
+ return JMX.newMBeanProxy(connection, objectName, PackageStateMBean.class);
+ }
+
+ protected ServiceStateMBean getServiceStateMBean(MBeanServerConnection connection) throws MalformedObjectNameException {
+ ObjectName objectName = new ObjectName("osgi.core:type=serviceState,version=1.5"); //$NON-NLS-1$
+ return JMX.newMBeanProxy(connection, objectName, ServiceStateMBean.class);
+ }
+
+ protected FrameworkMBean getFrameworkMBean(MBeanServerConnection connection) throws MalformedObjectNameException {
+ ObjectName objectName = new ObjectName("osgi.core:type=framework,version=1.5"); //$NON-NLS-1$
+ return JMX.newMBeanProxy(connection, objectName, FrameworkMBean.class);
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/admin/osgijmx/LaunchOSGiJMXFrameworkAdmin.java b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/admin/osgijmx/LaunchOSGiJMXFrameworkAdmin.java
new file mode 100644
index 0000000..606557a
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/admin/osgijmx/LaunchOSGiJMXFrameworkAdmin.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.integration.admin.osgijmx;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.libra.framework.editor.integration.internal.IntegrationPlugin;
+
+/**
+ * @author Kaloyan Raev
+ */
+public class LaunchOSGiJMXFrameworkAdmin extends AbstractOSGiJMXFrameworkAdmin {
+
+ private ILaunch launch;
+
+ public LaunchOSGiJMXFrameworkAdmin(ILaunch launch) {
+ this.launch = launch;
+ }
+
+ @Override
+ protected String getHost() throws CoreException {
+ return "localhost";
+ }
+
+ @Override
+ protected String getPort() throws CoreException {
+ return getJmxPort(launch);
+ }
+
+ public static String getJmxPort(ILaunch launch) throws CoreException {
+ String rawVMArgs = IntegrationPlugin.getProcess(launch).getAttribute(IProcess.ATTR_CMDLINE);
+ if (rawVMArgs == null) {
+ throw IntegrationPlugin.newCoreException(Messages.OSGiJMXFrameworkAdmin_CannotGetCmdLineArgs);
+ }
+
+ String port = null;
+ String[] vmArgs = DebugPlugin.parseArguments(rawVMArgs);
+ for (String arg : vmArgs) {
+ if (arg.startsWith("-Dcom.sun.management.jmxremote.port=")) { //$NON-NLS-1$
+ int index = arg.indexOf('=');
+ port = arg.substring(index + 1).trim();
+ }
+ }
+
+ if (port == null) {
+ throw IntegrationPlugin.newCoreException(Messages.OSGiJMXFrameworkAdmin_JmxRemoteNotConfigured);
+ }
+
+ return port;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/admin/osgijmx/Messages.java b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/admin/osgijmx/Messages.java
new file mode 100644
index 0000000..b76a25b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/admin/osgijmx/Messages.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ */
+package org.eclipse.libra.framework.editor.integration.admin.osgijmx;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Kaloyan Raev
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.libra.framework.editor.integration.admin.osgijmx.messages"; //$NON-NLS-1$
+ public static String OSGiJMXFrameworkAdmin_CannotGetCmdLineArgs;
+ public static String OSGiJMXFrameworkAdmin_JmxRemoteNotConfigured;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/admin/osgijmx/OSGiJMXFrameworkAdmin.java b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/admin/osgijmx/OSGiJMXFrameworkAdmin.java
new file mode 100644
index 0000000..9d443ce
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/admin/osgijmx/OSGiJMXFrameworkAdmin.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.integration.admin.osgijmx;
+
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * @author Kaloyan Raev
+ */
+public class OSGiJMXFrameworkAdmin extends AbstractOSGiJMXFrameworkAdmin {
+
+ private String host;
+ private String port;
+
+ public OSGiJMXFrameworkAdmin(String host, String port) {
+ this.host = host;
+ this.port = port;
+ }
+
+ @Override
+ protected String getHost() throws CoreException {
+ return host;
+ }
+
+ @Override
+ protected String getPort() throws CoreException {
+ return port;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/admin/osgijmx/messages.properties b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/admin/osgijmx/messages.properties
new file mode 100644
index 0000000..0db8e83
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/admin/osgijmx/messages.properties
@@ -0,0 +1,12 @@
+################################################################################
+# Copyright (c) 2011 SAP AG
+# 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:
+# Kaloyan Raev, SAP AG - initial content
+################################################################################
+OSGiJMXFrameworkAdmin_CannotGetCmdLineArgs=Cannot get command line arguments of the server process.
+OSGiJMXFrameworkAdmin_JmxRemoteNotConfigured=Server process is not configured for remote JMX access.
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/console/basic/AbstractBasicOSGiFrameworkConsole.java b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/console/basic/AbstractBasicOSGiFrameworkConsole.java
new file mode 100644
index 0000000..3e0ea3b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/console/basic/AbstractBasicOSGiFrameworkConsole.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.integration.console.basic;
+
+import java.io.IOException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.IStreamListener;
+import org.eclipse.debug.core.model.IStreamMonitor;
+import org.eclipse.debug.core.model.IStreamsProxy;
+import org.eclipse.libra.framework.editor.core.IOSGiFrameworkConsole;
+import org.eclipse.libra.framework.editor.integration.internal.IntegrationPlugin;
+
+/**
+ * @author Kaloyan Raev
+ */
+public abstract class AbstractBasicOSGiFrameworkConsole implements IOSGiFrameworkConsole, IStreamListener {
+
+ private StringBuilder result;
+
+ protected abstract IStreamsProxy getProxy() throws CoreException;
+
+ public synchronized String executeCommand(String command) throws CoreException {
+ result = new StringBuilder();
+
+ try {
+ IStreamsProxy proxy = getProxy();
+ proxy.getOutputStreamMonitor().addListener(this);
+ proxy.write(command + "\n"); //$NON-NLS-1$
+ } catch (IOException e) {
+ throw new CoreException(IntegrationPlugin.newErrorStatus(e));
+ }
+
+ long startTime = System.currentTimeMillis();
+ int size = 0;
+ do {
+ size = result.length();
+ try {
+ wait(10);
+ } catch (InterruptedException e) {
+ throw new CoreException(IntegrationPlugin.newErrorStatus(e));
+ }
+ } while ((result.length() == 0 && System.currentTimeMillis() - startTime < 5000)
+ || result.length() > size);
+
+ return result.toString();
+ }
+
+ public synchronized void streamAppended(String text, IStreamMonitor monitor) {
+ result.append(text);
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/console/basic/BasicOSGiFrameworkConsole.java b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/console/basic/BasicOSGiFrameworkConsole.java
new file mode 100644
index 0000000..e0896e8
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/console/basic/BasicOSGiFrameworkConsole.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.integration.console.basic;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IStreamsProxy;
+
+/**
+ * @author Kaloyan Raev
+ */
+public class BasicOSGiFrameworkConsole extends AbstractBasicOSGiFrameworkConsole {
+
+ private IStreamsProxy proxy;
+
+ protected BasicOSGiFrameworkConsole() {
+ this.proxy = null;
+ }
+
+ public BasicOSGiFrameworkConsole(IStreamsProxy proxy) {
+ this.proxy = proxy;
+ }
+
+ @Override
+ protected IStreamsProxy getProxy() throws CoreException {
+ return proxy;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/console/basic/LaunchBasicOSGiFrameworkConsole.java b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/console/basic/LaunchBasicOSGiFrameworkConsole.java
new file mode 100644
index 0000000..c22211c
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/console/basic/LaunchBasicOSGiFrameworkConsole.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.integration.console.basic;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IStreamsProxy;
+import org.eclipse.libra.framework.editor.integration.internal.IntegrationPlugin;
+
+/**
+ * @author Kaloyan Raev
+ */
+public class LaunchBasicOSGiFrameworkConsole extends BasicOSGiFrameworkConsole {
+
+ private ILaunch launch;
+
+ public LaunchBasicOSGiFrameworkConsole(ILaunch launch) {
+ super();
+ this.launch = launch;
+ }
+
+ @Override
+ protected IStreamsProxy getProxy() throws CoreException {
+ return getStreamsProxy(launch);
+ }
+
+ public static IStreamsProxy getStreamsProxy(ILaunch launch) throws CoreException {
+ IStreamsProxy proxy = IntegrationPlugin.getProcess(launch).getStreamsProxy();
+ if (proxy == null) {
+ throw IntegrationPlugin.newCoreException(Messages.BasicOSGiFrameworkConsole_CannotGetInOutStreams);
+ }
+ return proxy;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/console/basic/Messages.java b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/console/basic/Messages.java
new file mode 100644
index 0000000..cf77cb8
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/console/basic/Messages.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ */
+package org.eclipse.libra.framework.editor.integration.console.basic;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Kaloyan Raev
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.libra.framework.editor.integration.console.basic.messages"; //$NON-NLS-1$
+ public static String BasicOSGiFrameworkConsole_CannotGetInOutStreams;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/console/basic/messages.properties b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/console/basic/messages.properties
new file mode 100644
index 0000000..e16c8e9
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/console/basic/messages.properties
@@ -0,0 +1,11 @@
+################################################################################
+# Copyright (c) 2011 SAP AG
+# 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:
+# Kaloyan Raev, SAP AG - initial content
+################################################################################
+BasicOSGiFrameworkConsole_CannotGetInOutStreams=Cannot get standard input and output streams of the server process.
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/IntegrationPlugin.java b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/IntegrationPlugin.java
new file mode 100644
index 0000000..daf152a
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/IntegrationPlugin.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.integration.internal;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IProcess;
+
+/**
+ * @author Kaloyan Raev
+ */
+public class IntegrationPlugin extends Plugin {
+
+ public static final String PLUGIN_ID = "org.eclipse.libra.framework.editor.integration"; //$NON-NLS-1$
+
+ public static IStatus newErrorStatus(Throwable t) {
+ return newErrorStatus(t.getMessage(), t);
+ }
+
+ public static IStatus newErrorStatus(String message, Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, message, t);
+ }
+
+ public static CoreException newCoreException(String errorMessage) {
+ return new CoreException(new Status(IStatus.ERROR, PLUGIN_ID, errorMessage));
+ }
+
+ public static IProcess getProcess(ILaunch launch) throws CoreException {
+ IProcess[] processes = launch.getProcesses();
+ if (processes.length == 0) {
+ throw newCoreException(Messages.IntegrationPlugin_FrameworkNotStarted);
+ }
+ return processes[0];
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/Messages.java b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/Messages.java
new file mode 100644
index 0000000..0b72b16
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/Messages.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ */
+package org.eclipse.libra.framework.editor.integration.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Kaloyan Raev
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.libra.framework.editor.integration.internal.messages"; //$NON-NLS-1$
+ public static String IntegrationPlugin_FrameworkNotStarted;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/Bundle.java b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/Bundle.java
new file mode 100644
index 0000000..eda0b36
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/Bundle.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - moving to Eclipse Libra project and enhancements
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.integration.internal.admin.osgijmx;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.libra.framework.editor.core.model.IBundle;
+import org.eclipse.libra.framework.editor.core.model.IPackageExport;
+import org.eclipse.libra.framework.editor.core.model.IPackageImport;
+import org.eclipse.libra.framework.editor.core.model.IServiceReference;
+
+/**
+ * @author Christian Dupuis
+ * @author Kaloyan Raev
+ */
+public class Bundle implements IBundle {
+
+ private final Set<IPackageExport> exports = new HashSet<IPackageExport>();
+
+ private final String id;
+
+ private final Set<IPackageImport> imports = new HashSet<IPackageImport>();
+
+ private final String state;
+
+ private final String symbolicName;
+
+ private final String version;
+
+ private final String location;
+
+ private final Map<String, String> headers = new HashMap<String, String>();
+
+ private final Set<IServiceReference> registeredServices = new HashSet<IServiceReference>();
+
+ private final Set<IServiceReference> servicesInUse = new HashSet<IServiceReference>();
+
+ public Bundle(String id, String symbolicName, String version, String state, String location) {
+ this.symbolicName = symbolicName;
+ this.version = version;
+ this.id = id;
+ this.state = state;
+ this.location = location;
+ }
+
+ public Map<String, String> getHeaders() {
+ return headers;
+ }
+
+ public Set<IPackageExport> getPackageExports() {
+ return exports;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public Set<IPackageImport> getPackageImports() {
+ return imports;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public String getSymbolicName() {
+ return symbolicName;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void addPackageExport(IPackageExport pe) {
+ this.exports.add(pe);
+ }
+
+ public void addPackageImport(IPackageImport pi) {
+ this.imports.add(pi);
+ }
+
+ public void addRegisteredService(IServiceReference pi) {
+ this.registeredServices.add(pi);
+ }
+
+ public void addUsingService(IServiceReference pi) {
+ this.servicesInUse.add(pi);
+ }
+
+ public void addHeader(String key, String value) {
+ this.headers.put(key, value);
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public Set<IServiceReference> getRegisteredServices() {
+ return registeredServices;
+ }
+
+ public Set<IServiceReference> getServicesInUse() {
+ return servicesInUse;
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 17;
+ hashCode = 31 * hashCode + id.hashCode();
+ hashCode = 31 * hashCode + symbolicName.hashCode();
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof Bundle)) {
+ return false;
+ }
+ Bundle that = (Bundle) other;
+ if (this.id != that.id) {
+ return false;
+ }
+ if (this.id != null && !this.id.equals(that.id)) {
+ return false;
+ }
+ if (this.symbolicName != that.symbolicName) {
+ return false;
+ }
+ if (this.symbolicName != null && !this.symbolicName.equals(that.symbolicName)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/PackageExport.java b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/PackageExport.java
new file mode 100644
index 0000000..7b6cec9
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/PackageExport.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - moving to Eclipse Libra project and enhancements
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.integration.internal.admin.osgijmx;
+
+import org.eclipse.libra.framework.editor.core.model.IPackageExport;
+
+/**
+ * @author Christian Dupuis
+ * @author Kaloyan Raev
+ */
+public class PackageExport implements IPackageExport {
+
+ private final String name;
+
+ private final String version;
+
+ public PackageExport(String name, String version) {
+ this.name = name;
+ this.version = version;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/PackageImport.java b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/PackageImport.java
new file mode 100644
index 0000000..d1eb40b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/PackageImport.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - moving to Eclipse Libra project and enhancements
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.integration.internal.admin.osgijmx;
+
+import org.eclipse.libra.framework.editor.core.model.IPackageImport;
+
+/**
+ * @author Christian Dupuis
+ * @author Kaloyan Raev
+ */
+public class PackageImport implements IPackageImport {
+
+ private final String name;
+
+ private final String version;
+
+ private final String supplierId;
+
+ public PackageImport(String name, String version, String supplierId) {
+ this.name = name;
+ this.version = version;
+ this.supplierId = supplierId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public String getSupplierId() {
+ return supplierId;
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 17;
+ hashCode = 31 * hashCode + name.hashCode();
+ hashCode = 31 * hashCode + version.hashCode();
+ hashCode = 31 * hashCode + supplierId.hashCode();
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof PackageImport)) {
+ return false;
+ }
+ PackageImport that = (PackageImport) other;
+ if (this.name != that.name) {
+ return false;
+ }
+ if (this.name != null && !this.name.equals(that.name)) {
+ return false;
+ }
+ if (this.version != that.version) {
+ return false;
+ }
+ if (this.version != null && !this.version.equals(that.version)) {
+ return false;
+ }
+ if (this.supplierId != that.supplierId) {
+ return false;
+ }
+ if (this.supplierId != null && !this.supplierId.equals(that.supplierId)) {
+ return false;
+ }
+ return true;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/PackagesData.java b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/PackagesData.java
new file mode 100644
index 0000000..31a879f
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/PackagesData.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.integration.internal.admin.osgijmx;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.openmbean.TabularData;
+
+import org.osgi.jmx.framework.PackageStateMBean;
+
+/**
+ * @author Kaloyan Raev
+ */
+public class PackagesData {
+
+ private Map<PackageKey, Long> map = new HashMap<PackagesData.PackageKey, Long>();
+
+ public PackagesData(PackageStateMBean mbean) throws IOException {
+ TabularData data = mbean.listPackages();
+
+ Set<List> keys = (Set<List>) data.keySet();
+ for (List key : keys) {
+ String name = (String) key.get(0);
+ String version = (String) key.get(1);
+ Long exportingBundleId = ((Long[]) key.get(2))[0];
+ map.put(new PackageKey(name, version), exportingBundleId);
+ }
+ }
+
+ public Long getExportingBundleId(String packageName, String packageVersion) {
+ return map.get(new PackageKey(packageName, packageVersion));
+ }
+
+ class PackageKey {
+
+ private String name;
+ private String version;
+
+ PackageKey(String name, String version) {
+ this.name = name;
+ this.version = version;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + getOuterType().hashCode();
+ result = prime * result + ((name == null) ? 0 : name.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;
+ PackageKey other = (PackageKey) obj;
+ if (!getOuterType().equals(other.getOuterType()))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (version == null) {
+ if (other.version != null)
+ return false;
+ } else if (!version.equals(other.version))
+ return false;
+ return true;
+ }
+
+ private PackagesData getOuterType() {
+ return PackagesData.this;
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/ServiceReference.java b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/ServiceReference.java
new file mode 100644
index 0000000..cebb7f2
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/ServiceReference.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - moving to Eclipse Libra project and enhancements
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.integration.internal.admin.osgijmx;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.libra.framework.editor.core.model.IServiceReference;
+
+/**
+ * @author Christian Dupuis
+ * @author Kaloyan Raev
+ */
+public class ServiceReference implements IServiceReference {
+
+ private final Long bundleId;
+
+ private final String[] clazzes;
+
+ private final Map<String, String> properties = new HashMap<String, String>();
+
+ private final Set<Long> usingBundles = new HashSet<Long>();
+
+ private final Type type;
+
+ public ServiceReference(Type type, Long bundleId, String[] clazzes) {
+ this.bundleId = bundleId;
+ this.clazzes = clazzes;
+ this.type = type;
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ public String[] getClazzes() {
+ return clazzes;
+ }
+
+ public Set<Long> getUsingBundleIds() {
+ return usingBundles;
+ }
+
+ public void addProperty(String key, String value) {
+ this.properties.put(key, value);
+ }
+
+ public void addUsingBundle(Long id) {
+ this.usingBundles.add(id);
+ }
+
+ public Long getBundleId() {
+ return bundleId;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 17;
+ hashCode = 31 * hashCode + clazzes.hashCode();
+ hashCode = 31 * hashCode + type.hashCode();
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof ServiceReference)) {
+ return false;
+ }
+ ServiceReference that = (ServiceReference) other;
+ if (!Arrays.equals(this.clazzes, that.clazzes)) {
+ return false;
+ }
+ if (this.type != that.type) {
+ return false;
+ }
+ if (this.type != null && !this.type.equals(that.type)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/ServicesData.java b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/ServicesData.java
new file mode 100644
index 0000000..071e7fe
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/admin/osgijmx/ServicesData.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.integration.internal.admin.osgijmx;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.TabularData;
+
+import org.osgi.jmx.framework.ServiceStateMBean;
+
+/**
+ * @author Kaloyan Raev
+ */
+public class ServicesData {
+
+ private Map<Long, ServiceInfo> map = new HashMap<Long, ServicesData.ServiceInfo>();
+
+ public ServicesData(ServiceStateMBean serviceStateMBean) throws IOException {
+ TabularData data = serviceStateMBean.listServices();
+
+ Set<List> keys = (Set<List>) data.keySet();
+ for (List key : keys) {
+ CompositeData serviceInfo = data.get(((Collection) key).toArray());
+ Long serviceId = (Long) serviceInfo.get(ServiceStateMBean.IDENTIFIER);
+ Long bundleId = (Long) serviceInfo.get(ServiceStateMBean.BUNDLE_IDENTIFIER);
+ String[] objectClass = (String[]) serviceInfo.get(ServiceStateMBean.OBJECT_CLASS);
+ Long[] usingBundles = (Long[]) serviceInfo.get(ServiceStateMBean.USING_BUNDLES);
+ map.put(serviceId, new ServiceInfo(serviceId, bundleId, objectClass, usingBundles));
+ }
+ }
+
+ public ServiceInfo getService(Long serviceId) {
+ return map.get(serviceId);
+ }
+
+ public class ServiceInfo {
+
+ private Long serviceId;
+ private Long bundleId;
+ private String[] objectClass;
+ private Long[] usingBundles;
+
+ ServiceInfo(Long serviceId, Long bundleId, String[] objectClass, Long[] usingBundles) {
+ this.serviceId = serviceId;
+ this.bundleId = bundleId;
+ this.objectClass = objectClass;
+ this.usingBundles = usingBundles;
+ }
+
+ public Long getServiceId() {
+ return serviceId;
+ }
+
+ public Long getBundleId() {
+ return bundleId;
+ }
+
+ public String[] getObjectClass() {
+ return objectClass;
+ }
+
+ public Long[] getUsingBundles() {
+ return usingBundles;
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/messages.properties b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/messages.properties
new file mode 100644
index 0000000..1db8267
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.integration/src/org/eclipse/libra/framework/editor/integration/internal/messages.properties
@@ -0,0 +1,11 @@
+################################################################################
+# Copyright (c) 2011 SAP AG
+# 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:
+# Kaloyan Raev, SAP AG - initial content
+################################################################################
+IntegrationPlugin_FrameworkNotStarted=OSGi Framework not started.
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/.classpath b/plugins/org.eclipse.libra.framework.editor.ui/.classpath
new file mode 100644
index 0000000..64c5e31
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/.project b/plugins/org.eclipse.libra.framework.editor.ui/.project
new file mode 100644
index 0000000..2dd96cc
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.libra.framework.editor.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.libra.framework.editor.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..5ef1156
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Wed Oct 05 20:16:27 EEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+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
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.libra.framework.editor.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..72c88c6
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,44 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.libra.framework.editor.ui
+Bundle-Version: 0.1.0.qualifier
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.libra.framework.editor.ui.console;version="0.1.0";
+ uses:="org.eclipse.libra.framework.editor.ui.internal.overview,
+ org.eclipse.libra.framework.editor.ui.internal,
+ org.eclipse.swt.widgets,
+ org.eclipse.ui.forms,
+ org.eclipse.ui.forms.widgets",
+ org.eclipse.libra.framework.editor.ui.dependencies;version="0.1.0";
+ uses:="org.eclipse.jface.action,
+ org.eclipse.core.runtime,
+ org.eclipse.core.runtime.jobs,
+ org.eclipse.libra.framework.editor.ui.internal,
+ org.eclipse.libra.framework.editor.core.model,
+ org.eclipse.ui,
+ org.eclipse.swt.widgets,
+ org.eclipse.zest.core.viewers",
+ org.eclipse.libra.framework.editor.ui.overview;version="0.1.0";
+ uses:="org.eclipse.libra.framework.editor.ui.internal,
+ org.eclipse.libra.framework.editor.core.model,
+ org.eclipse.ui,
+ org.eclipse.swt.widgets"
+Require-Bundle: org.eclipse.core.filesystem;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.debug.core;bundle-version="[1.0.0,4.0.0)",
+ org.eclipse.pde.ui;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui.browser;bundle-version="[3.1.0,4.0.0)",
+ org.eclipse.ui.forms;bundle-version="[3.3.0,4.0.0)",
+ org.eclipse.ui.ide;bundle-version="[3.3.0,4.0.0)",
+ org.eclipse.wst.server.core;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.wst.server.ui;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.zest.core;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.zest.layouts;bundle-version="[1.0.0,2.0.0)"
+Import-Package: org.eclipse.libra.framework.editor.core;version="0.1.0",
+ org.eclipse.libra.framework.editor.core.model;version="0.1.0"
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.libra.framework.editor.ui.internal.EditorUIPlugin
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/build.properties b/plugins/org.eclipse.libra.framework.editor.ui/build.properties
new file mode 100644
index 0000000..aa1a008
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/plugin.properties b/plugins/org.eclipse.libra.framework.editor.ui/plugin.properties
new file mode 100644
index 0000000..7610509
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/plugin.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# Copyright (c) 2011 SAP AG.
+# 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:
+# Kaloyan Raev (SAP AG) - initial API and implementation
+###############################################################################
+Bundle-Name = OSGi Framework Editor UI (Incubation)
+Bundle-Vendor = Eclipse Web Tools Platform
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/pom.xml b/plugins/org.eclipse.libra.framework.editor.ui/pom.xml
new file mode 100644
index 0000000..92afb80
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/pom.xml
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.libra_parent</artifactId>
+ <groupId>org.eclipse.libra</groupId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../development/org.eclipse.libra.releng/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.libra.framework.editor.ui</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSGi Framework Editor UI Plug-in</name>
+ <version>0.1.0-SNAPSHOT</version>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/console/ServerConsoleEditorPage.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/console/ServerConsoleEditorPage.java
new file mode 100644
index 0000000..7bc9c9c
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/console/ServerConsoleEditorPage.java
@@ -0,0 +1,237 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - moving to Eclipse Libra project and enhancements
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.console;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.libra.framework.editor.core.IOSGiFrameworkConsole;
+import org.eclipse.libra.framework.editor.ui.internal.AbstractBundleEditorPage;
+import org.eclipse.libra.framework.editor.ui.internal.EditorUIPlugin;
+import org.eclipse.libra.framework.editor.ui.internal.SearchTextHistory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+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.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.ManagedForm;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.internal.browser.ImageResource;
+import org.eclipse.wst.server.ui.ServerUICore;
+
+
+/**
+ * @author Christian Dupuis
+ * @author Kaloyan Raev
+ */
+@SuppressWarnings("restriction")
+public class ServerConsoleEditorPage extends AbstractBundleEditorPage {
+
+ private Text commandText;
+
+ private StyledText manifestText;
+
+ private IToolBarManager toolBarManager;
+
+ private Action backAction;
+
+ private Action forwardAction;
+
+ private Action refreshAction;
+
+ private final SearchTextHistory history = new SearchTextHistory();
+
+ @Override
+ protected void createBundleContent(Composite parent) {
+
+ mform = new ManagedForm(parent);
+ setManagedForm(mform);
+ sform = mform.getForm();
+ FormToolkit toolkit = mform.getToolkit();
+ sform.setText("Server Console");
+ sform.setImage(ServerUICore.getLabelProvider().getImage(getServer()));
+ sform.setExpandHorizontal(true);
+ sform.setExpandVertical(true);
+ toolkit.decorateFormHeading(sform.getForm());
+
+ Composite body = sform.getBody();
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginLeft = 6;
+ layout.marginTop = 6;
+ layout.marginRight = 6;
+ body.setLayout(layout);
+
+ Section manifestSection = toolkit.createSection(sform.getBody(), ExpandableComposite.TITLE_BAR
+ | Section.DESCRIPTION);
+ manifestSection.setText("Commands");
+ manifestSection.setDescription("Execute commands on server.");
+ layout = new GridLayout();
+ manifestSection.setLayout(layout);
+ manifestSection.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Composite manifestComposite = toolkit.createComposite(manifestSection);
+ layout = new GridLayout();
+ layout.marginLeft = 6;
+ layout.marginTop = 6;
+ layout.numColumns = 3;
+ manifestComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ manifestComposite.setLayout(layout);
+ manifestSection.setClient(manifestComposite);
+
+ Label commandLabel = toolkit.createLabel(manifestComposite, "Command:");
+ commandLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(commandLabel);
+ commandText = toolkit.createText(manifestComposite, "", SWT.CANCEL | SWT.SEARCH);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(commandText);
+
+ commandText.addKeyListener(new KeyListener() {
+
+ public void keyPressed(KeyEvent e) {
+ if (e.character == SWT.CR || e.character == SWT.LF) {
+ history.add(commandText.getText());
+ String cmdLine = commandText.getText();
+ executeCommand(cmdLine);
+ }
+ else if (e.keyCode == SWT.ARROW_UP) {
+ String command = history.back();
+ commandText.setText(command);
+ commandText.setSelection(command.length());
+ e.doit = false;
+ }
+ else if (e.keyCode == SWT.ARROW_DOWN) {
+ String command = history.forward();
+ commandText.setText(command);
+ commandText.setSelection(command.length());
+ e.doit = false;
+ }
+ }
+
+ public void keyReleased(KeyEvent e) {
+ }
+ });
+
+ Button commandButton = toolkit.createButton(manifestComposite, "Execute", SWT.PUSH);
+ commandButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ history.add(commandText.getText());
+ String cmdLine = commandText.getText();
+ executeCommand(cmdLine);
+ }
+ });
+ Button clearButton = toolkit.createButton(manifestComposite, "Clear", SWT.PUSH);
+ clearButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ manifestText.setText("");
+ }
+ });
+
+ manifestText = new StyledText(manifestComposite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ manifestText.setWordWrap(false);
+ manifestText.setFont(JFaceResources.getTextFont());
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 3;
+ manifestText.setLayoutData(data);
+
+ Label helpLabel = toolkit.createLabel(manifestComposite, "Type 'help' to get a list of supported commands.");
+ GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(helpLabel);
+
+ toolBarManager = sform.getToolBarManager();
+
+ backAction = new Action("Back") {
+ @Override
+ public void run() {
+ commandText.setText(history.back());
+ String cmdLine = commandText.getText();
+ executeCommand(cmdLine);
+ }
+ };
+ backAction.setImageDescriptor(ImageResource
+ .getImageDescriptor(org.eclipse.ui.internal.browser.ImageResource.IMG_ELCL_NAV_BACKWARD));
+ backAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_NAV_BACKWARD));
+ backAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_NAV_BACKWARD));
+ backAction.setEnabled(false);
+ toolBarManager.add(backAction);
+
+ forwardAction = new Action("Forward") {
+ @Override
+ public void run() {
+ commandText.setText(history.forward());
+ String cmdLine = commandText.getText();
+ executeCommand(cmdLine);
+ }
+ };
+ forwardAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_NAV_FORWARD));
+ forwardAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_NAV_FORWARD));
+ forwardAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_NAV_FORWARD));
+ forwardAction.setEnabled(false);
+ toolBarManager.add(forwardAction);
+
+ refreshAction = new Action("Refresh from server", ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_NAV_REFRESH)) {
+
+ @Override
+ public void run() {
+ String cmdLine = history.current();
+ if (cmdLine != null) {
+ executeCommand(cmdLine);
+ }
+ }
+
+ };
+ toolBarManager.add(refreshAction);
+ sform.updateToolBar();
+ }
+
+ private void executeCommand(String cmdLine) {
+ clearStatus();
+
+ IOSGiFrameworkConsole console = (IOSGiFrameworkConsole) getServer().getOriginal()
+ .loadAdapter(IOSGiFrameworkConsole.class, null);
+
+ if (console == null) {
+ IStatus status = EditorUIPlugin.newErrorStatus("Console editor part is not integrated with the runtime.");
+ EditorUIPlugin.log(status);
+ setStatus(status);
+ }
+
+ try {
+ String result = console.executeCommand(cmdLine);
+ manifestText.append("osgi> " + cmdLine + "\n");
+ manifestText.append(result + "\n");
+ forwardAction.setEnabled(history.canForward());
+ backAction.setEnabled(history.canBack());
+ toolBarManager.update(true);
+ manifestText.setTopIndex(manifestText.getLineCount() - 1);
+ } catch (CoreException e) {
+ EditorUIPlugin.log(e);
+ setStatus(EditorUIPlugin.newErrorStatus("Failed to execute command. See Error Log for details."));
+ }
+
+ commandText.setText("");
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/dependencies/BundleDependencyEditorPage.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/dependencies/BundleDependencyEditorPage.java
new file mode 100644
index 0000000..acb669e
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/dependencies/BundleDependencyEditorPage.java
@@ -0,0 +1,499 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - moving to Eclipse Libra project and enhancements
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.dependencies;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.libra.framework.editor.core.IOSGiFrameworkAdmin;
+import org.eclipse.libra.framework.editor.core.model.IBundle;
+import org.eclipse.libra.framework.editor.ui.internal.AbstractBundleEditorPage;
+import org.eclipse.libra.framework.editor.ui.internal.EditorUIPlugin;
+import org.eclipse.libra.framework.editor.ui.internal.SearchControl;
+import org.eclipse.libra.framework.editor.ui.internal.SearchTextHistory;
+import org.eclipse.libra.framework.editor.ui.internal.dependencies.BundleDependencyContentProvider;
+import org.eclipse.libra.framework.editor.ui.internal.dependencies.BundleDependencyLabelProvider;
+import org.eclipse.libra.framework.editor.ui.internal.dependencies.FocusedBundleDependencyLayoutAlgorithm;
+import org.eclipse.libra.framework.editor.ui.overview.BundleInformationEditorPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+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.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.ManagedForm;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.internal.browser.ImageResource;
+import org.eclipse.wst.server.ui.ServerUICore;
+import org.eclipse.wst.server.ui.internal.editor.ServerEditorPartInput;
+import org.eclipse.wst.server.ui.internal.editor.ServerResourceCommandManager;
+import org.eclipse.zest.core.viewers.AbstractZoomableViewer;
+import org.eclipse.zest.core.viewers.GraphViewer;
+import org.eclipse.zest.core.viewers.IZoomableWorkbenchPart;
+import org.eclipse.zest.core.viewers.ZoomContributionViewItem;
+import org.eclipse.zest.core.widgets.ZestStyles;
+import org.eclipse.zest.layouts.LayoutAlgorithm;
+import org.eclipse.zest.layouts.LayoutStyles;
+import org.eclipse.zest.layouts.algorithms.CompositeLayoutAlgorithm;
+import org.eclipse.zest.layouts.algorithms.HorizontalShift;
+import org.eclipse.zest.layouts.algorithms.RadialLayoutAlgorithm;
+
+
+/**
+ * @author Christian Dupuis
+ * @author Kaloyan Raev
+ */
+@SuppressWarnings("restriction")
+public class BundleDependencyEditorPage extends AbstractBundleEditorPage implements IZoomableWorkbenchPart {
+
+ private GraphViewer viewer;
+
+ private BundleDependencyContentProvider contentProvider;
+
+ private BundleDependencyLabelProvider labelProvider;
+
+ private ZoomContributionViewItem zoomContributionItem;
+
+ private SearchControl searchControl;
+
+ private Action refreshAction;
+
+ private IToolBarManager toolBarManager;
+
+ private final SearchTextHistory history = new SearchTextHistory();
+
+ private Action forwardAction;
+
+ private Action backAction;
+
+ private ServerResourceCommandManager commandManager;
+
+ protected void createBundleContent(Composite parent) {
+ mform = new ManagedForm(parent);
+ setManagedForm(mform);
+ sform = mform.getForm();
+ FormToolkit toolkit = mform.getToolkit();
+ sform.setText("Bundle Dependency Graph");
+ sform.setImage(ServerUICore.getLabelProvider().getImage(getServer()));
+ sform.setExpandHorizontal(true);
+ sform.setExpandVertical(true);
+ toolkit.decorateFormHeading(sform.getForm());
+
+ Composite body = sform.getBody();
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ body.setLayout(layout);
+
+ Composite configComposite = toolkit.createComposite(body);
+ layout.marginLeft = 6;
+ layout.marginTop = 6;
+ layout.numColumns = 2;
+ configComposite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
+ configComposite.setLayout(layout);
+
+ Section expandableComposite = toolkit.createSection(configComposite, ExpandableComposite.TITLE_BAR
+ | ExpandableComposite.FOCUS_TITLE);
+ layout = new GridLayout();
+ expandableComposite.setLayout(layout);
+ expandableComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
+ expandableComposite.setFont(body.getFont());
+ expandableComposite.setBackground(body.getBackground());
+ expandableComposite.setText("Configuration");
+
+ Composite composite = toolkit.createComposite(expandableComposite, SWT.NONE);
+ layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginHeight = 0;
+ layout.marginRight = 0;
+ composite.setLayout(layout);
+ expandableComposite.setClient(composite);
+
+ final Button servicesButton = toolkit.createButton(composite, "Services", SWT.RADIO);
+ servicesButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ contentProvider.setShowServices(servicesButton.getSelection());
+ new BundleDependencyUpdateJob(false).schedule(200);
+ }
+ });
+
+ final Button packagesButton = toolkit.createButton(composite, "Packages", SWT.RADIO);
+ packagesButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ contentProvider.setShowPackage(packagesButton.getSelection());
+ new BundleDependencyUpdateJob(false).schedule(200);
+ }
+ });
+ packagesButton.setSelection(true);
+
+ new Label(composite, SWT.NONE);
+ Label dependenciesLabel = toolkit.createLabel(composite, "Dependencies");
+ dependenciesLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+
+ toolkit.createLabel(composite, "Incoming");
+
+ final Spinner incomingSpinner = new Spinner(composite, SWT.NONE);
+ incomingSpinner.setMinimum(0);
+ incomingSpinner.setIncrement(1);
+ incomingSpinner.setMaximum(20);
+ incomingSpinner.setSelection(1);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END);
+// data.widthHint = 20;
+ incomingSpinner.setLayoutData(data);
+ incomingSpinner.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ contentProvider.setIncomingDependencyDegree(incomingSpinner.getSelection());
+ new BundleDependencyUpdateJob(false).schedule(200);
+ }
+ });
+
+ toolkit.createLabel(composite, "Outgoing");
+
+ final Spinner outgoingSpinner = new Spinner(composite, SWT.NONE);
+ outgoingSpinner.setMinimum(0);
+ outgoingSpinner.setIncrement(1);
+ outgoingSpinner.setMaximum(20);
+ outgoingSpinner.setSelection(1);
+ data = new GridData(GridData.HORIZONTAL_ALIGN_END);
+// data.widthHint = 20;
+ outgoingSpinner.setLayoutData(data);
+ outgoingSpinner.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ contentProvider.setOutgoingDependencyDegree(outgoingSpinner.getSelection());
+ new BundleDependencyUpdateJob(false).schedule(200);
+ }
+ });
+
+ Label separator = new Label(configComposite, SWT.NONE);
+ // separator.setBackground(toolkit.getColors().getColor(IFormColors.TB_BG));
+ separator.setForeground(toolkit.getColors().getColor(IFormColors.H_BOTTOM_KEYLINE1));
+ data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.FILL_VERTICAL);
+ data.widthHint = 1;
+ separator.setLayoutData(data);
+
+ toolkit.paintBordersFor(expandableComposite);
+
+ layout = new GridLayout(2, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ body.setLayout(layout);
+
+ viewer = new GraphViewer(body, SWT.NONE);
+ viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ viewer.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED);
+
+ CompositeLayoutAlgorithm layoutAlgorithm = new CompositeLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING
+ | LayoutStyles.ENFORCE_BOUNDS, //
+ new LayoutAlgorithm[] { //
+ new RadialLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING | LayoutStyles.ENFORCE_BOUNDS), //
+ new HorizontalShift(LayoutStyles.NO_LAYOUT_NODE_RESIZING | LayoutStyles.ENFORCE_BOUNDS) });
+ searchControl = new SearchControl("Find", getManagedForm());
+ contentProvider = new BundleDependencyContentProvider(viewer, searchControl);
+
+ FocusedBundleDependencyLayoutAlgorithm la = new FocusedBundleDependencyLayoutAlgorithm(
+ LayoutStyles.NO_LAYOUT_NODE_RESIZING | LayoutStyles.ENFORCE_BOUNDS, layoutAlgorithm, contentProvider);
+ viewer.setLayoutAlgorithm(la);
+
+ viewer.setContentProvider(contentProvider);
+ viewer.addSelectionChangedListener(contentProvider);
+ viewer.setFilters(new ViewerFilter[] {});
+ labelProvider = new BundleDependencyLabelProvider(contentProvider, toolkit);
+ viewer.setLabelProvider(labelProvider);
+ viewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ public void doubleClick(DoubleClickEvent event) {
+ Object selection = ((IStructuredSelection) event.getSelection()).getFirstElement();
+ if (selection instanceof IBundle) {
+ IBundle bundle = (IBundle) selection;
+ setSelection(bundle);
+ }
+ }
+
+ });
+
+ toolBarManager = sform.getToolBarManager();
+ toolBarManager.add(searchControl);
+
+ backAction = new Action("Back") {
+ @Override
+ public void run() {
+ searchControl.getSearchText().setText(history.back());
+ setEnabled(history.canBack());
+ forwardAction.setEnabled(history.canForward());
+ toolBarManager.update(true);
+ new BundleDependencyUpdateJob(true).schedule();
+ }
+ };
+ backAction.setImageDescriptor(ImageResource
+ .getImageDescriptor(org.eclipse.ui.internal.browser.ImageResource.IMG_ELCL_NAV_BACKWARD));
+ backAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_NAV_BACKWARD));
+ backAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_NAV_BACKWARD));
+ backAction.setEnabled(false);
+ toolBarManager.add(backAction);
+
+ forwardAction = new Action("Forward") {
+ @Override
+ public void run() {
+ searchControl.getSearchText().setText(history.forward());
+ setEnabled(history.canForward());
+ backAction.setEnabled(history.canBack());
+ toolBarManager.update(true);
+ new BundleDependencyUpdateJob(true).schedule();
+ }
+ };
+ forwardAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_NAV_FORWARD));
+ forwardAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_NAV_FORWARD));
+ forwardAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_NAV_FORWARD));
+ forwardAction.setEnabled(false);
+ toolBarManager.add(forwardAction);
+
+ refreshAction = new Action("Refresh from server", ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_NAV_REFRESH)) {
+
+ @Override
+ public void run() {
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+
+ public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ monitor.beginTask("Updating bundle status from server", 1);
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ clearStatus();
+
+ IOSGiFrameworkAdmin admin = (IOSGiFrameworkAdmin) getServer().getOriginal()
+ .loadAdapter(IOSGiFrameworkAdmin.class, monitor);
+
+ if (admin == null) {
+ IStatus status = EditorUIPlugin.newErrorStatus("Bundle Dependency Graph editor part is not integrated with the runtime.");
+ EditorUIPlugin.log(status);
+ setStatus(status);
+ }
+
+ try {
+ Map<Long, IBundle> allBundles = admin.getBundles(monitor);
+ refresh(allBundles);
+ } catch (CoreException e) {
+ EditorUIPlugin.log(e);
+ setStatus(e.getStatus());
+ }
+ }
+ });
+ monitor.worked(1);
+ }
+ };
+
+ try {
+ IRunnableContext context = new ProgressMonitorDialog(Display.getCurrent().getActiveShell());
+ context.run(true, true, runnable);
+ }
+ catch (InvocationTargetException e1) {
+ }
+ catch (InterruptedException e2) {
+ }
+ }
+
+ };
+ toolBarManager.add(refreshAction);
+
+ sform.updateToolBar();
+ initPopupMenu();
+
+ searchControl.getSearchText().addKeyListener(new KeyListener() {
+
+ public void keyPressed(KeyEvent e) {
+ if (e.character == SWT.CR || e.character == SWT.LF) {
+ if (!"type filter text".equals(searchControl.getSearchText().getText())) {
+ history.add(searchControl.getSearchText().getText());
+ forwardAction.setEnabled(history.canForward());
+ backAction.setEnabled(history.canBack());
+ toolBarManager.update(true);
+ new BundleDependencyUpdateJob(true).schedule();
+ }
+ }
+ }
+
+ public void keyReleased(KeyEvent e) {
+ }
+ });
+
+ searchControl.getSearchText().addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ if ("".equals(searchControl.getSearchText().getText())) {
+ new BundleDependencyUpdateJob(true).schedule();
+ }
+ }
+ });
+
+ }
+
+ private void setSelection(IBundle bundle) {
+ setSelection(bundle.getSymbolicName(), bundle.getVersion());
+ }
+
+ private void setSelection(String bundle, String version) {
+ String filterText = bundle + " (" + version + ")";
+ searchControl.getSearchText().setText(filterText);
+ history.add(filterText);
+ forwardAction.setEnabled(history.canForward());
+ backAction.setEnabled(history.canBack());
+ toolBarManager.update(true);
+ new BundleDependencyUpdateJob(true).schedule();
+ }
+
+ public AbstractZoomableViewer getZoomableViewer() {
+ return viewer;
+ }
+
+ private void initPopupMenu() {
+ zoomContributionItem = new ZoomContributionViewItem(this);
+
+ MenuManager menuMgr = new MenuManager("#PopupMenu");
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ fillContextMenu(manager);
+ }
+ });
+
+ Menu menu = menuMgr.createContextMenu(viewer.getControl());
+ viewer.getControl().setMenu(menu);
+ getSite().registerContextMenu(menuMgr, viewer);
+ }
+
+ void fillContextMenu(IMenuManager manager) {
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+
+ if (!viewer.getSelection().isEmpty()) {
+ manager.add(new Action("Show Bundle Overview") {
+ @Override
+ public void run() {
+ Object obj = ((IStructuredSelection) viewer.getSelection()).getFirstElement();
+ if (obj instanceof IBundle) {
+ openDependencyPage((IBundle) obj);
+ }
+ }
+ });
+ manager.add(new Separator());
+ }
+ manager.add(zoomContributionItem);
+ }
+
+ public void init(IEditorSite site, IEditorInput input) {
+ super.init(site, input);
+ commandManager = ((ServerEditorPartInput) input).getServerCommandManager();
+ }
+
+ public void showDependenciesForBundle(String bundle, String version) {
+ setSelection(bundle, version);
+ }
+
+ public void openDependencyPage(IBundle bundle) {
+ BundleInformationEditorPage infoPage = openInformationPage();
+ if (infoPage != null) {
+ commandManager.getServerEditor().setActiveEditor(infoPage);
+ infoPage.showOverviewForBundle(bundle);
+ }
+ }
+
+ public void refresh(Map<Long, IBundle> bundles) {
+ if (bundles != null && !bundles.equals(viewer.getInput())) {
+ contentProvider.setBundles(bundles);
+ viewer.setInput(bundles.values());
+
+ BundleInformationEditorPage infoPage = openInformationPage();
+ if (infoPage != null) {
+ infoPage.refresh(bundles);
+ }
+ }
+ }
+
+ private BundleInformationEditorPage openInformationPage() {
+ IEditorPart[] parts = commandManager.getServerEditor().findEditors(getEditorInput());
+ for (IEditorPart part : parts) {
+ if (part instanceof BundleInformationEditorPage) {
+ return (BundleInformationEditorPage) part;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected void enablePage() {
+ super.enablePage();
+ setInfoStatus("Click the 'Refresh' button for fetching data from server.");
+ }
+
+ class BundleDependencyUpdateJob extends Job {
+
+ private final boolean deleteSelection;
+
+ public BundleDependencyUpdateJob(boolean deleteSelection) {
+ super("Updating Bundle Dependency Graph");
+ this.deleteSelection = deleteSelection;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ contentProvider.clearSelection();
+ if (deleteSelection) {
+ viewer.setSelection(new StructuredSelection());
+ }
+ viewer.refresh(true);
+ viewer.getGraphControl().applyLayout();
+ }
+ });
+ return Status.OK_STATUS;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/AbstractBundleEditorPage.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/AbstractBundleEditorPage.java
new file mode 100644
index 0000000..26f6027
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/AbstractBundleEditorPage.java
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc.
+ * 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - enhancements and bug fixes
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.internal;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.forms.ManagedForm;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerListener;
+import org.eclipse.wst.server.core.ServerEvent;
+import org.eclipse.wst.server.ui.editor.ServerEditorPart;
+import org.eclipse.wst.server.ui.internal.ImageResource;
+import org.eclipse.wst.server.ui.internal.Messages;
+import org.eclipse.wst.server.ui.internal.view.servers.StartAction;
+import org.eclipse.wst.server.ui.internal.view.servers.StopAction;
+
+/**
+ * @author Christian Dupuis
+ * @author Kaloyan Raev
+ */
+@SuppressWarnings("restriction")
+public abstract class AbstractBundleEditorPage extends ServerEditorPart {
+
+ class PageEnablementServerListener implements IServerListener {
+
+ public void serverChanged(final ServerEvent event) {
+ if ((event.getKind() & ServerEvent.SERVER_CHANGE) != 0 && (event.getKind() & ServerEvent.STATE_CHANGE) != 0) {
+ getSite().getShell().getDisplay().asyncExec(new Runnable() {
+
+ public void run() {
+ if (event.getState() == IServer.STATE_STARTED) {
+ enablePage();
+ }
+ else {
+ disablePage();
+ }
+ sform.getToolBarManager().update(true);
+ }
+ });
+ }
+ }
+ }
+
+ class StartServerAction extends Action {
+
+ private final String launchMode;
+
+ public StartServerAction(String launchMode) {
+ this.launchMode = launchMode;
+ if (launchMode == ILaunchManager.RUN_MODE) {
+ setToolTipText(Messages.actionStartToolTip);
+ setText(Messages.actionStart);
+ setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_START));
+ setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_START));
+ setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_START));
+ }
+ else if (launchMode == ILaunchManager.DEBUG_MODE) {
+ setToolTipText(Messages.actionDebugToolTip);
+ setText(Messages.actionDebug);
+ setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_START_DEBUG));
+ setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_START_DEBUG));
+ setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_START_DEBUG));
+ }
+ }
+
+ @Override
+ public void run() {
+ if (getServer().getOriginal().canStart(launchMode).isOK()) {
+ StartAction.start(getServer().getOriginal(), launchMode, getSite().getShell());
+ }
+ }
+
+ }
+
+ class StopServerAction extends Action {
+
+ public StopServerAction() {
+ setToolTipText(Messages.actionStopToolTip);
+ setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_STOP));
+ setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_STOP));
+ setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_STOP));
+ }
+
+ @Override
+ public void run() {
+ if (getServer().getOriginal().canStop().isOK()) {
+ StopAction.stop(getServer().getOriginal(), getSite().getShell());
+ }
+ }
+
+ }
+
+ private StartServerAction debugAction;
+
+ private StartServerAction runAction;
+
+ private IServerListener serverListener;
+
+ private StopServerAction stopAction;
+
+ protected ManagedForm mform;
+
+ protected ScrolledForm sform;
+
+ public final void createPartControl(Composite parent) {
+
+ createBundleContent(parent);
+
+ IToolBarManager toolBarManager = sform.getToolBarManager();
+
+ if (toolBarManager.getItems().length > 0) {
+ toolBarManager.add(new Separator());
+ }
+
+ debugAction = new StartServerAction(ILaunchManager.DEBUG_MODE);
+ toolBarManager.add(debugAction);
+ runAction = new StartServerAction(ILaunchManager.RUN_MODE);
+ toolBarManager.add(runAction);
+ stopAction = new StopServerAction();
+ toolBarManager.add(stopAction);
+ toolBarManager.update(true);
+
+ if (server.getOriginal().getServerState() != IServer.STATE_STARTED) {
+ disablePage();
+ }
+ else {
+ enablePage();
+ }
+ }
+
+ public void dispose() {
+ getServer().getOriginal().removeServerListener(serverListener);
+ super.dispose();
+ }
+
+ public void init(IEditorSite site, IEditorInput input) {
+ super.init(site, input);
+ serverListener = new PageEnablementServerListener();
+ getServer().getOriginal().addServerListener(serverListener);
+ }
+
+ public void setFocus() {
+ }
+
+ protected abstract void createBundleContent(Composite parent);
+
+ protected void disablePage() {
+ setInfoStatus("Server '" + getServer().getName() + "' is not running.");
+ setEnabled(sform.getForm().getBody(), false);
+ runAction.setEnabled(true);
+ debugAction.setEnabled(true);
+ stopAction.setEnabled(false);
+ }
+
+ protected void enablePage() {
+ clearStatus();
+ setEnabled(sform.getForm().getBody(), true);
+ runAction.setEnabled(false);
+ debugAction.setEnabled(false);
+ stopAction.setEnabled(true);
+ }
+
+ protected void setEnabled(Control control, boolean enabled) {
+ control.setEnabled(enabled);
+ if (control instanceof Composite) {
+ for (Control childControl : ((Composite) control).getChildren()) {
+ setEnabled(childControl, enabled);
+ }
+ }
+ }
+
+ /**
+ * Sets the status message of the editor.
+ *
+ * @param status status message to set.
+ */
+ public void setStatus(IStatus status) {
+ sform.getForm().setMessage(status.getMessage(), getMessageType(status));
+ }
+
+ /**
+ * Sets the status message of the editor with the provide info message.
+ *
+ * @param message info message to set.
+ */
+ public void setInfoStatus(String message) {
+ sform.getForm().setMessage(message, IMessageProvider.INFORMATION);
+ }
+
+ /**
+ * Clears the status message of the editor.
+ */
+ public void clearStatus() {
+ sform.getForm().setMessage(null);
+ }
+
+ /**
+ * Converts an IStatus message type to Form message type.
+ */
+ private int getMessageType(IStatus status) {
+ switch (status.getSeverity()) {
+ case IStatus.ERROR:
+ return IMessageProvider.ERROR;
+ case IStatus.WARNING:
+ return IMessageProvider.WARNING;
+ case IStatus.INFO:
+ return IMessageProvider.INFORMATION;
+ default:
+ return IMessageProvider.NONE;
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/EditorUIPlugin.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/EditorUIPlugin.java
new file mode 100644
index 0000000..e3e4870
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/EditorUIPlugin.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SAP AG
+ * 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:
+ * SAP AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.internal;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * @author Kaloyan Raev
+ */
+public class EditorUIPlugin extends AbstractUIPlugin {
+
+ public static final String PLUGIN_ID = "org.eclipse.libra.framework.editor";
+
+ private static EditorUIPlugin plugin = null;
+
+ public EditorUIPlugin() {
+ super();
+ plugin = this;
+ }
+
+ public static EditorUIPlugin getDefault() {
+ if (plugin == null) {
+ plugin = new EditorUIPlugin();
+ }
+ return plugin;
+ }
+
+ /**
+ * Constructs new IStatus object from the given String message.
+ *
+ * @param message the message to create the IStatus object from.
+ */
+ public static IStatus newErrorStatus(String message) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, message);
+ }
+
+ /**
+ * Constructs new IStatus object from the given Throwable object.
+ *
+ * @param t the Throwable object to create the IStatus message from.
+ */
+ public static IStatus newErrorStatus(Throwable t) {
+ return new Status(IStatus.ERROR, PLUGIN_ID, t.getMessage(), t);
+ }
+
+ /**
+ * Logs the specified status with this plug-in's log.
+ *
+ * @param status status to log
+ */
+ public static void log(IStatus status) {
+ getDefault().getLog().log(status);
+ }
+
+ /**
+ * Logs the specified throwable with this plug-in's log.
+ *
+ * @param t throwable to log
+ */
+ public static void log(Throwable t) {
+ if (t instanceof CoreException) {
+ log(((CoreException) t).getStatus());
+ } else {
+ log(newErrorStatus(t));
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/SearchControl.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/SearchControl.java
new file mode 100644
index 0000000..ab7a419
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/SearchControl.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009 SpringSource, a divison of VMware, Inc.
+ * 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.internal;
+
+import org.eclipse.jface.action.ControlContribution;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @author Christian Dupuis
+ */
+public class SearchControl extends ControlContribution {
+
+ private final IManagedForm managedForm;
+
+ private Text searchText;
+
+ public SearchControl(String id, IManagedForm managedForm) {
+ super(id);
+ this.managedForm = managedForm;
+ }
+
+ public Text getSearchText() {
+ return searchText;
+ }
+
+ protected Control createControl(Composite parent) {
+ if (parent instanceof ToolBar) {
+ parent.setCursor(null);
+ }
+
+ FormToolkit toolkit = managedForm.getToolkit();
+ Composite composite = toolkit.createComposite(parent);
+
+ GridLayout layout = new GridLayout(3, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.verticalSpacing = 0;
+
+ composite.setLayout(layout);
+ composite.setBackground(null);
+
+ searchText = toolkit.createText(composite, "", SWT.SINGLE | SWT.BORDER | SWT.SEARCH | SWT.CANCEL);
+ searchText.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.TRUE);
+ searchText.setLayoutData(new GridData(200, -1));
+ searchText.setText("type filter text");
+
+ toolkit.paintBordersFor(composite);
+
+ return composite;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/SearchTextHistory.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/SearchTextHistory.java
new file mode 100644
index 0000000..3c7850c
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/SearchTextHistory.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc.
+ * 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - enhancements and bug fixes
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Christian Dupuis
+ * @author Kaloyan Raev
+ */
+public class SearchTextHistory {
+
+ private static final int MAX_HISTORY = 10;
+
+ private List<String> history= new ArrayList<String>();
+
+ private int index = 0;
+
+ public void add(String text) {
+ int found = -1;
+ int size = history.size();
+ for (int i = 0; i < size; i++) {
+ String s = (String) history.get(i);
+ if (s.equals(text)) {
+ found = i;
+ break;
+ }
+ }
+
+ if (found == -1) {
+ if (size >= MAX_HISTORY)
+ history.remove(size - 1);
+ history.add(0, text);
+ } else if (found != 0) {
+ history.remove(found);
+ history.add(0, text);
+ }
+ index = 0;
+ }
+
+ public String back() {
+ if (canBack()) {
+ String text = history.get(index);
+ index++;
+ return text;
+ }
+ return null;
+ }
+
+ public String forward() {
+ if (canForward()) {
+ index--;
+ String text = history.get(index);
+ return text;
+ }
+ return null;
+ }
+
+ public boolean canForward() {
+ return index > 0;
+ }
+
+ public boolean canBack() {
+ return index < history.size();
+ }
+
+ public String current() {
+ return (history.size() == 0) ? null : history.get(0);
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependency.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependency.java
new file mode 100644
index 0000000..b2c18bf
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependency.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - moving to Eclipse Libra project and enhancements
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.internal.dependencies;
+
+import org.eclipse.libra.framework.editor.core.model.IBundle;
+
+/**
+ * @author Christian Dupuis
+ * @author Kaloyan Raev
+ */
+public abstract class BundleDependency {
+
+ private final IBundle exportingBundle;
+
+ private final IBundle importingBundle;
+
+ public BundleDependency(IBundle exportingBundle, IBundle importingBundle) {
+ this.exportingBundle = exportingBundle;
+ this.importingBundle = importingBundle;
+ }
+
+ public IBundle getExportingBundle() {
+ return exportingBundle;
+ }
+
+ public IBundle getImportingBundle() {
+ return importingBundle;
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 17;
+ hashCode = 31 * hashCode + exportingBundle.hashCode();
+ hashCode = 31 * hashCode + importingBundle.hashCode();
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof BundleDependency)) {
+ return false;
+ }
+ BundleDependency that = (BundleDependency) other;
+ if (this.exportingBundle != that.exportingBundle) {
+ return false;
+ }
+ if (this.exportingBundle != null && !this.exportingBundle.equals(that.exportingBundle)) {
+ return false;
+ }
+ if (this.importingBundle != that.importingBundle) {
+ return false;
+ }
+ if (this.importingBundle != null && !this.importingBundle.equals(that.importingBundle)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyContentProvider.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyContentProvider.java
new file mode 100644
index 0000000..e56709e
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyContentProvider.java
@@ -0,0 +1,479 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - moving to Eclipse Libra project and enhancements
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.internal.dependencies;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.libra.framework.editor.core.model.IBundle;
+import org.eclipse.libra.framework.editor.core.model.IPackageImport;
+import org.eclipse.libra.framework.editor.core.model.IServiceReference;
+import org.eclipse.libra.framework.editor.ui.internal.SearchControl;
+import org.eclipse.ui.internal.ide.StringMatcher;
+import org.eclipse.zest.core.viewers.GraphViewer;
+import org.eclipse.zest.core.viewers.IGraphContentProvider;
+
+/**
+ * @author Christian Dupuis
+ * @author Kaloyan Raev
+ */
+@SuppressWarnings("restriction")
+public class BundleDependencyContentProvider implements IGraphContentProvider, ISelectionChangedListener {
+
+ private static final Object[] NO_ELEMENTS = new Object[0];
+
+ private Map<Long, IBundle> bundles;
+
+ private BundleDependencyContentResult contentResult;
+
+ private Map<IBundle, Set<BundleDependency>> dependenciesByBundle;
+
+ private int incomingDependencyDegree = 1;
+
+ private int outgoingDependencyDegree = 1;
+
+ private final SearchControl searchControl;
+
+ private Set<BundleDependency> selectedDependencies = new HashSet<BundleDependency>();
+
+ private boolean showPackage = true;
+
+ private boolean showServices = false;
+
+ private final GraphViewer viewer;
+
+ public BundleDependencyContentProvider(GraphViewer viewer, SearchControl control) {
+ this.viewer = viewer;
+ this.searchControl = control;
+ }
+
+ public void clearSelection() {
+ for (BundleDependency dep : selectedDependencies) {
+ viewer.unReveal(dep);
+ }
+ selectedDependencies.clear();
+ for (Object node : viewer.getNodeElements()) {
+ viewer.update(node, null);
+ }
+
+ for (Object connection : viewer.getConnectionElements()) {
+ viewer.update(connection, null);
+ }
+ }
+
+ public void dispose() {
+ }
+
+ public BundleDependencyContentResult getContentResult() {
+ return this.contentResult;
+ }
+
+ public Object getDestination(Object rel) {
+ if (rel instanceof BundleDependency) {
+ return ((BundleDependency) rel).getExportingBundle();
+ }
+ return null;
+ }
+
+ @SuppressWarnings( { "unchecked" })
+ public Object[] getElements(Object input) {
+ if (input instanceof Collection) {
+ dependenciesByBundle = new HashMap<IBundle, Set<BundleDependency>>();
+ Set<IBundle> bundles = new HashSet<IBundle>((Collection<IBundle>) input);
+ if (!"type filter text".equals(searchControl.getSearchText().getText())
+ && searchControl.getSearchText().getText().trim().length() > 0) {
+ String searchText = searchControl.getSearchText().getText().trim() + "*";
+ StringMatcher matcher = new StringMatcher(searchText, true, false);
+ for (IBundle dep : new HashSet<IBundle>(bundles)) {
+ boolean filter = true;
+ if (matcher.match(dep.getSymbolicName())) {
+ filter = false;
+ }
+ if (matcher.match(dep.getSymbolicName() + " (" + dep.getVersion() + ")")) {
+ filter = false;
+ }
+ if (filter) {
+ bundles.remove(dep);
+ }
+ }
+ }
+ this.contentResult = new BundleDependencyContentResult(bundles);
+
+ Set<BundleDependency> dependencies = new HashSet<BundleDependency>();
+ if (showPackage) {
+ Set<IBundle> bundlesToProcess = new HashSet<IBundle>(bundles);
+ Set<IBundle> alreadyProcessedBundles = new HashSet<IBundle>();
+ int degree = 0;
+
+ do {
+ degree++;
+ Set<IBundle> copy = new HashSet<IBundle>(bundlesToProcess);
+ bundlesToProcess = new HashSet<IBundle>();
+ for (IBundle b : copy) {
+ bundlesToProcess.addAll(addOutgoingPackageDependencies(dependencies, b, degree,
+ alreadyProcessedBundles));
+ }
+ } while (bundlesToProcess.size() > 0);
+
+ bundlesToProcess = new HashSet<IBundle>(bundles);
+ alreadyProcessedBundles = new HashSet<IBundle>();
+ degree = 0;
+
+ do {
+ degree++;
+ Set<IBundle> copy = new HashSet<IBundle>(bundlesToProcess);
+ bundlesToProcess = new HashSet<IBundle>();
+ for (IBundle b : copy) {
+ bundlesToProcess.addAll(addIncomingPackageDependencies(dependencies, b, degree,
+ alreadyProcessedBundles));
+ }
+ } while (bundlesToProcess.size() > 0);
+ }
+ else if (showServices) {
+ Set<IBundle> bundlesToProcess = new HashSet<IBundle>(bundles);
+ Set<IBundle> alreadyProcessedBundles = new HashSet<IBundle>();
+ int degree = 0;
+
+ do {
+ degree++;
+ Set<IBundle> copy = new HashSet<IBundle>(bundlesToProcess);
+ bundlesToProcess = new HashSet<IBundle>();
+ for (IBundle b : copy) {
+ bundlesToProcess.addAll(addOutgoingServiceDependencies(dependencies, b, degree,
+ alreadyProcessedBundles));
+ }
+ } while (bundlesToProcess.size() > 0);
+
+ bundlesToProcess = new HashSet<IBundle>(bundles);
+ alreadyProcessedBundles = new HashSet<IBundle>();
+ degree = 0;
+
+ do {
+ degree++;
+ Set<IBundle> copy = new HashSet<IBundle>(bundlesToProcess);
+ bundlesToProcess = new HashSet<IBundle>();
+ for (IBundle b : copy) {
+ bundlesToProcess.addAll(addIncomingServiceDependencies(dependencies, b, degree,
+ alreadyProcessedBundles));
+ }
+ } while (bundlesToProcess.size() > 0);
+ }
+
+ if ("type filter text".equals(searchControl.getSearchText().getText())
+ || searchControl.getSearchText().getText().trim().length() == 0) {
+ this.contentResult = null;
+ }
+
+ return dependencies.toArray(new BundleDependency[dependencies.size()]);
+ }
+ return NO_ELEMENTS;
+ }
+
+ public Object getSource(Object rel) {
+ if (rel instanceof BundleDependency) {
+ return ((BundleDependency) rel).getImportingBundle();
+ }
+ return null;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ public boolean isSelected(IBundle bundle) {
+ for (BundleDependency dep : selectedDependencies) {
+ if (dep.getExportingBundle().equals(bundle)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean isSelected(BundleDependency deb) {
+ return (selectedDependencies != null && selectedDependencies.contains(deb));
+ }
+
+ @SuppressWarnings("unchecked")
+ public void selectionChanged(SelectionChangedEvent event) {
+ for (BundleDependency dep : selectedDependencies) {
+ viewer.unReveal(dep);
+ }
+ selectedDependencies = new HashSet<BundleDependency>();
+ Set<Object> newSelection = new HashSet<Object>();
+ Iterator<Object> iterator = ((IStructuredSelection) event.getSelection()).iterator();
+ while (iterator.hasNext()) {
+ Object selectedObject = iterator.next();
+ if (selectedObject instanceof IBundle) {
+ newSelection.add(selectedObject);
+ if (dependenciesByBundle.containsKey(selectedObject)) {
+ for (BundleDependency dep : dependenciesByBundle.get(selectedObject)) {
+ selectedDependencies.add(dep);
+ newSelection.add(dep.getExportingBundle());
+ }
+ }
+ }
+ else if (selectedObject instanceof BundleDependency) {
+ BundleDependency dep = (BundleDependency) selectedObject;
+ selectedDependencies.add(dep);
+ newSelection.add(dep.getExportingBundle());
+ newSelection.add(dep.getImportingBundle());
+ }
+ }
+
+ // viewer.setSelection(new StructuredSelection((Object[]) newSelection
+ // .toArray(new Object[newSelection.size()])), true);
+
+ for (Object node : viewer.getNodeElements()) {
+ viewer.update(node, null);
+ }
+
+ for (Object connection : viewer.getConnectionElements()) {
+ viewer.update(connection, null);
+ }
+
+ for (BundleDependency dep : selectedDependencies) {
+ viewer.reveal(dep);
+ }
+
+ // viewer.getGraphControl().redraw();
+ }
+
+ public void setBundles(Map<Long, IBundle> bundles) {
+ this.bundles = new HashMap<Long, IBundle>(bundles);
+ }
+
+ public void setIncomingDependencyDegree(int degree) {
+ this.incomingDependencyDegree = degree;
+ }
+
+ public void setOutgoingDependencyDegree(int degree) {
+ this.outgoingDependencyDegree = degree;
+ }
+
+ public void setShowPackage(boolean showPackage) {
+ this.showPackage = showPackage;
+ }
+
+ public void setShowServices(boolean showServices) {
+ this.showServices = showServices;
+ }
+
+ private Set<IBundle> addIncomingPackageDependencies(Set<BundleDependency> dependencies, IBundle bundle, int degree,
+ Set<IBundle> processedBundles) {
+
+ if (processedBundles.contains(bundle)) {
+ return Collections.emptySet();
+ }
+ processedBundles.add(bundle);
+
+ Set<IBundle> dependentBundles = new HashSet<IBundle>();
+ if (incomingDependencyDegree >= degree) {
+ String id = bundle.getId();
+
+ for (IBundle dependantBundle : this.bundles.values()) {
+ for (IPackageImport packageImport : dependantBundle.getPackageImports()) {
+ if (packageImport.getSupplierId().equals(id)) {
+
+ Set<BundleDependency> bundleDependencies = null;
+ if (dependenciesByBundle.containsKey(dependantBundle)) {
+ bundleDependencies = dependenciesByBundle.get(dependantBundle);
+ }
+ else {
+ bundleDependencies = new HashSet<BundleDependency>();
+ dependenciesByBundle.put(dependantBundle, bundleDependencies);
+ }
+
+ PackageBundleDependency bundleDependency = null;
+
+ for (BundleDependency dep : bundleDependencies) {
+ if (dep.getExportingBundle().equals(bundle) && dep instanceof PackageBundleDependency) {
+ bundleDependency = (PackageBundleDependency) dep;
+ break;
+ }
+ }
+
+ if (bundleDependency == null) {
+ bundleDependency = new PackageBundleDependency(bundle, dependantBundle);
+ bundleDependencies.add(bundleDependency);
+ dependencies.add(bundleDependency);
+ }
+ contentResult.addIncomingDependency(degree, dependantBundle);
+
+ bundleDependency.addPackageImport(packageImport);
+ dependentBundles.add(dependantBundle);
+ }
+ }
+ }
+ }
+ if (incomingDependencyDegree > degree) {
+ return dependentBundles;
+ }
+ return Collections.emptySet();
+ }
+
+ private Set<IBundle> addIncomingServiceDependencies(Set<BundleDependency> dependencies, IBundle bundle, int degree,
+ Set<IBundle> processedBundles) {
+
+ if (processedBundles.contains(bundle)) {
+ return Collections.emptySet();
+ }
+ processedBundles.add(bundle);
+
+ Set<IBundle> dependentBundles = new HashSet<IBundle>();
+ if (incomingDependencyDegree >= degree) {
+ for (IServiceReference pe : bundle.getRegisteredServices()) {
+ for (Long id : pe.getUsingBundleIds()) {
+ IBundle dependantBundle = this.bundles.get(id);
+
+ Set<BundleDependency> bundleDependencies = null;
+ if (dependenciesByBundle.containsKey(bundle)) {
+ bundleDependencies = dependenciesByBundle.get(bundle);
+ }
+ else {
+ bundleDependencies = new HashSet<BundleDependency>();
+ dependenciesByBundle.put(bundle, bundleDependencies);
+ }
+
+ ServiceReferenceBundleDependency bundleDependency = null;
+
+ for (BundleDependency dep : bundleDependencies) {
+ if (dep.getExportingBundle().equals(dependantBundle)
+ && dep instanceof ServiceReferenceBundleDependency) {
+ bundleDependency = (ServiceReferenceBundleDependency) dep;
+ break;
+ }
+ }
+
+ if (bundleDependency == null) {
+ bundleDependency = new ServiceReferenceBundleDependency(bundle, dependantBundle);
+ bundleDependencies.add(bundleDependency);
+ dependencies.add(bundleDependency);
+ }
+ contentResult.addIncomingDependency(degree, dependantBundle);
+
+ bundleDependency.addServiceReferece(pe);
+ dependentBundles.add(dependantBundle);
+ }
+ }
+ }
+ if (incomingDependencyDegree > degree) {
+ return dependentBundles;
+ }
+ return Collections.emptySet();
+ }
+
+ private Set<IBundle> addOutgoingPackageDependencies(Set<BundleDependency> dependencies, IBundle bundle, int degree,
+ Set<IBundle> processedBundles) {
+
+ if (processedBundles.contains(bundle)) {
+ return Collections.emptySet();
+ }
+ processedBundles.add(bundle);
+
+ Set<IBundle> dependentBundles = new HashSet<IBundle>();
+ if (outgoingDependencyDegree >= degree) {
+ for (IPackageImport pe : bundle.getPackageImports()) {
+ IBundle dependantBundle = this.bundles.get(Long.valueOf(pe.getSupplierId()));
+
+ Set<BundleDependency> bundleDependencies = null;
+ if (dependenciesByBundle.containsKey(bundle)) {
+ bundleDependencies = dependenciesByBundle.get(bundle);
+ }
+ else {
+ bundleDependencies = new HashSet<BundleDependency>();
+ dependenciesByBundle.put(bundle, bundleDependencies);
+ }
+
+ PackageBundleDependency bundleDependency = null;
+
+ for (BundleDependency dep : bundleDependencies) {
+ if (dep.getExportingBundle().equals(dependantBundle) && dep instanceof PackageBundleDependency) {
+ bundleDependency = (PackageBundleDependency) dep;
+ break;
+ }
+ }
+
+ if (bundleDependency == null) {
+ bundleDependency = new PackageBundleDependency(dependantBundle, bundle);
+ bundleDependencies.add(bundleDependency);
+ dependencies.add(bundleDependency);
+ }
+ contentResult.addOutgoingDependency(degree, dependantBundle);
+
+ bundleDependency.addPackageImport(pe);
+ dependentBundles.add(dependantBundle);
+ }
+ }
+ if (outgoingDependencyDegree > degree) {
+ return dependentBundles;
+ }
+ return Collections.emptySet();
+ }
+
+ private Set<IBundle> addOutgoingServiceDependencies(Set<BundleDependency> dependencies, IBundle bundle, int degree,
+ Set<IBundle> processedBundles) {
+
+ if (processedBundles.contains(bundle)) {
+ return Collections.emptySet();
+ }
+ processedBundles.add(bundle);
+
+ Set<IBundle> dependentBundles = new HashSet<IBundle>();
+ if (outgoingDependencyDegree >= degree) {
+ for (IServiceReference pe : bundle.getServicesInUse()) {
+ IBundle dependantBundle = this.bundles.get(pe.getBundleId());
+
+ Set<BundleDependency> bundleDependencies = null;
+ if (dependenciesByBundle.containsKey(bundle)) {
+ bundleDependencies = dependenciesByBundle.get(bundle);
+ }
+ else {
+ bundleDependencies = new HashSet<BundleDependency>();
+ dependenciesByBundle.put(bundle, bundleDependencies);
+ }
+
+ ServiceReferenceBundleDependency bundleDependency = null;
+
+ for (BundleDependency dep : bundleDependencies) {
+ if (dep.getExportingBundle().equals(dependantBundle)
+ && dep instanceof ServiceReferenceBundleDependency) {
+ bundleDependency = (ServiceReferenceBundleDependency) dep;
+ break;
+ }
+ }
+
+ if (bundleDependency == null) {
+ bundleDependency = new ServiceReferenceBundleDependency(dependantBundle, bundle);
+ bundleDependencies.add(bundleDependency);
+ dependencies.add(bundleDependency);
+ }
+ contentResult.addOutgoingDependency(degree, dependantBundle);
+
+ bundleDependency.addServiceReferece(pe);
+ dependentBundles.add(dependantBundle);
+ }
+ }
+ if (outgoingDependencyDegree > degree) {
+ return dependentBundles;
+ }
+ return Collections.emptySet();
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyContentResult.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyContentResult.java
new file mode 100644
index 0000000..14110fb
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyContentResult.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - moving to Eclipse Libra project and enhancements
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.internal.dependencies;
+
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.eclipse.libra.framework.editor.core.model.IBundle;
+
+/**
+ * @author Christian Dupuis
+ * @author Kaloyan Raev
+ */
+public class BundleDependencyContentResult {
+
+ private final Set<IBundle> bundles;
+
+ private final Map<Integer, Set<IBundle>> incomingDependencies = new HashMap<Integer, Set<IBundle>>();
+
+ private final Map<Integer, Set<IBundle>> outgoingDependencies = new HashMap<Integer, Set<IBundle>>();
+
+ public BundleDependencyContentResult(Set<IBundle> bundles) {
+ this.bundles = bundles;
+ }
+
+ public void addIncomingDependency(Integer level, IBundle bundleDependency) {
+ if (!incomingDependencies.containsKey(level)) {
+ incomingDependencies.put(level, new TreeSet<IBundle>(new Comparator<IBundle>() {
+
+ public int compare(IBundle o1, IBundle o2) {
+ return Long.valueOf(o1.getId()).compareTo(Long.valueOf(o2.getId()));
+ }
+ }));
+ }
+ incomingDependencies.get(level).add(bundleDependency);
+ }
+
+ public void addOutgoingDependency(Integer level, IBundle bundleDependency) {
+ if (!outgoingDependencies.containsKey(level)) {
+ outgoingDependencies.put(level, new TreeSet<IBundle>(new Comparator<IBundle>() {
+
+ public int compare(IBundle o1, IBundle o2) {
+ return Long.valueOf(o1.getId()).compareTo(Long.valueOf(o2.getId()));
+ }
+ }));
+ }
+ outgoingDependencies.get(level).add(bundleDependency);
+ }
+
+ public Set<IBundle> getBundles() {
+ return bundles;
+ }
+
+ public Map<Integer, Set<IBundle>> getIncomingDependencies() {
+ return incomingDependencies;
+ }
+
+ public Map<Integer, Set<IBundle>> getOutgoingDependencies() {
+ return outgoingDependencies;
+ }
+
+ public Integer getIncomingDegree() {
+ int degree = 0;
+ for (Integer integer : incomingDependencies.keySet()) {
+ degree = Math.max(degree, integer);
+ }
+ return degree;
+ }
+
+ public Integer getOutgoingDegree() {
+ int degree = 0;
+ for (Integer integer : outgoingDependencies.keySet()) {
+ degree = Math.max(degree, integer);
+ }
+ return degree;
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyLabelProvider.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyLabelProvider.java
new file mode 100644
index 0000000..fc9aa96
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyLabelProvider.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - moving to Eclipse Libra project and enhancements
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.internal.dependencies;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.libra.framework.editor.core.model.IBundle;
+import org.eclipse.pde.internal.ui.PDEPluginImages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.zest.core.viewers.IConnectionStyleProvider;
+import org.eclipse.zest.core.viewers.IEntityStyleProvider;
+import org.eclipse.zest.core.widgets.ZestStyles;
+
+/**
+ * @author Christian Dupuis
+ * @author Kaloyan Raev
+ */
+public class BundleDependencyLabelProvider implements ILabelProvider, IEntityStyleProvider, IConnectionStyleProvider,
+ ISelectionChangedListener {
+
+ private final Color blackColor = Display.getCurrent().getSystemColor(SWT.COLOR_BLACK);
+
+ private final Color colorBorder = new Color(null, 0, 0, 0);
+
+ private final Color colorRel = new Color(null, 150, 150, 255);
+
+ private final Color colorRelated = new Color(null, 236, 255, 122);
+
+ private final Color colorRelResolved = new Color(null, 255, 100, 100);
+
+ private final Color colorTestBackground = new Color(null, 255, 255, 255);
+
+ private final Color colorTestHighlight = new Color(null, 182, 217, 0);
+
+ private final BundleDependencyContentProvider contentProvider;
+
+ private final Color grayColor = Display.getCurrent().getSystemColor(SWT.COLOR_GRAY);
+
+ public BundleDependencyLabelProvider(BundleDependencyContentProvider contentProvider, FormToolkit formToolkit) {
+ this.contentProvider = contentProvider;
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ colorTestBackground.dispose();
+ colorTestHighlight.dispose();
+ colorRel.dispose();
+ colorRelResolved.dispose();
+ colorBorder.dispose();
+ colorRelated.dispose();
+ }
+
+ public boolean fisheyeNode(Object entity) {
+ return false;
+ }
+
+ public Color getBackgroundColour(Object entity) {
+ if (entity instanceof IBundle) {
+ if (contentProvider.isSelected((IBundle) entity)) {
+ return colorRelated;
+ }
+ }
+ return colorTestBackground;
+ }
+
+ public Color getBorderColor(Object entity) {
+ return colorBorder;
+ }
+
+ public Color getBorderHighlightColor(Object entity) {
+ return colorBorder;
+ }
+
+ public int getBorderWidth(Object entity) {
+ return 1;
+ }
+
+ public Color getColor(Object rel) {
+ if (rel instanceof BundleDependency) {
+ if (contentProvider.isSelected((BundleDependency) rel)) {
+ return blackColor;
+ }
+ else {
+ return grayColor;
+ }
+ }
+ return colorRel;
+ }
+
+ public int getConnectionStyle(Object rel) {
+ return ZestStyles.CONNECTIONS_DASH;
+ }
+
+ public Color getForegroundColour(Object entity) {
+ return colorBorder;
+ }
+
+ public Color getHighlightColor(Object rel) {
+ if (rel instanceof BundleDependency) {
+ return blackColor;
+ }
+ return colorTestHighlight;
+ }
+
+ public Image getImage(Object element) {
+ if (element instanceof IBundle) {
+ return PDEPluginImages.get(PDEPluginImages.OBJ_DESC_BUNDLE);
+ }
+ return null;
+ }
+
+ public int getLineWidth(Object rel) {
+ return 1;
+ }
+
+ public Color getNodeHighlightColor(Object entity) {
+ return colorTestHighlight;
+ }
+
+ public String getText(Object element) {
+ if (element instanceof IBundle) {
+ return ((IBundle) element).getSymbolicName() + " (" + ((IBundle) element).getVersion() + ")";
+ }
+ return null;
+ }
+
+ public IFigure getTooltip(Object entity) {
+ return null;
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+
+ }
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyLayoutAlgorithm.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyLayoutAlgorithm.java
new file mode 100644
index 0000000..d3bbd0b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/BundleDependencyLayoutAlgorithm.java
@@ -0,0 +1,241 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - moving to Eclipse Libra project and enhancements
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.internal.dependencies;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.libra.framework.editor.core.model.IBundle;
+import org.eclipse.zest.core.widgets.GraphNode;
+import org.eclipse.zest.core.widgets.ZestStyles;
+import org.eclipse.zest.layouts.LayoutEntity;
+import org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithm;
+import org.eclipse.zest.layouts.dataStructures.InternalNode;
+import org.eclipse.zest.layouts.dataStructures.InternalRelationship;
+
+/**
+ * @author Christian Dupuis
+ * @author Kaloyan Raev
+ */
+public class BundleDependencyLayoutAlgorithm extends AbstractLayoutAlgorithm {
+
+ private final BundleDependencyContentProvider contentProvider;
+
+ public BundleDependencyLayoutAlgorithm(BundleDependencyContentProvider contentProvider) {
+ super(ZestStyles.NODES_NO_LAYOUT_RESIZE);
+ this.contentProvider = contentProvider;
+ }
+
+ @Override
+ protected void applyLayoutInternal(InternalNode[] entitiesToLayout, InternalRelationship[] relationshipsToConsider,
+ double boundsX, double boundsY, double boundsWidth, double boundsHeight) {
+
+ BundleDependencyContentResult contentResult = this.contentProvider.getContentResult();
+ Set<IBundle> rootBundles = contentResult.getBundles();
+
+ Set<IBundle> bundlesProcessed = new HashSet<IBundle>();
+
+ if (contentResult != null) {
+ Set<ColumnHolder> columnNodes = new HashSet<ColumnHolder>();
+ double columnWith = 0;
+ double currentX = boundsX + 0;
+ double currentY = boundsY + 10;
+ double maxY = boundsHeight;
+ int columns = 0;
+
+ // Start with the incoming dependencies
+ int degree = contentResult.getIncomingDegree();
+ while (degree > 0) {
+ Set<InternalNode> degreeNodes = new HashSet<InternalNode>();
+ Set<IBundle> deps = contentResult.getIncomingDependencies().get(degree);
+ for (IBundle bundle : deps) {
+ if (!bundlesProcessed.contains(bundle)
+ && !rootBundles.contains(bundle)
+ && lowestRanking(bundle, contentResult.getIncomingDegree(), contentResult
+ .getIncomingDependencies()) == degree) {
+ for (InternalNode node : entitiesToLayout) {
+ LayoutEntity obj = node.getLayoutEntity();
+ IBundle graphBundle = (IBundle) ((GraphNode) obj.getGraphData()).getData();
+ if (graphBundle.equals(bundle)) {
+ columnWith = Math.max(columnWith, node.getWidthInLayout());
+ node.setLocation(currentX, currentY);
+ bundlesProcessed.add(bundle);
+ currentY = currentY + node.getHeightInLayout() + 15;
+ degreeNodes.add(node);
+ maxY = Math.max(currentY, maxY);
+ break;
+ }
+ }
+ }
+ }
+
+ for (InternalNode node : degreeNodes) {
+ if (node.getWidthInLayout() < columnWith) {
+ double x = (columnWith - node.getWidthInLayout()) / 2;
+ node.setLocation(node.getLayoutEntity().getXInLayout() + x, node.getLayoutEntity()
+ .getYInLayout());
+ }
+ }
+
+ ColumnHolder holder = new ColumnHolder();
+ holder.index = columns;
+ holder.y = currentY;
+ holder.nodes = degreeNodes;
+ columnNodes.add(holder);
+ columns++;
+ currentY = boundsY + 10;
+ if (degreeNodes.size() > 0) {
+ currentX = currentX + columnWith + 30;
+ }
+ degree--;
+ columnWith = 0;
+ }
+
+ Set<InternalNode> rootNodes = new HashSet<InternalNode>();
+ for (IBundle bundle : rootBundles) {
+ for (InternalNode node : entitiesToLayout) {
+ LayoutEntity obj = node.getLayoutEntity();
+ IBundle graphBundle = (IBundle) ((GraphNode) obj.getGraphData()).getData();
+ if (graphBundle.equals(bundle)) {
+ columnWith = Math.max(columnWith, node.getWidthInLayout());
+ node.setLocation(currentX, currentY);
+ bundlesProcessed.add(bundle);
+ currentY = currentY + node.getHeightInLayout() + 15;
+ maxY = Math.max(currentY, maxY);
+ rootNodes.add(node);
+ break;
+ }
+ }
+ }
+ for (InternalNode node : rootNodes) {
+ if (node.getWidthInLayout() < columnWith) {
+ double x = (columnWith - node.getWidthInLayout()) / 2;
+ node.setLocation(node.getLayoutEntity().getXInLayout() + x, node.getLayoutEntity().getYInLayout());
+ }
+ }
+
+ ColumnHolder holder = new ColumnHolder();
+ holder.index = columns;
+ holder.y = currentY;
+ holder.nodes = rootNodes;
+ columnNodes.add(holder);
+
+ currentY = boundsY + 10;
+ currentX = currentX + columnWith + 30;
+
+ int maxDegree = contentResult.getOutgoingDegree();
+ degree = 1;
+ while (degree <= maxDegree) {
+ Set<InternalNode> degreeNodes = new HashSet<InternalNode>();
+ Set<IBundle> deps = contentResult.getOutgoingDependencies().get(degree);
+ for (IBundle bundle : deps) {
+ if (!bundlesProcessed.contains(bundle)
+ && !rootBundles.contains(bundle)
+ && lowestRanking(bundle, contentResult.getOutgoingDegree(), contentResult
+ .getOutgoingDependencies()) == degree) {
+ for (InternalNode node : entitiesToLayout) {
+ LayoutEntity obj = node.getLayoutEntity();
+ IBundle graphBundle = (IBundle) ((GraphNode) obj.getGraphData()).getData();
+ if (graphBundle.equals(bundle)) {
+ columnWith = Math.max(columnWith, node.getWidthInLayout());
+ node.setLocation(currentX, currentY);
+ bundlesProcessed.add(bundle);
+ currentY = currentY + node.getHeightInLayout() + 15;
+ maxY = Math.max(currentY, maxY);
+ degreeNodes.add(node);
+ break;
+ }
+ }
+ }
+ }
+ for (InternalNode node : degreeNodes) {
+ if (node.getWidthInLayout() < columnWith) {
+ double x = (columnWith - node.getWidthInLayout()) / 2;
+ node.setLocation(node.getLayoutEntity().getXInLayout() + x, node.getLayoutEntity()
+ .getYInLayout());
+ }
+ }
+ holder = new ColumnHolder();
+ holder.index = columns;
+ holder.y = currentY;
+ holder.nodes = degreeNodes;
+ columnNodes.add(holder);
+ currentY = boundsY + 10;
+ currentX = currentX + columnWith + 30;
+ degree++;
+ columnWith = 0;
+ }
+
+ for (ColumnHolder column : columnNodes) {
+ if (column.y <= maxY) {
+ double y = (maxY - column.y) / 2;
+ for (InternalNode node : column.nodes) {
+ node.setLocation(node.getLayoutEntity().getXInLayout(), node.getLayoutEntity().getYInLayout()
+ + y);
+ }
+ }
+ }
+
+ }
+ }
+
+ private int lowestRanking(IBundle bundle, int maxDegree, Map<Integer, Set<IBundle>> bundles) {
+ int ranking = 1;
+ while (ranking <= maxDegree) {
+ for (IBundle b : bundles.get(ranking)) {
+ if (b.equals(bundle)) {
+ return ranking;
+ }
+ }
+ ranking++;
+ }
+ return ranking;
+ }
+
+ @Override
+ protected int getCurrentLayoutStep() {
+ return 1;
+ }
+
+ @Override
+ protected int getTotalNumberOfLayoutSteps() {
+ return 1;
+ }
+
+ @Override
+ protected boolean isValidConfiguration(boolean asynchronous, boolean continuous) {
+ return true;
+ }
+
+ @Override
+ protected void postLayoutAlgorithm(InternalNode[] entitiesToLayout, InternalRelationship[] relationshipsToConsider) {
+ }
+
+ @Override
+ protected void preLayoutAlgorithm(InternalNode[] entitiesToLayout, InternalRelationship[] relationshipsToConsider,
+ double x, double y, double width, double height) {
+ }
+
+ @Override
+ public void setLayoutArea(double x, double y, double width, double height) {
+ }
+
+ class ColumnHolder {
+ protected double y;
+
+ protected int index;
+
+ protected Set<InternalNode> nodes;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/FocusedBundleDependencyLayoutAlgorithm.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/FocusedBundleDependencyLayoutAlgorithm.java
new file mode 100644
index 0000000..c68cffa
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/FocusedBundleDependencyLayoutAlgorithm.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2009 SpringSource, a divison of VMware, Inc.
+ * 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.internal.dependencies;
+
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.zest.layouts.Filter;
+import org.eclipse.zest.layouts.InvalidLayoutConfiguration;
+import org.eclipse.zest.layouts.LayoutAlgorithm;
+import org.eclipse.zest.layouts.LayoutEntity;
+import org.eclipse.zest.layouts.LayoutRelationship;
+import org.eclipse.zest.layouts.algorithms.CompositeLayoutAlgorithm;
+import org.eclipse.zest.layouts.progress.ProgressListener;
+
+/**
+ * @author Christian Dupuis
+ */
+public class FocusedBundleDependencyLayoutAlgorithm implements LayoutAlgorithm {
+
+ private final BundleDependencyLayoutAlgorithm focusedLayoutAlgorithm;
+
+ private final CompositeLayoutAlgorithm layoutAlgorithm;
+
+ private final BundleDependencyContentProvider contentProvider;
+
+ public FocusedBundleDependencyLayoutAlgorithm(int styles, CompositeLayoutAlgorithm layoutAlgorithm,
+ BundleDependencyContentProvider contentProvider) {
+ this.contentProvider = contentProvider;
+ this.layoutAlgorithm = layoutAlgorithm;
+ this.focusedLayoutAlgorithm = new BundleDependencyLayoutAlgorithm(contentProvider);
+ }
+
+ public void addEntity(LayoutEntity entity) {
+ layoutAlgorithm.addEntity(entity);
+ focusedLayoutAlgorithm.addEntity(entity);
+ }
+
+ public void addProgressListener(ProgressListener listener) {
+ layoutAlgorithm.addProgressListener(listener);
+ focusedLayoutAlgorithm.addProgressListener(listener);
+ }
+
+ public void addRelationship(LayoutRelationship relationship) {
+ layoutAlgorithm.addRelationship(relationship);
+ focusedLayoutAlgorithm.addRelationship(relationship);
+ }
+
+ public void applyLayout(LayoutEntity[] entitiesToLayout, LayoutRelationship[] relationshipsToConsider, double x,
+ double y, double width, double height, boolean asynchronous, boolean continuous)
+ throws InvalidLayoutConfiguration {
+ if (contentProvider.getContentResult() != null) {
+ focusedLayoutAlgorithm.applyLayout(entitiesToLayout, relationshipsToConsider, x, y, width, height,
+ asynchronous, continuous);
+ }
+ else {
+ layoutAlgorithm.applyLayout(entitiesToLayout, relationshipsToConsider, x, y, width, height, asynchronous,
+ continuous);
+ }
+ }
+
+ public double getEntityAspectRatio() {
+ return layoutAlgorithm.getEntityAspectRatio();
+ }
+
+ public int getStyle() {
+ return layoutAlgorithm.getStyle();
+ }
+
+ public boolean isRunning() {
+ return layoutAlgorithm.isRunning();
+ }
+
+ public void removeEntity(LayoutEntity entity) {
+ layoutAlgorithm.removeEntity(entity);
+ focusedLayoutAlgorithm.removeEntity(entity);
+ }
+
+ public void removeProgressListener(ProgressListener listener) {
+ layoutAlgorithm.removeProgressListener(listener);
+ focusedLayoutAlgorithm.removeProgressListener(listener);
+ }
+
+ public void removeRelationship(LayoutRelationship relationship) {
+ layoutAlgorithm.removeRelationship(relationship);
+ focusedLayoutAlgorithm.removeRelationship(relationship);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void removeRelationships(List relationships) {
+ layoutAlgorithm.removeRelationships(relationships);
+ focusedLayoutAlgorithm.removeRelationships(relationships);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void setComparator(Comparator comparator) {
+ layoutAlgorithm.setComparator(comparator);
+ focusedLayoutAlgorithm.setComparator(comparator);
+ }
+
+ public void setEntityAspectRatio(double ratio) {
+ layoutAlgorithm.setEntityAspectRatio(ratio);
+ focusedLayoutAlgorithm.setEntityAspectRatio(ratio);
+ }
+
+ public void setFilter(Filter filter) {
+ layoutAlgorithm.setFilter(filter);
+ focusedLayoutAlgorithm.setFilter(filter);
+ }
+
+ public void setStyle(int style) {
+ layoutAlgorithm.setStyle(style);
+ focusedLayoutAlgorithm.setStyle(style);
+ }
+
+ public void stop() {
+ layoutAlgorithm.stop();
+ focusedLayoutAlgorithm.stop();
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/PackageBundleDependency.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/PackageBundleDependency.java
new file mode 100644
index 0000000..91c5f69
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/PackageBundleDependency.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - moving to Eclipse Libra project and enhancements
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.internal.dependencies;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.libra.framework.editor.core.model.IBundle;
+import org.eclipse.libra.framework.editor.core.model.IPackageImport;
+
+/**
+ * @author Christian Dupuis
+ * @author Kaloyan Raev
+ */
+public class PackageBundleDependency extends BundleDependency {
+
+ private final Set<IPackageImport> packageImport = new HashSet<IPackageImport>();
+
+ public PackageBundleDependency(IBundle exportingBundle, IBundle importingBundle) {
+ super(exportingBundle, importingBundle);
+ }
+
+ public void addPackageImport(IPackageImport pe) {
+ packageImport.add(pe);
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 17;
+ hashCode = 31 * hashCode + packageImport.hashCode();
+ return 31 * hashCode + super.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof PackageBundleDependency)) {
+ return false;
+ }
+ PackageBundleDependency that = (PackageBundleDependency) other;
+ if (!this.packageImport.equals(that.packageImport)) { // null safe guaranteed by the final modifier
+ return false;
+ }
+ return super.equals(other);
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/ServiceReferenceBundleDependency.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/ServiceReferenceBundleDependency.java
new file mode 100644
index 0000000..6f435b0
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/dependencies/ServiceReferenceBundleDependency.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - moving to Eclipse Libra project and enhancements
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.internal.dependencies;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.libra.framework.editor.core.model.IBundle;
+import org.eclipse.libra.framework.editor.core.model.IServiceReference;
+
+/**
+ * @author Christian Dupuis
+ * @author Kaloyan Raev
+ */
+public class ServiceReferenceBundleDependency extends BundleDependency {
+
+ private final Set<IServiceReference> serviceReference = new HashSet<IServiceReference>();;
+
+ public ServiceReferenceBundleDependency(IBundle exportingBundle, IBundle importingBundle) {
+ super(exportingBundle, importingBundle);
+ }
+
+ public void addServiceReferece(IServiceReference reference) {
+ serviceReference.add(reference);
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 17;
+ hashCode = 31 * hashCode + serviceReference.hashCode();
+ return 31 * hashCode + super.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof ServiceReferenceBundleDependency)) {
+ return false;
+ }
+ ServiceReferenceBundleDependency that = (ServiceReferenceBundleDependency) other;
+ if (!this.serviceReference.equals(that.serviceReference)) { // null safe guaranteed by the final modifier
+ return false;
+ }
+ return super.equals(other);
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationDetailsPart.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationDetailsPart.java
new file mode 100644
index 0000000..6a2b6ba
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationDetailsPart.java
@@ -0,0 +1,814 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - moving to Eclipse Libra project and enhancements
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.internal.overview;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.zip.ZipFile;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.core.runtime.content.IContentTypeManager;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.libra.framework.editor.core.model.IBundle;
+import org.eclipse.libra.framework.editor.core.model.IPackageExport;
+import org.eclipse.libra.framework.editor.core.model.IPackageImport;
+import org.eclipse.libra.framework.editor.core.model.IServiceReference;
+import org.eclipse.libra.framework.editor.ui.internal.EditorUIPlugin;
+import org.eclipse.libra.framework.editor.ui.internal.overview.BundleInformationDetailsPart.ServicesContentProvider.ServicesHolder;
+import org.eclipse.pde.internal.ui.PDEPlugin;
+import org.eclipse.pde.internal.ui.PDEPluginImages;
+import org.eclipse.pde.internal.ui.editor.JarEntryEditorInput;
+import org.eclipse.pde.internal.ui.editor.JarEntryFile;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.FilteredTree;
+import org.eclipse.ui.dialogs.PatternFilter;
+import org.eclipse.ui.forms.AbstractFormPart;
+import org.eclipse.ui.forms.IDetailsPage;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.IFormPart;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.ide.FileStoreEditorInput;
+import org.osgi.framework.Constants;
+
+/**
+ * @author Christian Dupuis
+ * @author Kaloyan Raev
+ */
+@SuppressWarnings("restriction")
+public class BundleInformationDetailsPart extends AbstractFormPart implements IDetailsPage {
+
+ class PackageExportContentProvider implements ITreeContentProvider {
+
+ private IBundle bundle;
+
+ public void dispose() {
+
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IPackageExport) {
+ Set<IBundle> bundles = new HashSet<IBundle>();
+ String name = ((IPackageExport) parentElement).getName();
+ String version = ((IPackageExport) parentElement).getVersion();
+ String id = bundle.getId();
+
+ for (IBundle bundle : BundleInformationDetailsPart.this.bundles.values()) {
+ for (IPackageImport pi : bundle.getPackageImports()) {
+ if (pi.getSupplierId().equals(id) && pi.getName().equals(name)
+ && pi.getVersion().equals(version)) {
+ bundles.add(bundle);
+ }
+ }
+ }
+ return bundles.toArray(new IBundle[bundles.size()]);
+ }
+ return new Object[0];
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (bundle.getPackageExports().size() > 0) {
+ return bundle.getPackageExports().toArray();
+ }
+ return new Object[] { "<no exported packages>" };
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ bundle = (IBundle) newInput;
+ }
+ }
+
+ class PackageImportContentProvider implements ITreeContentProvider {
+
+ private IBundle bundle;
+
+ public void dispose() {
+
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IPackageImport) {
+ String supplierId = ((IPackageImport) parentElement).getSupplierId();
+ return new Object[] { bundles.get(Long.valueOf(supplierId)) };
+ }
+ return new Object[0];
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (bundle.getPackageImports().size() > 0) {
+ return bundle.getPackageImports().toArray();
+ }
+ return new Object[] { "<no imported packages>" };
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ bundle = (IBundle) newInput;
+ }
+ }
+
+ class PackageLabelProvider extends LabelProvider {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+ */
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof IPackageImport) {
+ return PDEPluginImages.get(PDEPluginImages.OBJ_DESC_PACKAGE);
+ }
+ else if (element instanceof IPackageExport) {
+ return PDEPluginImages.get(PDEPluginImages.OBJ_DESC_PACKAGE);
+ }
+ else if (element instanceof IBundle) {
+ return PDEPluginImages.get(PDEPluginImages.OBJ_DESC_BUNDLE);
+ }
+ return super.getImage(element);
+ }
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof IPackageImport) {
+ return ((IPackageImport) element).getName() + " (" + ((IPackageImport) element).getVersion() + ")";
+ }
+ else if (element instanceof IPackageExport) {
+ return ((IPackageExport) element).getName() + " (" + ((IPackageExport) element).getVersion() + ")";
+ }
+ else if (element instanceof IBundle) {
+ return ((IBundle) element).getSymbolicName() + " (" + ((IBundle) element).getVersion() + ")";
+ }
+ return super.getText(element);
+ }
+ }
+
+ class ServicePropertyComparator extends ViewerComparator {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ Map.Entry<String, String> p1 = (Entry<String, String>) e1;
+ Map.Entry<String, String> p2 = (Entry<String, String>) e2;
+ return p1.getKey().compareTo(p2.getKey());
+ }
+ }
+
+ class ServicePropertyContentProvider implements IStructuredContentProvider {
+
+ private IServiceReference ref;
+
+ public void dispose() {
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (ref != null) {
+ return ref.getProperties().entrySet().toArray();
+ }
+ return new Object[0];
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ if (newInput instanceof IServiceReference) {
+ ref = (IServiceReference) newInput;
+ }
+ else {
+ ref = null;
+ }
+ }
+
+ }
+
+ class ServicePropertyLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public String getColumnText(Object element, int columnIndex) {
+ Map.Entry<String, String> entry = (Entry<String, String>) element;
+ if (columnIndex == 0) {
+ return entry.getKey();
+ }
+ else if (columnIndex == 1) {
+ return entry.getValue();
+ }
+ return null;
+ }
+ }
+
+ class ServicesContentProvider implements ITreeContentProvider {
+
+ class ServicesHolder {
+
+ private final String label;
+
+ private final Set<IServiceReference> refs;
+
+ public ServicesHolder(Set<IServiceReference> refs, String label) {
+ this.refs = refs;
+ this.label = label;
+ }
+
+ /**
+ * @return the label
+ */
+ public String getLabel() {
+ return label;
+ }
+
+ public Set<IServiceReference> getRefs() {
+ return refs;
+ }
+ }
+
+ private IBundle bundle;
+
+ public void dispose() {
+
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof ServicesHolder) {
+ return ((ServicesHolder) parentElement).getRefs().toArray();
+ }
+ else if (parentElement instanceof IServiceReference) {
+ Set<IBundle> bs = new HashSet<IBundle>();
+ IServiceReference ref = (IServiceReference) parentElement;
+ if (ref.getType() == IServiceReference.Type.IN_USE) {
+ bs.add(bundles.get(ref.getBundleId()));
+ }
+ else if (ref.getType() == IServiceReference.Type.REGISTERED) {
+ for (Long id : ref.getUsingBundleIds()) {
+ bs.add(bundles.get(id));
+ }
+ }
+ return bs.toArray();
+ }
+ return new Object[0];
+ }
+
+ public Object[] getElements(Object inputElement) {
+ Set<ServicesHolder> serviceHolder = new HashSet<ServicesHolder>();
+ if (bundle.getRegisteredServices().size() > 0) {
+ serviceHolder.add(new ServicesHolder(bundle.getRegisteredServices(), "Registered Services"));
+ }
+ if (bundle.getServicesInUse().size() > 0) {
+ serviceHolder.add(new ServicesHolder(bundle.getServicesInUse(), "Services in Use"));
+ }
+ if (serviceHolder.size() > 0) {
+ return serviceHolder.toArray();
+ }
+ return new Object[] { "<no registered or used services>" };
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ bundle = (IBundle) newInput;
+ }
+ }
+
+ class ServicesLabelProvider extends LabelProvider {
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof IServiceReference) {
+ return PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_EXTENSIONS_OBJ);
+ }
+ else if (element instanceof ServicesHolder) {
+ return PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_EXTENSIONS_OBJ);
+ }
+ else if (element instanceof IBundle) {
+ return PDEPluginImages.get(PDEPluginImages.OBJ_DESC_BUNDLE);
+ }
+ return super.getImage(element);
+ }
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof IServiceReference) {
+ String id = ((IServiceReference) element).getProperties().get(Constants.SERVICE_ID);
+ if (id.length() > 0) {
+ return ((IServiceReference) element).getClazzes()[0] + " (" + id + ")";
+ }
+ return ((IServiceReference) element).getClazzes()[0];
+ }
+ else if (element instanceof IBundle) {
+ return ((IBundle) element).getSymbolicName() + " (" + ((IBundle) element).getVersion() + ")";
+ }
+ else if (element instanceof ServicesHolder) {
+ return ((ServicesHolder) element).getLabel();
+ }
+ return super.getText(element);
+ }
+ }
+
+ private IBundle bundle;
+
+ private Map<Long, IBundle> bundles;
+
+ private Text bundleSymbolicNameText;
+
+ private FilteredTree exportsTable;
+
+ private TreeViewer exportsTableViewer;
+
+ private Text idText;
+
+ private FilteredTree importsTable;
+
+ private TreeViewer importsTableViewer;
+
+ private Text locationText;
+
+ private Text manifestText;
+
+ private final BundleInformationMasterDetailsBlock masterDetailsBlock;
+
+ private Text providerText;
+
+ private Table servicePropertiesTable;
+
+ private TableViewer servicePropertiesTableViewer;
+
+ private FilteredTree servicesTable;
+
+ private TreeViewer servicesTableViewer;
+
+ private Text stateText;
+
+ private Text versionText;
+
+ public BundleInformationDetailsPart(BundleInformationMasterDetailsBlock bundleInformationMasterDetailsBlock) {
+ this.masterDetailsBlock = bundleInformationMasterDetailsBlock;
+ }
+
+ public void createContents(Composite parent) {
+ FormToolkit toolkit = getManagedForm().getToolkit();
+ GridLayout layout = new GridLayout();
+ layout.marginTop = -5;
+ layout.marginLeft = 6;
+ parent.setLayout(layout);
+
+ GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
+ Section detailsSection = toolkit.createSection(parent, ExpandableComposite.TWISTIE
+ | ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
+ | ExpandableComposite.FOCUS_TITLE);
+ detailsSection.setText("Bundle Details");
+ detailsSection.setDescription("Details about the selected bundle.");
+ detailsSection.setLayoutData(data);
+ createSectionToolbar(detailsSection, toolkit, new Action("Show dependency graph for bundle",
+ PDEPluginImages.DESC_COMGROUP_OBJ) {
+ @Override
+ public void run() {
+ masterDetailsBlock.openDependencyPage(bundle.getSymbolicName(), bundle.getVersion());
+ }
+ });
+
+ Composite detailsComposite = toolkit.createComposite(detailsSection);
+ layout = new GridLayout();
+ layout.numColumns = 4;
+ detailsComposite.setLayout(layout);
+
+ data = new GridData(GridData.FILL_BOTH);
+ data.minimumHeight = 100;
+ data.heightHint = 100;
+ detailsComposite.setLayoutData(data);
+
+ toolkit.paintBordersFor(detailsComposite);
+ detailsSection.setClient(detailsComposite);
+
+ Label idLabel = toolkit.createLabel(detailsComposite, "Id:");
+ idLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ idText = toolkit.createText(detailsComposite, "");
+ idText.setEditable(false);
+ idText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+
+ Label stateLabel = toolkit.createLabel(detailsComposite, "State:");
+ stateLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ stateText = toolkit.createText(detailsComposite, "", SWT.NONE);
+ stateText.setEditable(false);
+ stateText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+
+ Label bundleSymbolicNameLabel = toolkit.createLabel(detailsComposite, "Symbolic-Name:");
+ bundleSymbolicNameLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ bundleSymbolicNameText = toolkit.createText(detailsComposite, "", SWT.NONE);
+ bundleSymbolicNameText.setEditable(false);
+ bundleSymbolicNameText
+ .setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+ GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(bundleSymbolicNameText);
+
+ Label versionLabel = toolkit.createLabel(detailsComposite, "Version:");
+ versionLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ versionText = toolkit.createText(detailsComposite, "");
+ versionText.setEditable(false);
+ versionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+
+ Label providerLabel = toolkit.createLabel(detailsComposite, "Provider:");
+ providerLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ providerText = toolkit.createText(detailsComposite, "", SWT.NONE);
+ providerText.setEditable(false);
+ providerText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+
+ Label locationLabel = toolkit.createLabel(detailsComposite, "Location:");
+ locationLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ locationText = toolkit.createText(detailsComposite, "", SWT.NONE);
+ locationText.setEditable(false);
+ locationText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+ GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(locationText);
+
+ Link openDependenciesText = new Link(detailsComposite, SWT.NONE);
+ openDependenciesText.setText("<a href=\"open\">Show dependency graph for bundle</a>");
+ openDependenciesText.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ masterDetailsBlock.openDependencyPage(bundle.getSymbolicName(), bundle.getVersion());
+ }
+ });
+ GridDataFactory.fillDefaults().grab(true, false).span(4, 1).applyTo(openDependenciesText);
+
+ Section manifestSection = toolkit.createSection(parent, ExpandableComposite.TWISTIE
+ | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
+ manifestSection.setText("Manifest");
+ manifestSection.setDescription("Displays the bundle manifest.");
+ manifestSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+
+ Composite manifestComposite = toolkit.createComposite(manifestSection);
+ layout = new GridLayout();
+ layout.numColumns = 1;
+ manifestComposite.setLayout(layout);
+ manifestComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ toolkit.paintBordersFor(manifestComposite);
+ manifestSection.setClient(manifestComposite);
+ createSectionToolbar(manifestSection, toolkit, new Action("Open MANIFEST.MF in editor",
+ PDEPluginImages.DESC_TOC_LEAFTOPIC_OBJ) {
+ @Override
+ public void run() {
+ openBundleEditor(bundle);
+ }
+ });
+
+ manifestText = toolkit.createText(manifestComposite, "", SWT.MULTI | SWT.WRAP);
+ manifestText.setEditable(false);
+ manifestText.setFont(JFaceResources.getTextFont());
+ GC gc = new GC(manifestText);
+ FontMetrics fm = gc.getFontMetrics();
+ int height = 10 * fm.getHeight();
+ gc.dispose();
+
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.heightHint = manifestText.computeSize(SWT.DEFAULT, height).y;
+ manifestText.setLayoutData(data);
+
+ Link openManifestText = new Link(manifestComposite, SWT.NONE);
+ openManifestText.setText("<a href=\"open\">Open MANIFEST.MF in editor</a>");
+ openManifestText.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ openBundleEditor(bundle);
+ }
+ });
+
+ Section importsSection = toolkit.createSection(parent, ExpandableComposite.TWISTIE
+ | ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
+ | ExpandableComposite.FOCUS_TITLE);
+ importsSection.setText("Package Imports");
+ importsSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+ importsSection.setDescription("Information about visible packages and consumers of those packages.");
+
+ Composite importsComposite = toolkit.createComposite(importsSection);
+ layout = new GridLayout();
+ layout.numColumns = 1;
+ importsComposite.setLayout(layout);
+ importsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ toolkit.paintBordersFor(importsComposite);
+ importsSection.setClient(importsComposite);
+ ImageDescriptor collapseAllImageDescriptor = PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ELCL_COLLAPSEALL);
+ createSectionToolbar(importsSection, toolkit, new Action("Collapse All", collapseAllImageDescriptor) {
+ @Override
+ public void run() {
+ importsTableViewer.collapseAll();
+ }
+ });
+
+ importsTable = new FilteredTree(importsComposite, SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER,
+ new PatternFilter());
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.heightHint = 200;
+ importsTable.getViewer().getControl().setLayoutData(data);
+
+ importsTableViewer = importsTable.getViewer();
+ importsTableViewer.setContentProvider(new PackageImportContentProvider());
+ importsTableViewer.setLabelProvider(new PackageLabelProvider());
+ importsTableViewer.setAutoExpandLevel(2);
+
+ Section exportsSection = toolkit.createSection(parent, ExpandableComposite.TWISTIE
+ | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
+ exportsSection.setText("Package Exports");
+ exportsSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+ exportsSection.setDescription("Information about exported packages and bundles that use these packages.");
+
+ Composite exportsComposite = toolkit.createComposite(exportsSection);
+ layout = new GridLayout();
+ layout.numColumns = 1;
+ exportsComposite.setLayout(layout);
+ exportsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ toolkit.paintBordersFor(exportsComposite);
+ exportsSection.setClient(exportsComposite);
+ createSectionToolbar(exportsSection, toolkit, new Action("Collapse All", collapseAllImageDescriptor) {
+ @Override
+ public void run() {
+ exportsTableViewer.collapseAll();
+ }
+ });
+
+ exportsTable = new FilteredTree(exportsComposite, SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER,
+ new PatternFilter());
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.heightHint = 200;
+ exportsTable.getViewer().getControl().setLayoutData(data);
+
+ exportsTableViewer = exportsTable.getViewer();
+ exportsTableViewer.setContentProvider(new PackageExportContentProvider());
+ exportsTableViewer.setLabelProvider(new PackageLabelProvider());
+ exportsTableViewer.setAutoExpandLevel(2);
+
+ Section servicesSection = toolkit.createSection(parent, ExpandableComposite.TWISTIE
+ | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
+ servicesSection.setText("Services");
+ servicesSection.setDescription("Details about registered and in-use services.");
+ servicesSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+
+ Composite servicesComposite = toolkit.createComposite(servicesSection);
+ layout = new GridLayout();
+ layout.numColumns = 1;
+ servicesComposite.setLayout(layout);
+ servicesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ toolkit.paintBordersFor(servicesComposite);
+ servicesSection.setClient(servicesComposite);
+ createSectionToolbar(servicesSection, toolkit, new Action("Collapse All", collapseAllImageDescriptor) {
+ @Override
+ public void run() {
+ servicesTableViewer.collapseAll();
+ }
+ });
+
+ servicesTable = new FilteredTree(servicesComposite, SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER,
+ new PatternFilter());
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.heightHint = 200;
+ servicesTable.getViewer().getControl().setLayoutData(data);
+
+ servicesTableViewer = servicesTable.getViewer();
+ servicesTableViewer.setContentProvider(new ServicesContentProvider());
+ servicesTableViewer.setLabelProvider(new ServicesLabelProvider());
+ servicesTableViewer.setAutoExpandLevel(2);
+
+ servicesTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ servicePropertiesTableViewer.setInput(((IStructuredSelection) event.getSelection()).getFirstElement());
+ }
+ });
+
+ Label servicePropertiesLabel = toolkit.createLabel(servicesComposite, "Service Properties:");
+ servicePropertiesLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+
+ servicePropertiesTable = toolkit.createTable(servicesComposite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL
+ | SWT.FULL_SELECTION);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.heightHint = 100;
+ servicePropertiesTable.setLayoutData(data);
+ servicePropertiesTable.setLinesVisible(true);
+ TableColumn keyColumn = new TableColumn(servicePropertiesTable, SWT.LEFT);
+ keyColumn.setText("Key");
+ keyColumn.setWidth(150);
+ TableColumn valueColumn = new TableColumn(servicePropertiesTable, SWT.LEFT);
+ valueColumn.setText("Value");
+ valueColumn.setWidth(450);
+ servicePropertiesTable.setHeaderVisible(true);
+
+ servicePropertiesTableViewer = new TableViewer(servicePropertiesTable);
+ servicePropertiesTableViewer.setContentProvider(new ServicePropertyContentProvider());
+ servicePropertiesTableViewer.setLabelProvider(new ServicePropertyLabelProvider());
+ servicePropertiesTableViewer.setComparator(new ServicePropertyComparator());
+
+ }
+
+ public void refresh(Map<Long, IBundle> bundles) {
+ this.bundles = bundles;
+ }
+
+ public void selectionChanged(IFormPart part, ISelection selection) {
+ bundle = (IBundle) ((IStructuredSelection) selection).getFirstElement();
+
+ idText.setText(bundle.getId());
+ stateText.setText(bundle.getState());
+ bundleSymbolicNameText.setText(bundle.getSymbolicName());
+ versionText.setText(bundle.getVersion());
+ String vendor = bundle.getHeaders().get("Bundle-Vendor");
+ providerText.setText((vendor == null) ? "" : vendor);
+ locationText.setText(bundle.getLocation());
+
+ importsTableViewer.setInput(bundle);
+ importsTableViewer.setAutoExpandLevel(2);
+
+ exportsTableViewer.setInput(bundle);
+ exportsTableViewer.setAutoExpandLevel(2);
+
+ StringBuilder builder = new StringBuilder();
+ for (Map.Entry<String, String> header : bundle.getHeaders().entrySet()) {
+ builder.append(header.getKey()).append(": ").append(header.getValue()).append(Text.DELIMITER);
+ }
+ manifestText.setText(builder.toString());
+
+ servicesTableViewer.setInput(bundle);
+ servicesTableViewer.setAutoExpandLevel(2);
+
+ }
+
+ private void createSectionToolbar(Section section, FormToolkit toolkit, Action... actions) {
+ ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
+ ToolBar toolbar = toolBarManager.createControl(section);
+ final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
+ toolbar.setCursor(handCursor);
+ // Cursor needs to be explicitly disposed
+ toolbar.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ if ((handCursor != null) && (handCursor.isDisposed() == false)) {
+ handCursor.dispose();
+ }
+ }
+ });
+
+ for (Action action : actions) {
+ toolBarManager.add(action);
+ }
+
+ toolBarManager.update(true);
+
+ section.setTextClient(toolbar);
+ }
+
+
+
+ private void openBundleEditor(IBundle bundle) {
+ try {
+ String fileName = "META-INF/MANIFEST.MF";
+ IEditorInput input = getEditorInput(getBundleRoot(bundle), fileName);
+ IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(fileName, getContentType());
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ page.openEditor(input, desc.getId());
+ } catch (Exception e) {
+ EditorUIPlugin.log(e);
+ }
+ }
+
+ private File getBundleRoot(IBundle bundle) throws URISyntaxException {
+ String location = bundle.getLocation();
+
+ // if location URI starts with "reference:" then remove it
+ if (location.startsWith("reference:")) {
+ location = location.substring("reference:".length());
+ }
+
+ File bundleRoot;
+ if (location.startsWith("file:/")) {
+ // this is a valid file URI
+ bundleRoot = new File(new URI(location));
+ } else if (location.startsWith("file:")) {
+ // this is an invalid file URI, probably it's a standard file path
+ location = location.substring("file:".length());
+ bundleRoot = new File(location);
+ } else {
+ // not a file URI or a standard file path - very high chance to throw exception
+ bundleRoot = new File(new URI(location));
+ }
+ return bundleRoot;
+ }
+
+ private IEditorInput getEditorInput(File bundleRoot, String filename) {
+ IEditorInput input = null;
+ if (bundleRoot.isFile()) {
+ try {
+ ZipFile zipFile = new ZipFile(bundleRoot);
+ if (zipFile.getEntry(filename) != null) {
+ input = new JarEntryEditorInput(new JarEntryFile(zipFile, filename));
+ }
+ }
+ catch (IOException e) {
+ }
+ }
+ else {
+ File file = new File(bundleRoot, filename);
+ if (file.exists()) {
+ IFileStore store;
+ try {
+ store = EFS.getStore(file.toURI());
+ input = new FileStoreEditorInput(store);
+ }
+ catch (CoreException e) {
+ }
+ }
+ }
+ return input;
+ }
+
+ private IContentType getContentType() {
+ // first check if an add-on (like Virgo Tooling) has registered a specialized content type
+ IContentType type = Platform.getContentTypeManager().findContentTypeFor("META-INF/MANIFEST.MF");
+ if (type == null) {
+ // then check if PDE is available
+ type = Platform.getContentTypeManager().getContentType("org.eclipse.pde.bundleManifest");
+ }
+ if (type == null) {
+ // in worst case use the default plain text content type
+ type = Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT);
+ }
+ return type;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationMasterDetailsBlock.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationMasterDetailsBlock.java
new file mode 100644
index 0000000..18af1c6
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationMasterDetailsBlock.java
@@ -0,0 +1,296 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - moving to Eclipse Libra project and enhancements
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.internal.overview;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.libra.framework.editor.core.model.IBundle;
+import org.eclipse.libra.framework.editor.ui.dependencies.BundleDependencyEditorPage;
+import org.eclipse.libra.framework.editor.ui.overview.BundleInformationEditorPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Sash;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.forms.DetailsPart;
+import org.eclipse.ui.forms.FormColors;
+import org.eclipse.ui.forms.IDetailsPage;
+import org.eclipse.ui.forms.IDetailsPageProvider;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.MasterDetailsBlock;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.part.MultiPageEditorPart;
+import org.eclipse.wst.server.core.IServer;
+
+/**
+ * @author Christian Dupuis
+ * @author Steffen Pingel
+ * @author Kaloyan Raev
+ */
+public class BundleInformationMasterDetailsBlock extends MasterDetailsBlock {
+
+ private BundleInformationDetailsPart detailsPart;
+
+ private BundleInformationMasterPart masterPart;
+
+ private final MultiPageEditorPart serverEditor;
+
+ private final BundleInformationEditorPage editorPage;
+
+ private final IServer server;
+
+ public BundleInformationMasterDetailsBlock(BundleInformationEditorPage bundleInformationEditorPage,
+ MultiPageEditorPart serverEditor, IServer server) {
+ this.editorPage = bundleInformationEditorPage;
+ this.serverEditor = serverEditor;
+ this.server = server;
+ }
+
+ @Override
+ public void createContent(IManagedForm managedForm) {
+ final ScrolledForm form = managedForm.getForm();
+ FormToolkit toolkit = managedForm.getToolkit();
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ form.getBody().setLayout(layout);
+ sashForm = new MDSashForm(form.getBody(), SWT.NULL);
+ sashForm.setData("form", managedForm); //$NON-NLS-1$
+ toolkit.adapt(sashForm, false, false);
+ sashForm.setMenu(form.getBody().getMenu());
+ sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
+ createMasterPart(managedForm, sashForm);
+ createDetailsPart(managedForm, sashForm);
+ hookResizeListener();
+ createToolBarActions(managedForm);
+ form.updateToolBar();
+
+ layout = new GridLayout(1, true);
+ layout.marginTop = 6;
+ layout.marginLeft = 6;
+ managedForm.getForm().getBody().setLayout(layout);
+ }
+
+ private void createDetailsPart(final IManagedForm mform, Composite parent) {
+ super.detailsPart = new DetailsPart(mform, mform.getToolkit().createPageBook(parent, SWT.V_SCROLL));
+ mform.addPart(super.detailsPart);
+ registerPages(super.detailsPart);
+ }
+
+ @Override
+ protected void createMasterPart(final IManagedForm managedForm, Composite parent) {
+ masterPart = new BundleInformationMasterPart(parent, managedForm.getToolkit(), ExpandableComposite.TWISTIE
+ | ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
+ | ExpandableComposite.FOCUS_TITLE, this);
+ managedForm.addPart(masterPart);
+ masterPart.createContents();
+ }
+
+ @Override
+ protected void createToolBarActions(IManagedForm managedForm) {
+
+ }
+
+ @Override
+ protected void registerPages(DetailsPart detailsPart) {
+ this.detailsPart = new BundleInformationDetailsPart(this);
+ detailsPart.setPageProvider(new IDetailsPageProvider() {
+
+ public Object getPageKey(Object object) {
+ if (object instanceof IBundle) {
+ return IBundle.class;
+ }
+ return object.getClass();
+ }
+
+ public IDetailsPage getPage(Object key) {
+ if (key.equals(IBundle.class)) {
+ return BundleInformationMasterDetailsBlock.this.detailsPart;
+ }
+ return null;
+ }
+ });
+ }
+
+ /**
+ * @param bundles
+ */
+ public void refresh(Map<Long, IBundle> bundles) {
+ if (masterPart.refresh(bundles)) {
+ detailsPart.refresh(bundles);
+
+ BundleDependencyEditorPage depPage = getDependencyPage();
+ if (depPage != null) {
+ depPage.refresh(bundles);
+ }
+ }
+ }
+
+ private void hookResizeListener() {
+ Listener listener = ((MDSashForm) sashForm).listener;
+ Control[] children = sashForm.getChildren();
+ for (Control element : children) {
+ if (element instanceof Sash) {
+ continue;
+ }
+ element.addListener(SWT.Resize, listener);
+ }
+ }
+
+ private void onSashPaint(Event e) {
+ Sash sash = (Sash) e.widget;
+ IManagedForm form = (IManagedForm) sash.getParent().getData("form"); //$NON-NLS-1$
+ FormColors colors = form.getToolkit().getColors();
+ boolean vertical = (sash.getStyle() & SWT.VERTICAL) != 0;
+ GC gc = e.gc;
+ Boolean hover = (Boolean) sash.getData("hover"); //$NON-NLS-1$
+ gc.setBackground(colors.getColor(IFormColors.TB_BG));
+ gc.setForeground(colors.getColor(IFormColors.TB_BORDER));
+ Point size = sash.getSize();
+ if (vertical) {
+ if (hover != null) {
+ gc.fillRectangle(0, 0, size.x, size.y);
+ // else
+ // gc.drawLine(1, 0, 1, size.y-1);
+ }
+ }
+ else {
+ if (hover != null) {
+ gc.fillRectangle(0, 0, size.x, size.y);
+ // else
+ // gc.drawLine(0, 1, size.x-1, 1);
+ }
+ }
+ }
+
+ class MDSashForm extends SashForm {
+
+ List<Sash> sashes = new ArrayList<Sash>();
+
+ Listener listener = new Listener() {
+ public void handleEvent(Event e) {
+ switch (e.type) {
+ case SWT.MouseEnter:
+ e.widget.setData("hover", Boolean.TRUE); //$NON-NLS-1$
+ ((Control) e.widget).redraw();
+ break;
+ case SWT.MouseExit:
+ e.widget.setData("hover", null); //$NON-NLS-1$
+ ((Control) e.widget).redraw();
+ break;
+ case SWT.Paint:
+ onSashPaint(e);
+ break;
+ case SWT.Resize:
+ hookSashListeners();
+ break;
+ }
+ }
+ };
+
+ public MDSashForm(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ public void layout(boolean changed) {
+ super.layout(changed);
+ hookSashListeners();
+ }
+
+ public void layout(Control[] children) {
+ super.layout(children);
+ hookSashListeners();
+ }
+
+ private void hookSashListeners() {
+ purgeSashes();
+ Control[] children = getChildren();
+ for (Control element : children) {
+ if (element instanceof Sash) {
+ Sash sash = (Sash) element;
+ if (sashes.contains(sash)) {
+ continue;
+ }
+ sash.addListener(SWT.Paint, listener);
+ sash.addListener(SWT.MouseEnter, listener);
+ sash.addListener(SWT.MouseExit, listener);
+ sashes.add(sash);
+ }
+ }
+ }
+
+ private void purgeSashes() {
+ for (Iterator<Sash> iter = sashes.iterator(); iter.hasNext();) {
+ Sash sash = iter.next();
+ if (sash.isDisposed()) {
+ iter.remove();
+ }
+ }
+ }
+ }
+
+ public void clear() {
+ masterPart.clear();
+ }
+
+ private BundleDependencyEditorPage getDependencyPage() {
+ IEditorPart[] parts = serverEditor.findEditors(editorPage.getEditorInput());
+ for (IEditorPart part : parts) {
+ if (part instanceof BundleDependencyEditorPage) {
+ return (BundleDependencyEditorPage) part;
+ }
+ }
+ return null;
+ }
+
+ public void openDependencyPage(String bundle, String version) {
+ BundleDependencyEditorPage depPage = getDependencyPage();
+ if (depPage != null) {
+ serverEditor.setActiveEditor(depPage);
+ depPage.showDependenciesForBundle(bundle, version);
+ }
+ }
+
+ /**
+ * @return the server
+ */
+ public IServer getServer() {
+ return server;
+ }
+
+ public void setSelectedBundle(IBundle bundle) {
+ masterPart.setSelectedBundle(bundle);
+ }
+
+ public void refresh() {
+ masterPart.updateButtonState();
+ }
+
+ public BundleInformationEditorPage getEditorPage() {
+ return this.editorPage;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationMasterPart.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationMasterPart.java
new file mode 100644
index 0000000..317afc2
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/internal/overview/BundleInformationMasterPart.java
@@ -0,0 +1,518 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - moving to Eclipse Libra project and enhancements
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.internal.overview;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.libra.framework.editor.core.IOSGiFrameworkAdmin;
+import org.eclipse.libra.framework.editor.core.model.IBundle;
+import org.eclipse.libra.framework.editor.ui.internal.EditorUIPlugin;
+import org.eclipse.pde.internal.ui.PDEPluginImages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Image;
+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.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.ui.forms.SectionPart;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.internal.browser.ImageResource;
+import org.eclipse.ui.internal.ide.StringMatcher;
+
+
+/**
+ * @author Christian Dupuis
+ * @author Steffen Pingel
+ * @author Kaloyan Raev
+ */
+@SuppressWarnings("restriction")
+public class BundleInformationMasterPart extends SectionPart {
+
+ private static final String TYPE_FILTER_TEXT = "type filter text";
+
+ private final FormToolkit toolkit;
+
+ private StructuredViewer bundleTableViewer;
+
+ private Table bundleTable;
+
+ private Button startButton;
+
+ private Button stopButton;
+
+ private Button refreshButton;
+
+ private Button updateButton;
+
+ private Text filterText;
+
+ private TableColumn idColumn;
+
+ private TableColumn symbolicNameColumn;
+
+ private TableColumn statusColumn;
+
+ private final BundleInformationMasterDetailsBlock masterDetailsBlock;
+
+ public BundleInformationMasterPart(Composite parent, FormToolkit toolkit, int style,
+ BundleInformationMasterDetailsBlock masterDetailsBlock) {
+ super(parent, toolkit, style);
+ this.toolkit = toolkit;
+ this.masterDetailsBlock = masterDetailsBlock;
+ }
+
+ protected void createContents() {
+ Section section = getSection();
+ section.setText("Bundle Status");
+ section.setDescription("Information about installed bundles on server.");
+ section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+ createSectionToolbar(section, toolkit);
+
+ Composite composite = toolkit.createComposite(section);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
+ toolkit.paintBordersFor(composite);
+ section.setClient(composite);
+
+ filterText = toolkit.createText(composite, TYPE_FILTER_TEXT, SWT.SEARCH | SWT.CANCEL);
+ filterText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ bundleTableViewer.refresh();
+ }
+ });
+ GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
+ filterText.setLayoutData(data);
+
+ toolkit.createLabel(composite, "", SWT.NONE);
+
+ bundleTable = toolkit.createTable(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
+ data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
+ data.heightHint = 550;
+ bundleTable.setLayoutData(data);
+ bundleTable.setLinesVisible(true);
+ TableColumn imageColumn = new TableColumn(bundleTable, SWT.LEFT);
+ imageColumn.setWidth(23);
+ idColumn = new TableColumn(bundleTable, SWT.RIGHT);
+ idColumn.setText("Id");
+ idColumn.setWidth(50);
+ idColumn.addListener(SWT.Selection, new SortingListener());
+ symbolicNameColumn = new TableColumn(bundleTable, SWT.LEFT);
+ symbolicNameColumn.setText("Symbolic-Name");
+ symbolicNameColumn.setWidth(280);
+ symbolicNameColumn.addListener(SWT.Selection, new SortingListener());
+ statusColumn = new TableColumn(bundleTable, SWT.CENTER);
+ statusColumn.setText("Status");
+ statusColumn.setWidth(70);
+ statusColumn.addListener(SWT.Selection, new SortingListener());
+
+ bundleTableViewer = new TableViewer(bundleTable);
+ bundleTableViewer.setContentProvider(new BundleStatusContentProvider());
+ bundleTableViewer.setLabelProvider(new BundleStatusLabelProvider());
+
+ bundleTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ getManagedForm().fireSelectionChanged(BundleInformationMasterPart.this, event.getSelection());
+ }
+ });
+ bundleTableViewer.addFilter(new ViewerFilter() {
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof IBundle && filterText.getText().length() > 0
+ && !TYPE_FILTER_TEXT.equals(filterText.getText())) {
+ StringMatcher matcher = new StringMatcher(filterText.getText() + "*", true, false);
+ return (matcher.match(((IBundle) element).getSymbolicName()));
+ }
+ return true;
+ }
+ });
+ bundleTable.setHeaderVisible(true);
+ bundleTableViewer.setComparator(new BundleSorter(SORT_COLUMN.ID, SWT.UP));
+
+ Composite buttonComposite = new Composite(composite, SWT.NONE);
+ buttonComposite.setLayout(new GridLayout(1, true));
+ data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
+ buttonComposite.setLayoutData(data);
+
+ startButton = toolkit.createButton(buttonComposite, "Start", SWT.PUSH);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = 70;
+ startButton.setLayoutData(data);
+ startButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ executeServerCommand("start");
+ }
+
+ });
+
+ stopButton = toolkit.createButton(buttonComposite, "Stop", SWT.PUSH);
+ stopButton.setLayoutData(data);
+ stopButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ executeServerCommand("stop");
+ }
+
+ });
+
+ refreshButton = toolkit.createButton(buttonComposite, "Refresh", SWT.PUSH);
+ refreshButton.setLayoutData(data);
+ refreshButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ executeServerCommand("refresh");
+ }
+
+ });
+
+ updateButton = toolkit.createButton(buttonComposite, "Update", SWT.PUSH);
+ updateButton.setLayoutData(data);
+ updateButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ executeServerCommand("update");
+ }
+
+ });
+
+ bundleTableViewer.addPostSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateButtonState();
+ }
+ });
+ updateButtonState();
+ }
+
+ void updateButtonState() {
+ boolean bundleSelected = getSelectedBundle() != null;
+ startButton.setEnabled(bundleSelected);
+ stopButton.setEnabled(bundleSelected);
+ refreshButton.setEnabled(bundleSelected);
+ updateButton.setEnabled(bundleSelected);
+ }
+
+ private IBundle getSelectedBundle() {
+ Object selectedObject = ((IStructuredSelection) bundleTableViewer
+ .getSelection()).getFirstElement();
+ if (selectedObject instanceof IBundle) {
+ return (IBundle) selectedObject;
+ }
+ return null;
+ }
+
+ private void executeServerCommand(final String command) {
+ IBundle bundle = getSelectedBundle();
+ if (bundle != null) {
+ final long bundleId = Long.parseLong(bundle.getId());
+ Job commandJob = new Job("Execute server command '" + command + "'") {
+
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ final IOSGiFrameworkAdmin admin = (IOSGiFrameworkAdmin) masterDetailsBlock.getServer()
+ .loadAdapter(IOSGiFrameworkAdmin.class, null);
+ try {
+ if ("start".equals(command)) {
+ admin.startBundle(bundleId);
+ } else if ("stop".equals(command)) {
+ admin.stopBundle(bundleId);
+ } else if ("refresh".equals(command)) {
+ admin.refreshBundle(bundleId);
+ } else if ("update".equals(command)) {
+ admin.updateBundle(bundleId);
+ }
+
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ try {
+ masterDetailsBlock.refresh(admin.getBundles(monitor));
+ } catch (CoreException e) {
+ EditorUIPlugin.log(e);
+ }
+ }
+ });
+
+ return Status.OK_STATUS;
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ }
+ };
+ commandJob.setSystem(true);
+ commandJob.schedule();
+ }
+ }
+
+ private void createSectionToolbar(Section section, FormToolkit toolkit) {
+ ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
+ ToolBar toolbar = toolBarManager.createControl(section);
+ final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
+ toolbar.setCursor(handCursor);
+ // Cursor needs to be explicitly disposed
+ toolbar.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ if ((handCursor != null) && (handCursor.isDisposed() == false)) {
+ handCursor.dispose();
+ }
+ }
+ });
+
+ toolBarManager.add(new Action("Refresh", ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_NAV_REFRESH)) {
+
+ @Override
+ public void run() {
+
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+
+ public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ monitor.beginTask("Updating bundle status from server", 1);
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ masterDetailsBlock.getEditorPage().clearStatus();
+
+ IOSGiFrameworkAdmin admin = (IOSGiFrameworkAdmin) masterDetailsBlock.getServer()
+ .loadAdapter(IOSGiFrameworkAdmin.class, monitor);
+
+ if (admin == null) {
+ IStatus status = EditorUIPlugin.newErrorStatus("Bundle Overview editor part is not integrated with the runtime.");
+ EditorUIPlugin.log(status);
+ masterDetailsBlock.getEditorPage().setStatus(status);
+ }
+
+ try {
+ masterDetailsBlock.refresh(admin.getBundles(monitor));
+ } catch (CoreException e) {
+ EditorUIPlugin.log(e);
+ masterDetailsBlock.getEditorPage().setStatus(e.getStatus());
+ }
+ }
+ });
+ monitor.worked(1);
+ }
+ };
+
+ try {
+ IRunnableContext context = new ProgressMonitorDialog(Display.getCurrent().getActiveShell());
+ context.run(true, true, runnable);
+ }
+ catch (InvocationTargetException e1) {
+ }
+ catch (InterruptedException e2) {
+ }
+
+ }
+
+ });
+
+ toolBarManager.update(true);
+
+ section.setTextClient(toolbar);
+ }
+
+ public boolean refresh(Map<Long, IBundle> bundles) {
+ if (bundles != null && !bundles.equals(bundleTableViewer.getInput())) {
+ super.refresh();
+ bundleTableViewer.setInput(bundles);
+ return true;
+ }
+ return false;
+ }
+
+ public void clear() {
+ bundleTableViewer.setInput(null);
+ }
+
+ class BundleStatusContentProvider implements IStructuredContentProvider {
+
+ private Map<Long, IBundle> bundles;
+
+ public Object[] getElements(Object inputElement) {
+ if (bundles != null) {
+ return bundles.values().toArray();
+ }
+ return new Object[0];
+ }
+
+ public void dispose() {
+ }
+
+ @SuppressWarnings("unchecked")
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ if (newInput instanceof Map) {
+ bundles = (Map<Long, IBundle>) newInput;
+ }
+ else {
+ bundles = null;
+ }
+ }
+
+ }
+
+ class BundleStatusLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ switch (columnIndex) {
+ case 0:
+ return PDEPluginImages.get(PDEPluginImages.OBJ_DESC_BUNDLE);
+ default:
+ return null;
+ }
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ IBundle bundle = (IBundle) element;
+ switch (columnIndex) {
+ case 1:
+ return bundle.getId();
+ case 2:
+ return bundle.getSymbolicName() + " (" + bundle.getVersion() + ")";
+ case 3:
+ return bundle.getState();
+ default:
+ return "";
+ }
+ }
+ }
+
+ class BundleStatusComparator extends ViewerComparator {
+ @Override
+ public void sort(Viewer viewer, Object[] elements) {
+ Arrays.sort(elements, new Comparator<Object>() {
+
+ public int compare(Object o1, Object o2) {
+ return Long.valueOf(((IBundle) o1).getId()).compareTo(Long.valueOf(((IBundle) o2).getId()));
+ }
+ });
+ }
+ }
+
+ class SortingListener implements Listener {
+
+ public void handleEvent(Event event) {
+ // determine new sort column and direction
+ TableColumn sortColumn = bundleTable.getSortColumn();
+ TableColumn currentColumn = (TableColumn) event.widget;
+ int dir = bundleTable.getSortDirection();
+ if (sortColumn == currentColumn) {
+ dir = dir == SWT.UP ? SWT.DOWN : SWT.UP;
+ }
+ else {
+ bundleTable.setSortColumn(currentColumn);
+ dir = SWT.UP;
+ }
+ // sort the data based on column and direction
+ SORT_COLUMN sortIdentifier = null;
+ if (currentColumn == idColumn) {
+ sortIdentifier = SORT_COLUMN.ID;
+ }
+ if (currentColumn == statusColumn) {
+ sortIdentifier = SORT_COLUMN.STATUS;
+ }
+ if (currentColumn == symbolicNameColumn) {
+ sortIdentifier = SORT_COLUMN.NAME;
+ }
+ bundleTable.setSortDirection(dir);
+ bundleTableViewer.setComparator(new BundleSorter(sortIdentifier, dir));
+ bundleTableViewer.refresh();
+ }
+ }
+
+ class BundleSorter extends ViewerComparator {
+
+ private final SORT_COLUMN sortColumn;
+
+ private final int dir;
+
+ public BundleSorter(SORT_COLUMN sortCoLumn, int dir) {
+ this.sortColumn = sortCoLumn;
+ this.dir = dir;
+ }
+
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ IBundle b1 = (IBundle) e1;
+ IBundle b2 = (IBundle) e2;
+ int compare = 0;
+ switch (sortColumn) {
+ case ID:
+ compare = Long.valueOf(b1.getId()).compareTo(Long.valueOf(b2.getId()));
+ break;
+ case STATUS:
+ compare = b1.getState().compareTo(b2.getState());
+ break;
+ case NAME:
+ compare = b1.getSymbolicName().compareTo(b2.getSymbolicName());
+ break;
+ }
+ if (this.dir == SWT.DOWN) {
+ compare = compare * -1;
+ }
+ return compare;
+ }
+ }
+
+ enum SORT_COLUMN {
+ ID, STATUS, NAME
+ }
+
+ public void setSelectedBundle(IBundle bundle) {
+ this.bundleTableViewer.setSelection(new StructuredSelection(bundle));
+ this.bundleTableViewer.reveal(bundle);
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/overview/BundleInformationEditorPage.java b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/overview/BundleInformationEditorPage.java
new file mode 100644
index 0000000..94c0bdc
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.editor.ui/src/org/eclipse/libra/framework/editor/ui/overview/BundleInformationEditorPage.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 SpringSource, a divison of VMware, Inc. 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:
+ * SpringSource, a division of VMware, Inc. - initial API and implementation
+ * SAP AG - moving to Eclipse Libra project and enhancements
+ *******************************************************************************/
+package org.eclipse.libra.framework.editor.ui.overview;
+
+import java.util.Map;
+
+import org.eclipse.libra.framework.editor.core.model.IBundle;
+import org.eclipse.libra.framework.editor.ui.internal.AbstractBundleEditorPage;
+import org.eclipse.libra.framework.editor.ui.internal.overview.BundleInformationMasterDetailsBlock;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.forms.ManagedForm;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.wst.server.ui.ServerUICore;
+import org.eclipse.wst.server.ui.internal.editor.ServerEditorPartInput;
+import org.eclipse.wst.server.ui.internal.editor.ServerResourceCommandManager;
+
+
+/**
+ * @author Christian Dupuis
+ * @author Steffen Pingel
+ * @author Kaloyan Raev
+ */
+@SuppressWarnings("restriction")
+public class BundleInformationEditorPage extends AbstractBundleEditorPage {
+
+ private BundleInformationMasterDetailsBlock masterDetailsBlock;
+
+ private ServerResourceCommandManager commandManager;
+
+ protected void createBundleContent(Composite parent) {
+ if (mform == null) {
+ mform = new ManagedForm(parent);
+ }
+
+ FormToolkit toolkit = getFormToolkit(parent.getDisplay());
+
+ sform = mform.getForm();
+ sform.getForm().setSeparatorVisible(true);
+ sform.getForm().setText("Bundle Information");
+ sform.setExpandHorizontal(true);
+ sform.setExpandVertical(true);
+ sform.setImage(ServerUICore.getLabelProvider().getImage(getServer()));
+ toolkit.decorateFormHeading(sform.getForm());
+
+ masterDetailsBlock = new BundleInformationMasterDetailsBlock(this, commandManager.getServerEditor(),
+ getServer().getOriginal());
+ masterDetailsBlock.createContent(mform);
+
+ }
+
+ @Override
+ protected void enablePage() {
+ super.enablePage();
+ setInfoStatus("Click the 'Refresh' button for fetching data from server.");
+ masterDetailsBlock.refresh();
+ }
+
+ protected void disablePage() {
+ super.disablePage();
+ masterDetailsBlock.clear();
+ }
+
+ public void init(IEditorSite site, IEditorInput input) {
+ super.init(site, input);
+ commandManager = ((ServerEditorPartInput) input).getServerCommandManager();
+ }
+
+ public void showOverviewForBundle(final IBundle bundle) {
+ masterDetailsBlock.setSelectedBundle(bundle);
+ }
+
+ public void refresh(Map<Long, IBundle> bundles) {
+ masterDetailsBlock.refresh(bundles);
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/.classpath b/plugins/org.eclipse.libra.framework.equinox.ui/.classpath
new file mode 100644
index 0000000..64c5e31
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/.cvsignore b/plugins/org.eclipse.libra.framework.equinox.ui/.cvsignore
new file mode 100644
index 0000000..4571f2d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/.cvsignore
@@ -0,0 +1,8 @@
+bin
+build.xml
+org.eclipse.jst.server.tomcat.ui_3.0.0.jar
+tomcatui.jar
+temp.folder
+@dot
+src.zip
+javaCompiler...args
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/.options b/plugins/org.eclipse.libra.framework.equinox.ui/.options
new file mode 100644
index 0000000..d88b03b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/.options
@@ -0,0 +1,4 @@
+# Debugging options for the org.eclipse.jst.server.tomcat.ui plugin
+
+# Turn on general debugging
+org.eclipse.jst.server.tomcat.ui/debug=true
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/.project b/plugins/org.eclipse.libra.framework.equinox.ui/.project
new file mode 100644
index 0000000..ff0f7a4
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.libra.framework.equinox.ui</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.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.libra.framework.equinox.ui/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..c8be432
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Fri Nov 10 17:11:35 HST 2006
+eclipse.preferences.version=1
+encoding/<project>=ISO-8859-1
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.libra.framework.equinox.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..87e641f
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,74 @@
+#Sat Oct 16 21:03:45 EEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=error
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,*.testsuite,*.deploy,*.location,*.execution,*.datapool,*.artifact,*.html,*.svg
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=disabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=error
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.incompatibleJDKLevel=warning
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.libra.framework.equinox.ui/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..584bdff
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,4 @@
+#Fri Nov 10 18:06:11 HST 2006
+eclipse.preferences.version=1
+internal.default.compliance=user
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?>\n<templates/>
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.libra.framework.equinox.ui/.settings/org.eclipse.pde.prefs
new file mode 100644
index 0000000..0e06e96
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/.settings/org.eclipse.pde.prefs
@@ -0,0 +1,15 @@
+#Mon Jan 15 21:56:48 EST 2007
+compilers.incompatible-environment=0
+compilers.p.build=0
+compilers.p.deprecated=1
+compilers.p.missing-packages=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=0
+compilers.p.unknown-element=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.libra.framework.equinox.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..72ff9a5
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,29 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.libra.framework.equinox.ui;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.libra.framework.equinox.ui.EquinoxUIPlugin
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.expressions;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jdt.debug.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jdt.launching;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.wst.server.core;bundle-version="[1.0.204,2.0.0)",
+ org.eclipse.jst.server.core;bundle-version="[1.0.103,2.0.0)",
+ org.eclipse.jst.server.ui;bundle-version="[1.0.103,2.0.0)",
+ org.eclipse.wst.common.project.facet.ui;bundle-version="[1.1.0,2.0.0)",
+ org.eclipse.wst.server.ui,
+ org.eclipse.pde.core,
+ org.eclipse.pde.ui,
+ org.eclipse.libra.framework.core,
+ org.eclipse.libra.framework.ui,
+ org.eclipse.libra.framework.equinox
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/about.html b/plugins/org.eclipse.libra.framework.equinox.ui/about.html
new file mode 100644
index 0000000..8f31159
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>March 25, 2011</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/build.properties b/plugins/org.eclipse.libra.framework.equinox.ui/build.properties
new file mode 100644
index 0000000..5016daa
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/build.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+bin.includes = plugin.xml,\
+ plugin.properties,\
+ icons/,\
+ .,\
+ META-INF/,\
+ about.html
+bin.excludes = bin/**,\
+ @dot/**,\
+ temp.folder/**
+source.. = src/
+
+
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/equinox.gif b/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/equinox.gif
new file mode 100644
index 0000000..f22fde1
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/equinox.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/mime_extension.gif b/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/mime_extension.gif
new file mode 100644
index 0000000..c585010
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/mime_extension.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/mime_mapping.gif b/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/mime_mapping.gif
new file mode 100644
index 0000000..0a8e4bf
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/mime_mapping.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/port.gif b/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/port.gif
new file mode 100644
index 0000000..7a354b7
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/port.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/project_missing.gif b/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/project_missing.gif
new file mode 100644
index 0000000..0cb4c16
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/project_missing.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/web_module.gif b/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/web_module.gif
new file mode 100644
index 0000000..bf20f70
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/icons/obj16/web_module.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/icons/wizban/felix_wiz.png b/plugins/org.eclipse.libra.framework.equinox.ui/icons/wizban/felix_wiz.png
new file mode 100644
index 0000000..05d4925
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/icons/wizban/felix_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/plugin.properties b/plugins/org.eclipse.libra.framework.equinox.ui/plugin.properties
new file mode 100644
index 0000000..7c765f4
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/plugin.properties
@@ -0,0 +1,21 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+pluginName=Equinox UI Support
+providerName=Eteration A.S.
+
+configurationEditorOSGiModulesPage=Modules
+configurationEditorTargetPage=Target Platform Profile
+
+cleanWorkDir=Clean Equinox Work Directory...
+cleanModuleWorkDir=Clean Module Work Directory...
+
+publisherContextFixLabel=Update context paths
+publisherContextFixDescription=Prompt to update module contexts when they are out of sync.
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/plugin.xml b/plugins/org.eclipse.libra.framework.equinox.ui/plugin.xml
new file mode 100644
index 0000000..ea09df2
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/plugin.xml
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2010 Eteration A.S. 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:
+ Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ -->
+
+<plugin>
+ <extension point="org.eclipse.wst.server.ui.serverImages">
+
+ <image
+ id="org.eclipse.libra.framework.equinox.30x"
+ icon="icons/obj16/equinox.gif"
+ typeIds="org.eclipse.libra.framework.equinox.serverType.30x"/>
+
+ <image
+ id="org.eclipse.libra.framework.equinox.runtimeType.30x"
+ icon="icons/obj16/equinox.gif"
+ typeIds="org.eclipse.libra.framework.equinox.runtimeType.30x"/>
+ </extension>
+
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ id="org.eclipse.libra.framework.equinox.ui.propertyTester"
+ namespace="org.eclipse.libra.framework.equinox.ui"
+ properties="hasConfiguration"
+ type="java.lang.Object"
+ class="org.eclipse.libra.framework.equinox.ui.internal.ConfigurationPropertyTester">
+ </propertyTester>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.ui.editorPages">
+ <page
+ id="org.eclipse.libra.framework.equinox.ui.editor.osgimodule"
+ order="20"
+ name="%configurationEditorOSGiModulesPage"
+ typeIds="org.eclipse.libra.framework.equinox.serverType.*"
+ class="org.eclipse.libra.framework.ui.internal.editor.ConfigurationOSGiModuleEditorPart">
+ <enablement>
+ <test property="org.eclipse.libra.framework.equinox.ui.hasConfiguration" value="true"/>
+ </enablement>
+ </page>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.ui.editorPages">
+ <page
+ id="org.eclipse.libra.framework.equinox.ui.editor.osgimodule"
+ order="22"
+ name="Target Platform Profile"
+ typeIds="org.eclipse.libra.framework.equinox.serverType.*"
+ class="org.eclipse.libra.framework.ui.internal.editor.TargetDefinitionEditorPart">
+ <enablement>
+ <test property="org.eclipse.libra.framework.equinox.ui.hasConfiguration" value="true"/>
+ </enablement>
+ </page>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.ui.editorPageSections">
+ <section
+ id="org.eclipse.libra.framework.equinox.editor.instance"
+ order="0"
+ insertionId="org.eclipse.wst.server.editor.overview.left"
+ typeIds="org.eclipse.libra.framework.equinox.serverType.*"
+ class="org.eclipse.libra.framework.ui.internal.editor.FrameworkInstanceLocationEditorSection"/>
+
+ </extension>
+
+ <extension point="org.eclipse.wst.server.ui.editorPageSections">
+ <section
+ id="org.eclipse.libra.framework.equinox.editor.instance.javaprofile"
+ order="0"
+ insertionId="org.eclipse.wst.server.editor.overview.right"
+ typeIds="org.eclipse.libra.framework.equinox.serverType.*"
+ class="org.eclipse.libra.framework.equinox.ui.internal.JavaProfileEditorSection"/>
+ <section
+ id="org.eclipse.libra.framework.equinox.editor.instance.jmxconsole"
+ order="0"
+ insertionId="org.eclipse.wst.server.editor.overview.right"
+ typeIds="org.eclipse.libra.framework.equinox.serverType.*"
+ class="org.eclipse.libra.framework.ui.JMXPropertiesEditorSection"/>
+
+ </extension>
+
+ <extension point="org.eclipse.wst.server.ui.wizardFragments">
+ <fragment
+ id="org.eclipse.libra.framework.equinox.30x"
+ typeIds="org.eclipse.libra.framework.equinox.runtimeType.30x"
+ class="org.eclipse.libra.framework.ui.OSGIFrameworkWizardFragment"/>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+ <launchConfigurationTypeImage
+ id="org.eclipse.libra.framework.equinox.30x.launchConfig.image"
+ configTypeID="org.eclipse.libra.framework.equinox.launchConfigurationType"
+ icon="icons/obj16/equinox.gif">
+ </launchConfigurationTypeImage>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ id="org.eclipse.libra.framework.equinox.ui.launchConfigurationTabGroup"
+ type="org.eclipse.libra.framework.equinox.launchConfigurationType"
+ class="org.eclipse.libra.framework.ui.GenericOSGILaunchConfigurationTabGroup">
+ </launchConfigurationTabGroup>
+ </extension>
+
+ <extension point="org.eclipse.wst.common.project.facet.ui.images">
+ <image runtime-component-type="org.eclipse.libra.framework.equinox.runtimeType"
+ path="icons/obj16/equinox.gif"/>
+ </extension>
+
+
+
+ <extension point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ id="org.eclipse.libra.framework.equinox.ui.serveractions"
+ objectClass="org.eclipse.wst.server.core.IServer">
+ <visibility>
+ <objectState name="serverType" value="org.eclipse.libra.framework.equinox.serverType.*"/>
+ </visibility>
+ <action
+ class="org.eclipse.libra.framework.ui.internal.actions.CleanWorkDirAction"
+ enablesFor="1"
+ id="org.eclipse.libra.framework.equinox.ui.cleanserverworkdir"
+ label="%cleanWorkDir">
+ </action>
+ </objectContribution>
+ <objectContribution
+ adaptable="true"
+ id="org.eclipse.libra.framework.equinox.ui.serveractions"
+ objectClass="org.eclipse.wst.server.ui.internal.view.servers.ModuleServer">
+ <visibility>
+ <and>
+ <objectState name="serverType" value="org.eclipse.libra.framework.equinox.serverType.*"/>
+ <objectState name="moduleType" value="osgi.bundle"/>
+ </and>
+ </visibility>
+ <action
+ class="org.eclipse.libra.framework.ui.internal.actions.CleanWorkDirAction"
+ enablesFor="1"
+ id="org.eclipse.libra.framework.equinox.ui.cleanmoduleworkdir"
+ label="%cleanModuleWorkDir">
+ </action>
+ </objectContribution>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.publishers">
+ <publisher
+ id="org.eclipse.libra.framework.equinox.ui.context"
+ typeIds="org.eclipse.libra.framework.equinox.serverType.*"
+ name="%publisherContextFixLabel"
+ description="%publisherContextFixDescription"
+ order=""
+ class="org.eclipse.libra.framework.ui.internal.ModulePublisherDelegate"/>
+ </extension>
+</plugin>
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/pom.xml b/plugins/org.eclipse.libra.framework.equinox.ui/pom.xml
new file mode 100644
index 0000000..0eba08d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/pom.xml
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.libra_parent</artifactId>
+ <groupId>org.eclipse.libra</groupId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../development/org.eclipse.libra.releng/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.libra.framework.equinox.ui</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSGi Frameworks Equinox Adapter UI Plug-in</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/src/org/eclipse/libra/framework/equinox/ui/EquinoxUIPlugin.java b/plugins/org.eclipse.libra.framework.equinox.ui/src/org/eclipse/libra/framework/equinox/ui/EquinoxUIPlugin.java
new file mode 100644
index 0000000..5a3468a
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/src/org/eclipse/libra/framework/equinox/ui/EquinoxUIPlugin.java
@@ -0,0 +1,59 @@
+package org.eclipse.libra.framework.equinox.ui;
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+public class EquinoxUIPlugin extends AbstractUIPlugin {
+ protected static EquinoxUIPlugin singleton;
+ public static final String PLUGIN_ID = "org.eclipse.libra.framework.equinox.ui";
+
+ public EquinoxUIPlugin() {
+ super();
+ singleton = this;
+ }
+
+ /**
+ * Returns the singleton instance of this plugin.
+ * @return org.eclipse.jst.server.tomcat.internal.TomcatUIPlugin
+ */
+ public static EquinoxUIPlugin getInstance() {
+ return singleton;
+ }
+
+ /**
+ * Convenience method for logging.
+ *
+ * @param status org.eclipse.core.runtime.IStatus
+ */
+ public static void log(IStatus status) {
+ getInstance().getLog().log(status);
+ }
+
+ /**
+ * Convenience method to get a Display. The method first checks, if
+ * the thread calling this method has an associated display. If so, this
+ * display is returned. Otherwise the method returns the default display.
+ *
+ * @return the display
+ */
+ public static Display getStandardDisplay() {
+ Display display = Display.getCurrent();
+ if (display == null)
+ display = Display.getDefault();
+ return display;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/src/org/eclipse/libra/framework/equinox/ui/internal/ConfigurationPropertyTester.java b/plugins/org.eclipse.libra.framework.equinox.ui/src/org/eclipse/libra/framework/equinox/ui/internal/ConfigurationPropertyTester.java
new file mode 100644
index 0000000..b3a72cb
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/src/org/eclipse/libra/framework/equinox/ui/internal/ConfigurationPropertyTester.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.equinox.ui.internal;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.libra.framework.core.FrameworkInstanceDelegate;
+import org.eclipse.libra.framework.equinox.IEquinoxFrameworkInstance;
+import org.eclipse.wst.server.core.IServerAttributes;
+
+/**
+ *
+ */
+public class ConfigurationPropertyTester extends PropertyTester {
+ /* (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ try {
+ IServerAttributes server = (IServerAttributes) receiver;
+ FrameworkInstanceDelegate equinox = (FrameworkInstanceDelegate) server.loadAdapter(IEquinoxFrameworkInstance.class, null);
+ if (equinox != null)
+ return equinox != null;
+ } catch (Exception e) {
+ // ignore
+ }
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.equinox.ui/src/org/eclipse/libra/framework/equinox/ui/internal/JavaProfileEditorSection.java b/plugins/org.eclipse.libra.framework.equinox.ui/src/org/eclipse/libra/framework/equinox/ui/internal/JavaProfileEditorSection.java
new file mode 100644
index 0000000..9a735e9
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox.ui/src/org/eclipse/libra/framework/equinox/ui/internal/JavaProfileEditorSection.java
@@ -0,0 +1,229 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Eteration A.S. 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:
+ * Naci Dai
+ *******************************************************************************/
+
+package org.eclipse.libra.framework.equinox.ui.internal;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.libra.framework.core.IOSGIExecutionEnvironment;
+import org.eclipse.libra.framework.core.IOSGIFrameworkInstance;
+import org.eclipse.libra.framework.core.TargetDefinitionUtil;
+import org.eclipse.libra.framework.equinox.IEquinoxFrameworkInstance;
+import org.eclipse.libra.framework.ui.ContextIds;
+import org.eclipse.libra.framework.ui.Messages;
+import org.eclipse.libra.framework.ui.Trace;
+import org.eclipse.pde.internal.core.target.provisional.ITargetDefinition;
+import org.eclipse.pde.internal.core.target.provisional.ITargetPlatformService;
+import org.eclipse.pde.internal.ui.SWTFactory;
+import org.eclipse.pde.internal.ui.wizards.target.EditTargetDefinitionWizard;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.help.IWorkbenchHelpSystem;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.ui.editor.ServerEditorSection;
+
+@SuppressWarnings("restriction")
+public class JavaProfileEditorSection extends ServerEditorSection {
+ protected Section section;
+ protected IEquinoxFrameworkInstance frameworkInstance;
+
+ protected PropertyChangeListener listener;
+ private Combo javaProfileCombo;
+
+ // Avoid hardcoding this at some point
+ // private final static String METADATADIR = ".metadata";
+
+ protected boolean updating = false;
+
+ public JavaProfileEditorSection() {
+ super();
+ }
+
+ /**
+ * Add listeners to detect undo changes and publishing of the server.
+ */
+ protected void addChangeListeners() {
+ listener = new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ if (updating)
+ return;
+ updating = true;
+ if (IOSGIFrameworkInstance.PROPERTY_JAVA_PROFILE
+ .equals(event.getPropertyName())) {
+ validate();
+ }
+ updating = false;
+ }
+ };
+ server.addPropertyChangeListener(listener);
+
+ }
+
+ /**
+ * Creates the SWT controls for this workbench part.
+ *
+ * @param parent
+ * the parent control
+ */
+ public void createSection(Composite parent) {
+ super.createSection(parent);
+ FormToolkit toolkit = getFormToolkit(parent.getDisplay());
+ section = toolkit.createSection(parent, ExpandableComposite.TWISTIE
+ | ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR
+ | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
+ section.setText(Messages.javaProfileSection);
+ section.setDescription(Messages.javaProfileSectionDescription);
+ section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
+ | GridData.VERTICAL_ALIGN_FILL));
+
+ Composite composite = toolkit.createComposite(section);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 3;
+ layout.marginHeight = 5;
+ layout.marginWidth = 10;
+ layout.verticalSpacing = 5;
+ layout.horizontalSpacing = 15;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
+ | GridData.VERTICAL_ALIGN_FILL));
+ IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
+ whs.setHelp(composite, ContextIds.FRAMEWORK_INSTANCE_EDITOR);
+ whs.setHelp(section, ContextIds.FRAMEWORK_INSTANCE_EDITOR);
+ toolkit.paintBordersFor(composite);
+ section.setClient(composite);
+
+ // Java Profiles Selection
+ Label label = createLabel(toolkit, composite,
+ Messages.javaProfileSection);
+ GridData data = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
+ label.setLayoutData(data);
+ String[] envList =IOSGIExecutionEnvironment.getExecutionEnvironmentIds();
+ javaProfileCombo = SWTFactory.createCombo(composite, SWT.SINGLE
+ | SWT.BORDER | SWT.READ_ONLY, 1, envList);
+ javaProfileCombo.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ frameworkInstance.setJavaProfile(javaProfileCombo.getText());
+ }
+ });
+
+ initialize();
+ }
+
+ protected Label createLabel(FormToolkit toolkit, Composite parent,
+ String text) {
+ Label label = toolkit.createLabel(parent, text);
+ label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ return label;
+ }
+
+ /**
+ * @see ServerEditorSection#dispose()
+ */
+ public void dispose() {
+
+ }
+
+ /**
+ * @see ServerEditorSection#init(IEditorSite, IEditorInput)
+ */
+ public void init(IEditorSite site, IEditorInput input) {
+ super.init(site, input);
+
+ // Cache workspace and default deploy paths
+ if (server != null) {
+ frameworkInstance = (IEquinoxFrameworkInstance) server.loadAdapter(
+ IEquinoxFrameworkInstance.class, null);
+ addChangeListeners();
+ }
+ initialize();
+ }
+
+ /**
+ * Initialize the fields in this editor.
+ */
+ protected void initialize() {
+ if (frameworkInstance == null)
+ return;
+ updating = true;
+
+ IRuntime runtime = server.getRuntime();
+ String id = frameworkInstance.getJavaPofile();
+
+ if (javaProfileCombo != null) {
+ String[] envList =IOSGIExecutionEnvironment.getExecutionEnvironmentIds();
+ int i = 0;
+ for (String e : envList) {
+ if (id.equals(e)) {
+ javaProfileCombo.select(i);
+ break;
+ }
+ i++;
+ }
+ }
+ updating = false;
+ validate();
+ }
+
+ protected void validate() {
+ if (frameworkInstance != null) {
+ // Validate
+ }
+ // All is okay, clear any previous error
+ setErrorMessage(null);
+ }
+
+ protected void handleEdit() {
+
+ try {
+ if (frameworkInstance != null
+ && frameworkInstance.getFrameworkInstanceConfiguration() != null) {
+
+ ITargetDefinition original = frameworkInstance
+ .getFrameworkInstanceConfiguration()
+ .getTargetDefinition();
+
+ EditTargetDefinitionWizard wizard = new EditTargetDefinitionWizard(
+ original, true);
+ wizard.setWindowTitle(Messages.configurationEditorTargetDefinitionTitle);
+ WizardDialog dialog = new WizardDialog(this.getShell(), wizard);
+ if (dialog.open() == Window.OK) {
+ // Replace all references to the original with the new
+ // target
+ ITargetDefinition newTarget = wizard.getTargetDefinition();
+ frameworkInstance.getFrameworkInstanceConfiguration()
+ .setTargetDefinition(newTarget);
+ ITargetPlatformService service = TargetDefinitionUtil.getTargetPlatformService();
+ service.saveTargetDefinition(newTarget);
+ }
+ }
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE,
+ "failed to update target platform definition");
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.equinox/.classpath b/plugins/org.eclipse.libra.framework.equinox/.classpath
new file mode 100644
index 0000000..64c5e31
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.libra.framework.equinox/.project b/plugins/org.eclipse.libra.framework.equinox/.project
new file mode 100644
index 0000000..86bb63b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.libra.framework.equinox</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.libra.framework.equinox/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.libra.framework.equinox/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..64203b9
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Oct 22 10:43:27 EEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+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
diff --git a/plugins/org.eclipse.libra.framework.equinox/META-INF/MANIFEST.MF b/plugins/org.eclipse.libra.framework.equinox/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..9372c83
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/META-INF/MANIFEST.MF
@@ -0,0 +1,31 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.libra.framework.equinox;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.libra.framework.equinox.EquinoxPlugin
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.jdt.launching,
+ org.eclipse.debug.core,
+ org.eclipse.pde.ui,
+ org.eclipse.pde,
+ org.eclipse.wst.server.core,
+ org.eclipse.wst.server.ui,
+ org.eclipse.jst.server.core,
+ org.eclipse.jdt.core,
+ org.eclipse.jst.common.project.facet.core,
+ org.eclipse.wst.common.modulecore,
+ org.eclipse.equinox.frameworkadmin,
+ org.eclipse.libra.framework.core
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.core.resources,
+ org.eclipse.debug.core,
+ org.eclipse.jdt.launching.sourcelookup,
+ org.eclipse.pde.core.plugin,
+ org.eclipse.pde.ui.launcher
+Export-Package: org.eclipse.libra.framework.equinox,
+ org.eclipse.libra.framework.equinox.internal
diff --git a/plugins/org.eclipse.libra.framework.equinox/about.html b/plugins/org.eclipse.libra.framework.equinox/about.html
new file mode 100644
index 0000000..7d9511d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>September 21, 2011</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.equinox/build.properties b/plugins/org.eclipse.libra.framework.equinox/build.properties
new file mode 100644
index 0000000..81e3c06
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/build.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties
diff --git a/plugins/org.eclipse.libra.framework.equinox/plugin.properties b/plugins/org.eclipse.libra.framework.equinox/plugin.properties
new file mode 100644
index 0000000..90310c7
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/plugin.properties
@@ -0,0 +1,25 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+pluginName=Equinox Support
+providerName=Eteration A.S.
+
+# --------------- Runtime Types ---------------
+libra=Eclipse Libra
+runtimeTypeEquinox30Label=Equinox 3.6+ OSGi Service Platform
+runtimeTypeEquinox30Description=Equinox 3.6+ OSGi Service Platform supports OSGi R4.
+
+
+# --------------- Runtime Instance ---------------
+runtimeInstanceTypeEquinox30Label=Equinox 3.6+ Runtime Instance
+runtimeInstanceTypeEquinox30Description=Publishes and runs osgi bundle projects on local equinox platform.
+
+equinoxLaunchConfigurationType=Equinox
+
diff --git a/plugins/org.eclipse.libra.framework.equinox/plugin.xml b/plugins/org.eclipse.libra.framework.equinox/plugin.xml
new file mode 100644
index 0000000..03aa599
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/plugin.xml
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?><!--
+ Copyright (c) 2010 Eteration A.S. 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:
+ Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ -->
+
+<plugin>
+
+
+ <extension
+ point="org.eclipse.wst.server.core.runtimeTypes">
+
+ <runtimeType
+ id="org.eclipse.libra.framework.equinox.runtimeType.30x"
+ name="%runtimeTypeEquinox30Label"
+ description="%runtimeTypeEquinox30Description"
+ vendor="%libra"
+ version="3.6"
+ class="org.eclipse.libra.framework.equinox.EquinoxFramework">
+ <moduleType
+ types="osgi.bundle"
+ versions="4.2"/>
+ <moduleType
+ types="java"
+ versions="1.6"/>
+ <moduleType
+ types="java"
+ versions="1.5"/>
+ </runtimeType>
+ </extension>
+
+
+ <extension point="org.eclipse.wst.server.core.runtimeLocators">
+ <runtimeLocator
+ id="org.eclipse.libra.framework.equinox.runtime.locator"
+ typeIds="org.eclipse.libra.framework.equinox.runtimeType.*"
+ class="org.eclipse.libra.framework.core.OSGIFrameworkLocatorDelegate"/>
+ </extension>
+
+ <extension point="org.eclipse.jst.server.core.runtimeClasspathProviders">
+ <runtimeClasspathProvider
+ id="org.eclipse.libra.framework.equinox.runtimeTarget"
+ runtimeTypeIds="org.eclipse.libra.framework.equinox.runtimeType.*"
+ class="org.eclipse.libra.framework.equinox.internal.EquinoxFrameworkClasspathProvider"/>
+ </extension>
+
+
+ <extension
+ point="org.eclipse.wst.server.core.serverTypes">
+ <serverType
+ id="org.eclipse.libra.framework.equinox.serverType.30x"
+ name="%runtimeInstanceTypeEquinox30Label"
+ description="%runtimeInstanceTypeEquinox30Description"
+ supportsRemoteHosts="false"
+ runtime="true"
+ startTimeout="120000"
+ stopTimeout="120000"
+ initialState="stopped"
+ startBeforePublish="false"
+ synchronousStart="true"
+ hasConfiguration="true"
+ launchConfigId="org.eclipse.libra.framework.equinox.launchConfigurationType"
+ runtimeTypeId="org.eclipse.libra.framework.equinox.runtimeType.30x"
+ class="org.eclipse.libra.framework.equinox.EquinoxFrameworkInstance"
+ behaviourClass="org.eclipse.libra.framework.equinox.internal.EquinoxFrameworkInstanceBehavior">
+ </serverType>
+ </extension>
+
+
+ <extension point="org.eclipse.wst.server.core.serverLocators">
+ <serverLocator
+ id="org.eclipse.libra.framework.equinox.server.locator"
+ supportsRemoteHosts="false"
+ typeIds="org.eclipse.libra.framework.equinox.serverType.*"
+ class="org.eclipse.libra.framework.core.OSGIFrameworkInstanceLocatorDelegate"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.launchableAdapters">
+ <launchableAdapter
+ class="org.eclipse.libra.framework.core.launching.LaunchableAdapterDelegate"
+ id="org.eclipse.libra.framework.equinox.osgi"/>
+ </extension>
+
+ <extension point="org.eclipse.debug.core.sourcePathComputers">
+ <sourcePathComputer
+ id="org.eclipse.libra.framework.equinox.sourcePathComputer"
+ class="org.eclipse.libra.framework.core.internal.debug.OSGIRuntimeSourcePathComputerDelegate"/>
+ </extension>
+
+ <extension point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ id="org.eclipse.libra.framework.equinox.launchConfigurationType"
+ name="%equinoxLaunchConfigurationType"
+ delegate="org.eclipse.libra.framework.core.launching.LaunchConfigurationDelegate"
+ modes="run, debug, profile"
+ sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
+ sourcePathComputerId="org.eclipse.libra.framework.equinox.sourcePathComputer"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.publishTasks">
+ <publishTask
+ id="org.eclipse.libra.framework.equinox.publishTask"
+ typeIds="org.eclipse.libra.framework.equinox.serverType.*"
+ class="org.eclipse.libra.framework.core.publish.PublishTask"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.common.project.facet.core.runtimes">
+ <runtime-component-type
+ id="org.eclipse.libra.framework.equinox.runtimeType"/>
+
+ <runtime-component-version
+ type="org.eclipse.libra.framework.equinox.runtimeType"
+ version="3.6"/>
+
+ <adapter>
+ <runtime-component
+ id="org.eclipse.libra.framework.equinox.runtimeType"/>
+ <factory
+ class="org.eclipse.jst.server.core.internal.RuntimeClasspathProvider$Factory"/>
+ <type
+ class="org.eclipse.jst.common.project.facet.core.IClasspathProvider"/>
+ </adapter>
+
+ <supported>
+ <runtime-component id="org.eclipse.libra.framework.equinox.runtimeType"/>
+ <facet id="osgi.bundle" />
+ </supported>
+ </extension>
+
+ <extension point="org.eclipse.wst.common.project.facet.core.defaultFacets">
+ <default-facets>
+ <runtime-component id="org.eclipse.libra.framework.equinox.runtimeType">
+ </runtime-component>
+ <facet
+ id="osgi.bundle" version="4.2">
+ </facet>
+ </default-facets>
+ </extension>
+
+ <extension point="org.eclipse.jst.server.core.runtimeFacetMappings">
+ <runtimeFacetMapping
+ runtimeTypeId="org.eclipse.libra.framework.equinox.runtimeType.30x"
+ runtime-component="org.eclipse.libra.framework.equinox.runtimeType"
+ version="3.6"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.installableRuntimes">
+
+ <runtime
+ id="org.eclipse.libra.framework.equinox.runtimeType.30x"
+ licenseUrl="http://www.apache.org/licenses/LICENSE-2.0.txt"
+ archiveUrl="http://download.eclipse.org/equinox/drops/R-3.6.2-201102101200/equinox-SDK-3.6.2.zip"
+ archivePath="equinox-SDK-3.6.2"
+ os="win32"/>
+ <runtime
+ id="org.eclipse.libra.framework.equinox.runtimeType.30x"
+ licenseUrl="http://www.apache.org/licenses/LICENSE-1.1"
+ archiveUrl="http://download.eclipse.org/equinox/drops/R-3.6.2-201102101200/equinox-SDK-3.6.2.zip"
+ archivePath="equinox-SDK-3.6.2"
+ os="linux"/>
+
+ <runtime
+ id="org.eclipse.libra.framework.equinox.runtimeType.30x"
+ licenseUrl="http://www.apache.org/licenses/LICENSE-1.1"
+ archiveUrl="http://download.eclipse.org/equinox/drops/R-3.6.2-201102101200/equinox-SDK-3.6.2.zip"
+ archivePath="equinox-SDK-3.6.2"
+ os="macosx"/>
+ </extension>
+
+
+</plugin>
diff --git a/plugins/org.eclipse.libra.framework.equinox/pom.xml b/plugins/org.eclipse.libra.framework.equinox/pom.xml
new file mode 100644
index 0000000..031ea2a
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/pom.xml
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.libra_parent</artifactId>
+ <groupId>org.eclipse.libra</groupId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../development/org.eclipse.libra.releng/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.libra.framework.equinox</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSGi Frameworks Equinox Adapter Plug-in</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxFramework.java b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxFramework.java
new file mode 100644
index 0000000..89844c3
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxFramework.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.equinox;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.libra.framework.core.FrameworkDelegate;
+import org.eclipse.libra.framework.core.IOSGIFrameworkWorkingCopy;
+import org.eclipse.wst.server.core.IRuntimeType;
+
+
+public class EquinoxFramework extends FrameworkDelegate implements
+ IOSGIFrameworkWorkingCopy, IEquinoxFramework {
+ public EquinoxFramework() {
+ }
+
+
+ public IEquinoxVersionHandler getVersionHandler() {
+ IRuntimeType type = getRuntime().getRuntimeType();
+ return EquinoxPlugin.getEquinoxVersionHandler(type.getId());
+ }
+
+ @SuppressWarnings("rawtypes")
+ public List getFrameworkClasspath(IPath configPath) {
+ IPath installPath = getRuntime().getLocation();
+ // If installPath is relative, convert to canonical path and hope for
+ // the best
+ if (!installPath.isAbsolute()) {
+ try {
+ String installLoc = (new File(installPath.toOSString()))
+ .getCanonicalPath();
+ installPath = new Path(installLoc);
+ } catch (IOException e) {
+ // Ignore if there is a problem
+ }
+ }
+ return getVersionHandler().getFrameworkClasspath(installPath, configPath);
+ }
+
+ /**
+ * Verifies the Felix installation directory. If it is correct, true is
+ * returned. Otherwise, the user is notified and false is returned.
+ *
+ * @return boolean
+ */
+ public IStatus verifyLocation() {
+ return getVersionHandler()
+ .verifyInstallPath(getRuntime().getLocation());
+ }
+
+
+ public IStatus validate() {
+ IStatus status = super.validate();
+ if (!status.isOK())
+ return status;
+
+ status = verifyLocation();
+ if (!status.isOK())
+ return status;
+ // return new Status(IStatus.ERROR, FelixPlugin.PLUGIN_ID, 0,
+ // Messages.errorInstallDir, null);
+ // don't accept trailing space since that can cause startup problems
+ if (getRuntime().getLocation().hasTrailingSeparator())
+ return new Status(IStatus.ERROR, EquinoxPlugin.PLUGIN_ID, 0,
+ Messages.errorInstallDirTrailingSlash, null);
+ if (getVMInstall() == null)
+ return new Status(IStatus.ERROR, EquinoxPlugin.PLUGIN_ID, 0,
+ Messages.errorJRE, null);
+
+
+
+ return Status.OK_STATUS;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxFrameworkInstance.java b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxFrameworkInstance.java
new file mode 100644
index 0000000..0b53e01
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxFrameworkInstance.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.equinox;
+
+import java.io.File;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+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.Status;
+import org.eclipse.libra.framework.core.FrameworkInstanceConfiguration;
+import org.eclipse.libra.framework.core.FrameworkInstanceDelegate;
+import org.eclipse.libra.framework.core.OSGIFrameworkInstanceBehaviorDelegate;
+import org.eclipse.libra.framework.core.TargetDefinitionUtil;
+import org.eclipse.libra.framework.core.Trace;
+import org.eclipse.libra.framework.equinox.internal.EquinoxFrameworkInstanceBehavior;
+import org.eclipse.pde.internal.core.target.provisional.ITargetDefinition;
+import org.eclipse.pde.internal.core.target.provisional.ITargetPlatformService;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IRuntime;
+
+
+@SuppressWarnings("restriction")
+public class EquinoxFrameworkInstance extends FrameworkInstanceDelegate implements
+ IEquinoxFrameworkInstance {
+
+ protected transient IEquinoxVersionHandler versionHandler;
+
+ @Override
+ public IStatus canModifyModules(IModule[] add, IModule[] remove) {
+ IStatus status = super.canModifyModules(add, remove);
+ if (!status.isOK())
+ return status;
+
+ if (getEquinoxVersionHandler() == null)
+ return new Status(IStatus.ERROR, EquinoxPlugin.PLUGIN_ID, 0,
+ Messages.errorNoRuntime, null);
+
+ if (add != null) {
+ int size = add.length;
+ for (int i = 0; i < size; i++) {
+ IModule module = add[i];
+ IStatus status2 = getEquinoxVersionHandler().canAddModule(
+ module);
+ if (status2 != null && !status2.isOK())
+ return status2;
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public void setDefaults(IProgressMonitor monitor) {
+ super.setDefaults(monitor);
+ try {
+ getEquinoxConfiguration();
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "Can't setup for Equinox configuration.",
+ e);
+ }
+ }
+
+ @Override
+ public void importRuntimeConfiguration(IRuntime runtime,
+ IProgressMonitor monitor) throws CoreException {
+
+ super.importRuntimeConfiguration(runtime, monitor);
+ OSGIFrameworkInstanceBehaviorDelegate fsb = (OSGIFrameworkInstanceBehaviorDelegate) getServer()
+ .loadAdapter(EquinoxFrameworkInstanceBehavior.class, null);
+ if (fsb != null) {
+ IPath tempDir = fsb.getTempDirectory();
+ if (!tempDir.isAbsolute()) {
+ IPath rootPath = ResourcesPlugin.getWorkspace().getRoot()
+ .getLocation();
+ tempDir = rootPath.append(tempDir);
+ }
+ setInstanceDirectory(tempDir.toPortableString());
+ }
+
+ try {
+ getEquinoxConfiguration();
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "Can't setup for Equinox configuration.",
+ e);
+ }
+ }
+
+ public EquinoxFramework getEquinoxRuntime() {
+ if (getServer().getRuntime() == null)
+ return null;
+ return (EquinoxFramework) getServer().getRuntime().loadAdapter(
+ EquinoxFramework.class, null);
+ }
+
+ public IEquinoxVersionHandler getEquinoxVersionHandler() {
+ if (versionHandler == null) {
+ if (getServer().getRuntime() == null || getEquinoxRuntime() == null)
+ return null;
+
+ versionHandler = getEquinoxRuntime().getVersionHandler();
+ }
+ return versionHandler;
+ }
+
+ public FrameworkInstanceConfiguration getEquinoxConfiguration()
+ throws CoreException {
+
+ return getFrameworkInstanceConfiguration();
+
+ }
+
+
+
+ @Override
+ public ITargetDefinition createDefaultTarget() throws CoreException {
+
+
+
+ //IPath installPath = getServer().getRuntime().getLocation();
+ ITargetPlatformService service = TargetDefinitionUtil.getTargetPlatformService();
+
+ ITargetDefinition targetDefinition = service.newTarget();
+ targetDefinition.setName(getServer().getName());
+ targetDefinition.resolve(new NullProgressMonitor());
+
+ service.saveTargetDefinition(targetDefinition);
+ return targetDefinition;
+ }
+
+
+
+ public String getFrameworkJarPath(){
+ IPath installPath = getServer().getRuntime().getLocation();
+ IPath plugins = installPath.append("plugins");
+ if (plugins.toFile().exists()) {
+ File[] files = plugins.toFile().listFiles();
+ for (File file : files) {
+ if (file.getName().indexOf("org.eclipse.osgi_") > -1) {
+ return file.getAbsolutePath();
+ }
+ }
+
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxHandler.java b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxHandler.java
new file mode 100644
index 0000000..389fd83
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxHandler.java
@@ -0,0 +1,356 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.equinox;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
+import org.eclipse.libra.framework.core.FrameworkCorePlugin;
+import org.eclipse.libra.framework.core.IOSGIExecutionEnvironment;
+import org.eclipse.libra.framework.core.Trace;
+import org.eclipse.pde.core.plugin.IPluginModelBase;
+import org.eclipse.pde.core.plugin.PluginRegistry;
+import org.eclipse.pde.core.plugin.TargetPlatform;
+import org.eclipse.pde.core.project.IBundleClasspathEntry;
+import org.eclipse.pde.core.project.IBundleProjectDescription;
+import org.eclipse.pde.internal.core.target.provisional.IResolvedBundle;
+import org.eclipse.wst.server.core.IModule;
+
+@SuppressWarnings("restriction")
+public class EquinoxHandler implements IEquinoxVersionHandler {
+
+ public IStatus verifyInstallPath(IPath location) {
+ boolean isFound = false;
+ IPath plugins = location.append("plugins");
+ if (plugins.toFile().exists()) {
+ File[] files = plugins.toFile().listFiles();
+ for (File file : files) {
+ if (file.getName().indexOf("org.eclipse.osgi_") > -1) {
+ isFound = true;
+ break;
+ }
+ }
+ if (isFound) {
+ return Status.OK_STATUS;
+ }
+ }
+ return new Status(IStatus.ERROR, EquinoxPlugin.PLUGIN_ID, 0,
+ Messages.warningCantReadConfig, null);
+ }
+
+ public String getFrameworkClass() {
+ return "org.eclipse.core.runtime.adaptor.EclipseStarter";
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public List getFrameworkClasspath(IPath installPath, IPath configPath) {
+
+ List cp = new ArrayList();
+ IPath plugins = installPath.append("plugins");
+
+ if (plugins.toFile().exists()) {
+ File[] files = plugins.toFile().listFiles();
+ for (File file : files) {
+ if (file.getName().indexOf("org.eclipse.osgi_") > -1) {
+ IPath path = plugins.append(file.getName());
+ cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(path));
+ }
+ }
+ }
+
+ return cp;
+ }
+
+ public String[] getFrameworkProgramArguments(IPath configPath,
+ boolean debug, boolean starting) {
+
+ ArrayList<String> programArgs = new ArrayList<String>();
+ programArgs.add("-dev");
+ programArgs.add("file:"+configPath.append("dev.properties").toOSString()); //$NON-NLS-1$
+ programArgs.add("-configuration");
+ programArgs.add(configPath.makeAbsolute().toOSString()); //$NON-NLS-1$
+ if (debug) {
+ programArgs.add("-debug"); //$NON-NLS-1$
+ }
+ programArgs.add("-os"); //$NON-NLS-1$
+ programArgs.add(TargetPlatform.getOS());
+ programArgs.add("-ws"); //$NON-NLS-1$
+ programArgs.add(TargetPlatform.getWS());
+ programArgs.add("-arch"); //$NON-NLS-1$
+ programArgs.add(TargetPlatform.getOSArch());
+ programArgs.add("-consoleLog"); //$NON-NLS-1$
+ programArgs.add("-console"); //$NON-NLS-1$
+
+ return (String[]) programArgs.toArray(new String[programArgs.size()]);
+ }
+
+ public String[] getExcludedFrameworkProgramArguments(boolean debug,
+ boolean starting) {
+ return null;
+ }
+
+ public String[] getFrameworkVMArguments(IPath installPath, boolean jmxEnabled, int jmxPort, String javaProfileID, IPath configPath, IPath deployPath, boolean isTestEnv) {
+
+ //String configPathStr = deployPath.makeAbsolute().toOSString();
+ String profilePath = deployPath.append("java.profile").toOSString();
+ Properties javaProfileProps = null;
+
+ IExecutionEnvironment environment[] = JavaRuntime.getExecutionEnvironmentsManager().getExecutionEnvironments();
+ for(IExecutionEnvironment e: environment){
+ if(javaProfileID.equals(e.getId())){
+ javaProfileProps = e.getProfileProperties();
+ break;
+ }
+ }
+
+ try {
+ if(IOSGIExecutionEnvironment.JAVASE6_SERVER.toString().equals(javaProfileID)){
+ copyFile(this.getClass().getResourceAsStream("java6-server.profile"), new File(profilePath));
+ }else if(javaProfileProps != null){
+ FileOutputStream os = new FileOutputStream(new File(profilePath));
+ javaProfileProps.store(os, "THIS FILE IS AUTO GENERATED");
+ }
+ } catch (IOException e) {
+ Trace.trace(Trace.SEVERE, "Could not set equinox VM arguments:"+e.getMessage(), e);
+ }
+ String vmArgs ="" ;
+
+ //If there is a non-default java profile then set it.
+ if(javaProfileID != null && !javaProfileID.equals(IOSGIExecutionEnvironment.Default.toString()))
+ vmArgs += "-Dosgi.java.profile=file:"+profilePath; //$NON-NLS-1$ //$NON-NLS-2$
+
+ if(jmxEnabled)
+ return new String[] {"-Dcom.sun.management.jmxremote.port="+jmxPort, "-Dcom.sun.management.jmxremote.authenticate=false", "-Dcom.sun.management.jmxremote.ssl=false", "-Declipse.ignoreApp=true", "-Dosgi.noShutdown=true", vmArgs };
+ else
+ return new String[] { "-Declipse.ignoreApp=true", "-Dosgi.noShutdown=true", vmArgs };
+
+ }
+
+ public IStatus canAddModule(IModule module) {
+ String id = module.getModuleType().getId();
+ // String version = module.getModuleType().getVersion();
+ if ("osgi.bundle".equals(id))
+ return Status.OK_STATUS;
+
+ return new Status(IStatus.ERROR, EquinoxPlugin.PLUGIN_ID, 0,
+ Messages.errorNotBundle, null);
+ }
+
+ public IStatus prepareFrameworkInstanceDirectory(IPath baseDir) {
+ return Status.OK_STATUS;
+ }
+
+ public IStatus prepareDeployDirectory(IPath deployPath) {
+
+ if (Trace.isTraceEnabled())
+ Trace.trace(Trace.FINER, "Creating runtime directory at "
+ + deployPath.toOSString());
+
+ // Prepare a directory structure
+ File temp = deployPath.append("plugins").toFile();
+ if (!temp.exists())
+ temp.mkdirs();
+ temp = deployPath.append("auto").toFile();
+ if (!temp.exists())
+ temp.mkdirs();
+ temp = deployPath.append("cache").toFile();
+ if (!temp.exists())
+ temp.mkdirs();
+
+ return Status.OK_STATUS;
+ }
+
+ public boolean supportsServeModulesWithoutPublish() {
+ return true;
+ }
+
+ public void prepareFrameworkConfigurationFile(IPath configPath,
+ String workspaceBundles, String frameworkJar, IResolvedBundle[] kernelBundles) {
+ String[] wsBundleIds = workspaceBundles.split(" ");
+
+ prepareDevProperties(configPath, wsBundleIds);
+ prepareConfigIni(configPath, wsBundleIds, frameworkJar, kernelBundles);
+ }
+
+ private void prepareConfigIni(IPath configPath, String[] wsBundleIds, String frameworkJar,
+ IResolvedBundle[] krBundles) {
+ String propertyInstall = "";
+ for (String bundle : wsBundleIds) {
+ if (bundle.indexOf("@") != -1)
+ bundle = bundle.substring(0, bundle.indexOf("@"));
+ IPluginModelBase[] models = PluginRegistry.getWorkspaceModels();
+ for (IPluginModelBase iPluginModelBase : models) {
+ if (bundle
+ .indexOf(iPluginModelBase.getPluginBase().getId()) > -1) {
+ String bpath = iPluginModelBase.getInstallLocation();
+ if(bpath.endsWith("/"))
+ bpath = bpath.substring(0,bpath.length()-1);
+ if(iPluginModelBase.isFragmentModel())
+ propertyInstall += "reference:file:" + bpath+ ", ";
+ else
+ propertyInstall += "reference:file:" + bpath+ "@start, ";
+ }
+ }
+ }
+
+ Properties properties = new Properties();
+ properties.setProperty(
+ "osgi.instance.area.default",
+ "file:"
+ + configPath.toPortableString().substring(
+ 0,
+ configPath.toPortableString().indexOf(
+ ".metadata")));
+
+ properties.put("osgi.framework", frameworkJar);
+ properties.setProperty("osgi.configuration.cascaded", "false"); //$NON-NLS-1$ //$NON-NLS-2$
+ int start = 4;
+ properties.put(
+ "osgi.bundles.defaultStartLevel", Integer.toString(start)); //$NON-NLS-1$
+ for (int i = 0; i < krBundles.length; i++) {
+ String targetBundlePath = "reference:file:"+krBundles[i].getBundleInfo().getLocation().getRawPath();
+ if (targetBundlePath != null && !(targetBundlePath.trim().equalsIgnoreCase(""))) {
+ if (targetBundlePath.indexOf("org.eclipse.osgi_") > -1)
+ continue;
+
+ File file = new File(targetBundlePath.substring(targetBundlePath.indexOf("/")));
+ if (file.isFile()) {
+ propertyInstall += targetBundlePath;
+ if(krBundles[i].isFragment())
+ propertyInstall += ", ";
+ else
+ propertyInstall += "@start, ";
+ } else {
+ for (String string2 : file.list()) {
+ if (string2.indexOf(".jar") > -1) {
+ propertyInstall += targetBundlePath + string2;
+ //String fbundleId = getBundleId(string2);
+ //IPluginModelBase modelBase = PluginRegistry.findModel(fbundleId);
+ if(krBundles[i].isFragment())
+ propertyInstall += ", ";
+ else
+ propertyInstall += "@start, ";
+ }
+ }
+ }
+ }
+
+ }
+
+ properties.setProperty("osgi.bundles", propertyInstall);
+ properties.put("eclipse.ignoreApp", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+ properties.put("osgi.noShutdown", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ try {
+ properties.store(
+ new FileOutputStream(configPath.append("config.ini")
+ .makeAbsolute().toFile()), "## AUTO GENERATED ##");
+ } catch (IOException e) {
+ Trace.trace(Trace.SEVERE, "Could not create equinox dev.properties configrutaion file:"+e.getMessage(), e);
+ }
+ }
+
+ private String getBundleId(String targetBundlePath) {
+ IPath kbPath = new Path(targetBundlePath);
+ String bundleId = kbPath.lastSegment();
+ if(bundleId.endsWith(".jar"))
+ bundleId = bundleId.substring(0,bundleId.length()-4);
+ int vversioNloc = bundleId.indexOf("_");
+ if(vversioNloc > 0)
+ bundleId = bundleId.substring(0, vversioNloc);
+ return bundleId;
+ }
+
+ private String[] prepareDevProperties(IPath configPath, String[] wsBundleIds) {
+ try {
+ // Create file
+ FileWriter fstream = new FileWriter(configPath.toPortableString()
+ + "/dev.properties");
+ BufferedWriter out = new BufferedWriter(fstream);
+ out.write("#OSAMI AUTO GENERATED\n");
+ for (String bundle : wsBundleIds) {
+ if (bundle.indexOf("@") != -1)
+ bundle = bundle.substring(0, bundle.indexOf("@"));
+ IPluginModelBase[] models = PluginRegistry.getWorkspaceModels();
+ String modelId = "";
+ for (IPluginModelBase iPluginModelBase : models) {
+ if (bundle.indexOf(iPluginModelBase.getPluginBase().getId()) > -1) {
+ IProject pluginProject = iPluginModelBase.getUnderlyingResource().getProject();
+ IJavaProject javaProject = JavaCore.create(pluginProject);
+ IBundleProjectDescription bundleProjectDescription = FrameworkCorePlugin.getDescription(pluginProject);
+ IPath bpath = new Path(iPluginModelBase.getInstallLocation());
+ IPath ploc = pluginProject.getLocation();
+ if(bpath.equals(ploc))
+ bpath = pluginProject.getFullPath();
+ else
+ bpath = bpath.makeRelativeTo(ploc.removeLastSegments(1));
+ IBundleClasspathEntry[] allCPEntry = bundleProjectDescription.getBundleClasspath();
+ modelId = iPluginModelBase.getPluginBase().getId();
+ out.write("\n"+modelId + "=");
+ for(IBundleClasspathEntry bcpe: allCPEntry){
+ if(bcpe.getSourcePath() != null && bcpe.getBinaryPath() == null)
+ out.write(" "+ ploc.removeLastSegments(1).append(javaProject.getOutputLocation()) +",");
+ else if(bcpe.getSourcePath() != null && bcpe.getBinaryPath() != null)
+ out.write(" "+bcpe.getBinaryPath().toOSString() +",");
+ else if(bcpe.getLibrary() != null && bcpe.getLibrary().toOSString().endsWith(".jar") )
+ out.write(" "+bcpe.getLibrary().toOSString() +",");
+ else
+ out.write(" "+javaProject.getOutputLocation().makeRelativeTo(pluginProject.getFullPath()) +",");
+ }
+
+ }
+ }
+ }
+ out.close();
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "Could not create equinox dev.properties configuration file:"+e.getMessage(), e);
+ }
+ return wsBundleIds;
+ }
+
+
+ private void copyFile(InputStream source, File destFile) throws IOException {
+
+
+ FileOutputStream destination = null;
+ try {
+ destination = new FileOutputStream(destFile);
+ int c;
+ while((c = source.read()) != -1){
+ destination.write(c);
+ }
+ }
+ finally {
+ if(source != null) {
+ source.close();
+ }
+ if(destination != null) {
+ destination.close();
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxPlugin.java b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxPlugin.java
new file mode 100644
index 0000000..9bedf86
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/EquinoxPlugin.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.equinox;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+public class EquinoxPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.libra.framework.equinox"; //$NON-NLS-1$
+
+ // The shared instance
+ private static EquinoxPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public EquinoxPlugin() {
+ super();
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#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 EquinoxPlugin getDefault() {
+ return plugin;
+ }
+
+
+
+ public static String getPreference(String id) {
+ return Platform.getPreferencesService().getString(PLUGIN_ID, id, "", null);
+ }
+
+ public static void setPreference(String id, String value) {
+ (new DefaultScope()).getNode(PLUGIN_ID).put(id, value);
+ }
+
+ public static IEquinoxVersionHandler getEquinoxVersionHandler(String id) {
+// if (id.indexOf("runtime") > 0)
+// id = id.substring(0, 30) + id.substring(38);
+// if (true)//"abc".equals(id))
+ return new EquinoxHandler();
+ }
+
+
+}
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/IEquinoxFramework.java b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/IEquinoxFramework.java
new file mode 100644
index 0000000..2174bec
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/IEquinoxFramework.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.equinox;
+
+import org.eclipse.libra.framework.core.IOSGIFramework;
+
+
+public interface IEquinoxFramework extends IOSGIFramework {
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/IEquinoxFrameworkInstance.java b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/IEquinoxFrameworkInstance.java
new file mode 100644
index 0000000..3e766d8
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/IEquinoxFrameworkInstance.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.equinox;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.libra.framework.core.FrameworkInstanceConfiguration;
+import org.eclipse.libra.framework.core.IOSGIFrameworkInstance;
+
+
+
+public interface IEquinoxFrameworkInstance extends IOSGIFrameworkInstance {
+
+
+ public FrameworkInstanceConfiguration getEquinoxConfiguration() throws CoreException;
+
+
+}
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/IEquinoxVersionHandler.java b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/IEquinoxVersionHandler.java
new file mode 100644
index 0000000..ad8a6d0
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/IEquinoxVersionHandler.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.equinox;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.pde.internal.core.target.provisional.IResolvedBundle;
+import org.eclipse.wst.server.core.IModule;
+
+@SuppressWarnings("restriction")
+public interface IEquinoxVersionHandler {
+
+ public abstract boolean supportsServeModulesWithoutPublish();
+
+ public abstract IStatus prepareDeployDirectory(IPath deployPath);
+
+ public abstract IStatus prepareFrameworkInstanceDirectory(IPath baseDir);
+
+ public abstract IStatus canAddModule(IModule module);
+
+ public abstract String[] getFrameworkVMArguments(IPath installPath, boolean jmxEnabled, int portNumber, String javaProfileID, IPath configPath,
+ IPath deployPath, boolean isTestEnv);
+
+ public abstract String[] getExcludedFrameworkProgramArguments(boolean debug,
+ boolean starting);
+
+ public abstract String[] getFrameworkProgramArguments(IPath configPath,
+ boolean debug, boolean starting);
+
+ @SuppressWarnings("rawtypes")
+ public abstract List getFrameworkClasspath(IPath installPath, IPath configPath);
+
+ public abstract String getFrameworkClass();
+
+ public abstract IStatus verifyInstallPath(IPath location);
+
+ public abstract void prepareFrameworkConfigurationFile(IPath confDir,String workspaceBundles, String frameworkJar, IResolvedBundle[] kernelBundles);
+
+}
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/Messages.java b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/Messages.java
new file mode 100644
index 0000000..21a983d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/Messages.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.equinox;
+
+import org.eclipse.osgi.util.NLS;
+/**
+ * Translated messages.
+ */
+public class Messages extends NLS {
+
+ public static String errorInstallDirTrailingSlash = null;
+ public static String errorJRE;
+ public static String warningCantReadConfig;
+ public static String warningCantReadBundle;
+ public static String errorNotBundle;
+ public static String errorOSGiBundlesOnly;
+ public static String errorNoRuntime;
+
+ public static String publishServerTask;
+ public static String errorConfigurationProjectClosed;
+ public static String errorNoConfiguration;
+ public static String loadingTask;
+ public static String errorCouldNotLoadConfiguration;
+ public static String configurationEditorActionAddOsgiModule;
+
+ static {
+ NLS.initializeMessages(EquinoxPlugin.PLUGIN_ID + ".Messages", Messages.class);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/Messages.properties b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/Messages.properties
new file mode 100644
index 0000000..88dac69
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/Messages.properties
@@ -0,0 +1,20 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+
+# --------------- General UI ---------------
+
+errorInstallDirTrailingSlash = Installation folder must not end with a slash
+errorJRE= Selected JRE is not valid;
+warningCantReadConfig=Cannot locate the correct conf folder. Invalid Installation folder
+warningCantReadBundle=Cannot locate the correct bundle folder. Invalid Installation folder
+errorNotBundle=Must be an osgi bundle
+errorOSGiBundlesOnly=Must be an osgi bundle
+errorNoRuntime=There is no runtime
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/internal/EquinoxConfigurationPublishHelper.java b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/internal/EquinoxConfigurationPublishHelper.java
new file mode 100644
index 0000000..a0ee01c
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/internal/EquinoxConfigurationPublishHelper.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.equinox.internal;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.libra.framework.core.OSGIFrameworkInstanceBehaviorDelegate;
+import org.eclipse.libra.framework.core.publish.PublishHelper;
+
+
+
+public class EquinoxConfigurationPublishHelper extends PublishHelper{
+ public OSGIFrameworkInstanceBehaviorDelegate behavior;
+
+ public EquinoxConfigurationPublishHelper(OSGIFrameworkInstanceBehaviorDelegate behavior) {
+ this.behavior = behavior;
+ }
+
+ protected IPath getPublishFolder() {
+ IPath configPath = behavior.getBaseDirectory();
+
+ configPath = configPath.append("plugins").makeAbsolute();
+ return configPath;
+ }
+
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/internal/EquinoxFrameworkClasspathProvider.java b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/internal/EquinoxFrameworkClasspathProvider.java
new file mode 100644
index 0000000..bf6b058
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/internal/EquinoxFrameworkClasspathProvider.java
@@ -0,0 +1,44 @@
+package org.eclipse.libra.framework.equinox.internal;
+
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jst.server.core.RuntimeClasspathProviderDelegate;
+import org.eclipse.wst.server.core.IRuntime;
+
+public class EquinoxFrameworkClasspathProvider extends
+ RuntimeClasspathProviderDelegate {
+ /**
+ * @see RuntimeClasspathProviderDelegate#resolveClasspathContainer(IProject,
+ * IRuntime)
+ */
+ public IClasspathEntry[] resolveClasspathContainer(IProject project,
+ IRuntime runtime) {
+ IPath installPath = runtime.getLocation();
+
+ if (installPath == null)
+ return new IClasspathEntry[0];
+
+ List<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
+
+ IPath path = installPath.append("bundle");
+ addLibraryEntries(list, path.toFile(), true);
+
+ return (IClasspathEntry[]) list
+ .toArray(new IClasspathEntry[list.size()]);
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/internal/EquinoxFrameworkInstanceBehavior.java b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/internal/EquinoxFrameworkInstanceBehavior.java
new file mode 100644
index 0000000..cd83122
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/internal/EquinoxFrameworkInstanceBehavior.java
@@ -0,0 +1,167 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.equinox.internal;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.libra.framework.core.FrameworkInstanceConfiguration;
+import org.eclipse.libra.framework.core.OSGIFrameworkInstanceBehaviorDelegate;
+import org.eclipse.libra.framework.core.ProgressUtil;
+import org.eclipse.libra.framework.core.Trace;
+import org.eclipse.libra.framework.equinox.EquinoxFrameworkInstance;
+import org.eclipse.libra.framework.equinox.IEquinoxFrameworkInstance;
+import org.eclipse.libra.framework.equinox.IEquinoxVersionHandler;
+import org.eclipse.libra.framework.equinox.Messages;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
+
+
+public class EquinoxFrameworkInstanceBehavior extends
+ OSGIFrameworkInstanceBehaviorDelegate {
+
+ protected transient EquinoxConfigurationPublishHelper publishHelper = new EquinoxConfigurationPublishHelper(
+ this);
+
+ /**
+ * EquinoxFrameworkInstanceBehavior.
+ */
+ public EquinoxFrameworkInstanceBehavior() {
+ super();
+ }
+
+ public IEquinoxVersionHandler getEquinoxVersionHandler() {
+ return getEquinoxRuntimeInstance().getEquinoxVersionHandler();
+ }
+
+ public EquinoxFrameworkInstance getEquinoxRuntimeInstance() {
+ return (EquinoxFrameworkInstance) getServer().loadAdapter(EquinoxFrameworkInstance.class, null);
+ }
+
+ public String getFrameworkClass() {
+ return getEquinoxVersionHandler().getFrameworkClass();
+ }
+
+ public String[] getFrameworkProgramArguments(boolean starting) {
+ return getEquinoxVersionHandler().getFrameworkProgramArguments(
+ getBaseDirectory(), getFrameworkInstance().isDebug(), starting);
+ }
+
+ public String[] getExcludedFrameworkProgramArguments(boolean starting) {
+ return getEquinoxVersionHandler().getExcludedFrameworkProgramArguments(
+ getFrameworkInstance().isDebug(), starting);
+ }
+
+ public String[] getFrameworkVMArguments() {
+ IPath installPath = getServer().getRuntime().getLocation();
+ // If installPath is relative, convert to canonical path and hope for
+ // the best
+ if (!installPath.isAbsolute()) {
+ try {
+ String installLoc = (new File(installPath.toOSString()))
+ .getCanonicalPath();
+ installPath = new Path(installLoc);
+ } catch (IOException e) {
+ // Ignore if there is a problem
+ }
+ }
+
+ IPath deployPath = getBaseDirectory();
+ // If deployPath is relative, convert to canonical path and hope for the
+ // best
+ if (!deployPath.isAbsolute()) {
+ try {
+ String deployLoc = (new File(deployPath.toOSString()))
+ .getCanonicalPath();
+ deployPath = new Path(deployLoc);
+ } catch (IOException e) {
+ // Ignore if there is a problem
+ }
+ }
+ String javaProfileID = ((IEquinoxFrameworkInstance)this.getFrameworkInstance()).getJavaPofile();
+ int jmxPort = ((IEquinoxFrameworkInstance)this.getFrameworkInstance()).getJMXPort();
+ boolean jmxEnabled = ((IEquinoxFrameworkInstance)this.getFrameworkInstance()).getJMXEnabled();
+
+ return getEquinoxVersionHandler().getFrameworkVMArguments(installPath, jmxEnabled,jmxPort,javaProfileID, null, deployPath, false);
+ }
+
+ protected void publishServer(int kind, IProgressMonitor monitor)
+ throws CoreException {
+ if (getServer().getRuntime() == null)
+ return;
+
+ IPath confDir = getBaseDirectory();
+ IStatus status = getEquinoxVersionHandler().prepareDeployDirectory(
+ confDir);
+
+ if (status != null && !status.isOK())
+ throw new CoreException(status);
+
+ monitor = ProgressUtil.getMonitorFor(monitor);
+ monitor.beginTask(Messages.publishServerTask, 600);
+
+ // TODO OSAMI 1) Cleanup 2) Backup and Publish,
+
+ // if (status != null && !status.isOK())
+ // throw new CoreException(status);
+
+ monitor.done();
+
+ setServerPublishState(IServer.PUBLISH_STATE_NONE);
+ }
+
+ @SuppressWarnings("rawtypes")
+ protected void publishModules(int kind, List modules, List deltaKind2,
+ MultiStatus multi, IProgressMonitor monitor) {
+
+
+ IPath confDir = getBaseDirectory();
+
+ FrameworkInstanceConfiguration equinoxConfiguration;
+ try {
+ equinoxConfiguration = getEquinoxRuntimeInstance().getEquinoxConfiguration();
+ publishHelper.exportBundles(modules, equinoxConfiguration, confDir);
+ String frameworkJarPath = "reference:file:"+getEquinoxRuntimeInstance().getFrameworkJarPath();
+ getEquinoxVersionHandler().prepareFrameworkConfigurationFile(confDir,
+ publishHelper.getServerModules(modules,"reference:file:", " " ),
+ frameworkJarPath, publishHelper.getTargetBundles(equinoxConfiguration));
+
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "Publishing failed", e);
+ }
+ }
+
+ protected void publishModule(int kind, int deltaKind, IModule[] moduleTree,
+ IProgressMonitor monitor) throws CoreException {
+ if (getServer().getServerState() != IServer.STATE_STOPPED) {
+ if (deltaKind == ServerBehaviourDelegate.ADDED
+ || deltaKind == ServerBehaviourDelegate.REMOVED)
+ setServerRestartState(true);
+ }
+
+ Properties p = loadModulePublishLocations();
+
+ setModulePublishState(moduleTree, IServer.PUBLISH_STATE_NONE);
+
+ saveModulePublishLocations(p);
+ }
+
+
+}
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/internal/EquinoxFrameworkInstanceLocator.java b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/internal/EquinoxFrameworkInstanceLocator.java
new file mode 100644
index 0000000..4facbeb
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/internal/EquinoxFrameworkInstanceLocator.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.equinox.internal;
+
+import org.eclipse.libra.framework.core.OSGIFrameworkLocatorDelegate;
+
+public class EquinoxFrameworkInstanceLocator extends OSGIFrameworkLocatorDelegate {
+
+ protected static final String[] runtimeTypes = new String[] {
+ "org.eclipse.libra.framework.equinox"};
+
+
+ public static String[] getRuntimeTypes() {
+ return runtimeTypes;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/java6-server.profile b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/java6-server.profile
new file mode 100644
index 0000000..9ebb1e1
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.equinox/src/org/eclipse/libra/framework/equinox/java6-server.profile
@@ -0,0 +1,211 @@
+org.osgi.framework.system.packages = \
+ com.sun.org.apache.xalan.internal.res,\
+ com.sun.org.apache.xml.internal.utils,\
+ com.sun.org.apache.xpath.internal,\
+ com.sun.org.apache.xpath.internal.jaxp,\
+ com.sun.org.apache.xpath.internal.objects,\
+ javax.accessibility,\
+ javax.activation,\
+ javax.activation;version="1.1.1",\
+ javax.activity,\
+ javax.annotation,\
+ javax.annotation;version="1.0.0",\
+ javax.annotation.processing,\
+ javax.crypto,\
+ javax.crypto.interfaces,\
+ javax.crypto.spec,\
+ javax.imageio,\
+ javax.imageio.event,\
+ javax.imageio.metadata,\
+ javax.imageio.plugins.bmp,\
+ javax.imageio.plugins.jpeg,\
+ javax.imageio.spi,\
+ javax.imageio.stream,\
+ javax.jws,\
+ javax.jws;version="2.0",\
+ javax.jws.soap,\
+ javax.jws.soap;version="2.0",\
+ javax.lang.model,\
+ javax.lang.model.element,\
+ javax.lang.model.type,\
+ javax.lang.model.util,\
+ javax.management,\
+ javax.management.loading,\
+ javax.management.modelmbean,\
+ javax.management.monitor,\
+ javax.management.openmbean,\
+ javax.management.relation,\
+ javax.management.remote,\
+ javax.management.remote.rmi,\
+ javax.management.timer,\
+ javax.naming,\
+ javax.naming.directory,\
+ javax.naming.event,\
+ javax.naming.ldap,\
+ javax.naming.spi,\
+ javax.net,\
+ javax.net.ssl,\
+ javax.print,\
+ javax.print.attribute,\
+ javax.print.attribute.standard,\
+ javax.print.event,\
+ javax.rmi,\
+ javax.rmi.CORBA,\
+ javax.rmi.ssl,\
+ javax.script,\
+ javax.script;version="1.1",\
+ javax.security.auth,\
+ javax.security.auth.callback,\
+ javax.security.auth.kerberos,\
+ javax.security.auth.login,\
+ javax.security.auth.spi,\
+ javax.security.auth.x500,\
+ javax.security.cert,\
+ javax.security.sasl,\
+ javax.sound.midi,\
+ javax.sound.midi.spi,\
+ javax.sound.sampled,\
+ javax.sound.sampled.spi,\
+ javax.sql,\
+ javax.sql.rowset,\
+ javax.sql.rowset.serial,\
+ javax.sql.rowset.spi,\
+ javax.swing,\
+ javax.swing.border,\
+ javax.swing.colorchooser,\
+ javax.swing.event,\
+ javax.swing.filechooser,\
+ javax.swing.plaf,\
+ javax.swing.plaf.basic,\
+ javax.swing.plaf.metal,\
+ javax.swing.plaf.multi,\
+ javax.swing.plaf.synth,\
+ javax.swing.table,\
+ javax.swing.text,\
+ javax.swing.text.html,\
+ javax.swing.text.html.parser,\
+ javax.swing.text.rtf,\
+ javax.swing.tree,\
+ javax.swing.undo,\
+ javax.tools,\
+ javax.transaction,\
+ javax.transaction;version="1.0.1",\
+ javax.transaction;version="1.1.0",\
+ javax.transaction.xa,\
+ javax.transaction.xa;version="1.0.1",\
+ javax.transaction.xa;version="1.1.0",\
+ javax.xml,\
+ javax.xml;version="1.0.1",\
+ javax.xml.bind,\
+ javax.xml.bind;version="2.0",\
+ javax.xml.bind.annotation,\
+ javax.xml.bind.annotation;version="2.0",\
+ javax.xml.bind.annotation.adapters,\
+ javax.xml.bind.annotation.adapters;version="2.0",\
+ javax.xml.bind.attachment,\
+ javax.xml.bind.attachment;version="2.0",\
+ javax.xml.bind.helpers,\
+ javax.xml.bind.helpers;version="2.0",\
+ javax.xml.bind.util,\
+ javax.xml.bind.util;version="2.0",\
+ javax.xml.crypto,\
+ javax.xml.crypto;version="1.0",\
+ javax.xml.crypto.dom,\
+ javax.xml.crypto.dom;version="1.0",\
+ javax.xml.crypto.dsig,\
+ javax.xml.crypto.dsig;version="1.0",\
+ javax.xml.crypto.dsig.dom,\
+ javax.xml.crypto.dsig.dom;version="1.0",\
+ javax.xml.crypto.dsig.keyinfo,\
+ javax.xml.crypto.dsig.keyinfo;version="1.0",\
+ javax.xml.crypto.dsig.spec,\
+ javax.xml.crypto.dsig.spec;version="1.0",\
+ javax.xml.datatype,\
+ javax.xml.namespace,\
+ javax.xml.parsers,\
+ javax.xml.soap,\
+ javax.xml.soap;version="1.3.0",\
+ javax.xml.stream,\
+ javax.xml.stream;version="1.0.1",\
+ javax.xml.stream.events,\
+ javax.xml.stream.events;version="1.0.1",\
+ javax.xml.stream.util,\
+ javax.xml.stream.util;version="1.0.1",\
+ javax.xml.transform,\
+ javax.xml.transform.dom,\
+ javax.xml.transform.sax,\
+ javax.xml.transform.stax,\
+ javax.xml.transform.stream,\
+ javax.xml.validation,\
+ javax.xml.ws,\
+ javax.xml.ws;version="2.1.1",\
+ javax.xml.ws.handler,\
+ javax.xml.ws.handler;version="2.1.1",\
+ javax.xml.ws.handler.soap,\
+ javax.xml.ws.handler.soap;version="2.1.1",\
+ javax.xml.ws.http,\
+ javax.xml.ws.http;version="2.1.1",\
+ javax.xml.ws.soap,\
+ javax.xml.ws.soap;version="2.1.1",\
+ javax.xml.ws.spi,\
+ javax.xml.ws.spi;version="2.1.1",\
+ javax.xml.xpath,\
+ org.ietf.jgss,\
+ org.omg.CORBA,\
+ org.omg.CORBA_2_3,\
+ org.omg.CORBA_2_3.portable,\
+ org.omg.CORBA.DynAnyPackage,\
+ org.omg.CORBA.ORBPackage,\
+ org.omg.CORBA.portable,\
+ org.omg.CORBA.TypeCodePackage,\
+ org.omg.CosNaming,\
+ org.omg.CosNaming.NamingContextExtPackage,\
+ org.omg.CosNaming.NamingContextPackage,\
+ org.omg.Dynamic,\
+ org.omg.DynamicAny,\
+ org.omg.DynamicAny.DynAnyFactoryPackage,\
+ org.omg.DynamicAny.DynAnyPackage,\
+ org.omg.IOP,\
+ org.omg.IOP.CodecFactoryPackage,\
+ org.omg.IOP.CodecPackage,\
+ org.omg.Messaging,\
+ org.omg.PortableInterceptor,\
+ org.omg.PortableInterceptor.ORBInitInfoPackage,\
+ org.omg.PortableServer,\
+ org.omg.PortableServer.CurrentPackage,\
+ org.omg.PortableServer.POAManagerPackage,\
+ org.omg.PortableServer.POAPackage,\
+ org.omg.PortableServer.portable,\
+ org.omg.PortableServer.ServantLocatorPackage,\
+ org.omg.SendingContext,\
+ org.omg.stub.java.rmi,\
+ org.w3c.dom,\
+ org.w3c.dom.bootstrap,\
+ org.w3c.dom.css,\
+ org.w3c.dom.events,\
+ org.w3c.dom.html,\
+ org.w3c.dom.ls,\
+ org.w3c.dom.ranges,\
+ org.w3c.dom.stylesheets,\
+ org.w3c.dom.traversal,\
+ org.w3c.dom.views ,\
+ org.xml.sax,\
+ org.xml.sax.ext,\
+ org.xml.sax.helpers
+org.osgi.framework.bootdelegation = \
+ org.eclipse.virgo.osgi.extensions.*,\
+ org.eclipse.virgo.osgi.launcher.*,\
+ com.sun.*,\
+ javax.xml.*,\
+ org.apache.xerces.jaxp.*,\
+ org.w3c.*,\
+ org.xml.*,\
+ sun.*
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1,\
+ J2SE-1.3,\
+ J2SE-1.4,\
+ J2SE-1.5,\
+ JavaSE-1.6
+osgi.java.profile.name = Equinox-Kernel-Java6
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/.classpath b/plugins/org.eclipse.libra.framework.felix.ui/.classpath
new file mode 100644
index 0000000..64c5e31
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/.cvsignore b/plugins/org.eclipse.libra.framework.felix.ui/.cvsignore
new file mode 100644
index 0000000..4571f2d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/.cvsignore
@@ -0,0 +1,8 @@
+bin
+build.xml
+org.eclipse.jst.server.tomcat.ui_3.0.0.jar
+tomcatui.jar
+temp.folder
+@dot
+src.zip
+javaCompiler...args
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/.options b/plugins/org.eclipse.libra.framework.felix.ui/.options
new file mode 100644
index 0000000..d88b03b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/.options
@@ -0,0 +1,4 @@
+# Debugging options for the org.eclipse.jst.server.tomcat.ui plugin
+
+# Turn on general debugging
+org.eclipse.jst.server.tomcat.ui/debug=true
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/.project b/plugins/org.eclipse.libra.framework.felix.ui/.project
new file mode 100644
index 0000000..999cce4
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.libra.framework.felix.ui</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.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.libra.framework.felix.ui/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..c8be432
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Fri Nov 10 17:11:35 HST 2006
+eclipse.preferences.version=1
+encoding/<project>=ISO-8859-1
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.libra.framework.felix.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..87e641f
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,74 @@
+#Sat Oct 16 21:03:45 EEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=error
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,*.testsuite,*.deploy,*.location,*.execution,*.datapool,*.artifact,*.html,*.svg
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=disabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=error
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.incompatibleJDKLevel=warning
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.libra.framework.felix.ui/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..584bdff
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,4 @@
+#Fri Nov 10 18:06:11 HST 2006
+eclipse.preferences.version=1
+internal.default.compliance=user
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?>\n<templates/>
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.libra.framework.felix.ui/.settings/org.eclipse.pde.prefs
new file mode 100644
index 0000000..0e06e96
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/.settings/org.eclipse.pde.prefs
@@ -0,0 +1,15 @@
+#Mon Jan 15 21:56:48 EST 2007
+compilers.incompatible-environment=0
+compilers.p.build=0
+compilers.p.deprecated=1
+compilers.p.missing-packages=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=0
+compilers.p.unknown-element=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.libra.framework.felix.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..1709673
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,29 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.libra.framework.felix.ui;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.libra.framework.felix.ui.FelixUIPlugin
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.expressions;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jdt.debug.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jdt.launching;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.wst.server.core;bundle-version="[1.0.204,2.0.0)",
+ org.eclipse.jst.server.core;bundle-version="[1.0.103,2.0.0)",
+ org.eclipse.jst.server.ui;bundle-version="[1.0.103,2.0.0)",
+ org.eclipse.wst.common.project.facet.ui;bundle-version="[1.1.0,2.0.0)",
+ org.eclipse.libra.framework.felix,
+ org.eclipse.wst.server.ui,
+ org.eclipse.pde.core,
+ org.eclipse.pde.ui,
+ org.eclipse.libra.framework.core,
+ org.eclipse.libra.framework.ui
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/about.html b/plugins/org.eclipse.libra.framework.felix.ui/about.html
new file mode 100644
index 0000000..8f31159
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>March 25, 2011</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/build.properties b/plugins/org.eclipse.libra.framework.felix.ui/build.properties
new file mode 100644
index 0000000..5016daa
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/build.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+bin.includes = plugin.xml,\
+ plugin.properties,\
+ icons/,\
+ .,\
+ META-INF/,\
+ about.html
+bin.excludes = bin/**,\
+ @dot/**,\
+ temp.folder/**
+source.. = src/
+
+
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/felix.gif b/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/felix.gif
new file mode 100644
index 0000000..d126d8d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/felix.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/mime_extension.gif b/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/mime_extension.gif
new file mode 100644
index 0000000..c585010
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/mime_extension.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/mime_mapping.gif b/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/mime_mapping.gif
new file mode 100644
index 0000000..0a8e4bf
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/mime_mapping.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/port.gif b/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/port.gif
new file mode 100644
index 0000000..7a354b7
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/port.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/project_missing.gif b/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/project_missing.gif
new file mode 100644
index 0000000..0cb4c16
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/project_missing.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/web_module.gif b/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/web_module.gif
new file mode 100644
index 0000000..bf20f70
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/icons/obj16/web_module.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/icons/wizban/felix_wiz.png b/plugins/org.eclipse.libra.framework.felix.ui/icons/wizban/felix_wiz.png
new file mode 100644
index 0000000..05d4925
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/icons/wizban/felix_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/plugin.properties b/plugins/org.eclipse.libra.framework.felix.ui/plugin.properties
new file mode 100644
index 0000000..c01f84b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/plugin.properties
@@ -0,0 +1,21 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+pluginName=Apache Felix UI Support
+providerName=Eteration A.S.
+
+configurationEditorOSGiModulesPage=Modules
+configurationEditorTargetPage=Target Platform Profile
+
+cleanFelixWorkDir=Clean Felix Work Directory...
+cleanFelixModuleWorkDir=Clean Module Work Directory...
+
+publisherContextFixLabel=Update context paths
+publisherContextFixDescription=Prompt to update module contexts when they are out of sync.
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/plugin.xml b/plugins/org.eclipse.libra.framework.felix.ui/plugin.xml
new file mode 100644
index 0000000..15fc814
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/plugin.xml
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2010 Eteration A.S. 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:
+ Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ -->
+
+<plugin>
+ <extension point="org.eclipse.wst.server.ui.serverImages">
+ <image
+ id="org.eclipse.libra.framework.felix.20x"
+ icon="icons/obj16/felix.gif"
+ typeIds="org.eclipse.libra.framework.felix.serverType.20x"/>
+
+ <image
+ id="org.eclipse.libra.framework.felix.runtimeType.20x"
+ icon="icons/obj16/felix.gif"
+ typeIds="org.eclipse.libra.framework.felix.runtimeType.20x"/>
+
+
+ <image
+ id="org.eclipse.libra.framework.felix.30x"
+ icon="icons/obj16/felix.gif"
+ typeIds="org.eclipse.libra.framework.felix.serverType.30x"/>
+
+ <image
+ id="org.eclipse.libra.framework.felix.runtimeType.30x"
+ icon="icons/obj16/felix.gif"
+ typeIds="org.eclipse.libra.framework.felix.runtimeType.30x"/>
+ </extension>
+
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ id="org.eclipse.libra.framework.felix.ui.propertyTester"
+ namespace="org.eclipse.libra.framework.felix.ui"
+ properties="hasConfiguration"
+ type="java.lang.Object"
+ class="org.eclipse.libra.framework.felix.ui.internal.ConfigurationPropertyTester">
+ </propertyTester>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.ui.editorPages">
+ <page
+ id="org.eclipse.libra.framework.felix.ui.editor.osgimodule"
+ order="20"
+ name="%configurationEditorOSGiModulesPage"
+ typeIds="org.eclipse.libra.framework.felix.serverType.*"
+ class="org.eclipse.libra.framework.ui.internal.editor.ConfigurationOSGiModuleEditorPart">
+ <enablement>
+ <test property="org.eclipse.libra.framework.felix.ui.hasConfiguration" value="true"/>
+ </enablement>
+ </page>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.ui.editorPages">
+ <page
+ id="org.eclipse.libra.framework.felix.ui.editor.osgimodule"
+ order="22"
+ name="Target Platform Profile"
+ typeIds="org.eclipse.libra.framework.felix.serverType.*"
+ class="org.eclipse.libra.framework.ui.internal.editor.TargetDefinitionEditorPart">
+ <enablement>
+ <test property="org.eclipse.libra.framework.felix.ui.hasConfiguration" value="true"/>
+ </enablement>
+ </page>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.ui.editorPageSections">
+ <section
+ id="org.eclipse.libra.framework.felix.editor.instance"
+ order="0"
+ insertionId="org.eclipse.wst.server.editor.overview.left"
+ typeIds="org.eclipse.libra.framework.felix.serverType.*"
+ class="org.eclipse.libra.framework.ui.internal.editor.FrameworkInstanceLocationEditorSection"/>
+ <section
+ id="org.eclipse.libra.framework.equinox.editor.instance"
+ order="0"
+ insertionId="org.eclipse.wst.server.editor.overview.right"
+ typeIds="org.eclipse.libra.framework.felix.serverType.*"
+ class="org.eclipse.libra.framework.ui.JMXPropertiesEditorSection"/>
+
+ </extension>
+
+ <extension point="org.eclipse.wst.server.ui.wizardFragments">
+ <fragment
+ id="org.eclipse.libra.framework.felix.20x"
+ typeIds="org.eclipse.libra.framework.felix.runtimeType.20x"
+ class="org.eclipse.libra.framework.ui.OSGIFrameworkWizardFragment"/>
+ <fragment
+ id="org.eclipse.libra.framework.felix.30x"
+ typeIds="org.eclipse.libra.framework.felix.runtimeType.30x"
+ class="org.eclipse.libra.framework.ui.OSGIFrameworkWizardFragment"/>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+ <launchConfigurationTypeImage
+ id="org.eclipse.libra.framework.felix.20x.launchConfig.image"
+ configTypeID="org.eclipse.libra.framework.felix.launchConfigurationType"
+ icon="icons/obj16/felix.gif">
+ </launchConfigurationTypeImage>
+ <launchConfigurationTypeImage
+ id="org.eclipse.libra.framework.felix.30x.launchConfig.image"
+ configTypeID="org.eclipse.libra.framework.felix.launchConfigurationType"
+ icon="icons/obj16/felix.gif">
+ </launchConfigurationTypeImage>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ id="org.eclipse.libra.framework.felix.ui.launchConfigurationTabGroup"
+ type="org.eclipse.libra.framework.felix.launchConfigurationType"
+ class="org.eclipse.libra.framework.ui.GenericOSGILaunchConfigurationTabGroup">
+ </launchConfigurationTabGroup>
+ </extension>
+
+ <extension point="org.eclipse.wst.common.project.facet.ui.images">
+ <image runtime-component-type="org.eclipse.libra.framework.felix.runtimeType"
+ path="icons/obj16/felix.gif"/>
+ </extension>
+
+
+
+ <extension point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ id="org.eclipse.libra.framework.felix.ui.serveractions"
+ objectClass="org.eclipse.wst.server.core.IServer">
+ <visibility>
+ <objectState name="serverType" value="org.eclipse.libra.framework.felix.serverType.*"/>
+ </visibility>
+ <action
+ class="org.eclipse.libra.framework.ui.internal.actions.CleanWorkDirAction"
+ enablesFor="1"
+ id="org.eclipse.libra.framework.felix.ui.cleanserverworkdir"
+ label="%cleanFelixWorkDir">
+ </action>
+ </objectContribution>
+ <objectContribution
+ adaptable="true"
+ id="org.eclipse.libra.framework.felix..ui.serveractions"
+ objectClass="org.eclipse.wst.server.ui.internal.view.servers.ModuleServer">
+ <visibility>
+ <and>
+ <objectState name="serverType" value="org.eclipse.libra.framework.felix.serverType.*"/>
+ <objectState name="moduleType" value="osgi.bundle"/>
+ </and>
+ </visibility>
+ <action
+ class="org.eclipse.libra.framework.ui.internal.actions.CleanWorkDirAction"
+ enablesFor="1"
+ id="org.eclipse.libra.framework.felix.ui.cleanmoduleworkdir"
+ label="%cleanFelixModuleWorkDir">
+ </action>
+ </objectContribution>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.publishers">
+ <publisher
+ id="org.eclipse.libra.framework.felix.ui.context"
+ typeIds="org.eclipse.libra.framework.felix.serverType.*"
+ name="%publisherContextFixLabel"
+ description="%publisherContextFixDescription"
+ order=""
+ class="org.eclipse.libra.framework.ui.internal.ModulePublisherDelegate"/>
+ </extension>
+</plugin>
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/pom.xml b/plugins/org.eclipse.libra.framework.felix.ui/pom.xml
new file mode 100644
index 0000000..771c484
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/pom.xml
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.libra_parent</artifactId>
+ <groupId>org.eclipse.libra</groupId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../development/org.eclipse.libra.releng/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.libra.framework.felix.ui</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSGi Frameworks Felix Adapter UI Plug-in</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/src/org/eclipse/libra/framework/felix/ui/FelixUIPlugin.java b/plugins/org.eclipse.libra.framework.felix.ui/src/org/eclipse/libra/framework/felix/ui/FelixUIPlugin.java
new file mode 100644
index 0000000..22cdc1e
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/src/org/eclipse/libra/framework/felix/ui/FelixUIPlugin.java
@@ -0,0 +1,59 @@
+package org.eclipse.libra.framework.felix.ui;
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+public class FelixUIPlugin extends AbstractUIPlugin {
+ protected static FelixUIPlugin singleton;
+ public static final String PLUGIN_ID = "org.eclipse.libra.framework.felix.ui";
+
+ public FelixUIPlugin() {
+ super();
+ singleton = this;
+ }
+
+ /**
+ * Returns the singleton instance of this plugin.
+ * @return org.eclipse.jst.server.tomcat.internal.TomcatUIPlugin
+ */
+ public static FelixUIPlugin getInstance() {
+ return singleton;
+ }
+
+ /**
+ * Convenience method for logging.
+ *
+ * @param status org.eclipse.core.runtime.IStatus
+ */
+ public static void log(IStatus status) {
+ getInstance().getLog().log(status);
+ }
+
+ /**
+ * Convenience method to get a Display. The method first checks, if
+ * the thread calling this method has an associated display. If so, this
+ * display is returned. Otherwise the method returns the default display.
+ *
+ * @return the display
+ */
+ public static Display getStandardDisplay() {
+ Display display = Display.getCurrent();
+ if (display == null)
+ display = Display.getDefault();
+ return display;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.felix.ui/src/org/eclipse/libra/framework/felix/ui/internal/ConfigurationPropertyTester.java b/plugins/org.eclipse.libra.framework.felix.ui/src/org/eclipse/libra/framework/felix/ui/internal/ConfigurationPropertyTester.java
new file mode 100644
index 0000000..7392385
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix.ui/src/org/eclipse/libra/framework/felix/ui/internal/ConfigurationPropertyTester.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.felix.ui.internal;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.libra.framework.core.FrameworkInstanceDelegate;
+import org.eclipse.libra.framework.felix.IFelixFrameworkInstance;
+import org.eclipse.wst.server.core.IServerAttributes;
+
+/**
+ *
+ */
+public class ConfigurationPropertyTester extends PropertyTester {
+ /* (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ try {
+ IServerAttributes server = (IServerAttributes) receiver;
+ FrameworkInstanceDelegate felix = (FrameworkInstanceDelegate) server.loadAdapter(IFelixFrameworkInstance.class, null);
+ if (felix != null)
+ return felix != null;
+ } catch (Exception e) {
+ // ignore
+ }
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.felix/.classpath b/plugins/org.eclipse.libra.framework.felix/.classpath
new file mode 100644
index 0000000..64c5e31
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.libra.framework.felix/.project b/plugins/org.eclipse.libra.framework.felix/.project
new file mode 100644
index 0000000..ecab378
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.libra.framework.felix</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.libra.framework.felix/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.libra.framework.felix/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..64203b9
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Oct 22 10:43:27 EEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+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
diff --git a/plugins/org.eclipse.libra.framework.felix/META-INF/MANIFEST.MF b/plugins/org.eclipse.libra.framework.felix/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..1c3920b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/META-INF/MANIFEST.MF
@@ -0,0 +1,31 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.libra.framework.felix;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.libra.framework.felix.FelixPlugin
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.jdt.launching,
+ org.eclipse.debug.core,
+ org.eclipse.pde.ui,
+ org.eclipse.pde,
+ org.eclipse.wst.server.core,
+ org.eclipse.wst.server.ui,
+ org.eclipse.jst.server.core,
+ org.eclipse.jdt.core,
+ org.eclipse.jst.common.project.facet.core,
+ org.eclipse.wst.common.modulecore,
+ org.eclipse.equinox.frameworkadmin,
+ org.eclipse.libra.framework.core
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.core.resources,
+ org.eclipse.debug.core,
+ org.eclipse.jdt.launching.sourcelookup,
+ org.eclipse.pde.core.plugin,
+ org.eclipse.pde.ui.launcher
+Export-Package: org.eclipse.libra.framework.felix,
+ org.eclipse.libra.framework.felix.internal
diff --git a/plugins/org.eclipse.libra.framework.felix/about.html b/plugins/org.eclipse.libra.framework.felix/about.html
new file mode 100644
index 0000000..7d9511d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>September 21, 2011</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.felix/build.properties b/plugins/org.eclipse.libra.framework.felix/build.properties
new file mode 100644
index 0000000..81e3c06
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/build.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties
diff --git a/plugins/org.eclipse.libra.framework.felix/plugin.properties b/plugins/org.eclipse.libra.framework.felix/plugin.properties
new file mode 100644
index 0000000..7fe2af4
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/plugin.properties
@@ -0,0 +1,31 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+pluginName=Apache Felix Support
+providerName=Eteration A.S.
+
+# --------------- Runtime Types ---------------
+libra=Eclipse Libra
+runtimeTypeFelix20Label=Apache Felix 2.0 OSGi Service Platform
+runtimeTypeFelix20Description=Apache Felix 2.0 OSGi Service Platform supports OSGi R3.
+
+runtimeTypeFelix30Label=Apache Felix 3.0 OSGi Service Platform
+runtimeTypeFelix30Description=Apache Felix 3.0 OSGi Service Platform supports OSGi R4.
+
+
+# --------------- Runtime Instance ---------------
+runtimeInstanceTypeFelix20Label=Apache Felix 2.0 Framework Instance
+runtimeInstanceTypeFelix20Description=Publishes and runs osgi bundle projects on local felix platform.
+
+runtimeInstanceTypeFelix30Label=Apache Felix 3.0 Framework Instance
+runtimeInstanceTypeFelix30Description=Publishes and runs osgi bundle projects on local felix platform.
+
+felixLaunchConfigurationType=Apache Felix
+
diff --git a/plugins/org.eclipse.libra.framework.felix/plugin.xml b/plugins/org.eclipse.libra.framework.felix/plugin.xml
new file mode 100644
index 0000000..2efd141
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/plugin.xml
@@ -0,0 +1,225 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?><!--
+ Copyright (c) 2010 Eteration A.S. 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:
+ Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ -->
+<plugin>
+ <extension
+ point="org.eclipse.wst.server.core.runtimeTypes">
+ <runtimeType
+ id="org.eclipse.libra.framework.felix.runtimeType.20x"
+ name="%runtimeTypeFelix20Label"
+ description="%runtimeTypeFelix20Description"
+ vendor="%libra"
+ version="2.0"
+ class="org.eclipse.libra.framework.felix.FelixFramework">
+ <moduleType
+ types="osgi.bundle"
+ versions="4.2"/>
+ <moduleType
+ types="java"
+ versions="1.6"/>
+ <moduleType
+ types="java"
+ versions="1.5"/>
+ </runtimeType>
+ <runtimeType
+ id="org.eclipse.libra.framework.felix.runtimeType.30x"
+ name="%runtimeTypeFelix30Label"
+ description="%runtimeTypeFelix30Description"
+ vendor="%libra"
+ version="2.0"
+ class="org.eclipse.libra.framework.felix.FelixFramework">
+ <moduleType
+ types="osgi.bundle"
+ versions="4.2"/>
+ <moduleType
+ types="java"
+ versions="1.6"/>
+ <moduleType
+ types="java"
+ versions="1.5"/>
+ </runtimeType>
+ </extension>
+
+
+ <extension point="org.eclipse.wst.server.core.runtimeLocators">
+ <runtimeLocator
+ id="org.eclipse.libra.framework.felix.runtime.locator"
+ typeIds="org.eclipse.libra.framework.felix.runtimeType.*"
+ class="org.eclipse.libra.framework.core.OSGIFrameworkLocatorDelegate"/>
+ </extension>
+
+ <extension point="org.eclipse.jst.server.core.runtimeClasspathProviders">
+ <runtimeClasspathProvider
+ id="org.eclipse.libra.framework.felix.runtimeTarget"
+ runtimeTypeIds="org.eclipse.libra.framework.felix.runtimeType.*"
+ class="org.eclipse.libra.framework.felix.internal.FelixRuntimeClasspathProvider"/>
+ </extension>
+
+
+ <extension
+ point="org.eclipse.wst.server.core.serverTypes">
+ <serverType
+ id="org.eclipse.libra.framework.felix.serverType.20x"
+ name="%runtimeInstanceTypeFelix20Label"
+ description="%runtimeInstanceTypeFelix20Description"
+ supportsRemoteHosts="false"
+ runtime="true"
+ startTimeout="120000"
+ stopTimeout="120000"
+ initialState="stopped"
+ startBeforePublish="false"
+ synchronousStart="true"
+ hasConfiguration="true"
+ launchConfigId="org.eclipse.libra.framework.felix.launchConfigurationType"
+ runtimeTypeId="org.eclipse.libra.framework.felix.runtimeType.20x"
+ class="org.eclipse.libra.framework.felix.FelixFrameworkInstance"
+ behaviourClass="org.eclipse.libra.framework.felix.internal.FelixRuntimeInstanceBehavior">
+ </serverType>
+ <serverType
+ id="org.eclipse.libra.framework.felix.serverType.30x"
+ name="%runtimeInstanceTypeFelix30Label"
+ description="%runtimeInstanceTypeFelix30Description"
+ supportsRemoteHosts="false"
+ runtime="true"
+ startTimeout="120000"
+ stopTimeout="120000"
+ initialState="stopped"
+ startBeforePublish="false"
+ synchronousStart="true"
+ hasConfiguration="true"
+ launchConfigId="org.eclipse.libra.framework.felix.launchConfigurationType"
+ runtimeTypeId="org.eclipse.libra.framework.felix.runtimeType.30x"
+ class="org.eclipse.libra.framework.felix.FelixFrameworkInstance"
+ behaviourClass="org.eclipse.libra.framework.felix.internal.FelixRuntimeInstanceBehavior">
+ </serverType>
+ </extension>
+
+
+ <extension point="org.eclipse.wst.server.core.serverLocators">
+ <serverLocator
+ id="org.eclipse.libra.framework.felix.server.locator"
+ supportsRemoteHosts="false"
+ typeIds="org.eclipse.libra.framework.felix.serverType.*"
+ class="org.eclipse.libra.framework.core.OSGIFrameworkInstanceLocatorDelegate"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.launchableAdapters">
+ <launchableAdapter
+ class="org.eclipse.libra.framework.core.launching.LaunchableAdapterDelegate"
+ id="org.eclipse.libra.framework.felix.osgi"/>
+ </extension>
+
+ <extension point="org.eclipse.debug.core.sourcePathComputers">
+ <sourcePathComputer
+ id="org.eclipse.libra.framework.felix.sourcePathComputer"
+ class="org.eclipse.libra.framework.core.internal.debug.OSGIRuntimeSourcePathComputerDelegate"/>
+ </extension>
+
+ <extension point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ id="org.eclipse.libra.framework.felix.launchConfigurationType"
+ name="%felixLaunchConfigurationType"
+ delegate="org.eclipse.libra.framework.core.launching.LaunchConfigurationDelegate"
+ modes="run, debug, profile"
+ sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
+ sourcePathComputerId="org.eclipse.libra.framework.felix.sourcePathComputer"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.publishTasks">
+ <publishTask
+ id="org.eclipse.libra.framework.felix.publishTask"
+ typeIds="org.eclipse.libra.framework.felix.serverType.*"
+ class="org.eclipse.libra.framework.core.publish.PublishTask"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.common.project.facet.core.runtimes">
+ <runtime-component-type
+ id="org.eclipse.libra.framework.felix.runtimeType"/>
+
+ <runtime-component-version
+ type="org.eclipse.libra.framework.felix.runtimeType"
+ version="2.0"/>
+ <runtime-component-version
+ type="org.eclipse.libra.framework.felix.runtimeType"
+ version="3.0"/>
+
+ <adapter>
+ <runtime-component
+ id="org.eclipse.libra.framework.felix.runtimeType"/>
+ <factory
+ class="org.eclipse.jst.server.core.internal.RuntimeClasspathProvider$Factory"/>
+ <type
+ class="org.eclipse.jst.common.project.facet.core.IClasspathProvider"/>
+ </adapter>
+ <supported>
+ <runtime-component id="org.eclipse.libra.framework.felix.runtimeType"/>
+ <facet id="osgi.bundle" />
+ </supported>
+
+ </extension>
+
+ <extension point="org.eclipse.wst.common.project.facet.core.defaultFacets">
+ <default-facets>
+ <runtime-component id="org.eclipse.libra.framework.felix.runtimeType">
+ </runtime-component>
+ <facet
+ id="osgi.bundle" version="4.2">
+ </facet>
+ </default-facets>
+ </extension>
+
+ <extension point="org.eclipse.jst.server.core.runtimeFacetMappings">
+ <runtimeFacetMapping
+ runtimeTypeId="org.eclipse.libra.framework.felix.runtimeType.20x"
+ runtime-component="org.eclipse.libra.framework.felix.runtimeType"
+ version="2.0"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.installableRuntimes">
+ <runtime
+ id="org.eclipse.libra.framework.felix.runtimeType.20x"
+ licenseUrl="http://www.apache.org/licenses/LICENSE-2.0.txt"
+ archiveUrl="http://archive.apache.org/dist/felix/org.apache.felix.main.distribution-2.0.5.zip"
+ archivePath="org.apache.felix.main.distribution-2.0.5"
+ os="win32"/>
+ <runtime
+ id="org.eclipse.libra.framework.felix.runtimeType.20x"
+ licenseUrl="http://www.apache.org/licenses/LICENSE-1.1"
+ archiveUrl="http://archive.apache.org/dist/felix/org.apache.felix.main.distribution-2.0.5.tar.gz"
+ archivePath="org.apache.felix.main.distribution-2.0.5"
+ os="linux"/>
+ <runtime
+ id="org.eclipse.libra.framework.felix.runtimeType.20x"
+ licenseUrl="http://www.apache.org/licenses/LICENSE-1.1"
+ archiveUrl="http://archive.apache.org/dist/felix/org.apache.felix.main.distribution-2.0.5.tar.gz"
+ archivePath="org.apache.felix.main.distribution-2.0.5"
+ os="macosx"/>
+ <runtime
+ id="org.eclipse.libra.framework.felix.runtimeType.30x"
+ licenseUrl="http://www.apache.org/licenses/LICENSE-2.0.txt"
+ archiveUrl="http://archive.apache.org/dist/felix/org.apache.felix.main.distribution-3.0.4.zip"
+ archivePath="org.apache.felix.main.distribution-3.0.4"
+ os="win32"/>
+ <runtime
+ id="org.eclipse.libra.framework.felix.runtimeType.30x"
+ licenseUrl="http://www.apache.org/licenses/LICENSE-1.1"
+ archiveUrl="http://archive.apache.org/dist/felix/org.apache.felix.main.distribution-3.0.4.tar.gz"
+ archivePath="org.apache.felix.main.distribution-3.0.4"
+ os="linux"/>
+ <runtime
+ id="org.eclipse.libra.framework.felix.runtimeType.30x"
+ licenseUrl="http://www.apache.org/licenses/LICENSE-1.1"
+ archiveUrl="http://archive.apache.org/dist/felix/org.apache.felix.main.distribution-3.0.4.tar.gz"
+ archivePath="org.apache.felix.main.distribution-3.0.4"
+ os="macosx"/>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.libra.framework.felix/pom.xml b/plugins/org.eclipse.libra.framework.felix/pom.xml
new file mode 100644
index 0000000..61dcdde
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/pom.xml
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.libra_parent</artifactId>
+ <groupId>org.eclipse.libra</groupId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../development/org.eclipse.libra.releng/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.libra.framework.felix</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSGi Frameworks Felix Adapter Plug-in</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/plugins/org.eclipse.libra.framework.felix/schema/org.eclipse.libra.runtime.felix.exsd b/plugins/org.eclipse.libra.framework.felix/schema/org.eclipse.libra.runtime.felix.exsd
new file mode 100644
index 0000000..4804632
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/schema/org.eclipse.libra.runtime.felix.exsd
@@ -0,0 +1,99 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.libra.framework.felix" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.libra.framework.felix" id="org.eclipse.libra.framework.felix" name="Felix"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="client">
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.libra.framework.felix.IConfig"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/Felix2Handler.java b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/Felix2Handler.java
new file mode 100644
index 0000000..ff0b61b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/Felix2Handler.java
@@ -0,0 +1,193 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.felix;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.libra.framework.core.Trace;
+import org.eclipse.wst.server.core.IModule;
+
+
+public class Felix2Handler implements IFelixVersionHandler {
+
+
+
+ public IStatus verifyInstallPath(IPath location) {
+
+ File f = location.append("conf").toFile();
+ if(f == null || !f.exists())
+ return new Status(IStatus.ERROR, FelixPlugin.PLUGIN_ID,
+ 0, Messages.warningCantReadConfig, null);
+ File[] conf = f.listFiles();
+ if (conf != null) {
+ int size = conf.length;
+ for (int i = 0; i < size; i++) {
+ if (!f.canRead())
+ return new Status(IStatus.WARNING, FelixPlugin.PLUGIN_ID,
+ 0, Messages.warningCantReadConfig, null);
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ public String getFrameworkClass() {
+ return "org.apache.felix.main.Main";
+ }
+
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public List getFrameworkClasspath(IPath installPath, IPath configPath) {
+
+ List cp = new ArrayList();
+
+ IPath binPath = installPath.append("bin");
+ if (binPath.toFile().exists()) {
+ IPath path = binPath.append("felix.jar");
+ cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(path));
+ }
+
+ return cp;
+ }
+
+
+ public String[] getFrameworkProgramArguments(IPath configPath, boolean debug,
+ boolean starting) {
+ return new String[]{configPath.append("cache").makeAbsolute().toPortableString()};
+ }
+
+
+ public String[] getExcludedFrameworkProgramArguments(boolean debug,
+ boolean starting) {
+ return null;
+ }
+
+
+ public String[] getFrameworkVMArguments(IPath installPath, IPath configPath,
+ IPath deployPath, boolean isTestEnv, boolean jmxEnabled, int jmxPort) {
+
+ String configPathStr = deployPath.makeAbsolute().append("config.properties").toPortableString(); //$NON-NLS-1$
+ String vmArgs = "-Dfelix.config.properties=file:" + configPathStr; //$NON-NLS-1$
+
+ //String configPathStr = deployPath.makeAbsolute().toOSString();
+ String profilePath = deployPath.append("java.profile").toOSString();
+
+
+ String vmArgs2 ="" ;
+ try {
+ copyFile(this.getClass().getResourceAsStream("java6-server.profile"), new File(profilePath));
+ vmArgs2 += "-Dosgi.java.profile=file:"+profilePath; //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (IOException e) {
+ Trace.trace(Trace.SEVERE, "Could not set equinox VM arguments:"+e.getMessage(), e);
+ }
+
+
+
+ if(jmxEnabled)
+ return new String[]{"-Dcom.sun.management.jmxremote.port="+jmxPort, "-Dcom.sun.management.jmxremote.authenticate=false", "-Dcom.sun.management.jmxremote.ssl=false", vmArgs, vmArgs2};
+ else
+ return new String[]{ vmArgs, vmArgs2};
+ }
+
+ private void copyFile(InputStream source, File destFile) throws IOException {
+
+
+ FileOutputStream destination = null;
+ try {
+ destination = new FileOutputStream(destFile);
+ int c;
+ while((c = source.read()) != -1){
+ destination.write(c);
+ }
+ }
+ finally {
+ if(source != null) {
+ source.close();
+ }
+ if(destination != null) {
+ destination.close();
+ }
+ }
+ }
+
+ public IStatus canAddModule(IModule module) {
+ String id = module.getModuleType().getId();
+ //String version = module.getModuleType().getVersion();
+ if ("osgi.bundle".equals(id) )
+ return Status.OK_STATUS;
+
+ return new Status(IStatus.ERROR, FelixPlugin.PLUGIN_ID, 0,
+ Messages.errorNotBundle, null);
+ }
+
+
+ public IStatus prepareFrameworkInstanceDirectory(IPath baseDir) {
+ return Status.OK_STATUS;//TomcatVersionHelper.createCatalinaInstanceDirectory(baseDir);
+ }
+
+
+ public IStatus prepareDeployDirectory(IPath deployPath) {
+
+ if (Trace.isTraceEnabled())
+ Trace.trace(Trace.FINER, "Creating runtime directory at " + deployPath.toOSString());
+
+
+ // Prepare a felix directory structure
+ File temp = deployPath.append("plugins").toFile();
+ if (!temp.exists())
+ temp.mkdirs();
+ temp = deployPath.append("auto").toFile();
+ if (!temp.exists())
+ temp.mkdirs();
+ temp = deployPath.append("cache").toFile();
+ if (!temp.exists())
+ temp.mkdirs();
+
+ return Status.OK_STATUS;
+ }
+
+
+
+ public boolean supportsServeModulesWithoutPublish() {
+ return true;
+ }
+
+ public void prepareFrameworkConfigurationFile(IPath configPath, String workspaceBundles, String kernelBundles) {
+ Properties properties = new Properties();
+
+ properties.setProperty("felix.auto.deploy.dir",configPath.append("auto").makeAbsolute().toPortableString());
+ properties.setProperty("felix.auto.deploy.action", "install,start");
+ properties.setProperty("org.osgi.framework.startlevel.beginning", "2");
+ properties.setProperty("felix.auto.install.1", kernelBundles);
+ properties.setProperty("felix.auto.start.1", kernelBundles);
+ properties.setProperty("felix.auto.install.2", workspaceBundles);
+ properties.setProperty("felix.auto.start.2", workspaceBundles);
+ properties.setProperty("org.osgi.framework.storage", "file:"
+ + configPath.append("auto").makeAbsolute().toPortableString());
+ properties.setProperty("org.osgi.framework.storage.clean","onFirstInit");
+
+ try {
+ properties.store(new FileOutputStream(configPath.append("config.properties").makeAbsolute().toFile()), "## AUTO GENERATED ##");
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/FelixFramework.java b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/FelixFramework.java
new file mode 100644
index 0000000..efb7a6c
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/FelixFramework.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.felix;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.libra.framework.core.FrameworkDelegate;
+import org.eclipse.libra.framework.core.IOSGIFrameworkWorkingCopy;
+import org.eclipse.wst.server.core.IRuntimeType;
+
+
+public class FelixFramework extends FrameworkDelegate implements
+ IOSGIFrameworkWorkingCopy, IFelixFramework {
+ public FelixFramework() {
+ }
+
+
+ public IFelixVersionHandler getVersionHandler() {
+ IRuntimeType type = getRuntime().getRuntimeType();
+ return FelixPlugin.getFelixVersionHandler(type.getId());
+ }
+
+ @SuppressWarnings("rawtypes")
+ public List getFrameworkClasspath(IPath configPath) {
+ IPath installPath = getRuntime().getLocation();
+ // If installPath is relative, convert to canonical path and hope for
+ // the best
+ if (!installPath.isAbsolute()) {
+ try {
+ String installLoc = (new File(installPath.toOSString()))
+ .getCanonicalPath();
+ installPath = new Path(installLoc);
+ } catch (IOException e) {
+ // Ignore if there is a problem
+ }
+ }
+ return getVersionHandler().getFrameworkClasspath(installPath, configPath);
+ }
+
+ /**
+ * Verifies the Felix installation directory. If it is correct, true is
+ * returned. Otherwise, the user is notified and false is returned.
+ *
+ * @return boolean
+ */
+ public IStatus verifyLocation() {
+ return getVersionHandler()
+ .verifyInstallPath(getRuntime().getLocation());
+ }
+
+
+ public IStatus validate() {
+ IStatus status = super.validate();
+ if (!status.isOK())
+ return status;
+
+ status = verifyLocation();
+ if (!status.isOK())
+ return status;
+ // return new Status(IStatus.ERROR, FelixPlugin.PLUGIN_ID, 0,
+ // Messages.errorInstallDir, null);
+ // don't accept trailing space since that can cause startup problems
+ if (getRuntime().getLocation().hasTrailingSeparator())
+ return new Status(IStatus.ERROR, FelixPlugin.PLUGIN_ID, 0,
+ Messages.errorInstallDirTrailingSlash, null);
+ if (getVMInstall() == null)
+ return new Status(IStatus.ERROR, FelixPlugin.PLUGIN_ID, 0,
+ Messages.errorJRE, null);
+
+
+
+ File f = getRuntime().getLocation().append("conf").toFile();
+ File[] conf = f.listFiles();
+ if (conf != null) {
+ int size = conf.length;
+ for (int i = 0; i < size; i++) {
+ if (!f.canRead())
+ return new Status(IStatus.WARNING, FelixPlugin.PLUGIN_ID,
+ 0, Messages.warningCantReadConfig, null);
+ }
+ }
+
+
+ f = getRuntime().getLocation().append("bundle").toFile();
+ File[] bundle = f.listFiles();
+ if (bundle != null) {
+ int size = bundle.length;
+ for (int i = 0; i < size; i++) {
+ if (!f.canRead())
+ return new Status(IStatus.WARNING, FelixPlugin.PLUGIN_ID,
+ 0, Messages.warningCantReadBundle, null);
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/FelixFrameworkInstance.java b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/FelixFrameworkInstance.java
new file mode 100644
index 0000000..b0c2578
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/FelixFrameworkInstance.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.felix;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.libra.framework.core.FrameworkInstanceConfiguration;
+import org.eclipse.libra.framework.core.FrameworkInstanceDelegate;
+import org.eclipse.libra.framework.core.OSGIFrameworkInstanceBehaviorDelegate;
+import org.eclipse.libra.framework.core.TargetDefinitionUtil;
+import org.eclipse.libra.framework.core.Trace;
+import org.eclipse.libra.framework.felix.internal.FelixRuntimeInstanceBehavior;
+import org.eclipse.pde.internal.core.target.provisional.IBundleContainer;
+import org.eclipse.pde.internal.core.target.provisional.ITargetDefinition;
+import org.eclipse.pde.internal.core.target.provisional.ITargetPlatformService;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IRuntime;
+
+@SuppressWarnings("restriction")
+public class FelixFrameworkInstance extends FrameworkInstanceDelegate implements
+ IFelixFrameworkInstance {
+
+ protected transient IFelixVersionHandler versionHandler;
+
+ @Override
+ public IStatus canModifyModules(IModule[] add, IModule[] remove) {
+ IStatus status = super.canModifyModules(add, remove);
+ if (!status.isOK())
+ return status;
+
+ if (getFelixVersionHandler() == null)
+ return new Status(IStatus.ERROR, FelixPlugin.PLUGIN_ID, 0,
+ Messages.errorNoRuntime, null);
+
+ if (add != null) {
+ int size = add.length;
+ for (int i = 0; i < size; i++) {
+ IModule module = add[i];
+ IStatus status2 = getFelixVersionHandler().canAddModule(module);
+ if (status2 != null && !status2.isOK())
+ return status2;
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public void setDefaults(IProgressMonitor monitor) {
+ super.setDefaults(monitor);
+ try {
+ getFelixConfiguration();
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "Can't setup for Felix configuration.",e);
+ }
+ }
+ @Override
+ public void importRuntimeConfiguration(IRuntime runtime,
+ IProgressMonitor monitor) throws CoreException {
+
+ super.importRuntimeConfiguration(runtime, monitor);
+ OSGIFrameworkInstanceBehaviorDelegate fsb = (OSGIFrameworkInstanceBehaviorDelegate)getServer().loadAdapter(FelixRuntimeInstanceBehavior.class, null);
+ if(fsb != null ){
+ IPath tempDir = fsb.getTempDirectory();
+ if (!tempDir.isAbsolute()) {
+ IPath rootPath = ResourcesPlugin.getWorkspace().getRoot().getLocation();
+ tempDir = rootPath.append(tempDir);
+ }
+ setInstanceDirectory(tempDir.toPortableString());
+ }
+
+ try {
+ getFelixConfiguration();
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "Can't setup for Felix configuration.",e);
+ }
+ }
+
+
+ public FelixFramework getFelixRuntime() {
+ if (getServer().getRuntime() == null)
+ return null;
+ return (FelixFramework) getServer().getRuntime().loadAdapter(
+ FelixFramework.class, null);
+ }
+
+ public IFelixVersionHandler getFelixVersionHandler() {
+ if (versionHandler == null) {
+ if (getServer().getRuntime() == null || getFelixRuntime() == null)
+ return null;
+
+ versionHandler = getFelixRuntime().getVersionHandler();
+ }
+ return versionHandler;
+ }
+
+ public FrameworkInstanceConfiguration getFelixConfiguration() throws CoreException {
+
+ return getFrameworkInstanceConfiguration();
+
+ }
+
+
+ private IBundleContainer[] getDefaultBundleContainers(IPath installPath) {
+ IBundleContainer[] containers = new IBundleContainer[2];
+ ITargetPlatformService service = TargetDefinitionUtil.getTargetPlatformService();
+
+ containers[0] = service.newDirectoryContainer(
+ installPath.append("bin").makeAbsolute()
+ .toPortableString());
+ containers[1] = service.newDirectoryContainer(
+ installPath.append("bundle").makeAbsolute()
+ .toPortableString());
+ return containers;
+
+ }
+
+
+ @Override
+ public ITargetDefinition createDefaultTarget() throws CoreException {
+ IPath installPath = getServer().getRuntime().getLocation();
+
+ ITargetPlatformService service = TargetDefinitionUtil.getTargetPlatformService();
+
+ ITargetDefinition targetDefinition = service.newTarget();
+ targetDefinition.setName(getServer().getName());
+ IBundleContainer[] containers = getDefaultBundleContainers(installPath);
+
+ targetDefinition.setBundleContainers(containers);
+ service.saveTargetDefinition(targetDefinition);
+ return targetDefinition;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/FelixPlugin.java b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/FelixPlugin.java
new file mode 100644
index 0000000..c67bf88
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/FelixPlugin.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.felix;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+public class FelixPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.libra.framework.felix"; //$NON-NLS-1$
+
+ // The shared instance
+ private static FelixPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public FelixPlugin() {
+ super();
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#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 FelixPlugin getDefault() {
+ return plugin;
+ }
+
+
+
+ public static String getPreference(String id) {
+ return Platform.getPreferencesService().getString(PLUGIN_ID, id, "", null);
+ }
+
+ public static void setPreference(String id, String value) {
+ (new DefaultScope()).getNode(PLUGIN_ID).put(id, value);
+ }
+
+ public static IFelixVersionHandler getFelixVersionHandler(String id) {
+// if (id.indexOf("runtime") > 0)
+// id = id.substring(0, 30) + id.substring(38);
+// if (true)//"abc".equals(id))
+ return new Felix2Handler();
+ }
+
+
+}
diff --git a/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/IFelixFramework.java b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/IFelixFramework.java
new file mode 100644
index 0000000..702c18e
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/IFelixFramework.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.felix;
+
+import org.eclipse.libra.framework.core.IOSGIFramework;
+
+
+public interface IFelixFramework extends IOSGIFramework {
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/IFelixFrameworkInstance.java b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/IFelixFrameworkInstance.java
new file mode 100644
index 0000000..1939a86
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/IFelixFrameworkInstance.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.felix;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.libra.framework.core.FrameworkInstanceConfiguration;
+import org.eclipse.libra.framework.core.IOSGIFrameworkInstance;
+
+
+
+public interface IFelixFrameworkInstance extends IOSGIFrameworkInstance {
+
+ public FrameworkInstanceConfiguration getFelixConfiguration() throws CoreException;
+
+}
diff --git a/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/IFelixVersionHandler.java b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/IFelixVersionHandler.java
new file mode 100644
index 0000000..5b22c83
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/IFelixVersionHandler.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.felix;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.wst.server.core.IModule;
+
+public interface IFelixVersionHandler {
+
+ public abstract boolean supportsServeModulesWithoutPublish();
+
+ public abstract IStatus prepareDeployDirectory(IPath deployPath);
+
+ public abstract IStatus prepareFrameworkInstanceDirectory(IPath baseDir);
+
+ public abstract IStatus canAddModule(IModule module);
+
+ public abstract String[] getFrameworkVMArguments(IPath installPath, IPath configPath,
+ IPath deployPath, boolean isTestEnv, boolean jmxEnabled, int jmxPort);
+
+ public abstract String[] getExcludedFrameworkProgramArguments(boolean debug,
+ boolean starting);
+
+ public abstract String[] getFrameworkProgramArguments(IPath configPath,
+ boolean debug, boolean starting);
+
+ @SuppressWarnings("rawtypes")
+ public abstract List getFrameworkClasspath(IPath installPath, IPath configPath);
+
+ public abstract String getFrameworkClass();
+
+ public abstract IStatus verifyInstallPath(IPath location);
+
+ public abstract void prepareFrameworkConfigurationFile(IPath confDir,String workspaceBundles, String kernelBundles);
+
+}
diff --git a/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/Messages.java b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/Messages.java
new file mode 100644
index 0000000..cd95e52
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/Messages.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.felix;
+
+import org.eclipse.osgi.util.NLS;
+/**
+ * Translated messages.
+ */
+public class Messages extends NLS {
+
+ public static String errorInstallDirTrailingSlash = null;
+ public static String errorJRE;
+ public static String warningCantReadConfig;
+ public static String warningCantReadBundle;
+ public static String errorNotBundle;
+ public static String errorOSGiBundlesOnly;
+ public static String errorNoRuntime;
+
+ public static String publishServerTask;
+ public static String errorConfigurationProjectClosed;
+ public static String errorNoConfiguration;
+ public static String loadingTask;
+ public static String errorCouldNotLoadConfiguration;
+ public static String configurationEditorActionAddOsgiModule;
+
+ static {
+ NLS.initializeMessages(FelixPlugin.PLUGIN_ID + ".Messages", Messages.class);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/Messages.properties b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/Messages.properties
new file mode 100644
index 0000000..88dac69
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/Messages.properties
@@ -0,0 +1,20 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+
+# --------------- General UI ---------------
+
+errorInstallDirTrailingSlash = Installation folder must not end with a slash
+errorJRE= Selected JRE is not valid;
+warningCantReadConfig=Cannot locate the correct conf folder. Invalid Installation folder
+warningCantReadBundle=Cannot locate the correct bundle folder. Invalid Installation folder
+errorNotBundle=Must be an osgi bundle
+errorOSGiBundlesOnly=Must be an osgi bundle
+errorNoRuntime=There is no runtime
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/internal/FelixConfigurationPublishHelper.java b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/internal/FelixConfigurationPublishHelper.java
new file mode 100644
index 0000000..7d61e00
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/internal/FelixConfigurationPublishHelper.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.felix.internal;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.libra.framework.core.OSGIFrameworkInstanceBehaviorDelegate;
+import org.eclipse.libra.framework.core.publish.PublishHelper;
+
+
+
+public class FelixConfigurationPublishHelper extends PublishHelper{
+ public OSGIFrameworkInstanceBehaviorDelegate behavior;
+
+ public FelixConfigurationPublishHelper(OSGIFrameworkInstanceBehaviorDelegate behavior) {
+ this.behavior = behavior;
+ }
+
+ protected IPath getPublishFolder() {
+ IPath configPath = behavior.getBaseDirectory();
+ configPath = configPath.append("plugins").makeAbsolute();
+ return configPath;
+ }
+
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/internal/FelixRuntimeClasspathProvider.java b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/internal/FelixRuntimeClasspathProvider.java
new file mode 100644
index 0000000..c46678d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/internal/FelixRuntimeClasspathProvider.java
@@ -0,0 +1,44 @@
+package org.eclipse.libra.framework.felix.internal;
+
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jst.server.core.RuntimeClasspathProviderDelegate;
+import org.eclipse.wst.server.core.IRuntime;
+
+public class FelixRuntimeClasspathProvider extends
+ RuntimeClasspathProviderDelegate {
+ /**
+ * @see RuntimeClasspathProviderDelegate#resolveClasspathContainer(IProject,
+ * IRuntime)
+ */
+ public IClasspathEntry[] resolveClasspathContainer(IProject project,
+ IRuntime runtime) {
+ IPath installPath = runtime.getLocation();
+
+ if (installPath == null)
+ return new IClasspathEntry[0];
+
+ List<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
+ // String runtimeId = runtime.getRuntimeType().getId();
+ IPath path = installPath.append("osgi");
+ addLibraryEntries(list, path.toFile(), true);
+
+ return (IClasspathEntry[]) list
+ .toArray(new IClasspathEntry[list.size()]);
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/internal/FelixRuntimeInstanceBehavior.java b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/internal/FelixRuntimeInstanceBehavior.java
new file mode 100644
index 0000000..e87e682
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/internal/FelixRuntimeInstanceBehavior.java
@@ -0,0 +1,168 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.felix.internal;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.libra.framework.core.FrameworkInstanceConfiguration;
+import org.eclipse.libra.framework.core.OSGIFrameworkInstanceBehaviorDelegate;
+import org.eclipse.libra.framework.core.ProgressUtil;
+import org.eclipse.libra.framework.core.Trace;
+import org.eclipse.libra.framework.felix.FelixFrameworkInstance;
+import org.eclipse.libra.framework.felix.IFelixFrameworkInstance;
+import org.eclipse.libra.framework.felix.IFelixVersionHandler;
+import org.eclipse.libra.framework.felix.Messages;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
+
+
+public class FelixRuntimeInstanceBehavior extends
+ OSGIFrameworkInstanceBehaviorDelegate {
+
+ protected transient FelixConfigurationPublishHelper publishHelper = new FelixConfigurationPublishHelper(
+ this);
+
+ /**
+ * FelixRuntimeInstanceBehavior.
+ */
+ public FelixRuntimeInstanceBehavior() {
+ super();
+ }
+
+ public IFelixVersionHandler getFelixVersionHandler() {
+ return getFelixRuntimeInstance().getFelixVersionHandler();
+ }
+
+ public FelixFrameworkInstance getFelixRuntimeInstance() {
+ return (FelixFrameworkInstance) getServer().loadAdapter(FelixFrameworkInstance.class, null);
+ }
+
+ public String getFrameworkClass() {
+ return getFelixVersionHandler().getFrameworkClass();
+ }
+
+ public String[] getFrameworkProgramArguments(boolean starting) {
+ return getFelixVersionHandler().getFrameworkProgramArguments(
+ getBaseDirectory(), getFrameworkInstance().isDebug(), starting);
+ }
+
+ public String[] getExcludedFrameworkProgramArguments(boolean starting) {
+ return getFelixVersionHandler().getExcludedFrameworkProgramArguments(
+ getFrameworkInstance().isDebug(), starting);
+ }
+
+ public String[] getFrameworkVMArguments() {
+ IPath installPath = getServer().getRuntime().getLocation();
+ // If installPath is relative, convert to canonical path and hope for
+ // the best
+ if (!installPath.isAbsolute()) {
+ try {
+ String installLoc = (new File(installPath.toOSString()))
+ .getCanonicalPath();
+ installPath = new Path(installLoc);
+ } catch (IOException e) {
+ // Ignore if there is a problem
+ }
+ }
+
+ IPath deployPath = getBaseDirectory();
+ // If deployPath is relative, convert to canonical path and hope for the
+ // best
+ if (!deployPath.isAbsolute()) {
+ try {
+ String deployLoc = (new File(deployPath.toOSString()))
+ .getCanonicalPath();
+ deployPath = new Path(deployLoc);
+ } catch (IOException e) {
+ // Ignore if there is a problem
+ }
+ }
+
+ int jmxPort = ((IFelixFrameworkInstance)this.getFrameworkInstance()).getJMXPort();
+ boolean jmxEnabled = ((IFelixFrameworkInstance)this.getFrameworkInstance()).getJMXEnabled();
+ return getFelixVersionHandler().getFrameworkVMArguments(installPath, null, deployPath, false, jmxEnabled, jmxPort);
+ }
+
+ protected void publishServer(int kind, IProgressMonitor monitor)
+ throws CoreException {
+ if (getServer().getRuntime() == null)
+ return;
+
+ IPath confDir = getBaseDirectory();
+ IStatus status = getFelixVersionHandler().prepareDeployDirectory(
+ confDir);
+
+ if (status != null && !status.isOK())
+ throw new CoreException(status);
+
+ monitor = ProgressUtil.getMonitorFor(monitor);
+ monitor.beginTask(Messages.publishServerTask, 600);
+
+ // TODO OSAMI 1) Cleanup 2) Backup and Publish,
+
+ // if (status != null && !status.isOK())
+ // throw new CoreException(status);
+
+ monitor.done();
+
+ setServerPublishState(IServer.PUBLISH_STATE_NONE);
+ }
+
+ @SuppressWarnings("rawtypes")
+ protected void publishModules(int kind, List modules, List deltaKind2,
+ MultiStatus multi, IProgressMonitor monitor) {
+
+
+ IPath confDir = getBaseDirectory();
+
+ FrameworkInstanceConfiguration felixConfiguration;
+
+ try {
+ felixConfiguration = getFelixRuntimeInstance().getFelixConfiguration();
+
+
+ publishHelper.exportBundles(modules, felixConfiguration, confDir);
+ getFelixVersionHandler().prepareFrameworkConfigurationFile(confDir,
+ publishHelper.getServerModules(modules,"reference:file:", " " ),
+ publishHelper.getTargetBundles(felixConfiguration,"reference:file:", " "));
+
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "Publishing failed", e);
+ }
+ }
+
+ protected void publishModule(int kind, int deltaKind, IModule[] moduleTree,
+ IProgressMonitor monitor) throws CoreException {
+ if (getServer().getServerState() != IServer.STATE_STOPPED) {
+ if (deltaKind == ServerBehaviourDelegate.ADDED
+ || deltaKind == ServerBehaviourDelegate.REMOVED)
+ setServerRestartState(true);
+ }
+
+ Properties p = loadModulePublishLocations();
+
+ // TODO OSAMI PUBLISH
+
+ setModulePublishState(moduleTree, IServer.PUBLISH_STATE_NONE);
+
+ saveModulePublishLocations(p);
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/internal/FelixRuntimeInstanceLocator.java b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/internal/FelixRuntimeInstanceLocator.java
new file mode 100644
index 0000000..983eaf8
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/internal/FelixRuntimeInstanceLocator.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.felix.internal;
+
+import org.eclipse.libra.framework.core.OSGIFrameworkLocatorDelegate;
+
+public class FelixRuntimeInstanceLocator extends OSGIFrameworkLocatorDelegate {
+
+ protected static final String[] runtimeTypes = new String[] {
+ "org.eclipse.libra.framework.felix"};
+
+ public static String[] getRuntimeTypes() {
+ return runtimeTypes;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/java6-server.profile b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/java6-server.profile
new file mode 100644
index 0000000..9ebb1e1
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.felix/src/org/eclipse/libra/framework/felix/java6-server.profile
@@ -0,0 +1,211 @@
+org.osgi.framework.system.packages = \
+ com.sun.org.apache.xalan.internal.res,\
+ com.sun.org.apache.xml.internal.utils,\
+ com.sun.org.apache.xpath.internal,\
+ com.sun.org.apache.xpath.internal.jaxp,\
+ com.sun.org.apache.xpath.internal.objects,\
+ javax.accessibility,\
+ javax.activation,\
+ javax.activation;version="1.1.1",\
+ javax.activity,\
+ javax.annotation,\
+ javax.annotation;version="1.0.0",\
+ javax.annotation.processing,\
+ javax.crypto,\
+ javax.crypto.interfaces,\
+ javax.crypto.spec,\
+ javax.imageio,\
+ javax.imageio.event,\
+ javax.imageio.metadata,\
+ javax.imageio.plugins.bmp,\
+ javax.imageio.plugins.jpeg,\
+ javax.imageio.spi,\
+ javax.imageio.stream,\
+ javax.jws,\
+ javax.jws;version="2.0",\
+ javax.jws.soap,\
+ javax.jws.soap;version="2.0",\
+ javax.lang.model,\
+ javax.lang.model.element,\
+ javax.lang.model.type,\
+ javax.lang.model.util,\
+ javax.management,\
+ javax.management.loading,\
+ javax.management.modelmbean,\
+ javax.management.monitor,\
+ javax.management.openmbean,\
+ javax.management.relation,\
+ javax.management.remote,\
+ javax.management.remote.rmi,\
+ javax.management.timer,\
+ javax.naming,\
+ javax.naming.directory,\
+ javax.naming.event,\
+ javax.naming.ldap,\
+ javax.naming.spi,\
+ javax.net,\
+ javax.net.ssl,\
+ javax.print,\
+ javax.print.attribute,\
+ javax.print.attribute.standard,\
+ javax.print.event,\
+ javax.rmi,\
+ javax.rmi.CORBA,\
+ javax.rmi.ssl,\
+ javax.script,\
+ javax.script;version="1.1",\
+ javax.security.auth,\
+ javax.security.auth.callback,\
+ javax.security.auth.kerberos,\
+ javax.security.auth.login,\
+ javax.security.auth.spi,\
+ javax.security.auth.x500,\
+ javax.security.cert,\
+ javax.security.sasl,\
+ javax.sound.midi,\
+ javax.sound.midi.spi,\
+ javax.sound.sampled,\
+ javax.sound.sampled.spi,\
+ javax.sql,\
+ javax.sql.rowset,\
+ javax.sql.rowset.serial,\
+ javax.sql.rowset.spi,\
+ javax.swing,\
+ javax.swing.border,\
+ javax.swing.colorchooser,\
+ javax.swing.event,\
+ javax.swing.filechooser,\
+ javax.swing.plaf,\
+ javax.swing.plaf.basic,\
+ javax.swing.plaf.metal,\
+ javax.swing.plaf.multi,\
+ javax.swing.plaf.synth,\
+ javax.swing.table,\
+ javax.swing.text,\
+ javax.swing.text.html,\
+ javax.swing.text.html.parser,\
+ javax.swing.text.rtf,\
+ javax.swing.tree,\
+ javax.swing.undo,\
+ javax.tools,\
+ javax.transaction,\
+ javax.transaction;version="1.0.1",\
+ javax.transaction;version="1.1.0",\
+ javax.transaction.xa,\
+ javax.transaction.xa;version="1.0.1",\
+ javax.transaction.xa;version="1.1.0",\
+ javax.xml,\
+ javax.xml;version="1.0.1",\
+ javax.xml.bind,\
+ javax.xml.bind;version="2.0",\
+ javax.xml.bind.annotation,\
+ javax.xml.bind.annotation;version="2.0",\
+ javax.xml.bind.annotation.adapters,\
+ javax.xml.bind.annotation.adapters;version="2.0",\
+ javax.xml.bind.attachment,\
+ javax.xml.bind.attachment;version="2.0",\
+ javax.xml.bind.helpers,\
+ javax.xml.bind.helpers;version="2.0",\
+ javax.xml.bind.util,\
+ javax.xml.bind.util;version="2.0",\
+ javax.xml.crypto,\
+ javax.xml.crypto;version="1.0",\
+ javax.xml.crypto.dom,\
+ javax.xml.crypto.dom;version="1.0",\
+ javax.xml.crypto.dsig,\
+ javax.xml.crypto.dsig;version="1.0",\
+ javax.xml.crypto.dsig.dom,\
+ javax.xml.crypto.dsig.dom;version="1.0",\
+ javax.xml.crypto.dsig.keyinfo,\
+ javax.xml.crypto.dsig.keyinfo;version="1.0",\
+ javax.xml.crypto.dsig.spec,\
+ javax.xml.crypto.dsig.spec;version="1.0",\
+ javax.xml.datatype,\
+ javax.xml.namespace,\
+ javax.xml.parsers,\
+ javax.xml.soap,\
+ javax.xml.soap;version="1.3.0",\
+ javax.xml.stream,\
+ javax.xml.stream;version="1.0.1",\
+ javax.xml.stream.events,\
+ javax.xml.stream.events;version="1.0.1",\
+ javax.xml.stream.util,\
+ javax.xml.stream.util;version="1.0.1",\
+ javax.xml.transform,\
+ javax.xml.transform.dom,\
+ javax.xml.transform.sax,\
+ javax.xml.transform.stax,\
+ javax.xml.transform.stream,\
+ javax.xml.validation,\
+ javax.xml.ws,\
+ javax.xml.ws;version="2.1.1",\
+ javax.xml.ws.handler,\
+ javax.xml.ws.handler;version="2.1.1",\
+ javax.xml.ws.handler.soap,\
+ javax.xml.ws.handler.soap;version="2.1.1",\
+ javax.xml.ws.http,\
+ javax.xml.ws.http;version="2.1.1",\
+ javax.xml.ws.soap,\
+ javax.xml.ws.soap;version="2.1.1",\
+ javax.xml.ws.spi,\
+ javax.xml.ws.spi;version="2.1.1",\
+ javax.xml.xpath,\
+ org.ietf.jgss,\
+ org.omg.CORBA,\
+ org.omg.CORBA_2_3,\
+ org.omg.CORBA_2_3.portable,\
+ org.omg.CORBA.DynAnyPackage,\
+ org.omg.CORBA.ORBPackage,\
+ org.omg.CORBA.portable,\
+ org.omg.CORBA.TypeCodePackage,\
+ org.omg.CosNaming,\
+ org.omg.CosNaming.NamingContextExtPackage,\
+ org.omg.CosNaming.NamingContextPackage,\
+ org.omg.Dynamic,\
+ org.omg.DynamicAny,\
+ org.omg.DynamicAny.DynAnyFactoryPackage,\
+ org.omg.DynamicAny.DynAnyPackage,\
+ org.omg.IOP,\
+ org.omg.IOP.CodecFactoryPackage,\
+ org.omg.IOP.CodecPackage,\
+ org.omg.Messaging,\
+ org.omg.PortableInterceptor,\
+ org.omg.PortableInterceptor.ORBInitInfoPackage,\
+ org.omg.PortableServer,\
+ org.omg.PortableServer.CurrentPackage,\
+ org.omg.PortableServer.POAManagerPackage,\
+ org.omg.PortableServer.POAPackage,\
+ org.omg.PortableServer.portable,\
+ org.omg.PortableServer.ServantLocatorPackage,\
+ org.omg.SendingContext,\
+ org.omg.stub.java.rmi,\
+ org.w3c.dom,\
+ org.w3c.dom.bootstrap,\
+ org.w3c.dom.css,\
+ org.w3c.dom.events,\
+ org.w3c.dom.html,\
+ org.w3c.dom.ls,\
+ org.w3c.dom.ranges,\
+ org.w3c.dom.stylesheets,\
+ org.w3c.dom.traversal,\
+ org.w3c.dom.views ,\
+ org.xml.sax,\
+ org.xml.sax.ext,\
+ org.xml.sax.helpers
+org.osgi.framework.bootdelegation = \
+ org.eclipse.virgo.osgi.extensions.*,\
+ org.eclipse.virgo.osgi.launcher.*,\
+ com.sun.*,\
+ javax.xml.*,\
+ org.apache.xerces.jaxp.*,\
+ org.w3c.*,\
+ org.xml.*,\
+ sun.*
+org.osgi.framework.executionenvironment = \
+ OSGi/Minimum-1.0,\
+ OSGi/Minimum-1.1,\
+ J2SE-1.3,\
+ J2SE-1.4,\
+ J2SE-1.5,\
+ JavaSE-1.6
+osgi.java.profile.name = Equinox-Kernel-Java6
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/.classpath b/plugins/org.eclipse.libra.framework.jonas.ui/.classpath
new file mode 100644
index 0000000..64c5e31
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/.cvsignore b/plugins/org.eclipse.libra.framework.jonas.ui/.cvsignore
new file mode 100644
index 0000000..4571f2d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/.cvsignore
@@ -0,0 +1,8 @@
+bin
+build.xml
+org.eclipse.jst.server.tomcat.ui_3.0.0.jar
+tomcatui.jar
+temp.folder
+@dot
+src.zip
+javaCompiler...args
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/.options b/plugins/org.eclipse.libra.framework.jonas.ui/.options
new file mode 100644
index 0000000..d88b03b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/.options
@@ -0,0 +1,4 @@
+# Debugging options for the org.eclipse.jst.server.tomcat.ui plugin
+
+# Turn on general debugging
+org.eclipse.jst.server.tomcat.ui/debug=true
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/.project b/plugins/org.eclipse.libra.framework.jonas.ui/.project
new file mode 100644
index 0000000..5fca971
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.libra.framework.jonas.ui</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.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/.settings/com.chronon.sb.browser.launcher.prefs b/plugins/org.eclipse.libra.framework.jonas.ui/.settings/com.chronon.sb.browser.launcher.prefs
new file mode 100644
index 0000000..743101a
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/.settings/com.chronon.sb.browser.launcher.prefs
@@ -0,0 +1,6 @@
+#Fri May 27 10:43:13 EEST 2011
+auto.defaultPkgs=
+auto.excludePkgs=
+auto.partialPkgs=
+eclipse.preferences.version=1
+isManual=false
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.libra.framework.jonas.ui/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..c8be432
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Fri Nov 10 17:11:35 HST 2006
+eclipse.preferences.version=1
+encoding/<project>=ISO-8859-1
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.libra.framework.jonas.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..87e641f
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,74 @@
+#Sat Oct 16 21:03:45 EEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=error
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,*.testsuite,*.deploy,*.location,*.execution,*.datapool,*.artifact,*.html,*.svg
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=disabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=error
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.incompatibleJDKLevel=warning
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.libra.framework.jonas.ui/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..584bdff
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,4 @@
+#Fri Nov 10 18:06:11 HST 2006
+eclipse.preferences.version=1
+internal.default.compliance=user
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?>\n<templates/>
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.libra.framework.jonas.ui/.settings/org.eclipse.pde.prefs
new file mode 100644
index 0000000..0e06e96
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/.settings/org.eclipse.pde.prefs
@@ -0,0 +1,15 @@
+#Mon Jan 15 21:56:48 EST 2007
+compilers.incompatible-environment=0
+compilers.p.build=0
+compilers.p.deprecated=1
+compilers.p.missing-packages=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=0
+compilers.p.unknown-element=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.libra.framework.jonas.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..dfae400
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,29 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.libra.framework.jonas.ui;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.libra.framework.jonas.ui.JonasUIPlugin
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.expressions;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jdt.debug.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jdt.launching;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.wst.server.core;bundle-version="[1.0.204,2.0.0)",
+ org.eclipse.jst.server.core;bundle-version="[1.0.103,2.0.0)",
+ org.eclipse.jst.server.ui;bundle-version="[1.0.103,2.0.0)",
+ org.eclipse.wst.common.project.facet.ui;bundle-version="[1.1.0,2.0.0)",
+ org.eclipse.libra.framework.jonas,
+ org.eclipse.wst.server.ui,
+ org.eclipse.pde.core,
+ org.eclipse.pde.ui,
+ org.eclipse.libra.framework.core,
+ org.eclipse.libra.framework.ui
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/about.html b/plugins/org.eclipse.libra.framework.jonas.ui/about.html
new file mode 100644
index 0000000..8f31159
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>March 25, 2011</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/build.properties b/plugins/org.eclipse.libra.framework.jonas.ui/build.properties
new file mode 100644
index 0000000..5016daa
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/build.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+bin.includes = plugin.xml,\
+ plugin.properties,\
+ icons/,\
+ .,\
+ META-INF/,\
+ about.html
+bin.excludes = bin/**,\
+ @dot/**,\
+ temp.folder/**
+source.. = src/
+
+
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/jonas.gif b/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/jonas.gif
new file mode 100644
index 0000000..10cfff1
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/jonas.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/mime_extension.gif b/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/mime_extension.gif
new file mode 100644
index 0000000..c585010
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/mime_extension.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/mime_mapping.gif b/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/mime_mapping.gif
new file mode 100644
index 0000000..0a8e4bf
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/mime_mapping.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/port.gif b/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/port.gif
new file mode 100644
index 0000000..7a354b7
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/port.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/project_missing.gif b/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/project_missing.gif
new file mode 100644
index 0000000..0cb4c16
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/project_missing.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/web_module.gif b/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/web_module.gif
new file mode 100644
index 0000000..bf20f70
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/icons/obj16/web_module.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/icons/wizban/felix_wiz.png b/plugins/org.eclipse.libra.framework.jonas.ui/icons/wizban/felix_wiz.png
new file mode 100644
index 0000000..05d4925
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/icons/wizban/felix_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/plugin.properties b/plugins/org.eclipse.libra.framework.jonas.ui/plugin.properties
new file mode 100644
index 0000000..02477b3
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/plugin.properties
@@ -0,0 +1,21 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+pluginName=Apache Jonas UI Support
+providerName=Eteration A.S.
+
+configurationEditorOSGiModulesPage=Modules
+configurationEditorTargetPage=Target Platform Profile
+
+cleanJonasWorkDir=Clean Jonas Work Directory...
+cleanJonasModuleWorkDir=Clean Module Work Directory...
+
+publisherContextFixLabel=Update context paths
+publisherContextFixDescription=Prompt to update module contexts when they are out of sync.
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/plugin.xml b/plugins/org.eclipse.libra.framework.jonas.ui/plugin.xml
new file mode 100644
index 0000000..b776da6
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/plugin.xml
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2010 Eteration A.S. 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:
+ Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ -->
+
+<plugin>
+ <extension point="org.eclipse.wst.server.ui.serverImages">
+ <image
+ id="org.eclipse.libra.framework.jonas"
+ icon="icons/obj16/jonas.gif"
+ typeIds="org.eclipse.libra.framework.jonas.serverType"/>
+
+ <image
+ id="org.eclipse.libra.framework.jonas.runtimeType"
+ icon="icons/obj16/jonas.gif"
+ typeIds="org.eclipse.libra.framework.jonas.runtimeType"/>
+
+ </extension>
+
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ id="org.eclipse.libra.framework.jonas.ui.propertyTester"
+ namespace="org.eclipse.libra.framework.jonas.ui"
+ properties="hasConfiguration"
+ type="java.lang.Object"
+ class="org.eclipse.libra.framework.jonas.ui.internal.ConfigurationPropertyTester">
+ </propertyTester>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.ui.editorPages">
+ <page
+ id="org.eclipse.libra.framework.jonas.ui.editor.osgimodule"
+ order="20"
+ name="%configurationEditorOSGiModulesPage"
+ typeIds="org.eclipse.libra.framework.jonas.serverType"
+ class="org.eclipse.libra.framework.ui.internal.editor.ConfigurationOSGiModuleEditorPart">
+ <enablement>
+ <test property="org.eclipse.libra.framework.jonas.ui.hasConfiguration" value="true"/>
+ </enablement>
+ </page>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.ui.editorPages">
+ <page
+ id="org.eclipse.libra.framework.jonas.ui.editor.osgimodule"
+ order="22"
+ name="Target Platform Profile"
+ typeIds="org.eclipse.libra.framework.jonas.serverType"
+ class="org.eclipse.libra.framework.ui.internal.editor.TargetDefinitionEditorPart">
+ <enablement>
+ <test property="org.eclipse.libra.framework.jonas.ui.hasConfiguration" value="true"/>
+ </enablement>
+ </page>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.ui.editorPageSections">
+ <section
+ id="org.eclipse.libra.framework.jonas.editor.instance"
+ order="0"
+ insertionId="org.eclipse.wst.server.editor.overview.left"
+ typeIds="org.eclipse.libra.framework.jonas.serverType"
+ class="org.eclipse.libra.framework.ui.internal.editor.FrameworkInstanceLocationEditorSection"/>
+
+ </extension>
+
+ <extension point="org.eclipse.wst.server.ui.wizardFragments">
+ <fragment
+ id="org.eclipse.libra.framework.jonas"
+ typeIds="org.eclipse.libra.framework.jonas.runtimeType"
+ class="org.eclipse.libra.framework.ui.OSGIFrameworkWizardFragment"/>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+ <launchConfigurationTypeImage
+ id="org.eclipse.libra.framework.jonas.launchConfig.image"
+ configTypeID="org.eclipse.libra.framework.jonas.launchConfigurationType"
+ icon="icons/obj16/jonas.gif">
+ </launchConfigurationTypeImage>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ id="org.eclipse.libra.framework.jonas.ui.launchConfigurationTabGroup"
+ type="org.eclipse.libra.framework.jonas.launchConfigurationType"
+ class="org.eclipse.libra.framework.ui.GenericOSGILaunchConfigurationTabGroup">
+ </launchConfigurationTabGroup>
+ </extension>
+
+ <extension point="org.eclipse.wst.common.project.facet.ui.images">
+ <image runtime-component-type="org.eclipse.libra.framework.jonas.runtimeType"
+ path="icons/obj16/jonas.gif"/>
+ </extension>
+
+
+
+ <extension point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ id="org.eclipse.libra.framework.jonas.ui.serveractions"
+ objectClass="org.eclipse.wst.server.core.IServer">
+ <visibility>
+ <objectState name="serverType" value="org.eclipse.libra.framework.jonas.serverType"/>
+ </visibility>
+ <action
+ class="org.eclipse.libra.framework.ui.internal.actions.CleanWorkDirAction"
+ enablesFor="1"
+ id="org.eclipse.libra.framework.jonas.ui.cleanserverworkdir"
+ label="%cleanTomcatWorkDir">
+ </action>
+ </objectContribution>
+ <objectContribution
+ adaptable="true"
+ id="org.eclipse.libra.framework.jonas.ui.serveractions"
+ objectClass="org.eclipse.wst.server.ui.internal.view.servers.ModuleServer">
+ <visibility>
+ <and>
+ <objectState name="serverType" value="org.eclipse.libra.framework.jonas.serverType"/>
+ <objectState name="moduleType" value="osgi.bundle"/>
+ </and>
+ </visibility>
+ <action
+ class="org.eclipse.libra.framework.ui.internal.actions.CleanWorkDirAction"
+ enablesFor="1"
+ id="org.eclipse.libra.framework.jonas.ui.cleanmoduleworkdir"
+ label="%cleanTomcatModuleWorkDir">
+ </action>
+ </objectContribution>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.publishers">
+ <publisher
+ id="org.eclipse.libra.framework.jonas.ui.context"
+ typeIds="org.eclipse.libra.framework.jonas.serverType"
+ name="%publisherContextFixLabel"
+ description="%publisherContextFixDescription"
+ order=""
+ class="org.eclipse.libra.framework.ui.internal.ModulePublisherDelegate"/>
+ </extension>
+</plugin>
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/pom.xml b/plugins/org.eclipse.libra.framework.jonas.ui/pom.xml
new file mode 100644
index 0000000..b46b38e
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/pom.xml
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.libra_parent</artifactId>
+ <groupId>org.eclipse.libra</groupId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../development/org.eclipse.libra.releng/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.libra.framework.jonas.ui</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSGi Frameworks JOnAS Adapter UI Plug-in</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/src/org/eclipse/libra/framework/jonas/ui/JonasUIPlugin.java b/plugins/org.eclipse.libra.framework.jonas.ui/src/org/eclipse/libra/framework/jonas/ui/JonasUIPlugin.java
new file mode 100644
index 0000000..bab184c
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/src/org/eclipse/libra/framework/jonas/ui/JonasUIPlugin.java
@@ -0,0 +1,59 @@
+package org.eclipse.libra.framework.jonas.ui;
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+public class JonasUIPlugin extends AbstractUIPlugin {
+ protected static JonasUIPlugin singleton;
+ public static final String PLUGIN_ID = "org.eclipse.libra.framework.jonas.ui";
+
+ public JonasUIPlugin() {
+ super();
+ singleton = this;
+ }
+
+ /**
+ * Returns the singleton instance of this plugin.
+ * @return org.eclipse.jst.server.tomcat.internal.TomcatUIPlugin
+ */
+ public static JonasUIPlugin getInstance() {
+ return singleton;
+ }
+
+ /**
+ * Convenience method for logging.
+ *
+ * @param status org.eclipse.core.runtime.IStatus
+ */
+ public static void log(IStatus status) {
+ getInstance().getLog().log(status);
+ }
+
+ /**
+ * Convenience method to get a Display. The method first checks, if
+ * the thread calling this method has an associated display. If so, this
+ * display is returned. Otherwise the method returns the default display.
+ *
+ * @return the display
+ */
+ public static Display getStandardDisplay() {
+ Display display = Display.getCurrent();
+ if (display == null)
+ display = Display.getDefault();
+ return display;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.jonas.ui/src/org/eclipse/libra/framework/jonas/ui/internal/ConfigurationPropertyTester.java b/plugins/org.eclipse.libra.framework.jonas.ui/src/org/eclipse/libra/framework/jonas/ui/internal/ConfigurationPropertyTester.java
new file mode 100644
index 0000000..15ac808
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas.ui/src/org/eclipse/libra/framework/jonas/ui/internal/ConfigurationPropertyTester.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.jonas.ui.internal;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.libra.framework.core.FrameworkInstanceDelegate;
+import org.eclipse.libra.framework.jonas.IJonasFrameworkInstance;
+import org.eclipse.wst.server.core.IServerAttributes;
+
+/**
+ *
+ */
+public class ConfigurationPropertyTester extends PropertyTester {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object,
+ * java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ public boolean test(Object receiver, String property, Object[] args,
+ Object expectedValue) {
+ try {
+ IServerAttributes server = (IServerAttributes) receiver;
+ FrameworkInstanceDelegate jonas = (FrameworkInstanceDelegate) server
+ .loadAdapter(IJonasFrameworkInstance.class, null);
+ if (jonas != null)
+ return jonas != null;
+ } catch (Exception e) {
+ // ignore
+ }
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.jonas/.classpath b/plugins/org.eclipse.libra.framework.jonas/.classpath
new file mode 100644
index 0000000..64c5e31
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.libra.framework.jonas/.project b/plugins/org.eclipse.libra.framework.jonas/.project
new file mode 100644
index 0000000..d0f0ab4
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.libra.framework.jonas</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.libra.framework.jonas/.settings/com.chronon.sb.browser.launcher.prefs b/plugins/org.eclipse.libra.framework.jonas/.settings/com.chronon.sb.browser.launcher.prefs
new file mode 100644
index 0000000..743101a
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/.settings/com.chronon.sb.browser.launcher.prefs
@@ -0,0 +1,6 @@
+#Fri May 27 10:43:13 EEST 2011
+auto.defaultPkgs=
+auto.excludePkgs=
+auto.partialPkgs=
+eclipse.preferences.version=1
+isManual=false
diff --git a/plugins/org.eclipse.libra.framework.jonas/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.libra.framework.jonas/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..64203b9
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Oct 22 10:43:27 EEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+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
diff --git a/plugins/org.eclipse.libra.framework.jonas/META-INF/MANIFEST.MF b/plugins/org.eclipse.libra.framework.jonas/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..f88d1a2
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/META-INF/MANIFEST.MF
@@ -0,0 +1,35 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.libra.framework.jonas;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.libra.framework.jonas.JonasPlugin
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.jdt.launching,
+ org.eclipse.debug.core,
+ org.eclipse.pde.ui,
+ org.eclipse.pde,
+ org.eclipse.wst.server.core,
+ org.eclipse.wst.server.ui,
+ org.eclipse.jst.server.core,
+ org.eclipse.jdt.core,
+ org.eclipse.jst.common.project.facet.core,
+ org.eclipse.wst.common.modulecore,
+ org.eclipse.equinox.frameworkadmin,
+ org.eclipse.libra.framework.core,
+ org.apache.ant,
+ org.eclipse.ant.core,
+ org.eclipse.ant.launching
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.core.resources,
+ org.eclipse.debug.core,
+ org.eclipse.jdt.launching.sourcelookup,
+ org.eclipse.pde.core.plugin,
+ org.eclipse.pde.ui.launcher,
+ org.apache.tools.ant
+Export-Package: org.eclipse.libra.framework.jonas,
+ org.eclipse.libra.framework.jonas.internal
diff --git a/plugins/org.eclipse.libra.framework.jonas/about.html b/plugins/org.eclipse.libra.framework.jonas/about.html
new file mode 100644
index 0000000..7d9511d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>September 21, 2011</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.jonas/build.properties b/plugins/org.eclipse.libra.framework.jonas/build.properties
new file mode 100644
index 0000000..81e3c06
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/build.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties
diff --git a/plugins/org.eclipse.libra.framework.jonas/plugin.properties b/plugins/org.eclipse.libra.framework.jonas/plugin.properties
new file mode 100644
index 0000000..37b9f5d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/plugin.properties
@@ -0,0 +1,24 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+pluginName=OW2 JonAS Support
+providerName=Eteration A.S.
+
+# --------------- Runtime Types ---------------
+libra=Eclipse Libra
+runtimeTypeJonasLabel=OW2 Micro JOnAS OSGi Service Platform
+runtimeTypeJonasDescription=OW2 micro JOnAS OSGi Service Platform supports OSGi R4.
+
+# --------------- Runtime Instance ---------------
+runtimeInstanceTypeJonasLabel=OW2 Micro JOnAS Framework Instance
+runtimeInstanceTypeJonasDescription=Publishes and runs osgi bundle projects on local Jonas platform.
+
+jonasLaunchConfigurationType=OW2 JOnAS
+
diff --git a/plugins/org.eclipse.libra.framework.jonas/plugin.xml b/plugins/org.eclipse.libra.framework.jonas/plugin.xml
new file mode 100644
index 0000000..9bbe325
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/plugin.xml
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?><!--
+ Copyright (c) 2010 Eteration A.S. 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:
+ Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ -->
+<plugin>
+ <extension
+ point="org.eclipse.wst.server.core.runtimeTypes">
+ <runtimeType
+ id="org.eclipse.libra.framework.jonas.runtimeType"
+ name="%runtimeTypeJonasLabel"
+ description="%runtimeTypeJonasDescription"
+ vendor="%libra"
+ version="2.0"
+ class="org.eclipse.libra.framework.jonas.JonasFramework">
+ <moduleType
+ types="osgi.bundle"
+ versions="4.2"/>
+ <moduleType
+ types="java"
+ versions="1.6"/>
+ <moduleType
+ types="java"
+ versions="1.5"/>
+ </runtimeType>
+ </extension>
+ <extension point="org.eclipse.wst.server.core.runtimeLocators">
+ <runtimeLocator
+ id="org.eclipse.libra.framework.jonas.runtime.locator"
+ typeIds="org.eclipse.libra.framework.jonas.runtimeType.*"
+ class="org.eclipse.libra.framework.core.OSGIFrameworkLocatorDelegate"/>
+ </extension>
+
+ <extension point="org.eclipse.jst.server.core.runtimeClasspathProviders">
+ <runtimeClasspathProvider
+ id="org.eclipse.libra.framework.jonas.runtimeTarget"
+ runtimeTypeIds="org.eclipse.libra.framework.jonas.runtimeType"
+ class="org.eclipse.libra.framework.jonas.internal.JonasFrameworkClasspathProvider"/>
+ </extension>
+
+
+ <extension
+ point="org.eclipse.wst.server.core.serverTypes">
+ <serverType
+ id="org.eclipse.libra.framework.jonas.serverType"
+ name="%runtimeInstanceTypeJonasLabel"
+ description="%runtimeInstanceTypeJonasDescription"
+ supportsRemoteHosts="false"
+ runtime="true"
+ startTimeout="120000"
+ stopTimeout="120000"
+ initialState="stopped"
+ startBeforePublish="false"
+ hasConfiguration="true"
+ launchConfigId="org.eclipse.libra.framework.jonas.launchConfigurationType"
+ runtimeTypeId="org.eclipse.libra.framework.jonas.runtimeType"
+ class="org.eclipse.libra.framework.jonas.JonasFrameworkInstance"
+ behaviourClass="org.eclipse.libra.framework.jonas.internal.JonasFrameworkInstanceBehavior">
+ </serverType>
+ </extension>
+
+
+ <extension point="org.eclipse.wst.server.core.serverLocators">
+ <serverLocator
+ id="org.eclipse.libra.framework.jonas.server.locator"
+ supportsRemoteHosts="false"
+ typeIds="org.eclipse.libra.framework.jonas.serverType"
+ class="org.eclipse.libra.framework.core.OSGIFrameworkInstanceLocatorDelegate"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.launchableAdapters">
+ <launchableAdapter
+ class="org.eclipse.libra.framework.core.launching.LaunchableAdapterDelegate"
+ id="org.eclipse.libra.framework.jonas.osgi"/>
+ </extension>
+
+ <extension point="org.eclipse.debug.core.sourcePathComputers">
+ <sourcePathComputer
+ id="org.eclipse.libra.framework.jonas.sourcePathComputer"
+ class="org.eclipse.libra.framework.core.internal.debug.OSGIFrameworkSourcePathComputerDelegate"/>
+ </extension>
+
+ <extension point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ id="org.eclipse.libra.framework.jonas.launchConfigurationType"
+ name="%jonasLaunchConfigurationType"
+ delegate="org.eclipse.libra.framework.core.launching.LaunchConfigurationDelegate"
+ modes="run, debug, profile"
+ sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
+ sourcePathComputerId="org.eclipse.libra.framework.jonas.sourcePathComputer"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.publishTasks">
+ <publishTask
+ id="org.eclipse.libra.framework.jonas.publishTask"
+ typeIds="org.eclipse.libra.framework.jonas.serverType"
+ class="org.eclipse.libra.framework.core.publish.PublishTask"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.common.project.facet.core.runtimes">
+ <runtime-component-type
+ id="org.eclipse.libra.framework.jonas.runtimeType"/>
+
+ <runtime-component-version
+ type="org.eclipse.libra.framework.jonas.runtimeType"
+ version="6.0"/>
+
+ <adapter>
+ <runtime-component
+ id="org.eclipse.libra.framework.jonas.runtimeType"/>
+ <factory
+ class="org.eclipse.jst.server.core.internal.RuntimeClasspathProvider$Factory"/>
+ <type
+ class="org.eclipse.jst.common.project.facet.core.IClasspathProvider"/>
+ </adapter>
+ <supported>
+ <runtime-component id="org.eclipse.libra.framework.jonas.runtimeType"/>
+ <facet id="osgi.bundle" />
+ </supported>
+
+ </extension>
+
+ <extension point="org.eclipse.wst.common.project.facet.core.defaultFacets">
+ <default-facets>
+ <runtime-component id="org.eclipse.libra.framework.jonas.runtimeType">
+ </runtime-component>
+ <facet
+ id="osgi.bundle" version="4.2">
+ </facet>
+ </default-facets>
+ </extension>
+
+ <extension point="org.eclipse.jst.server.core.runtimeFacetMappings">
+ <runtimeFacetMapping
+ runtimeTypeId="org.eclipse.libra.framework.jonas.runtimeType"
+ runtime-component="org.eclipse.libra.framework.jonas.runtimeType"
+ version="6.0"/>
+ </extension>
+ <extension point="org.eclipse.wst.server.core.installableRuntimes">
+ <runtime
+ id="org.eclipse.libra.framework.jonas.runtimeType"
+ licenseUrl="http://www.gnu.org/licenses/lgpl-2.1.html"
+ archiveUrl="http://download.forge.objectweb.org/jonas/micro-jonas-5.3.0-M2-bin.zip"
+ archivePath="micro-jonas-5.3.0-M2"
+ os="win32"/>
+ <runtime
+ id="org.eclipse.libra.framework.jonas.runtimeType"
+ licenseUrl="http://www.gnu.org/licenses/lgpl-2.1.html"
+ archiveUrl="http://download.forge.objectweb.org/jonas/micro-jonas-5.3.0-M2-bin.tar.gz"
+ archivePath="micro-jonas-5.3.0-M2"
+ os="linux"/>
+ <runtime
+ id="org.eclipse.libra.framework.jonas.runtimeType"
+ licenseUrl="http://www.gnu.org/licenses/lgpl-2.1.html"
+ archiveUrl="http://download.forge.objectweb.org/jonas/micro-jonas-5.3.0-M2-bin.tar.gz"
+ archivePath="micro-jonas-5.3.0-M2"
+ os="macosx"/>
+ </extension>
+
+</plugin>
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.jonas/pom.xml b/plugins/org.eclipse.libra.framework.jonas/pom.xml
new file mode 100644
index 0000000..f6f00f2
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/pom.xml
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.libra_parent</artifactId>
+ <groupId>org.eclipse.libra</groupId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../development/org.eclipse.libra.releng/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.libra.framework.jonas</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSGi Frameworks JOnAS Adapter Plug-in</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/plugins/org.eclipse.libra.framework.jonas/src/jonasbase.zip b/plugins/org.eclipse.libra.framework.jonas/src/jonasbase.zip
new file mode 100644
index 0000000..1eb0604
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/src/jonasbase.zip
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/IJonasFramework.java b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/IJonasFramework.java
new file mode 100644
index 0000000..d61702b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/IJonasFramework.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.jonas;
+
+import org.eclipse.libra.framework.core.IOSGIFramework;
+
+
+public interface IJonasFramework extends IOSGIFramework {
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/IJonasFrameworkInstance.java b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/IJonasFrameworkInstance.java
new file mode 100644
index 0000000..a739e42
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/IJonasFrameworkInstance.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.jonas;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.libra.framework.core.FrameworkInstanceConfiguration;
+import org.eclipse.libra.framework.core.IOSGIFrameworkInstance;
+
+
+
+public interface IJonasFrameworkInstance extends IOSGIFrameworkInstance {
+
+ public FrameworkInstanceConfiguration getJonasConfiguration() throws CoreException;
+
+}
diff --git a/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/IJonasVersionHandler.java b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/IJonasVersionHandler.java
new file mode 100644
index 0000000..0f5bcff
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/IJonasVersionHandler.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.jonas;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.wst.server.core.IModule;
+
+public interface IJonasVersionHandler {
+
+ public abstract boolean supportsServeModulesWithoutPublish();
+
+ public abstract IStatus prepareDeployDirectory(IPath deployPath);
+
+ public abstract IStatus prepareFrameworkInstanceDirectory(IPath baseDir);
+
+ public abstract IStatus canAddModule(IModule module);
+
+ public abstract String[] getFrameworkVMArguments(IPath installPath, IPath configPath,
+ IPath deployPath, boolean isTestEnv);
+
+ public abstract String[] getExcludedFrameworkProgramArguments(boolean debug,
+ boolean starting);
+
+ public abstract String[] getFrameworkProgramArguments(IPath configPath,
+ boolean debug, boolean starting);
+
+ @SuppressWarnings("rawtypes")
+ public abstract List getFrameworkClasspath(IPath installPath, IPath configPath);
+
+ public abstract String getFrameworkClass();
+
+ public abstract IStatus verifyInstallPath(IPath location);
+
+ public abstract void prepareFrameworkConfigurationFile(IPath confDir,String workspaceBundles, String kernelBundles);
+
+ public abstract void createJonasBase(IPath location, String instanceDirectory);
+
+}
diff --git a/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/JonasFramework.java b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/JonasFramework.java
new file mode 100644
index 0000000..a8d7664
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/JonasFramework.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.jonas;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.libra.framework.core.FrameworkDelegate;
+import org.eclipse.libra.framework.core.IOSGIFrameworkWorkingCopy;
+import org.eclipse.wst.server.core.IRuntimeType;
+
+
+public class JonasFramework extends FrameworkDelegate implements
+ IOSGIFrameworkWorkingCopy, IJonasFramework {
+ public JonasFramework() {
+ }
+
+
+ public IJonasVersionHandler getVersionHandler() {
+ IRuntimeType type = getRuntime().getRuntimeType();
+ return JonasPlugin.getJonasVersionHandler(type.getId());
+ }
+
+ @SuppressWarnings("rawtypes")
+ public List getFrameworkClasspath(IPath configPath) {
+ IPath installPath = getRuntime().getLocation();
+ // If installPath is relative, convert to canonical path and hope for
+ // the best
+ if (!installPath.isAbsolute()) {
+ try {
+ String installLoc = (new File(installPath.toOSString()))
+ .getCanonicalPath();
+ installPath = new Path(installLoc);
+ } catch (IOException e) {
+ // Ignore if there is a problem
+ }
+ }
+ return getVersionHandler().getFrameworkClasspath(installPath, configPath);
+ }
+
+ /**
+ * Verifies the Felix installation directory. If it is correct, true is
+ * returned. Otherwise, the user is notified and false is returned.
+ *
+ * @return boolean
+ */
+ public IStatus verifyLocation() {
+ return getVersionHandler()
+ .verifyInstallPath(getRuntime().getLocation());
+ }
+
+
+ public IStatus validate() {
+ IStatus status = super.validate();
+ if (!status.isOK())
+ return status;
+
+ status = verifyLocation();
+ if (!status.isOK())
+ return status;
+ // return new Status(IStatus.ERROR, FelixPlugin.PLUGIN_ID, 0,
+ // Messages.errorInstallDir, null);
+ // don't accept trailing space since that can cause startup problems
+ if (getRuntime().getLocation().hasTrailingSeparator())
+ return new Status(IStatus.ERROR, JonasPlugin.PLUGIN_ID, 0,
+ Messages.errorInstallDirTrailingSlash, null);
+ if (getVMInstall() == null)
+ return new Status(IStatus.ERROR, JonasPlugin.PLUGIN_ID, 0,
+ Messages.errorJRE, null);
+
+
+ File f = getRuntime().getLocation().append("conf").toFile();
+ File[] conf = f.listFiles();
+ if (conf != null) {
+ int size = conf.length;
+ for (int i = 0; i < size; i++) {
+ if (!f.canRead())
+ return new Status(IStatus.WARNING, JonasPlugin.PLUGIN_ID,
+ 0, Messages.warningCantReadConfig, null);
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/JonasFrameworkInstance.java b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/JonasFrameworkInstance.java
new file mode 100644
index 0000000..2fd733e
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/JonasFrameworkInstance.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.jonas;
+
+import java.io.File;
+
+import org.apache.tools.ant.DirectoryScanner;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.libra.framework.core.FrameworkInstanceConfiguration;
+import org.eclipse.libra.framework.core.FrameworkInstanceDelegate;
+import org.eclipse.libra.framework.core.OSGIFrameworkInstanceBehaviorDelegate;
+import org.eclipse.libra.framework.core.TargetDefinitionUtil;
+import org.eclipse.libra.framework.core.Trace;
+import org.eclipse.libra.framework.jonas.internal.JonasFrameworkInstanceBehavior;
+import org.eclipse.pde.internal.core.target.provisional.IBundleContainer;
+import org.eclipse.pde.internal.core.target.provisional.ITargetDefinition;
+import org.eclipse.pde.internal.core.target.provisional.ITargetPlatformService;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IRuntime;
+
+@SuppressWarnings("restriction")
+public class JonasFrameworkInstance extends FrameworkInstanceDelegate implements
+ IJonasFrameworkInstance {
+
+ protected transient IJonasVersionHandler versionHandler;
+
+ @Override
+ public IStatus canModifyModules(IModule[] add, IModule[] remove) {
+ IStatus status = super.canModifyModules(add, remove);
+ if (!status.isOK())
+ return status;
+
+ if (getJonasVersionHandler() == null)
+ return new Status(IStatus.ERROR, JonasPlugin.PLUGIN_ID, 0,
+ Messages.errorNoRuntime, null);
+
+ if (add != null) {
+ int size = add.length;
+ for (int i = 0; i < size; i++) {
+ IModule module = add[i];
+ IStatus status2 = getJonasVersionHandler().canAddModule(module);
+ if (status2 != null && !status2.isOK())
+ return status2;
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public void setDefaults(IProgressMonitor monitor) {
+ super.setDefaults(monitor);
+ try {
+ getJonasConfiguration();
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "Can't setup for Felix configuration.", e);
+ }
+ }
+
+ @Override
+ public void importRuntimeConfiguration(IRuntime runtime,
+ IProgressMonitor monitor) throws CoreException {
+
+ super.importRuntimeConfiguration(runtime, monitor);
+ OSGIFrameworkInstanceBehaviorDelegate fsb = (OSGIFrameworkInstanceBehaviorDelegate) getServer()
+ .loadAdapter(JonasFrameworkInstanceBehavior.class, null);
+ if (fsb != null) {
+ IPath tempDir = fsb.getTempDirectory();
+ if (!tempDir.isAbsolute()) {
+ IPath rootPath = ResourcesPlugin.getWorkspace().getRoot()
+ .getLocation();
+ tempDir = rootPath.append(tempDir);
+ }
+ setInstanceDirectory(tempDir.toPortableString());
+ }
+
+ try {
+ getJonasConfiguration();
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "Can't setup for Felix configuration.", e);
+ }
+ }
+
+ public JonasFramework getJonasRuntime() {
+ if (getServer().getRuntime() == null)
+ return null;
+ return (JonasFramework) getServer().getRuntime().loadAdapter(
+ JonasFramework.class, null);
+ }
+
+ public IJonasVersionHandler getJonasVersionHandler() {
+ if (versionHandler == null) {
+ if (getServer().getRuntime() == null || getJonasRuntime() == null)
+ return null;
+
+ versionHandler = getJonasRuntime().getVersionHandler();
+ }
+ return versionHandler;
+ }
+
+ public FrameworkInstanceConfiguration getJonasConfiguration()
+ throws CoreException {
+
+ return getFrameworkInstanceConfiguration();
+
+ }
+
+ @SuppressWarnings("restriction")
+ private IBundleContainer[] getDefaultBundleContainers(IPath installPath) {
+ try {
+ DirectoryScanner scanner = new DirectoryScanner();
+ String baseDir = installPath.append("repositories/maven2-internal").toOSString();
+ scanner.setBasedir(baseDir);
+ scanner.setIncludes(new String[]{"**/*.jar"});
+ scanner.scan();
+ String[] bundles = scanner.getIncludedFiles();
+ ITargetPlatformService service = TargetDefinitionUtil.getTargetPlatformService();
+
+ if(bundles != null && bundles.length>0){
+
+ IBundleContainer[] containers = new IBundleContainer[bundles.length];
+ int i=0;
+ for(String b: bundles){
+ File bundle = new File(b);
+ IPath baseDirFile = new Path(baseDir);
+
+ containers[i] = service.newDirectoryContainer(baseDirFile.append(bundle.getParent()).toOSString());
+ i++;
+ }
+ return containers;
+ }
+ } catch (Throwable t) {
+ // TODO Auto-generated catch block
+ t.printStackTrace();
+ }
+ return new IBundleContainer[0];
+ }
+
+ @Override
+ public ITargetDefinition createDefaultTarget() throws CoreException {
+ IPath installPath = getServer().getRuntime().getLocation();
+ ITargetPlatformService service = TargetDefinitionUtil.getTargetPlatformService();
+
+ ITargetDefinition targetDefinition = service.newTarget();
+ targetDefinition.setName(getServer().getName());
+ IBundleContainer[] containers = getDefaultBundleContainers(installPath);
+
+ targetDefinition.setBundleContainers(containers);
+ service.saveTargetDefinition(targetDefinition);
+
+ return targetDefinition;
+ }
+
+
+
+}
diff --git a/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/JonasHandler.java b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/JonasHandler.java
new file mode 100644
index 0000000..abc6855
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/JonasHandler.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.jonas;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.libra.framework.jonas.internal.util.ZipUtil;
+import org.eclipse.wst.server.core.IModule;
+
+public class JonasHandler implements IJonasVersionHandler {
+
+ public IStatus verifyInstallPath(IPath location) {
+
+ File f = location.append("conf/jonas.properties").toFile();
+ if (f == null || !f.exists())
+ return new Status(IStatus.ERROR, JonasPlugin.PLUGIN_ID, 0,
+ Messages.warningCantReadConfig, null);
+ File[] conf = f.listFiles();
+ if (conf != null) {
+ int size = conf.length;
+ for (int i = 0; i < size; i++) {
+ if (!f.canRead())
+ return new Status(IStatus.WARNING, JonasPlugin.PLUGIN_ID,
+ 0, Messages.warningCantReadConfig, null);
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ public String getFrameworkClass() {
+ return "org.ow2.jonas.commands.admin.ClientAdmin";
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public List getFrameworkClasspath(IPath installPath, IPath configPath) {
+
+ List cp = new ArrayList();
+
+ IPath binPath = installPath.append("/lib/bootstrap");
+ if (binPath.toFile().exists()) {
+ IPath path = binPath.append("/felix-launcher.jar");
+ cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(path));
+ IPath path2 = binPath.append("/jonas-commands.jar");
+ cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(path2));
+ IPath path3 = binPath.append("/jonas-version.jar");
+ cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(path3));
+ }
+
+ return cp;
+ }
+
+ public String[] getFrameworkProgramArguments(IPath configPath, boolean debug,
+ boolean starting) {
+ return new String[] { "-start" };
+ }
+
+ public String[] getExcludedFrameworkProgramArguments(boolean debug,
+ boolean starting) {
+ return null;
+ }
+
+ public String[] getFrameworkVMArguments(IPath installPath, IPath configPath,
+ IPath deployPath, boolean isTestEnv) {
+
+ String configPathStr = deployPath.makeAbsolute().toOSString();
+ String vmArgs = "-Dfelix.config.properties=file:" + configPathStr + "/config.properties"; //$NON-NLS-1$ //$NON-NLS-2$
+ String jonasRoot = installPath.toOSString();
+ String jonasBase = deployPath.append("/jonasbase").toOSString();
+ return new String[] {
+ "-Djonas.root=" + jonasRoot,
+ "-Djonas.base=" + jonasBase,
+ "-Dipojo.log.level=ERROR",
+ "-Djava.security.policy=" + jonasBase + "/conf/java.policy",
+ "-Djava.security.auth.login.config=" + jonasBase
+ + "/conf/jaas.config",
+ "-Djava.endorsed.dirs=" + jonasRoot + "/lib/endorsed",
+ "-Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB",
+ "-Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton",
+ "-Dorg.omg.PortableInterceptor.ORBInitializerClass.standard_init=org.jacorb.orb.standardInterceptors.IORInterceptorInitializer",
+ "-Dcom.sun.CORBA.ORBDynamicStubFactoryFactoryClass=com.sun.corba.se.impl.presentation.rmi.StubFactoryFactoryStaticImpl",
+ "-Djavax.xml.soap.SOAPConnectionFactory=com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnectionFactory",
+ "-Djavax.xml.soap.SOAPFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl",
+ "-Djavax.xml.soap.MetaFactory=com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl",
+ "-Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl",
+ "-Djonas.felix.tui.enabled=true", "-Djonas.cache.clean=true" };
+ }
+
+ public IStatus canAddModule(IModule module) {
+ String id = module.getModuleType().getId();
+ // String version = module.getModuleType().getVersion();
+ if ("osgi.bundle".equals(id))
+ return Status.OK_STATUS;
+
+ return new Status(IStatus.ERROR, JonasPlugin.PLUGIN_ID, 0,
+ Messages.errorNotBundle, null);
+ }
+
+ public IStatus prepareFrameworkInstanceDirectory(IPath baseDir) {
+ return Status.OK_STATUS;// TomcatVersionHelper.createCatalinaInstanceDirectory(baseDir);
+ }
+
+ public IStatus prepareDeployDirectory(IPath deployPath) {
+
+ // if (Trace.isTraceEnabled())
+ // Trace.trace(Trace.FINER, "Creating runtime directory at "
+ // + deployPath.toOSString());
+ //
+ // // Prepare a felix directory structure
+ // File temp = deployPath.append("plugins").toFile();
+ // if (!temp.exists())
+ // temp.mkdirs();
+ // temp = deployPath.append("auto").toFile();
+ // if (!temp.exists())
+ // temp.mkdirs();
+ // temp = deployPath.append("cache").toFile();
+ // if (!temp.exists())
+ // temp.mkdirs();
+
+ return Status.OK_STATUS;
+ }
+
+ public boolean supportsServeModulesWithoutPublish() {
+ return true;
+ }
+
+ public void prepareFrameworkConfigurationFile(IPath configPath,
+ String workspaceBundles, String kernelBundles) {
+ // Properties properties = new Properties();
+ //
+ // properties.setProperty("felix.auto.deploy.dir",
+ // configPath.append("auto").makeAbsolute().toPortableString());
+ // properties.setProperty("felix.auto.deploy.action", "install,start");
+ // properties.setProperty("org.osgi.framework.startlevel.beginning",
+ // "2");
+ // properties.setProperty("felix.auto.install.1", kernelBundles);
+ // properties.setProperty("felix.auto.start.1", kernelBundles);
+ // properties.setProperty("felix.auto.install.2", workspaceBundles);
+ // properties.setProperty("felix.auto.start.2", workspaceBundles);
+ // properties.setProperty("org.osgi.framework.storage", "file:"
+ // + configPath.append("auto").makeAbsolute().toPortableString());
+ // properties.setProperty("org.osgi.framework.storage.clean",
+ // "onFirstInit");
+ //
+ // try {
+ // properties.store(
+ // new FileOutputStream(configPath.append("config.properties")
+ // .makeAbsolute().toFile()), "## AUTO GENERATED ##");
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // }
+ }
+
+ final int BUFFER = 2048;
+
+ public void createJonasBase(IPath location, String instanceDirectory) {
+ try {
+ ZipUtil.unzip(
+ this.getClass().getResourceAsStream("/jonasbase.zip"),
+ new File(instanceDirectory));
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/JonasPlugin.java b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/JonasPlugin.java
new file mode 100644
index 0000000..c2526cc
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/JonasPlugin.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.jonas;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+public class JonasPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.libra.framework.jonas"; //$NON-NLS-1$
+
+ // The shared instance
+ private static JonasPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public JonasPlugin() {
+ super();
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#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 JonasPlugin getDefault() {
+ return plugin;
+ }
+
+
+
+ public static String getPreference(String id) {
+ return Platform.getPreferencesService().getString(PLUGIN_ID, id, "", null);
+ }
+
+ public static void setPreference(String id, String value) {
+ (new DefaultScope()).getNode(PLUGIN_ID).put(id, value);
+ }
+
+ public static IJonasVersionHandler getJonasVersionHandler(String id) {
+// if (id.indexOf("runtime") > 0)
+// id = id.substring(0, 30) + id.substring(38);
+// if (true)//"abc".equals(id))
+ return new JonasHandler();
+ }
+
+
+}
diff --git a/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/Messages.java b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/Messages.java
new file mode 100644
index 0000000..f510066
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/Messages.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.jonas;
+
+import org.eclipse.osgi.util.NLS;
+/**
+ * Translated messages.
+ */
+public class Messages extends NLS {
+
+ public static String errorInstallDirTrailingSlash = null;
+ public static String errorJRE;
+ public static String warningCantReadConfig;
+ public static String warningCantReadBundle;
+ public static String errorNotBundle;
+ public static String errorOSGiBundlesOnly;
+ public static String errorNoRuntime;
+
+ public static String publishServerTask;
+ public static String errorConfigurationProjectClosed;
+ public static String errorNoConfiguration;
+ public static String loadingTask;
+ public static String errorCouldNotLoadConfiguration;
+ public static String configurationEditorActionAddOsgiModule;
+
+ static {
+ NLS.initializeMessages(JonasPlugin.PLUGIN_ID + ".Messages", Messages.class);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/Messages.properties b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/Messages.properties
new file mode 100644
index 0000000..88dac69
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/Messages.properties
@@ -0,0 +1,20 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+
+# --------------- General UI ---------------
+
+errorInstallDirTrailingSlash = Installation folder must not end with a slash
+errorJRE= Selected JRE is not valid;
+warningCantReadConfig=Cannot locate the correct conf folder. Invalid Installation folder
+warningCantReadBundle=Cannot locate the correct bundle folder. Invalid Installation folder
+errorNotBundle=Must be an osgi bundle
+errorOSGiBundlesOnly=Must be an osgi bundle
+errorNoRuntime=There is no runtime
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/internal/JonasConfigurationPublishHelper.java b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/internal/JonasConfigurationPublishHelper.java
new file mode 100644
index 0000000..ced6f86
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/internal/JonasConfigurationPublishHelper.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.jonas.internal;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.libra.framework.core.OSGIFrameworkInstanceBehaviorDelegate;
+import org.eclipse.libra.framework.core.publish.PublishHelper;
+
+
+
+public class JonasConfigurationPublishHelper extends PublishHelper{
+ public OSGIFrameworkInstanceBehaviorDelegate behavior;
+
+ public JonasConfigurationPublishHelper(OSGIFrameworkInstanceBehaviorDelegate behavior) {
+ this.behavior = behavior;
+ }
+
+ protected IPath getPublishFolder() {
+ IPath configPath = behavior.getBaseDirectory();
+ //configPath = configPath.append("plugins").makeAbsolute();
+ return configPath;
+ }
+
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/internal/JonasFrameworkClasspathProvider.java b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/internal/JonasFrameworkClasspathProvider.java
new file mode 100644
index 0000000..36b67af
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/internal/JonasFrameworkClasspathProvider.java
@@ -0,0 +1,44 @@
+package org.eclipse.libra.framework.jonas.internal;
+
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jst.server.core.RuntimeClasspathProviderDelegate;
+import org.eclipse.wst.server.core.IRuntime;
+
+public class JonasFrameworkClasspathProvider extends
+ RuntimeClasspathProviderDelegate {
+ /**
+ * @see RuntimeClasspathProviderDelegate#resolveClasspathContainer(IProject,
+ * IRuntime)
+ */
+ public IClasspathEntry[] resolveClasspathContainer(IProject project,
+ IRuntime runtime) {
+ IPath installPath = runtime.getLocation();
+
+ if (installPath == null)
+ return new IClasspathEntry[0];
+
+ List<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
+ // String runtimeId = runtime.getRuntimeType().getId();
+ IPath path = installPath.append("osgi");
+ addLibraryEntries(list, path.toFile(), true);
+
+ return (IClasspathEntry[]) list
+ .toArray(new IClasspathEntry[list.size()]);
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/internal/JonasFrameworkInstanceBehavior.java b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/internal/JonasFrameworkInstanceBehavior.java
new file mode 100644
index 0000000..9d0d6c6
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/internal/JonasFrameworkInstanceBehavior.java
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.jonas.internal;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.libra.framework.core.FrameworkInstanceConfiguration;
+import org.eclipse.libra.framework.core.OSGIFrameworkInstanceBehaviorDelegate;
+import org.eclipse.libra.framework.core.ProgressUtil;
+import org.eclipse.libra.framework.core.Trace;
+import org.eclipse.libra.framework.jonas.IJonasVersionHandler;
+import org.eclipse.libra.framework.jonas.JonasFrameworkInstance;
+import org.eclipse.libra.framework.jonas.Messages;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
+
+
+public class JonasFrameworkInstanceBehavior extends
+ OSGIFrameworkInstanceBehaviorDelegate {
+
+ protected transient JonasConfigurationPublishHelper publishHelper = new JonasConfigurationPublishHelper(
+ this);
+
+ /**
+ * FelixRuntimeInstanceBehavior.
+ */
+ public JonasFrameworkInstanceBehavior() {
+ super();
+ }
+
+ public IJonasVersionHandler getJonasVersionHandler() {
+ return getJonasRuntimeInstance().getJonasVersionHandler();
+ }
+
+ public JonasFrameworkInstance getJonasRuntimeInstance() {
+ return (JonasFrameworkInstance) getServer().loadAdapter(JonasFrameworkInstance.class, null);
+ }
+
+ public String getFrameworkClass() {
+ return getJonasVersionHandler().getFrameworkClass();
+ }
+
+ public String[] getFrameworkProgramArguments(boolean starting) {
+ return getJonasVersionHandler().getFrameworkProgramArguments(
+ getBaseDirectory(), getFrameworkInstance().isDebug(), starting);
+ }
+
+ public String[] getExcludedFrameworkProgramArguments(boolean starting) {
+ return getJonasVersionHandler().getExcludedFrameworkProgramArguments(
+ getFrameworkInstance().isDebug(), starting);
+ }
+
+ public String[] getFrameworkVMArguments() {
+ IPath installPath = getServer().getRuntime().getLocation();
+ // If installPath is relative, convert to canonical path and hope for
+ // the best
+ if (!installPath.isAbsolute()) {
+ try {
+ String installLoc = (new File(installPath.toOSString()))
+ .getCanonicalPath();
+ installPath = new Path(installLoc);
+ } catch (IOException e) {
+ // Ignore if there is a problem
+ }
+ }
+
+ IPath deployPath = getBaseDirectory();
+ // If deployPath is relative, convert to canonical path and hope for the
+ // best
+ if (!deployPath.isAbsolute()) {
+ try {
+ String deployLoc = (new File(deployPath.toOSString()))
+ .getCanonicalPath();
+ deployPath = new Path(deployLoc);
+ } catch (IOException e) {
+ // Ignore if there is a problem
+ }
+ }
+
+ return getJonasVersionHandler().getFrameworkVMArguments(installPath, null, deployPath, false);
+ }
+
+ protected void publishServer(int kind, IProgressMonitor monitor)
+ throws CoreException {
+ if (getServer().getRuntime() == null)
+ return;
+
+ IPath confDir = getBaseDirectory();
+ getJonasVersionHandler().createJonasBase(getServer().getRuntime().getLocation(), this.getJonasRuntimeInstance().getInstanceDirectory());
+ IStatus status = getJonasVersionHandler().prepareDeployDirectory(
+ confDir);
+
+ if (status != null && !status.isOK())
+ throw new CoreException(status);
+
+ monitor = ProgressUtil.getMonitorFor(monitor);
+ monitor.beginTask(Messages.publishServerTask, 600);
+
+ // TODO OSAMI 1) Cleanup 2) Backup and Publish,
+
+ // if (status != null && !status.isOK())
+ // throw new CoreException(status);
+
+ monitor.done();
+
+ setServerPublishState(IServer.PUBLISH_STATE_NONE);
+ }
+
+ @SuppressWarnings("rawtypes")
+ protected void publishModules(int kind, List modules, List deltaKind2,
+ MultiStatus multi, IProgressMonitor monitor) {
+
+
+ IPath confDir = getBaseDirectory();
+
+ FrameworkInstanceConfiguration jonasConfiguration;
+
+ try {
+ jonasConfiguration = getJonasRuntimeInstance().getJonasConfiguration();
+ IPath deployDir=confDir.append("/jonasbase/tmp");
+ IPath installDir=confDir.append("/jonasbase/deploy");
+ File deployPath=deployDir.toFile();
+ if(!deployPath.exists()){
+ deployPath.mkdir();
+ }
+
+ publishHelper.exportBundles(modules, jonasConfiguration, installDir, deployDir);
+ getJonasVersionHandler().prepareFrameworkConfigurationFile(deployDir,
+ publishHelper.getServerModules(modules,"reference:file:", " " ),
+ publishHelper.getTargetBundles(jonasConfiguration,"reference:file:", " "));
+
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "Publishing failed", e);
+ }
+ }
+
+ protected void publishModule(int kind, int deltaKind, IModule[] moduleTree,
+ IProgressMonitor monitor) throws CoreException {
+ if (getServer().getServerState() != IServer.STATE_STOPPED) {
+ if (deltaKind == ServerBehaviourDelegate.ADDED
+ || deltaKind == ServerBehaviourDelegate.REMOVED)
+ setServerRestartState(true);
+ }
+
+ Properties p = loadModulePublishLocations();
+
+ // TODO OSAMI PUBLISH
+
+ setModulePublishState(moduleTree, IServer.PUBLISH_STATE_NONE);
+
+ saveModulePublishLocations(p);
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/internal/JonasFrameworkInstanceLocator.java b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/internal/JonasFrameworkInstanceLocator.java
new file mode 100644
index 0000000..ca6aced
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/internal/JonasFrameworkInstanceLocator.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.jonas.internal;
+
+import org.eclipse.libra.framework.core.OSGIFrameworkLocatorDelegate;
+
+public class JonasFrameworkInstanceLocator extends OSGIFrameworkLocatorDelegate {
+
+ protected static final String[] runtimeTypes = new String[] {
+ "org.eclipse.libra.framework.jonas"};
+
+ public static String[] getRuntimeTypes() {
+ return runtimeTypes;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/internal/util/ZipUtil.java b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/internal/util/ZipUtil.java
new file mode 100644
index 0000000..8a4e980
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.jonas/src/org/eclipse/libra/framework/jonas/internal/util/ZipUtil.java
@@ -0,0 +1,75 @@
+package org.eclipse.libra.framework.jonas.internal.util;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.jar.JarInputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+public class ZipUtil {
+ public static void unzip(InputStream in, File dest) throws IOException
+ {
+ if (!dest.exists())
+ {
+ dest.mkdirs();
+ }
+ if (!dest.isDirectory())
+ {
+ throw new IOException("Destination must be a directory.");
+ }
+ ZipInputStream jin = new ZipInputStream(in);
+ byte[] buffer = new byte[1024];
+
+ ZipEntry entry = jin.getNextEntry();
+ while (entry != null)
+ {
+ String fileName = entry.getName();
+ if (fileName.charAt(fileName.length() - 1) == '/')
+ {
+ fileName = fileName.substring(0, fileName.length() - 1);
+ }
+ if (fileName.charAt(0) == '/')
+ {
+ fileName = fileName.substring(1);
+ }
+ if (File.separatorChar != '/')
+ {
+ fileName = fileName.replace('/', File.separatorChar);
+ }
+ File file = new File(dest, fileName);
+ if (entry.isDirectory())
+ {
+ // make sure the directory exists
+ file.mkdirs();
+ jin.closeEntry();
+ }
+ else
+ {
+ // make sure the directory exists
+ File parent = file.getParentFile();
+ if (parent != null && !parent.exists())
+ {
+ parent.mkdirs();
+ }
+
+ // dump the file
+ OutputStream out = new FileOutputStream(file);
+ int len = 0;
+ while ((len = jin.read(buffer, 0, buffer.length)) != -1)
+ {
+ out.write(buffer, 0, len);
+ }
+ out.flush();
+ out.close();
+ jin.closeEntry();
+ file.setLastModified(entry.getTime());
+ }
+ entry = jin.getNextEntry();
+ }
+
+ jin.close();
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/.classpath b/plugins/org.eclipse.libra.framework.knopflerfish.ui/.classpath
new file mode 100644
index 0000000..64c5e31
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/.project b/plugins/org.eclipse.libra.framework.knopflerfish.ui/.project
new file mode 100644
index 0000000..42a0458
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.libra.framework.knopflerfish.ui</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.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.libra.framework.knopflerfish.ui/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..c8be432
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Fri Nov 10 17:11:35 HST 2006
+eclipse.preferences.version=1
+encoding/<project>=ISO-8859-1
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.libra.framework.knopflerfish.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..87e641f
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,74 @@
+#Sat Oct 16 21:03:45 EEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=error
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,*.testsuite,*.deploy,*.location,*.execution,*.datapool,*.artifact,*.html,*.svg
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=disabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=error
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.incompatibleJDKLevel=warning
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.libra.framework.knopflerfish.ui/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..584bdff
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,4 @@
+#Fri Nov 10 18:06:11 HST 2006
+eclipse.preferences.version=1
+internal.default.compliance=user
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?>\n<templates/>
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.libra.framework.knopflerfish.ui/.settings/org.eclipse.pde.prefs
new file mode 100644
index 0000000..0e06e96
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/.settings/org.eclipse.pde.prefs
@@ -0,0 +1,15 @@
+#Mon Jan 15 21:56:48 EST 2007
+compilers.incompatible-environment=0
+compilers.p.build=0
+compilers.p.deprecated=1
+compilers.p.missing-packages=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=0
+compilers.p.unknown-element=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.libra.framework.knopflerfish.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..31eaade
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,28 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.libra.framework.knopflerfish.ui;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.libra.framework.knopflerfish.ui.KnopflerfishUIPlugin
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.expressions;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jdt.debug.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jdt.launching;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.wst.server.core;bundle-version="[1.0.204,2.0.0)",
+ org.eclipse.jst.server.core;bundle-version="[1.0.103,2.0.0)",
+ org.eclipse.wst.common.project.facet.ui;bundle-version="[1.1.0,2.0.0)",
+ org.eclipse.wst.server.ui,
+ org.eclipse.pde.core,
+ org.eclipse.pde.ui,
+ org.eclipse.libra.framework.core,
+ org.eclipse.libra.framework.ui,
+ org.eclipse.libra.framework.knopflerfish
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/about.html b/plugins/org.eclipse.libra.framework.knopflerfish.ui/about.html
new file mode 100644
index 0000000..8f31159
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>March 25, 2011</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/build.properties b/plugins/org.eclipse.libra.framework.knopflerfish.ui/build.properties
new file mode 100644
index 0000000..5016daa
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/build.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+bin.includes = plugin.xml,\
+ plugin.properties,\
+ icons/,\
+ .,\
+ META-INF/,\
+ about.html
+bin.excludes = bin/**,\
+ @dot/**,\
+ temp.folder/**
+source.. = src/
+
+
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/knopflerfish.gif b/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/knopflerfish.gif
new file mode 100644
index 0000000..9f09561
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/knopflerfish.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/mime_extension.gif b/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/mime_extension.gif
new file mode 100644
index 0000000..c585010
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/mime_extension.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/mime_mapping.gif b/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/mime_mapping.gif
new file mode 100644
index 0000000..0a8e4bf
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/mime_mapping.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/port.gif b/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/port.gif
new file mode 100644
index 0000000..7a354b7
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/port.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/project_missing.gif b/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/project_missing.gif
new file mode 100644
index 0000000..0cb4c16
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/project_missing.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/web_module.gif b/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/web_module.gif
new file mode 100644
index 0000000..bf20f70
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/obj16/web_module.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/wizban/knopflerfish_wiz.png b/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/wizban/knopflerfish_wiz.png
new file mode 100644
index 0000000..05d4925
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/icons/wizban/knopflerfish_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/plugin.properties b/plugins/org.eclipse.libra.framework.knopflerfish.ui/plugin.properties
new file mode 100644
index 0000000..2ec5726
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/plugin.properties
@@ -0,0 +1,21 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+pluginName=Knopflerfish UI Support
+providerName=Eteration A.S.
+
+configurationEditorOSGiModulesPage=Modules
+configurationEditorTargetPage=Target Platform Profile
+
+cleanKnopflerfishWorkDir=Clean Knopflerfish Work Directory...
+cleanKnopflerfishModuleWorkDir=Clean Module Work Directory...
+
+publisherContextFixLabel=Update context paths
+publisherContextFixDescription=Prompt to update module contexts when they are out of sync.
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/plugin.xml b/plugins/org.eclipse.libra.framework.knopflerfish.ui/plugin.xml
new file mode 100644
index 0000000..98db270
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/plugin.xml
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2010 Eteration A.S. 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:
+ Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ -->
+
+<plugin>
+ <extension point="org.eclipse.wst.server.ui.serverImages">
+ <image
+ id="org.eclipse.libra.framework.knopflerfish.31"
+ icon="icons/obj16/knopflerfish.gif"
+ typeIds="org.eclipse.libra.framework.knopflerfish.serverType.31"/>
+
+ <image
+ id="org.eclipse.libra.framework.knopflerfish.runtimeType.31"
+ icon="icons/obj16/knopflerfish.gif"
+ typeIds="org.eclipse.libra.framework.knopflerfish.runtimeType.31"/>
+
+ </extension>
+
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ id="org.eclipse.libra.framework.knopflerfish.ui.propertyTester"
+ namespace="org.eclipse.libra.framework.knopflerfish.ui"
+ properties="hasConfiguration"
+ type="java.lang.Object"
+ class="org.eclipse.libra.framework.knopflerfish.ui.internal.ConfigurationPropertyTester">
+ </propertyTester>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.ui.editorPages">
+ <page
+ id="org.eclipse.libra.framework.knopflerfish.ui.editor.osgimodule"
+ order="20"
+ name="%configurationEditorOSGiModulesPage"
+ typeIds="org.eclipse.libra.framework.knopflerfish.serverType.*"
+ class="org.eclipse.libra.framework.ui.internal.editor.ConfigurationOSGiModuleEditorPart">
+ <enablement>
+ <test property="org.eclipse.libra.framework.knopflerfish.ui.hasConfiguration" value="true"/>
+ </enablement>
+ </page>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.ui.editorPages">
+ <page
+ id="org.eclipse.libra.framework.knopflerfish.ui.editor.osgimodule"
+ order="22"
+ name="Target Platform Profile"
+ typeIds="org.eclipse.libra.framework.knopflerfish.serverType.*"
+ class="org.eclipse.libra.framework.ui.internal.editor.TargetDefinitionEditorPart">
+ <enablement>
+ <test property="org.eclipse.libra.framework.knopflerfish.ui.hasConfiguration" value="true"/>
+ </enablement>
+ </page>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.ui.editorPageSections">
+ <section
+ id="org.eclipse.libra.framework.knopflerfish.editor.instance"
+ order="0"
+ insertionId="org.eclipse.wst.server.editor.overview.left"
+ typeIds="org.eclipse.libra.framework.knopflerfish.serverType.*"
+ class="org.eclipse.libra.framework.ui.internal.editor.FrameworkInstanceLocationEditorSection"/>
+
+ </extension>
+
+ <extension point="org.eclipse.wst.server.ui.wizardFragments">
+ <fragment
+ id="org.eclipse.libra.framework.knopflerfish.31"
+ typeIds="org.eclipse.libra.framework.knopflerfish.runtimeType.31"
+ class="org.eclipse.libra.framework.ui.OSGIFrameworkWizardFragment"/>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+ <launchConfigurationTypeImage
+ id="org.eclipse.libra.framework.knopflerfish.31.launchConfig.image"
+ configTypeID="org.eclipse.libra.framework.knopflerfish.launchConfigurationType"
+ icon="icons/obj16/knopflerfish.gif">
+ </launchConfigurationTypeImage>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ id="org.eclipse.libra.framework.knopflerfish.ui.launchConfigurationTabGroup"
+ type="org.eclipse.libra.framework.knopflerfish.launchConfigurationType"
+ class="org.eclipse.libra.framework.ui.GenericOSGILaunchConfigurationTabGroup">
+ </launchConfigurationTabGroup>
+ </extension>
+
+ <extension point="org.eclipse.wst.common.project.facet.ui.images">
+ <image runtime-component-type="org.eclipse.libra.framework.knopflerfish.runtimeType"
+ path="icons/obj16/knopflerfish.gif"/>
+ </extension>
+
+
+
+ <extension point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ id="org.eclipse.libra.framework.knopflerfish.ui.serveractions"
+ objectClass="org.eclipse.wst.server.core.IServer">
+ <visibility>
+ <objectState name="serverType" value="org.eclipse.libra.framework.knopflerfish.serverType.*"/>
+ </visibility>
+ <action
+ class="org.eclipse.libra.framework.ui.internal.actions.CleanWorkDirAction"
+ enablesFor="1"
+ id="org.eclipse.libra.framework.knopflerfish.ui.cleanserverworkdir"
+ label="%cleanTomcatWorkDir">
+ </action>
+ </objectContribution>
+ <objectContribution
+ adaptable="true"
+ id="org.eclipse.libra.framework.knopflerfish..ui.serveractions"
+ objectClass="org.eclipse.wst.server.ui.internal.view.servers.ModuleServer">
+ <visibility>
+ <and>
+ <objectState name="serverType" value="org.eclipse.libra.framework.knopflerfish.serverType.*"/>
+ <objectState name="moduleType" value="osgi.bundle"/>
+ </and>
+ </visibility>
+ <action
+ class="org.eclipse.libra.framework.ui.internal.actions.CleanWorkDirAction"
+ enablesFor="1"
+ id="org.eclipse.libra.framework.knopflerfish.ui.cleanmoduleworkdir"
+ label="%cleanKnopflerfishModuleWorkDir">
+ </action>
+ </objectContribution>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.publishers">
+ <publisher
+ id="org.eclipse.libra.framework.knopflerfish.ui.context"
+ typeIds="org.eclipse.libra.framework.knopflerfish.serverType.*"
+ name="%publisherContextFixLabel"
+ description="%publisherContextFixDescription"
+ order=""
+ class="org.eclipse.libra.framework.ui.internal.ModulePublisherDelegate"/>
+ </extension>
+</plugin>
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/pom.xml b/plugins/org.eclipse.libra.framework.knopflerfish.ui/pom.xml
new file mode 100644
index 0000000..cf843e3
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/pom.xml
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.libra_parent</artifactId>
+ <groupId>org.eclipse.libra</groupId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../development/org.eclipse.libra.releng/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.libra.framework.knopflerfish.ui</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSGi Frameworks Knopflerfish Adapter UI Plug-in</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/src/org/eclipse/libra/framework/knopflerfish/ui/KnopflerfishUIPlugin.java b/plugins/org.eclipse.libra.framework.knopflerfish.ui/src/org/eclipse/libra/framework/knopflerfish/ui/KnopflerfishUIPlugin.java
new file mode 100644
index 0000000..56b184a
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/src/org/eclipse/libra/framework/knopflerfish/ui/KnopflerfishUIPlugin.java
@@ -0,0 +1,59 @@
+package org.eclipse.libra.framework.knopflerfish.ui;
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+public class KnopflerfishUIPlugin extends AbstractUIPlugin {
+ protected static KnopflerfishUIPlugin singleton;
+ public static final String PLUGIN_ID = "org.eclipse.libra.framework.knopflerfish.ui";
+
+
+
+
+ public KnopflerfishUIPlugin() {
+ super();
+ singleton = this;
+ }
+
+
+ public static KnopflerfishUIPlugin getInstance() {
+ return singleton;
+ }
+
+ /**
+ * Convenience method for logging.
+ *
+ * @param status org.eclipse.core.runtime.IStatus
+ */
+ public static void log(IStatus status) {
+ getInstance().getLog().log(status);
+ }
+
+ /**
+ * Convenience method to get a Display. The method first checks, if
+ * the thread calling this method has an associated display. If so, this
+ * display is returned. Otherwise the method returns the default display.
+ *
+ * @return the display
+ */
+ public static Display getStandardDisplay() {
+ Display display = Display.getCurrent();
+ if (display == null)
+ display = Display.getDefault();
+ return display;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish.ui/src/org/eclipse/libra/framework/knopflerfish/ui/internal/ConfigurationPropertyTester.java b/plugins/org.eclipse.libra.framework.knopflerfish.ui/src/org/eclipse/libra/framework/knopflerfish/ui/internal/ConfigurationPropertyTester.java
new file mode 100644
index 0000000..2ead64a
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish.ui/src/org/eclipse/libra/framework/knopflerfish/ui/internal/ConfigurationPropertyTester.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.knopflerfish.ui.internal;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.libra.framework.core.FrameworkInstanceDelegate;
+import org.eclipse.libra.framework.knopflerfish.IKnopflerfishFramework;
+import org.eclipse.wst.server.core.IServerAttributes;
+
+/**
+ *
+ */
+public class ConfigurationPropertyTester extends PropertyTester {
+ /* (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ try {
+ IServerAttributes server = (IServerAttributes) receiver;
+ FrameworkInstanceDelegate knopflerfish = (FrameworkInstanceDelegate) server.loadAdapter(IKnopflerfishFramework.class, null);
+ if (knopflerfish != null)
+ return knopflerfish != null;
+ } catch (Exception e) {
+ // ignore
+ }
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/.classpath b/plugins/org.eclipse.libra.framework.knopflerfish/.classpath
new file mode 100644
index 0000000..64c5e31
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/.project b/plugins/org.eclipse.libra.framework.knopflerfish/.project
new file mode 100644
index 0000000..e875150
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.libra.framework.knopflerfish</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.libra.framework.knopflerfish/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..64203b9
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Oct 22 10:43:27 EEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+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
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/META-INF/MANIFEST.MF b/plugins/org.eclipse.libra.framework.knopflerfish/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..c306b5b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/META-INF/MANIFEST.MF
@@ -0,0 +1,31 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.libra.framework.knopflerfish;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.libra.framework.knopflerfish.KnopflerfishPlugin
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.jdt.launching,
+ org.eclipse.debug.core,
+ org.eclipse.pde.ui,
+ org.eclipse.pde,
+ org.eclipse.wst.server.core,
+ org.eclipse.wst.server.ui,
+ org.eclipse.jst.server.core,
+ org.eclipse.jdt.core,
+ org.eclipse.jst.common.project.facet.core,
+ org.eclipse.wst.common.modulecore,
+ org.eclipse.equinox.frameworkadmin,
+ org.eclipse.libra.framework.core
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.core.resources,
+ org.eclipse.debug.core,
+ org.eclipse.jdt.launching.sourcelookup,
+ org.eclipse.pde.core.plugin,
+ org.eclipse.pde.ui.launcher
+Export-Package: org.eclipse.libra.framework.knopflerfish,
+ org.eclipse.libra.framework.knopflerfish.internal
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/about.html b/plugins/org.eclipse.libra.framework.knopflerfish/about.html
new file mode 100644
index 0000000..7d9511d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>September 21, 2011</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/build.properties b/plugins/org.eclipse.libra.framework.knopflerfish/build.properties
new file mode 100644
index 0000000..81e3c06
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/build.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/plugin.properties b/plugins/org.eclipse.libra.framework.knopflerfish/plugin.properties
new file mode 100644
index 0000000..577d04f
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/plugin.properties
@@ -0,0 +1,25 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+pluginName=Knopflerfish Support
+providerName=Eteration A.S.
+
+# --------------- Runtime Types ---------------
+libra=Eclipse Libra
+runtimeTypeKnopflerfish31Label=Knopflerfish 3.1- OSGi Service Platform
+runtimeTypeknopflerfish31Description=Knopflerfish 3.1- OSGi Service Platform supports OSGi R4.2
+
+
+# --------------- Runtime Instance ---------------
+runtimeInstanceTypeKnopflerfish31Label=Knopflerfish 3.1 Runtime Instance
+runtimeInstanceTypeKnopflerfish31Description=Publishes and runs osgi bundle projects on local knopflerfish platform.
+
+knopflerfishLaunchConfigurationType=Knopflerfish
+
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/plugin.xml b/plugins/org.eclipse.libra.framework.knopflerfish/plugin.xml
new file mode 100644
index 0000000..a14584c
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/plugin.xml
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?><!--
+ Copyright (c) 2010 Eteration A.S. 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:
+ Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ -->
+
+<plugin>
+
+
+ <extension
+ point="org.eclipse.wst.server.core.runtimeTypes">
+ <runtimeType
+ id="org.eclipse.libra.framework.knopflerfish.runtimeType.31"
+ name="%runtimeTypeKnopflerfish31Label"
+ description="%runtimeTypeknopflerfish31Description"
+ vendor="%libra"
+ version="2.0"
+ class="org.eclipse.libra.framework.knopflerfish.KnopflerfishFramework">
+
+ <moduleType
+ types="osgi.bundle"
+ versions="4.2"/>
+ <moduleType
+ types="java"
+ versions="1.6"/>
+ <moduleType
+ types="java"
+ versions="1.5"/>
+ </runtimeType>
+ </extension>
+
+
+ <extension point="org.eclipse.wst.server.core.runtimeLocators">
+ <runtimeLocator
+ id="org.eclipse.libra.framework.knopflerfish.runtime.locator"
+ typeIds="org.eclipse.libra.framework.knopflerfish.runtimeType.*"
+ class="org.eclipse.libra.framework.core.OSGIFrameworkLocatorDelegate"/>
+ </extension>
+
+ <extension point="org.eclipse.jst.server.core.runtimeClasspathProviders">
+ <runtimeClasspathProvider
+ id="org.eclipse.libra.framework.knopflerfish.runtimeTarget"
+ runtimeTypeIds="org.eclipse.libra.framework.knopflerfish.runtimeType.*"
+ class="org.eclipse.libra.framework.knopflerfish.internal.KnopflerfishFrameworkClasspathProvider"/>
+ </extension>
+
+
+ <extension
+ point="org.eclipse.wst.server.core.serverTypes">
+ <serverType
+ id="org.eclipse.libra.framework.knopflerfish.serverType.31"
+ name="%runtimeInstanceTypeKnopflerfish31Label"
+ description="%runtimeInstanceTypeKnopflerfish31Description"
+ supportsRemoteHosts="false"
+ runtime="true"
+ startTimeout="120000"
+ stopTimeout="120000"
+ initialState="stopped"
+ startBeforePublish="false"
+ synchronousStart="true"
+ hasConfiguration="true"
+ launchConfigId="org.eclipse.libra.framework.knopflerfish.launchConfigurationType"
+ runtimeTypeId="org.eclipse.libra.framework.knopflerfish.runtimeType.31"
+ class="org.eclipse.libra.framework.knopflerfish.KnopflerfishFrameworkInstance"
+ behaviourClass="org.eclipse.libra.framework.knopflerfish.internal.KnopflerfishFrameworkInstanceBehavior">
+ </serverType>
+ </extension>
+
+
+ <extension point="org.eclipse.wst.server.core.serverLocators">
+ <serverLocator
+ id="org.eclipse.libra.framework.knopflerfish.server.locator"
+ supportsRemoteHosts="false"
+ typeIds="org.eclipse.libra.framework.knopflerfish.serverType.*"
+ class="org.eclipse.libra.framework.core.OSGIFrameworkInstanceLocatorDelegate"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.launchableAdapters">
+ <launchableAdapter
+ class="org.eclipse.libra.framework.core.launching.LaunchableAdapterDelegate"
+ id="org.eclipse.libra.framework.knopflerfish.osgi"/>
+ </extension>
+
+ <extension point="org.eclipse.debug.core.sourcePathComputers">
+ <sourcePathComputer
+ id="org.eclipse.libra.framework.knopflerfish.sourcePathComputer"
+ class="org.eclipse.libra.framework.core.internal.debug.OSGIRuntimeSourcePathComputerDelegate"/>
+ </extension>
+
+ <extension point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ id="org.eclipse.libra.framework.knopflerfish.launchConfigurationType"
+ name="%knopflerfishLaunchConfigurationType"
+ delegate="org.eclipse.libra.framework.core.launching.LaunchConfigurationDelegate"
+ modes="run, debug, profile"
+ sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
+ sourcePathComputerId="org.eclipse.libra.framework.knopflerfish.sourcePathComputer"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.publishTasks">
+ <publishTask
+ id="org.eclipse.libra.framework.knopflerfish.publishTask"
+ typeIds="org.eclipse.libra.framework.knopflerfish.serverType.*"
+ class="org.eclipse.libra.framework.core.publish.PublishTask"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.common.project.facet.core.runtimes">
+ <runtime-component-type
+ id="org.eclipse.libra.framework.knopflerfish.runtimeType"/>
+
+ <runtime-component-version
+ type="org.eclipse.libra.framework.knopflerfish.runtimeType"
+ version="3.1"/>
+
+ <adapter>
+ <runtime-component
+ id="org.eclipse.libra.framework.knopflerfish.runtimeType"/>
+ <factory
+ class="org.eclipse.jst.server.core.internal.RuntimeClasspathProvider$Factory"/>
+ <type
+ class="org.eclipse.jst.common.project.facet.core.IClasspathProvider"/>
+ </adapter>
+
+ <supported>
+ <runtime-component id="org.eclipse.libra.framework.knopflerfish.runtimeType"/>
+ <facet id="osgi.bundle" />
+ </supported>
+
+ </extension>
+
+ <extension point="org.eclipse.wst.common.project.facet.core.defaultFacets">
+ <default-facets>
+ <runtime-component id="org.eclipse.libra.framework.knopflerfish.runtimeType">
+ </runtime-component>
+ <facet
+ id="osgi.bundle" version="4.2">
+ </facet>
+ </default-facets>
+ </extension>
+
+ <extension point="org.eclipse.jst.server.core.runtimeFacetMappings">
+ <runtimeFacetMapping
+ runtimeTypeId="org.eclipse.libra.framework.knopflerfish.runtimeType.31"
+ runtime-component="org.eclipse.libra.framework.knopflerfish.runtimeType"
+ version="3.1"/>
+ </extension>
+
+ <extension point="org.eclipse.wst.server.core.installableRuntimes">
+ <runtime
+ id="org.eclipse.libra.framework.knopflerfish.runtimeType.31"
+ licenseUrl="http://www.knopflerfish.org/license.html"
+ archiveUrl="http://www.knopflerfish.org/releases/3.1.0/knopflerfish_osgi_sdk_3.1.0.jar"
+ archivePath="knopflerfish_osgi_sdk_3.1.0"
+ os="win32"/>
+ <runtime
+ id="org.eclipse.libra.framework.knopflerfish.runtimeType.31"
+ licenseUrl="http://www.knopflerfish.org/license.html"
+ archiveUrl="http://www.knopflerfish.org/releases/3.1.0/knopflerfish_osgi_sdk_3.1.0.jar"
+ archivePath="knopflerfish_osgi_sdk_3.1.0"
+ os="linux"/>
+ <runtime
+ id="org.eclipse.libra.framework.knopflerfish.runtimeType.31"
+ licenseUrl="http://www.knopflerfish.org/license.html"
+ archiveUrl="http://www.knopflerfish.org/releases/3.1.0/knopflerfish_osgi_sdk_3.1.0.jar"
+ archivePath="knopflerfish_osgi_sdk_3.1.0"
+ os="macosx"/>
+ </extension>
+
+
+</plugin>
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/pom.xml b/plugins/org.eclipse.libra.framework.knopflerfish/pom.xml
new file mode 100644
index 0000000..23ab9be
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/pom.xml
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.libra_parent</artifactId>
+ <groupId>org.eclipse.libra</groupId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../development/org.eclipse.libra.releng/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.libra.framework.knopflerfish</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSGi Frameworks Knopflerfish Adapter Plug-in</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/IKnopflerfishFramework.java b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/IKnopflerfishFramework.java
new file mode 100644
index 0000000..3f529b2
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/IKnopflerfishFramework.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.knopflerfish;
+
+import org.eclipse.libra.framework.core.IOSGIFramework;
+
+
+public interface IKnopflerfishFramework extends IOSGIFramework {
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/IKnopflerfishFrameworkInstance.java b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/IKnopflerfishFrameworkInstance.java
new file mode 100644
index 0000000..b7d3b32
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/IKnopflerfishFrameworkInstance.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.knopflerfish;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.libra.framework.core.FrameworkInstanceConfiguration;
+import org.eclipse.libra.framework.core.IOSGIFrameworkInstance;
+
+
+
+public interface IKnopflerfishFrameworkInstance extends IOSGIFrameworkInstance {
+
+ public FrameworkInstanceConfiguration getKnopflerfishConfiguration() throws CoreException;
+
+}
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/IKnopflerfishVersionHandler.java b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/IKnopflerfishVersionHandler.java
new file mode 100644
index 0000000..c2a390d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/IKnopflerfishVersionHandler.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.knopflerfish;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.libra.framework.core.FrameworkInstanceConfiguration;
+import org.eclipse.libra.framework.knopflerfish.internal.KnopflerfishConfigurationPublishHelper;
+import org.eclipse.wst.server.core.IModule;
+
+
+public interface IKnopflerfishVersionHandler {
+
+ public abstract boolean supportsServeModulesWithoutPublish();
+
+ public abstract IStatus prepareDeployDirectory(IPath deployPath);
+
+ public abstract IStatus prepareFrameworkInstanceDirectory(IPath baseDir);
+
+ public abstract IStatus canAddModule(IModule module);
+
+ public abstract String[] getFrameworkVMArguments(IPath installPath, IPath configPath,
+ IPath deployPath, boolean isTestEnv);
+
+ public abstract String[] getExcludedFrameworkProgramArguments(boolean debug,
+ boolean starting);
+
+ public abstract String[] getFrameworkProgramArguments(IPath configPath,
+ boolean debug, boolean starting);
+
+ @SuppressWarnings("rawtypes")
+ public abstract List getFrameworkClasspath(IPath installPath, IPath configPath);
+
+ public abstract String getFrameworkClass();
+
+ public abstract IStatus verifyInstallPath(IPath location);
+
+ public abstract void prepareFrameworkConfigurationFile(IPath installPath, IPath confDir, KnopflerfishConfigurationPublishHelper publishHelper, FrameworkInstanceConfiguration configuration);
+
+
+}
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/Knopflerfish31Handler.java b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/Knopflerfish31Handler.java
new file mode 100644
index 0000000..3be7c7f
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/Knopflerfish31Handler.java
@@ -0,0 +1,268 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.knopflerfish;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.libra.framework.core.FrameworkInstanceConfiguration;
+import org.eclipse.libra.framework.core.Trace;
+import org.eclipse.libra.framework.knopflerfish.internal.KnopflerfishConfigurationPublishHelper;
+import org.eclipse.wst.server.core.IModule;
+
+
+public class Knopflerfish31Handler implements IKnopflerfishVersionHandler {
+
+ public IStatus verifyInstallPath(IPath location) {
+
+ File f = location.append("osgi").toFile();
+ if (f == null || !f.exists())
+ return new Status(IStatus.ERROR, KnopflerfishPlugin.PLUGIN_ID, 0,
+ Messages.warningCantReadConfig, null);
+ File[] conf = f.listFiles();
+ if (conf != null) {
+ int size = conf.length;
+ for (int i = 0; i < size; i++) {
+ if (!f.canRead())
+ return new Status(IStatus.WARNING,
+ KnopflerfishPlugin.PLUGIN_ID, 0,
+ Messages.warningCantReadConfig, null);
+ }
+ }
+
+ File f2 = location.append("osgi").append("framework.jar").toFile();
+ if (f2 == null || !f2.exists())
+ return new Status(
+ IStatus.ERROR,
+ KnopflerfishPlugin.PLUGIN_ID,
+ 0,
+ "Cannot locate framework.jar. Invalid installation folder",
+ null);
+
+ return Status.OK_STATUS;
+ }
+
+ public String getFrameworkClass() {
+ return "org.knopflerfish.framework.Main";
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public List getFrameworkClasspath(IPath installPath, IPath configPath) {
+
+ List cp = new ArrayList();
+
+ IPath binPath = installPath.append("osgi");
+ if (binPath.toFile().exists()) {
+ IPath path = binPath.append("framework.jar");
+ cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(path));
+ }
+
+ return cp;
+ }
+
+ public String[] getFrameworkProgramArguments(IPath configPath, boolean debug,
+ boolean starting) {
+ return new String[] {
+ "-init",
+ "-xargs",
+ "file:"
+ + configPath.append("osami.xargs").makeAbsolute()
+ .toOSString() };
+ }
+
+ public String[] getExcludedFrameworkProgramArguments(boolean debug,
+ boolean starting) {
+ return null;
+ }
+
+ public String[] getFrameworkVMArguments(IPath installPath, IPath configPath,
+ IPath deployPath, boolean isTestEnv) {
+
+ return new String[] {};
+ }
+
+ public IStatus canAddModule(IModule module) {
+ String id = module.getModuleType().getId();
+ // String version = module.getModuleType().getVersion();
+ if ("osami.bundle".equals(id))
+ return Status.OK_STATUS;
+
+ return new Status(IStatus.ERROR, KnopflerfishPlugin.PLUGIN_ID, 0,
+ Messages.errorNotBundle, null);
+ }
+
+ public IStatus prepareFrameworkInstanceDirectory(IPath baseDir) {
+ return Status.OK_STATUS;// TomcatVersionHelper.createCatalinaInstanceDirectory(baseDir);
+ }
+
+ public IStatus prepareDeployDirectory(IPath deployPath) {
+
+ if (Trace.isTraceEnabled())
+ Trace.trace(Trace.FINER, "Creating runtime directory at "
+ + deployPath.toOSString());
+
+ // Prepare a felix directory structure
+ File temp = deployPath.append("plugins").toFile();
+ if (!temp.exists())
+ temp.mkdirs();
+
+ return Status.OK_STATUS;
+ }
+
+ public boolean supportsServeModulesWithoutPublish() {
+ return true;
+ }
+
+ private void writeXargs(IPath installPath, IPath confPath, PrintWriter out,
+ KnopflerfishConfigurationPublishHelper publishHelper,
+ FrameworkInstanceConfiguration configuration) {
+
+ out.println("#");
+ out.println("# Generated by OSAMI Tools");
+ out.println("# for Knopflerfish release 3.1.0");
+ out.println("# Copyright 2010 eteration a.s.");
+
+ out.println("# load common properties");
+ out.println("-xargs file:"
+ + confPath.append("props.xargs").toOSString());
+
+ out.println("# Semicolon seprated list of base URLs for searching (completing)");
+ out.println("# bundle URLs in '-install URL' command line options and in the console.");
+ out.println("-Dorg.knopflerfish.gosg.jars=file:"
+ + installPath.append("osgi").append("jars").toOSString());
+
+ out.println("-init");
+
+
+// out.println("-istart file:"+ installPath.append("osgi").append("jars").append("cm/cm_all-3.0.1.jar"));
+// out.println("-istart file:"+ installPath.append("osgi").append("jars").append("console/console_all-3.0.1.jar"));
+// out.println("-istart file:"+ installPath.append("osgi").append("jars").append("log/log_all-3.0.5.jar"));
+// out.println("-istart file:"+ installPath.append("osgi").append("jars").append("event/event_all-3.0.4.jar"));
+// out.println("-istart file:"+ installPath.append("osgi").append("jars").append("consoletty/consoletty-3.0.1.jar"));
+// out.println("-istart file:"+ installPath.append("osgi").append("jars").append("frameworkcommands/frameworkcommands-3.0.3.jar"));
+// out.println("-istart file:"+ installPath.append("osgi").append("jars").append("logcommands/logcommands-3.0.1.jar"));
+// out.println("-istart file:"+ installPath.append("osgi").append("jars").append("useradmin/useradmin_api-3.0.1.jar"));
+
+
+ out.println("## Basic KF bundles");
+ out.println("-initlevel 3");
+ String kb[] = publishHelper.getTargetBundlePaths(configuration);
+ for (String kernelBundle : kb) {
+ out.println("-install file:" + kernelBundle);
+ }
+ for (String kernelBundle : kb) {
+ out.println("-start file:" + kernelBundle);
+ }
+ out.println("-startlevel 3");
+
+// out.println("## Workspace bundles");
+// String wb[] = publishHelper.getWorkspaceBundlePaths(configuration);
+// out.println("-initlevel 4");
+// for (String workspaceBundle : wb) {
+// out.println("-install file:" + workspaceBundle);
+// }
+// for (String workspaceBundle : wb) {
+// out.println("-start file:" + workspaceBundle);
+// }
+//
+// out.println("-startlevel 4");
+
+// wb = publishHelper.getWorkspaceBundlePaths(configuration);
+// for (String workspaceBundle : wb) {
+// out.println("-start "+ workspaceBundle);
+// }
+
+
+ out.println("-launch");
+ out.println("");
+ out.flush();
+ }
+
+ private void writePropsXargs(PrintWriter out,
+ KnopflerfishConfigurationPublishHelper publishHelper,
+ FrameworkInstanceConfiguration configuration) {
+
+ out.println("#");
+ out.println("# Generated by OSAMI Tools");
+ out.println("# for Knopflerfish release 3.1.0");
+ out.println("# Copyright 2010 eteration a.s.");
+
+ out.println("# Common properties used by different init.xargs files");
+ out.println("-Forg.osgi.provisioning.spid=knopflerfish");
+ out.println("-Forg.knopflerfish.framework.debug.errors=true");
+ out.println("-Forg.knopflerfish.framework.bundlestorage.file.reference=true");
+ out.println("-Forg.knopflerfish.startlevel.use=true");
+
+ out.println("# Web server properties");
+ out.println("-Forg.knopflerfish.http.dnslookup=false");
+ out.println("-Forg.osgi.service.http.port=8080");
+
+ out.println("# Web server properties");
+ out.println("-Forg.knopflerfish.http.dnslookup=false");
+ out.println("-Forg.osgi.service.http.port=8080");
+
+ out.println("# Log service properties");
+ out.println("-Forg.knopflerfish.log.out=false");
+ out.println("-Forg.knopflerfish.log.level=info");
+ out.println("-Forg.knopflerfish.log.grabio=true");
+ out.println("-Forg.knopflerfish.log.file=true");
+ out.println("-Forg.knopflerfish.log.memory.size=250");
+
+ out.println("#consoletelnet properties");
+ out.println("-Forg.knopflerfish.consoletelnet.user=admin");
+ out.println("-Forg.knopflerfish.consoletelnet.pwd=admin");
+ out.println("-Forg.knopflerfish.consoletelnet.port=2323");
+ out.flush();
+
+ }
+
+ public void prepareFrameworkConfigurationFile(IPath installPath,
+ IPath confDir,
+ KnopflerfishConfigurationPublishHelper publishHelper,
+ FrameworkInstanceConfiguration configuration) {
+
+ OutputStream out = null;
+ try {
+ out = new FileOutputStream(confDir.append("osami.xargs")
+ .makeAbsolute().toFile());
+
+ PrintWriter pw = new PrintWriter(out);
+ writeXargs(installPath, confDir, pw, publishHelper, configuration);
+ out.flush();
+ out.close();
+
+ out = new FileOutputStream(confDir.append("props.xargs")
+ .makeAbsolute().toFile());
+ pw = new PrintWriter(out);
+ writePropsXargs(pw, publishHelper, configuration);
+ out.close();
+ out = null;
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ if (out != null)
+ try {
+ out.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/KnopflerfishFramework.java b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/KnopflerfishFramework.java
new file mode 100644
index 0000000..99ad5e0
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/KnopflerfishFramework.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.knopflerfish;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.libra.framework.core.FrameworkDelegate;
+import org.eclipse.libra.framework.core.IOSGIFrameworkWorkingCopy;
+import org.eclipse.wst.server.core.IRuntimeType;
+
+
+public class KnopflerfishFramework extends FrameworkDelegate implements
+ IOSGIFrameworkWorkingCopy, IKnopflerfishFramework {
+ public KnopflerfishFramework() {
+ }
+
+
+ public IKnopflerfishVersionHandler getVersionHandler() {
+ IRuntimeType type = getRuntime().getRuntimeType();
+ return KnopflerfishPlugin.getFelixVersionHandler(type.getId());
+ }
+
+ @SuppressWarnings("rawtypes")
+ public List getFrameworkClasspath(IPath configPath) {
+ IPath installPath = getRuntime().getLocation();
+ // If installPath is relative, convert to canonical path and hope for
+ // the best
+ if (!installPath.isAbsolute()) {
+ try {
+ String installLoc = (new File(installPath.toOSString()))
+ .getCanonicalPath();
+ installPath = new Path(installLoc);
+ } catch (IOException e) {
+ // Ignore if there is a problem
+ }
+ }
+ return getVersionHandler().getFrameworkClasspath(installPath, configPath);
+ }
+
+ /**
+ * Verifies the Felix installation directory. If it is correct, true is
+ * returned. Otherwise, the user is notified and false is returned.
+ *
+ * @return boolean
+ */
+ public IStatus verifyLocation() {
+ return getVersionHandler()
+ .verifyInstallPath(getRuntime().getLocation());
+ }
+
+
+ public IStatus validate() {
+ IStatus status = super.validate();
+ if (!status.isOK())
+ return status;
+
+ status = verifyLocation();
+ if (!status.isOK())
+ return status;
+ // return new Status(IStatus.ERROR, FelixPlugin.PLUGIN_ID, 0,
+ // Messages.errorInstallDir, null);
+ // don't accept trailing space since that can cause startup problems
+ if (getRuntime().getLocation().hasTrailingSeparator())
+ return new Status(IStatus.ERROR, KnopflerfishPlugin.PLUGIN_ID, 0,
+ Messages.errorInstallDirTrailingSlash, null);
+ if (getVMInstall() == null)
+ return new Status(IStatus.ERROR, KnopflerfishPlugin.PLUGIN_ID, 0,
+ Messages.errorJRE, null);
+
+
+
+ File f = getRuntime().getLocation().append("conf").toFile();
+ File[] conf = f.listFiles();
+ if (conf != null) {
+ int size = conf.length;
+ for (int i = 0; i < size; i++) {
+ if (!f.canRead())
+ return new Status(IStatus.WARNING, KnopflerfishPlugin.PLUGIN_ID,
+ 0, Messages.warningCantReadConfig, null);
+ }
+ }
+
+
+ f = getRuntime().getLocation().append("bundle").toFile();
+ File[] bundle = f.listFiles();
+ if (bundle != null) {
+ int size = bundle.length;
+ for (int i = 0; i < size; i++) {
+ if (!f.canRead())
+ return new Status(IStatus.WARNING, KnopflerfishPlugin.PLUGIN_ID,
+ 0, Messages.warningCantReadBundle, null);
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/KnopflerfishFrameworkInstance.java b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/KnopflerfishFrameworkInstance.java
new file mode 100644
index 0000000..dbd67d8
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/KnopflerfishFrameworkInstance.java
@@ -0,0 +1,224 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.knopflerfish;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+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.Status;
+import org.eclipse.equinox.frameworkadmin.BundleInfo;
+import org.eclipse.libra.framework.core.FrameworkInstanceConfiguration;
+import org.eclipse.libra.framework.core.FrameworkInstanceDelegate;
+import org.eclipse.libra.framework.core.OSGIFrameworkInstanceBehaviorDelegate;
+import org.eclipse.libra.framework.core.TargetDefinitionUtil;
+import org.eclipse.libra.framework.core.Trace;
+import org.eclipse.libra.framework.knopflerfish.internal.KnopflerfishFrameworkInstanceBehavior;
+import org.eclipse.pde.internal.core.target.provisional.IBundleContainer;
+import org.eclipse.pde.internal.core.target.provisional.IResolvedBundle;
+import org.eclipse.pde.internal.core.target.provisional.ITargetDefinition;
+import org.eclipse.pde.internal.core.target.provisional.ITargetPlatformService;
+import org.eclipse.pde.internal.core.target.provisional.NameVersionDescriptor;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IRuntime;
+
+
+@SuppressWarnings("restriction")
+public class KnopflerfishFrameworkInstance extends FrameworkInstanceDelegate
+ implements IKnopflerfishFrameworkInstance {
+
+ protected transient IKnopflerfishVersionHandler versionHandler;
+
+ @Override
+ public IStatus canModifyModules(IModule[] add, IModule[] remove) {
+ IStatus status = super.canModifyModules(add, remove);
+ if (!status.isOK())
+ return status;
+
+ if (getKnopflerfishVersionHandler() == null)
+ return new Status(IStatus.ERROR, KnopflerfishPlugin.PLUGIN_ID, 0,
+ Messages.errorNoRuntime, null);
+
+ if (add != null) {
+ int size = add.length;
+ for (int i = 0; i < size; i++) {
+ IModule module = add[i];
+ IStatus status2 = getKnopflerfishVersionHandler().canAddModule(
+ module);
+ if (status2 != null && !status2.isOK())
+ return status2;
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public void setDefaults(IProgressMonitor monitor) {
+ super.setDefaults(monitor);
+ try {
+ getKnopflerfishConfiguration();
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "Can't setup for Felix configuration.", e);
+ }
+ }
+
+ @Override
+ public void importRuntimeConfiguration(IRuntime runtime,
+ IProgressMonitor monitor) throws CoreException {
+
+ super.importRuntimeConfiguration(runtime, monitor);
+ OSGIFrameworkInstanceBehaviorDelegate fsb = (OSGIFrameworkInstanceBehaviorDelegate) getServer()
+ .loadAdapter(KnopflerfishFrameworkInstanceBehavior.class, null);
+ if (fsb != null) {
+ IPath tempDir = fsb.getTempDirectory();
+ if (!tempDir.isAbsolute()) {
+ IPath rootPath = ResourcesPlugin.getWorkspace().getRoot()
+ .getLocation();
+ tempDir = rootPath.append(tempDir);
+ }
+ setInstanceDirectory(tempDir.toPortableString());
+ }
+
+ try {
+ getKnopflerfishConfiguration();
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "Can't setup for Felix configuration.", e);
+ }
+ }
+
+ public KnopflerfishFramework getKnopflerfishRuntime() {
+ if (getServer().getRuntime() == null)
+ return null;
+ return (KnopflerfishFramework) getServer().getRuntime().loadAdapter(
+ KnopflerfishFramework.class, null);
+ }
+
+ public IKnopflerfishVersionHandler getKnopflerfishVersionHandler() {
+ if (versionHandler == null) {
+ if (getServer().getRuntime() == null
+ || getKnopflerfishRuntime() == null)
+ return null;
+
+ versionHandler = getKnopflerfishRuntime().getVersionHandler();
+ }
+ return versionHandler;
+ }
+
+ public FrameworkInstanceConfiguration getKnopflerfishConfiguration()
+ throws CoreException {
+
+ return getFrameworkInstanceConfiguration();
+
+ }
+
+
+ @Override
+ public ITargetDefinition createDefaultTarget() throws CoreException {
+
+
+ IPath installPath = getServer().getRuntime().getLocation();
+ ITargetPlatformService service = TargetDefinitionUtil.getTargetPlatformService();
+
+ ITargetDefinition targetDefinition = service.newTarget();
+ targetDefinition.setName(getServer().getName());
+ IBundleContainer[] containers = getDefaultBundleContainers(installPath);
+
+ targetDefinition.setBundleContainers(containers);
+ targetDefinition.resolve(new NullProgressMonitor());
+
+ IResolvedBundle[] targetBundles = targetDefinition.getAllBundles();
+ List<NameVersionDescriptor> includedB = new ArrayList<NameVersionDescriptor>();
+ for (IResolvedBundle b : targetBundles) {
+ if (b.getStatus().getSeverity() == IStatus.OK) {
+
+ if (shouldInclude(b.getBundleInfo())) {
+ if (b.getStatus().getCode() == IResolvedBundle.STATUS_PLUGIN_DOES_NOT_EXIST) {
+ includedB.add(new NameVersionDescriptor(b
+ .getBundleInfo().getSymbolicName(), null,
+ NameVersionDescriptor.TYPE_PLUGIN));
+ } else {
+ includedB.add(new NameVersionDescriptor(b
+ .getBundleInfo().getSymbolicName(), null));
+ }
+ }
+
+ }
+
+ }
+ targetDefinition.setIncluded(includedB
+ .toArray(new NameVersionDescriptor[includedB.size()]));
+
+ service.saveTargetDefinition(targetDefinition);
+ return targetDefinition;
+ }
+
+ private boolean shouldInclude(BundleInfo bundleInfo) {
+ String bundles[] = {"log_api-3.0.5.jar",
+ "console_api-3.0.1.jar",
+ "cm_api-3.0.1.jar",
+ "log-3.0.5.jar",
+ "console-3.0.1.jar",
+ "consoletty-3.0.1.jar",
+ "frameworkcommands-3.0.3.jar",
+ "logcommands-3.0.1.jar",
+ "useradmin_api-3.0.1.jar"};
+
+ for (String bundleName : bundles) {
+ if(bundleInfo.getLocation().toString().indexOf(bundleName)>0)
+ return true;
+ }
+ return false;
+ }
+
+ private IBundleContainer[] getDefaultBundleContainers(IPath installPath) {
+ IBundleContainer[] containers = new IBundleContainer[8];
+ ITargetPlatformService service = TargetDefinitionUtil.getTargetPlatformService();
+ containers[0] = service.newDirectoryContainer(
+ installPath.append("osgi").makeAbsolute()
+ .toPortableString());
+ containers[1] = service.newDirectoryContainer(
+ installPath.append("osgi").append("jars").append("log")
+ .makeAbsolute().toPortableString());
+
+ containers[2] = service.newDirectoryContainer(
+ installPath.append("osgi").append("jars").append("console").makeAbsolute()
+ .toPortableString());
+
+ containers[3] = service.newDirectoryContainer(
+ installPath.append("osgi").append("jars").append("cm")
+ .makeAbsolute().toPortableString());
+ containers[4] = service.newDirectoryContainer(
+ installPath.append("osgi").append("jars")
+ .append("consoletty").makeAbsolute()
+ .toPortableString());
+ containers[5] = service.newDirectoryContainer(
+ installPath.append("osgi").append("jars")
+ .append("frameworkcommands").makeAbsolute()
+ .toPortableString());
+ containers[6] = service.newDirectoryContainer(
+ installPath.append("osgi").append("jars")
+ .append("logcommands").makeAbsolute()
+ .toPortableString());
+ containers[7] = service.newDirectoryContainer(
+ installPath.append("osgi").append("jars")
+ .append("useradmin").makeAbsolute()
+ .toPortableString());
+
+ return containers;
+
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/KnopflerfishPlugin.java b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/KnopflerfishPlugin.java
new file mode 100644
index 0000000..cc3644e
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/KnopflerfishPlugin.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.knopflerfish;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+public class KnopflerfishPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.libra.framework.knopflerfish"; //$NON-NLS-1$
+
+ // The shared instance
+ private static KnopflerfishPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public KnopflerfishPlugin() {
+ super();
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#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 KnopflerfishPlugin getDefault() {
+ return plugin;
+ }
+
+
+
+ public static String getPreference(String id) {
+ return Platform.getPreferencesService().getString(PLUGIN_ID, id, "", null);
+ }
+
+ public static void setPreference(String id, String value) {
+ (new DefaultScope()).getNode(PLUGIN_ID).put(id, value);
+ }
+
+ public static IKnopflerfishVersionHandler getFelixVersionHandler(String id) {
+// if (id.indexOf("runtime") > 0)
+// id = id.substring(0, 30) + id.substring(38);
+// if (true)//"abc".equals(id))
+ return new Knopflerfish31Handler();
+ }
+
+
+}
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/Messages.java b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/Messages.java
new file mode 100644
index 0000000..eaedc01
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/Messages.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.knopflerfish;
+
+import org.eclipse.osgi.util.NLS;
+/**
+ * Translated messages.
+ */
+public class Messages extends NLS {
+
+ public static String errorInstallDirTrailingSlash = null;
+ public static String errorJRE;
+ public static String warningCantReadConfig;
+ public static String warningCantReadBundle;
+ public static String errorNotBundle;
+ public static String errorOSGiBundlesOnly;
+ public static String errorNoRuntime;
+
+ public static String publishServerTask;
+ public static String errorConfigurationProjectClosed;
+ public static String errorNoConfiguration;
+ public static String loadingTask;
+ public static String errorCouldNotLoadConfiguration;
+ public static String configurationEditorActionAddOsgiModule;
+
+ static {
+ NLS.initializeMessages(KnopflerfishPlugin.PLUGIN_ID + ".Messages", Messages.class);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/Messages.properties b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/Messages.properties
new file mode 100644
index 0000000..7896a43
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/Messages.properties
@@ -0,0 +1,20 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+
+# --------------- General UI ---------------
+
+errorInstallDirTrailingSlash = Installation folder must not end with a slash
+errorJRE= Selected JRE is not valid;
+warningCantReadConfig=Cannot locate the correct osgi folder. Invalid Installation folder
+warningCantReadBundle=Cannot locate the correct bundle folder. Invalid Installation folder
+errorNotBundle=Must be an osgi bundle
+errorOSGiBundlesOnly=Must be an osgi bundle
+errorNoRuntime=There is no runtime
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/internal/KnopflerfishConfigurationPublishHelper.java b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/internal/KnopflerfishConfigurationPublishHelper.java
new file mode 100644
index 0000000..3f59b99
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/internal/KnopflerfishConfigurationPublishHelper.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.knopflerfish.internal;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.libra.framework.core.OSGIFrameworkInstanceBehaviorDelegate;
+import org.eclipse.libra.framework.core.publish.PublishHelper;
+
+
+
+public class KnopflerfishConfigurationPublishHelper extends PublishHelper{
+ public OSGIFrameworkInstanceBehaviorDelegate behavior;
+
+ public KnopflerfishConfigurationPublishHelper(OSGIFrameworkInstanceBehaviorDelegate behavior) {
+ this.behavior = behavior;
+ }
+
+ protected IPath getPublishFolder() {
+ IPath configPath = behavior.getBaseDirectory();
+ configPath = configPath.append("plugins").makeAbsolute();
+ return configPath;
+ }
+
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/internal/KnopflerfishFrameworkClasspathProvider.java b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/internal/KnopflerfishFrameworkClasspathProvider.java
new file mode 100644
index 0000000..341a6e9
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/internal/KnopflerfishFrameworkClasspathProvider.java
@@ -0,0 +1,44 @@
+package org.eclipse.libra.framework.knopflerfish.internal;
+
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jst.server.core.RuntimeClasspathProviderDelegate;
+import org.eclipse.wst.server.core.IRuntime;
+
+public class KnopflerfishFrameworkClasspathProvider extends
+ RuntimeClasspathProviderDelegate {
+ /**
+ * @see RuntimeClasspathProviderDelegate#resolveClasspathContainer(IProject,
+ * IRuntime)
+ */
+ public IClasspathEntry[] resolveClasspathContainer(IProject project,
+ IRuntime runtime) {
+ IPath installPath = runtime.getLocation();
+
+ if (installPath == null)
+ return new IClasspathEntry[0];
+
+ List<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
+ // String runtimeId = runtime.getRuntimeType().getId();
+ IPath path = installPath.append("bundle");
+ addLibraryEntries(list, path.toFile(), true);
+
+ return (IClasspathEntry[]) list
+ .toArray(new IClasspathEntry[list.size()]);
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/internal/KnopflerfishFrameworkInstanceBehavior.java b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/internal/KnopflerfishFrameworkInstanceBehavior.java
new file mode 100644
index 0000000..2596d2f
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/internal/KnopflerfishFrameworkInstanceBehavior.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.knopflerfish.internal;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.libra.framework.core.FrameworkInstanceConfiguration;
+import org.eclipse.libra.framework.core.OSGIFrameworkInstanceBehaviorDelegate;
+import org.eclipse.libra.framework.core.ProgressUtil;
+import org.eclipse.libra.framework.core.Trace;
+import org.eclipse.libra.framework.knopflerfish.IKnopflerfishVersionHandler;
+import org.eclipse.libra.framework.knopflerfish.Knopflerfish31Handler;
+import org.eclipse.libra.framework.knopflerfish.KnopflerfishFrameworkInstance;
+import org.eclipse.libra.framework.knopflerfish.Messages;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
+
+
+public class KnopflerfishFrameworkInstanceBehavior extends
+ OSGIFrameworkInstanceBehaviorDelegate {
+
+ protected transient KnopflerfishConfigurationPublishHelper publishHelper = new KnopflerfishConfigurationPublishHelper(
+ this);
+
+ /**
+ * FelixRuntimeInstanceBehavior.
+ */
+ public KnopflerfishFrameworkInstanceBehavior() {
+ super();
+ }
+
+ public IKnopflerfishVersionHandler getKnopflerfishVersionHandler() {
+ return getKnopflerfishRuntimeInstance().getKnopflerfishVersionHandler();
+ }
+
+ public KnopflerfishFrameworkInstance getKnopflerfishRuntimeInstance() {
+ return (KnopflerfishFrameworkInstance) getServer().loadAdapter(KnopflerfishFrameworkInstance.class, null);
+ }
+
+ public String getFrameworkClass() {
+ return getKnopflerfishVersionHandler().getFrameworkClass();
+ }
+
+ public String[] getFrameworkProgramArguments(boolean starting) {
+ return getKnopflerfishVersionHandler().getFrameworkProgramArguments(
+ getBaseDirectory(), getFrameworkInstance().isDebug(), starting);
+ }
+
+ public String[] getExcludedFrameworkProgramArguments(boolean starting) {
+ return getKnopflerfishVersionHandler().getExcludedFrameworkProgramArguments(
+ getFrameworkInstance().isDebug(), starting);
+ }
+
+ public String[] getFrameworkVMArguments() {
+ IPath installPath = getServer().getRuntime().getLocation();
+ // If installPath is relative, convert to canonical path and hope for
+ // the best
+ if (!installPath.isAbsolute()) {
+ try {
+ String installLoc = (new File(installPath.toOSString()))
+ .getCanonicalPath();
+ installPath = new Path(installLoc);
+ } catch (IOException e) {
+ // Ignore if there is a problem
+ }
+ }
+
+ IPath deployPath = getBaseDirectory();
+ // If deployPath is relative, convert to canonical path and hope for the
+ // best
+ if (!deployPath.isAbsolute()) {
+ try {
+ String deployLoc = (new File(deployPath.toOSString()))
+ .getCanonicalPath();
+ deployPath = new Path(deployLoc);
+ } catch (IOException e) {
+ // Ignore if there is a problem
+ }
+ }
+
+ return getKnopflerfishVersionHandler().getFrameworkVMArguments(installPath, null, deployPath, false);
+ }
+
+ protected void publishServer(int kind, IProgressMonitor monitor)
+ throws CoreException {
+ if (getServer().getRuntime() == null)
+ return;
+
+ IPath confDir = getBaseDirectory();
+ IStatus status = getKnopflerfishVersionHandler().prepareDeployDirectory(
+ confDir);
+
+ if (status != null && !status.isOK())
+ throw new CoreException(status);
+
+ monitor = ProgressUtil.getMonitorFor(monitor);
+ monitor.beginTask(Messages.publishServerTask, 600);
+
+ // TODO OSAMI 1) Cleanup 2) Backup and Publish,
+
+ // if (status != null && !status.isOK())
+ // throw new CoreException(status);
+
+ monitor.done();
+
+ setServerPublishState(IServer.PUBLISH_STATE_NONE);
+ }
+
+ @SuppressWarnings("rawtypes")
+ protected void publishModules(int kind, List modules, List deltaKind2,
+ MultiStatus multi, IProgressMonitor monitor) {
+
+
+ IPath confDir = getBaseDirectory();
+ IPath installPath = getServer().getRuntime().getLocation();
+ // If installPath is relative, convert to canonical path and hope for
+ // the best
+ if (!installPath.isAbsolute()) {
+ try {
+ String installLoc = (new File(installPath.toOSString()))
+ .getCanonicalPath();
+ installPath = new Path(installLoc);
+ } catch (IOException e) {
+ // Ignore if there is a problem
+ }
+ }
+
+ FrameworkInstanceConfiguration felixConfiguration;
+ try {
+ felixConfiguration = getKnopflerfishRuntimeInstance().getKnopflerfishConfiguration();
+ publishHelper.exportBundles(modules, felixConfiguration, confDir);
+ ((Knopflerfish31Handler)getKnopflerfishVersionHandler()).prepareFrameworkConfigurationFile(installPath,confDir,publishHelper,felixConfiguration);
+
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "Publishing failed", e);
+ }
+ }
+
+ protected void publishModule(int kind, int deltaKind, IModule[] moduleTree,
+ IProgressMonitor monitor) throws CoreException {
+ if (getServer().getServerState() != IServer.STATE_STOPPED) {
+ if (deltaKind == ServerBehaviourDelegate.ADDED
+ || deltaKind == ServerBehaviourDelegate.REMOVED)
+ setServerRestartState(true);
+ }
+
+ Properties p = loadModulePublishLocations();
+
+ // TODO OSAMI PUBLISH
+
+ setModulePublishState(moduleTree, IServer.PUBLISH_STATE_NONE);
+
+ saveModulePublishLocations(p);
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/internal/KnopflerfishFrameworkInstanceLocator.java b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/internal/KnopflerfishFrameworkInstanceLocator.java
new file mode 100644
index 0000000..8a76a8c
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.knopflerfish/src/org/eclipse/libra/framework/knopflerfish/internal/KnopflerfishFrameworkInstanceLocator.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.libra.framework.knopflerfish.internal;
+
+import org.eclipse.libra.framework.core.OSGIFrameworkLocatorDelegate;
+
+public class KnopflerfishFrameworkInstanceLocator extends OSGIFrameworkLocatorDelegate {
+
+ protected static final String[] runtimeTypes = new String[] {
+ "org.eclipse.libra.framework.knopflerfish"};
+
+
+ public static String[] getRuntimeTypes() {
+ return runtimeTypes;
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.ui/.classpath b/plugins/org.eclipse.libra.framework.ui/.classpath
new file mode 100644
index 0000000..64c5e31
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.libra.framework.ui/.project b/plugins/org.eclipse.libra.framework.ui/.project
new file mode 100644
index 0000000..4026934
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.libra.framework.ui</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.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.libra.framework.ui/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.libra.framework.ui/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..c8be432
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Fri Nov 10 17:11:35 HST 2006
+eclipse.preferences.version=1
+encoding/<project>=ISO-8859-1
diff --git a/plugins/org.eclipse.libra.framework.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.libra.framework.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..87e641f
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,74 @@
+#Sat Oct 16 21:03:45 EEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=error
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,*.testsuite,*.deploy,*.location,*.execution,*.datapool,*.artifact,*.html,*.svg
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=disabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=error
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.incompatibleJDKLevel=warning
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/plugins/org.eclipse.libra.framework.ui/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.libra.framework.ui/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..584bdff
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,4 @@
+#Fri Nov 10 18:06:11 HST 2006
+eclipse.preferences.version=1
+internal.default.compliance=user
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?>\n<templates/>
diff --git a/plugins/org.eclipse.libra.framework.ui/.settings/org.eclipse.pde.prefs b/plugins/org.eclipse.libra.framework.ui/.settings/org.eclipse.pde.prefs
new file mode 100644
index 0000000..0e06e96
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/.settings/org.eclipse.pde.prefs
@@ -0,0 +1,15 @@
+#Mon Jan 15 21:56:48 EST 2007
+compilers.incompatible-environment=0
+compilers.p.build=0
+compilers.p.deprecated=1
+compilers.p.missing-packages=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=0
+compilers.p.unknown-element=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/plugins/org.eclipse.libra.framework.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.libra.framework.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..db100dd
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,35 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.libra.framework.ui;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Bundle-Activator: org.eclipse.libra.framework.ui.FrameworkUIPlugin
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Export-Package: org.eclipse.libra.framework.ui,
+ org.eclipse.libra.framework.ui.internal,
+ org.eclipse.libra.framework.ui.internal.actions,
+ org.eclipse.libra.framework.ui.internal.editor
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.expressions;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jdt.debug.ui;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jdt.launching;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.wst.server.core;bundle-version="[1.0.204,2.0.0)",
+ org.eclipse.jst.server.core;bundle-version="[1.0.103,2.0.0)",
+ org.eclipse.jst.server.ui;bundle-version="[1.0.103,2.0.0)",
+ org.eclipse.wst.common.project.facet.ui;bundle-version="[1.1.0,2.0.0)",
+ org.eclipse.wst.server.ui,
+ org.eclipse.pde.core,
+ org.eclipse.pde.ui,
+ org.eclipse.libra.framework.core,
+ org.eclipse.gef
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: org.eclipse.libra.framework.editor.ui.console;version="[0.1.0,2.0.0)",
+ org.eclipse.libra.framework.editor.ui.dependencies;version="[0.1.0,2.0.0)",
+ org.eclipse.libra.framework.editor.ui.overview;version="[0.1.0,2.0.0)"
diff --git a/plugins/org.eclipse.libra.framework.ui/about.html b/plugins/org.eclipse.libra.framework.ui/about.html
new file mode 100644
index 0000000..8f31159
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>March 25, 2011</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.ui/build.properties b/plugins/org.eclipse.libra.framework.ui/build.properties
new file mode 100644
index 0000000..5016daa
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/build.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+bin.includes = plugin.xml,\
+ plugin.properties,\
+ icons/,\
+ .,\
+ META-INF/,\
+ about.html
+bin.excludes = bin/**,\
+ @dot/**,\
+ temp.folder/**
+source.. = src/
+
+
diff --git a/plugins/org.eclipse.libra.framework.ui/icons/obj16/bundle_obj.png b/plugins/org.eclipse.libra.framework.ui/icons/obj16/bundle_obj.png
new file mode 100644
index 0000000..a756f97
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/icons/obj16/bundle_obj.png
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.ui/icons/obj16/mime_extension.gif b/plugins/org.eclipse.libra.framework.ui/icons/obj16/mime_extension.gif
new file mode 100644
index 0000000..c585010
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/icons/obj16/mime_extension.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.ui/icons/obj16/mime_mapping.gif b/plugins/org.eclipse.libra.framework.ui/icons/obj16/mime_mapping.gif
new file mode 100644
index 0000000..0a8e4bf
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/icons/obj16/mime_mapping.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.ui/icons/obj16/port.gif b/plugins/org.eclipse.libra.framework.ui/icons/obj16/port.gif
new file mode 100644
index 0000000..7a354b7
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/icons/obj16/port.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.ui/icons/obj16/project_missing.gif b/plugins/org.eclipse.libra.framework.ui/icons/obj16/project_missing.gif
new file mode 100644
index 0000000..0cb4c16
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/icons/obj16/project_missing.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.ui/icons/obj16/web_module.gif b/plugins/org.eclipse.libra.framework.ui/icons/obj16/web_module.gif
new file mode 100644
index 0000000..bf20f70
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/icons/obj16/web_module.gif
Binary files differ
diff --git a/plugins/org.eclipse.libra.framework.ui/plugin.properties b/plugins/org.eclipse.libra.framework.ui/plugin.properties
new file mode 100644
index 0000000..3d40b9b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/plugin.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+###############################################################################
+pluginName=OSGI Runtimes UI Support
+providerName=Eteration A.S.
diff --git a/plugins/org.eclipse.libra.framework.ui/plugin.xml b/plugins/org.eclipse.libra.framework.ui/plugin.xml
new file mode 100644
index 0000000..29fa0dc
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/plugin.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+ Copyright (c) 2010, 2011 Eteration A.S. 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:
+ Naci Dai and Murat Yener, Eteration A.S. - Initial API and implementation
+ Kaloyan Raev, SAP AG - integration with OSGi Framework Editor parts
+ -->
+
+<plugin>
+ <extension point="org.eclipse.wst.server.ui.serverImages">
+ <image
+ id="org.eclipse.wst.server.ui.web"
+ typeIds="osgi.bundle"
+ icon="icons/obj16/bundle_obj.png"/>
+ </extension>
+ <extension
+ point="org.eclipse.wst.server.ui.editorPages">
+ <page
+ class="org.eclipse.libra.framework.editor.ui.overview.BundleInformationEditorPage"
+ id="org.eclipse.libra.framework.editor.integration.bundleInformation"
+ name="Bundle Overview"
+ order="30"
+ typeIds="org.eclipse.libra.framework.*">
+ </page>
+ <page
+ class="org.eclipse.libra.framework.editor.ui.dependencies.BundleDependencyEditorPage"
+ id="org.eclipse.libra.framework.editor.integration.bundleDependency"
+ name="Bundle Dependency Graph"
+ order="40"
+ typeIds="org.eclipse.libra.framework.*">
+ </page>
+ <page
+ class="org.eclipse.libra.framework.editor.ui.console.ServerConsoleEditorPage"
+ id="org.eclipse.libra.framework.editor.integration.serverConsole"
+ name="Console"
+ order="50"
+ typeIds="org.eclipse.libra.framework.*">
+ </page>
+ </extension>
+</plugin>
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.ui/pom.xml b/plugins/org.eclipse.libra.framework.ui/pom.xml
new file mode 100644
index 0000000..e72a8ea
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/pom.xml
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.libra_parent</artifactId>
+ <groupId>org.eclipse.libra</groupId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../../development/org.eclipse.libra.releng/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.libra.framework.ui</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSGi Frameworks Server Adapters UI Plug-in</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/CleanWorkDirDialog.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/CleanWorkDirDialog.java
new file mode 100644
index 0000000..d9176d5
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/CleanWorkDirDialog.java
@@ -0,0 +1,361 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.ui;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServer.IOperationListener;
+import org.eclipse.wst.server.core.ServerUtil;
+
+
+/**
+ * Dialog to confirm deletion of the work directory for a module on a
+ * server, or the work directory for the entire server. Handling
+ * includes stopping and restarting the server if it is running at
+ * the time of the deletion.
+ *
+ */
+public class CleanWorkDirDialog extends Dialog {
+ protected IServer server;
+ protected IModule module;
+ protected int state;
+ protected String mode;
+ protected IStatus completionStatus;
+
+ /**
+ * Creates a dialog instance confirm deletion of the work directory for a
+ * module on a server, or the work directory for the entire server.
+ *
+ * @param parentShell the parent shell, or <code>null</code> to create a
+ * top-level shell
+ * @param server server on which to delete the work directory
+ * @param module module whose work directory is to be deleted, or <code>null</code> if
+ * if these server's entire work directory is to be deleted.
+ */
+ public CleanWorkDirDialog(Shell parentShell, IServer server, IModule module) {
+ super(parentShell);
+
+ if (server == null)
+ throw new IllegalArgumentException();
+
+ this.server = server;
+ this.module = module;
+
+ }
+
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(Messages.confirmCleanWorkDirTitle);
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ if (state < 0 || state == IServer.STATE_UNKNOWN)
+ captureServerState();
+
+ // create a composite with standard margins and spacing
+ Composite composite = (Composite)super.createDialogArea(parent);
+ // Since there are only label widgets on this page, set the help on the parent
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, ContextIds.FRAMEWORK_INSTANCE_CLEAN_WORK_DIR);
+
+ Label label = new Label(composite, SWT.WRAP);
+ if (state == IServer.STATE_STARTING || state == IServer.STATE_STOPPING || state == IServer.STATE_UNKNOWN) {
+ label.setText(NLS.bind(Messages.cleanServerStateChanging, server.getName()));
+ }
+ else {
+ if (module != null)
+ label.setText(NLS.bind(Messages.cleanModuleWorkDir, module.getName(), server.getName()));
+ else
+ label.setText(NLS.bind(Messages.cleanServerWorkDir, server.getName()));
+ GridData data = new GridData();
+ data.widthHint = 300;
+ label.setLayoutData(data);
+
+ if (state == IServer.STATE_STARTED) {
+ label = new Label(composite, SWT.WRAP);
+ label.setText(Messages.cleanServerRunning);
+ data = new GridData();
+ data.widthHint = 300;
+ label.setLayoutData(data);
+ }
+ }
+
+ applyDialogFont(composite);
+ return composite;
+ }
+
+ protected void createButtonsForButtonBar(Composite parent) {
+ super.createButtonsForButtonBar(parent);
+
+ if (state < 0 || state == IServer.STATE_UNKNOWN)
+ captureServerState();
+
+ // If server is transitioning, only allow Cancel
+ if (state == IServer.STATE_STARTING || state == IServer.STATE_STOPPING) {
+ Button button = getButton(IDialogConstants.OK_ID);
+ if (button != null)
+ button.setEnabled(false);
+ }
+ }
+
+ protected void okPressed() {
+ String jobName = NLS.bind(Messages.cleanServerTask,
+ module != null ? module.getName() : server.getName());
+ // Create job to perform the cleaning, including stopping and starting the server if necessary
+ CleanWorkDirJob job = new CleanWorkDirJob(jobName);
+ // Note: Since stop and start, if needed, will set scheduling rules in their jobs,
+ // don't set one here. Instead do the actual deletion in a child job too with the
+ // scheduling rule on that job, like stop and start.
+ job.schedule();
+
+ super.okPressed();
+ }
+
+ /*
+ * Job to clean the appropriate Framework Instance work directory. It includes
+ * stopping and starting the framework if the instance is currently running.
+ * The stopping, deletion, and starting are all done with child jobs,
+ * each using the server scheduling rule. Thus, this job should
+ * not use this rule or it will block these child jobs.
+ */
+ class CleanWorkDirJob extends Job {
+ /**
+ * @param name name for job
+ */
+ public CleanWorkDirJob(String jobName) {
+ super(jobName);
+ }
+
+ /**
+ * @see Job#belongsTo(Object)
+ */
+ public boolean belongsTo(Object family) {
+ return ServerUtil.SERVER_JOB_FAMILY.equals(family);
+ }
+
+ protected IStatus run(IProgressMonitor monitor) {
+ final Object mutex = new Object();
+
+ if (module != null) {
+ }
+
+ // If state has changed since dialog was open, abort
+ if (server.getServerState() != state) {
+ return newErrorStatus(
+ NLS.bind(Messages.errorCouldNotCleanStateChange, server.getName()), null);
+ }
+
+ IOperationListener listener = new IOperationListener() {
+ public void done(IStatus result) {
+ synchronized (mutex) {
+ completionStatus = result;
+ mutex.notifyAll();
+ }
+ }
+ };
+
+ boolean restart = false;
+ IStatus status = Status.OK_STATUS;
+ // If server isn't stopped, try to stop, clean, and restart
+ if (state != IServer.STATE_STOPPED) {
+ status = server.canStop();
+ if (!status.isOK()) {
+ return wrapErrorStatus(status,
+ NLS.bind(Messages.errorCouldNotCleanCantStop, server.getName()));
+ }
+
+ boolean done = false;
+ boolean force = false;
+ while (!done) {
+ // Stop the server and wait for completion
+ synchronized (mutex) {
+ server.stop(force, listener);
+
+ while (completionStatus == null) {
+ try {
+ mutex.wait();
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+ }
+ }
+ // If forced, or there was an error (doesn't include timeout), or we are stopped, time to exit
+ if (force || !completionStatus.isOK() || server.getServerState() == IServer.STATE_STOPPED) {
+ done = true;
+ }
+ else {
+ force = FrameworkUIPlugin.queryCleanTermination(server);
+ completionStatus = null;
+ }
+ }
+
+ if (!completionStatus.isOK()) {
+ // If stop job failed, assume error was displayed for that job
+ return Status.OK_STATUS;
+ }
+ if (server.getServerState() != IServer.STATE_STOPPED) {
+ return newErrorStatus(
+ NLS.bind(Messages.errorCouldNotCleanStopFailed, server.getName()), null);
+ }
+ restart = true;
+ completionStatus = null;
+ }
+
+ DeleteWorkDirJob deleteJob = new DeleteWorkDirJob(getName(), module, restart);
+ deleteJob.setRule(ServerUtil.getServerSchedulingRule(server));
+
+ deleteJob.addJobChangeListener(new JobChangeAdapter() {
+ public void done(IJobChangeEvent event) {
+ synchronized (mutex) {
+ completionStatus = event.getResult();
+ mutex.notifyAll();
+ }
+
+ }
+ });
+
+ // Perform the work directory deletion job
+ synchronized (mutex) {
+ deleteJob.schedule();
+
+ while (completionStatus == null) {
+ try {
+ mutex.wait();
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+ }
+ }
+ if (!completionStatus.isOK()) {
+ // If delete job failed, assume error was displayed for that job
+ return Status.OK_STATUS;
+ }
+ completionStatus = null;
+
+ if (restart) {
+ status = server.canStart(mode);
+ if (!status.isOK()) {
+ return wrapErrorStatus(status,
+ NLS.bind(Messages.errorCleanCantRestart, server.getName()));
+ }
+
+ // Restart the server and wait for completion
+ synchronized (mutex) {
+ server.start(mode, listener);
+
+ while (completionStatus == null) {
+ try {
+ mutex.wait();
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+ }
+ }
+
+ if (!completionStatus.isOK()) {
+ // If start job failed, assume error was displayed for that job
+ return Status.OK_STATUS;
+ }
+ }
+ return status;
+ }
+ }
+
+ /*
+ * Job to actually delete the work directory. This is done
+ * in a separate job so it can be a "sibling" of potential
+ * stop and start jobs. This allows it to have a server
+ * scheduling rule.
+ */
+ class DeleteWorkDirJob extends Job {
+ private IModule jobModule;
+ private boolean restart;
+
+ /**
+ * @param name name for job
+ */
+ public DeleteWorkDirJob(String jobName, IModule am, boolean restart) {
+ super(jobName);
+ this.jobModule = am;
+ this.restart = restart;
+ }
+
+ /**
+ * @see Job#belongsTo(Object)
+ */
+ public boolean belongsTo(Object family) {
+ return ServerUtil.SERVER_JOB_FAMILY.equals(family);
+ }
+
+ protected IStatus run(IProgressMonitor monitor) {
+
+ IStatus status = Status.OK_STATUS;
+ // If server isn't stopped, abort the attempt to delete the work directory
+ if (server.getServerState() != IServer.STATE_STOPPED) {
+ return newErrorStatus(
+ NLS.bind(Messages.errorCantDeleteServerNotStopped,
+ jobModule != null ? module.getName() : server.getName()), null);
+ }
+
+ //TODO OSAMI - Delete the work directory for runtime and clean cached items
+
+ if (!status.isOK()) {
+ String cleanName = module != null ? module.getName() : server.getName();
+ return wrapErrorStatus(status,
+ restart ?
+ NLS.bind(Messages.errorErrorDuringCleanWasRunning,
+ cleanName , server.getName()) :
+ NLS.bind(Messages.errorErrorDuringClean, cleanName));
+ }
+ return status;
+ }
+ }
+
+ private void captureServerState() {
+ state = server.getServerState();
+ if (state != IServer.STATE_STOPPED) {
+ mode = server.getMode();
+ }
+ }
+
+ protected IStatus newErrorStatus(String message, Throwable throwable) {
+ return new Status(IStatus.ERROR, FrameworkUIPlugin.PLUGIN_ID, 0,
+ message, throwable);
+ }
+
+ protected IStatus wrapErrorStatus(IStatus status, String message) {
+ MultiStatus ms = new MultiStatus(FrameworkUIPlugin.PLUGIN_ID, 0, message, null);
+ ms.add(status);
+ return ms;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/ContextIds.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/ContextIds.java
new file mode 100644
index 0000000..48dc38d
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/ContextIds.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+
+package org.eclipse.libra.framework.ui;
+
+
+/**
+ * Constant ids for context help.
+ */
+public interface ContextIds {
+ public static final String FRAMEWORK_INSTANCE_EDITOR = FrameworkUIPlugin.PLUGIN_ID + ".teig0000";
+ public static final String FRAMEWORK_INSTANCE_EDITOR_TEST_ENVIRONMENT = FrameworkUIPlugin.PLUGIN_ID + ".teig0002";
+ public static final String FRAMEWORK_INSTANCE_EDITOR_SECURE = FrameworkUIPlugin.PLUGIN_ID + ".teig0004";
+ public static final String FRAMEWORK_INSTANCE_EDITOR_DEBUG_MODE = FrameworkUIPlugin.PLUGIN_ID + ".teig0006";
+
+ public static final String CONFIGURATION_EDITOR_MODULES = FrameworkUIPlugin.PLUGIN_ID + ".tecw0000";
+ public static final String CONFIGURATION_EDITOR_MODULES_LIST = FrameworkUIPlugin.PLUGIN_ID + ".tecw0002";
+ public static final String CONFIGURATION_EDITOR_MODULES_ADD_PROJECT = FrameworkUIPlugin.PLUGIN_ID + ".tecw0004";
+ public static final String CONFIGURATION_EDITOR_MODULES_ADD_EXTERNAL = FrameworkUIPlugin.PLUGIN_ID + ".tecw0006";
+ public static final String CONFIGURATION_EDITOR_MODULES_EDIT = FrameworkUIPlugin.PLUGIN_ID + ".tecw0008";
+ public static final String CONFIGURATION_EDITOR_MODULES_REMOVE = FrameworkUIPlugin.PLUGIN_ID + ".tecw0010";
+
+ public static final String CONFIGURATION_EDITOR_MODULE_DIALOG = FrameworkUIPlugin.PLUGIN_ID + ".tdwm0000";
+ public static final String CONFIGURATION_EDITOR_MODULE_DIALOG_PROJECT = FrameworkUIPlugin.PLUGIN_ID + ".tdpr0002";
+ public static final String CONFIGURATION_EDITOR_MODULE_DIALOG_PATH = FrameworkUIPlugin.PLUGIN_ID + ".tdpr0004";
+ public static final String CONFIGURATION_EDITOR_MODULE_DIALOG_DOCBASE = FrameworkUIPlugin.PLUGIN_ID + ".tdpr0006";
+ public static final String CONFIGURATION_EDITOR_MODULE_DIALOG_RELOAD = FrameworkUIPlugin.PLUGIN_ID + ".tdpr0008";
+
+ public static final String CONFIGURATION_EDITOR_MAPPINGS = FrameworkUIPlugin.PLUGIN_ID + ".tecm0000";
+ public static final String CONFIGURATION_EDITOR_MAPPINGS_LIST = FrameworkUIPlugin.PLUGIN_ID + ".tecm0002";
+ public static final String CONFIGURATION_EDITOR_MAPPINGS_ADD = FrameworkUIPlugin.PLUGIN_ID + ".tecm0004";
+ public static final String CONFIGURATION_EDITOR_MAPPINGS_EDIT = FrameworkUIPlugin.PLUGIN_ID + ".tecm0006";
+ public static final String CONFIGURATION_EDITOR_MAPPINGS_REMOVE = FrameworkUIPlugin.PLUGIN_ID + ".tecm0008";
+
+ public static final String CONFIGURATION_EDITOR_MAPPING_DIALOG = FrameworkUIPlugin.PLUGIN_ID + ".tdmm0000";
+ public static final String CONFIGURATION_EDITOR_MAPPING_DIALOG_TYPE = FrameworkUIPlugin.PLUGIN_ID + ".tdmm0002";
+ public static final String CONFIGURATION_EDITOR_MAPPING_DIALOG_EXTENSION = FrameworkUIPlugin.PLUGIN_ID + ".tdmm0004";
+
+ public static final String CONFIGURATION_EDITOR_PORTS = FrameworkUIPlugin.PLUGIN_ID + ".tecp0000";
+ public static final String CONFIGURATION_EDITOR_PORTS_LIST = FrameworkUIPlugin.PLUGIN_ID + ".tecp0002";
+
+ public static final String FRAMEWORK_COMPOSITE = FrameworkUIPlugin.PLUGIN_ID + ".twnr0000";
+
+ public static final String FRAMEWORK_INSTANCE_CLEAN_WORK_DIR = FrameworkUIPlugin.PLUGIN_ID + ".tvcp0000";
+ public static final String FRAMEWORK_INSTANCE_CLEAN_WORK_DIR_TERMINATE = FrameworkUIPlugin.PLUGIN_ID + ".tvcp0001";
+}
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/FrameworkUIPlugin.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/FrameworkUIPlugin.java
new file mode 100644
index 0000000..27ad9a7
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/FrameworkUIPlugin.java
@@ -0,0 +1,212 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+
+package org.eclipse.libra.framework.ui;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.libra.framework.ui.internal.TerminationDialog;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.wst.server.core.IServer;
+
+
+
+public class FrameworkUIPlugin extends AbstractUIPlugin {
+ protected static FrameworkUIPlugin singleton;
+
+ protected Map imageDescriptors = new HashMap();
+
+ // base url for icons
+ private static URL ICON_BASE_URL;
+
+ private static final String URL_OBJ = "obj16/";
+ //private static final String URL_WIZBAN = "wizban/";
+
+ public static final String PLUGIN_ID = "org.eclipse.libra.framework.ui";
+
+ //public static final String IMG_WIZ_FELIX = "wizFelix";
+
+ public static final String IMG_WEB_MODULE = "webModule";
+ public static final String IMG_MIME_MAPPING = "mimeMapping";
+ public static final String IMG_MIME_EXTENSION = "mimeExtension";
+ public static final String IMG_PORT = "port";
+ public static final String IMG_PROJECT_MISSING = "projectMissing";
+
+
+ public static final String PREF_JDK_INSTALL_DIR = "jdkinstall";
+
+
+ public FrameworkUIPlugin() {
+ super();
+ singleton = this;
+ }
+
+ protected ImageRegistry createImageRegistry() {
+ ImageRegistry registry = new ImageRegistry();
+
+ //registerImage(registry, IMG_WIZ_FELIX, URL_WIZBAN + "fmwk_wiz.png");
+
+ registerImage(registry, IMG_WEB_MODULE, URL_OBJ + "web_module.gif");
+ registerImage(registry, IMG_MIME_MAPPING, URL_OBJ + "mime_mapping.gif");
+ registerImage(registry, IMG_MIME_EXTENSION, URL_OBJ + "mime_extension.gif");
+ registerImage(registry, IMG_PORT, URL_OBJ + "port.gif");
+ registerImage(registry, IMG_PROJECT_MISSING, URL_OBJ + "project_missing.gif");
+
+ return registry;
+ }
+
+ /**
+ * Return the image with the given key from the image registry.
+ * @param key java.lang.String
+ * @return org.eclipse.jface.parts.IImage
+ */
+ public static Image getImage(String key) {
+ return getInstance().getImageRegistry().get(key);
+ }
+
+ /**
+ * Return the image with the given key from the image registry.
+ * @param key java.lang.String
+ * @return org.eclipse.jface.parts.IImage
+ */
+ public static ImageDescriptor getImageDescriptor(String key) {
+ try {
+ getInstance().getImageRegistry();
+ return (ImageDescriptor) getInstance().imageDescriptors.get(key);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the singleton instance of this plugin.
+ * @return org.eclipse.libra.framework.ui.FrameworkUIPlugin
+ */
+ public static FrameworkUIPlugin getInstance() {
+ return singleton;
+ }
+
+ /**
+ * Convenience method for logging.
+ *
+ * @param status org.eclipse.core.runtime.IStatus
+ */
+ public static void log(IStatus status) {
+ getInstance().getLog().log(status);
+ }
+
+ /**
+ * Convenience method to get a Display. The method first checks, if
+ * the thread calling this method has an associated display. If so, this
+ * display is returned. Otherwise the method returns the default display.
+ *
+ * @return the display
+ */
+ public static Display getStandardDisplay() {
+ Display display = Display.getCurrent();
+ if (display == null)
+ display = Display.getDefault();
+ return display;
+ }
+
+ /**
+ * Convenience method to display an error dialog.
+ *
+ * @param title title for the dialog or null for default title
+ * @param message primary message to display
+ * @param status reason for the error
+ */
+ public static void openError(final String title, final String message, final IStatus status) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ Shell shell = getShell();
+ ErrorDialog.openError(shell,
+ title != null ? title : Messages.errorDefaultDialogTitle,
+ message, status);
+ }
+ });
+ }
+
+ public static boolean queryCleanTermination(IServer server) {
+ CleanTerminationRunnable tr = new CleanTerminationRunnable(server);
+ Display.getDefault().syncExec(tr);
+ return tr.shouldTerminate();
+ }
+
+ public static class CleanTerminationRunnable implements Runnable {
+ IServer server;
+ boolean terminate;
+
+ CleanTerminationRunnable(IServer server) {
+ this.server = server;
+ }
+
+ public void run() {
+ Shell shell = getShell();
+ TerminationDialog dialog = new TerminationDialog(shell,
+ Messages.cleanTerminateRuntimeInstanceDialogTitle,
+ NLS.bind(Messages.cleanTerminateRuntimeInstanceMessage, server.getName()));
+ dialog.open();
+ if (dialog.getReturnCode() == IDialogConstants.OK_ID) {
+ terminate = true;
+ }
+ }
+
+ boolean shouldTerminate() {
+ return terminate;
+ }
+ }
+
+ /**
+ * Convenience method to get a shell
+ *
+ * @return Shell
+ */
+ public static Shell getShell() {
+ return getStandardDisplay().getActiveShell();
+ }
+
+ /**
+ * Register an image with the registry.
+ * @param key java.lang.String
+ * @param partialURL java.lang.String
+ */
+ private void registerImage(ImageRegistry registry, String key, String partialURL) {
+ if (ICON_BASE_URL == null) {
+ String pathSuffix = "icons/";
+ ICON_BASE_URL = singleton.getBundle().getEntry(pathSuffix);
+ }
+
+ try {
+ ImageDescriptor id = ImageDescriptor.createFromURL(new URL(ICON_BASE_URL, partialURL));
+ registry.put(key, id);
+ imageDescriptors.put(key, id);
+ } catch (Exception e) {
+ Trace.trace(Trace.WARNING, "Error registering image", e);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/GenericOSGILaunchConfigurationTabGroup.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/GenericOSGILaunchConfigurationTabGroup.java
new file mode 100644
index 0000000..c8e02c4
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/GenericOSGILaunchConfigurationTabGroup.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+
+package org.eclipse.libra.framework.ui;
+
+import org.eclipse.debug.ui.*;
+import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
+import org.eclipse.wst.server.ui.ServerLaunchConfigurationTab;
+
+
+public class GenericOSGILaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
+ /*
+ * @see ILaunchConfigurationTabGroup#createTabs(ILaunchConfigurationDialog, String)
+ */
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[6];
+ tabs[0] = new ServerLaunchConfigurationTab(new String[] { "org.eclipse.libra" });
+ tabs[0].setLaunchConfigurationDialog(dialog);
+ tabs[1] = new JavaArgumentsTab();
+ tabs[1].setLaunchConfigurationDialog(dialog);
+ tabs[2] = new JavaClasspathTab();
+ tabs[2].setLaunchConfigurationDialog(dialog);
+ tabs[3] = new SourceLookupTab();
+ tabs[3].setLaunchConfigurationDialog(dialog);
+ tabs[4] = new EnvironmentTab();
+ tabs[4].setLaunchConfigurationDialog(dialog);
+ tabs[5] = new CommonTab();
+ tabs[5].setLaunchConfigurationDialog(dialog);
+ setTabs(tabs);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/JMXPropertiesEditorSection.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/JMXPropertiesEditorSection.java
new file mode 100644
index 0000000..7f0beec
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/JMXPropertiesEditorSection.java
@@ -0,0 +1,236 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Eteration A.S. 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:
+ * Naci Dai, Murat Yener
+ *******************************************************************************/
+
+package org.eclipse.libra.framework.ui;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.libra.framework.core.IOSGIFrameworkInstance;
+import org.eclipse.libra.framework.ui.internal.SWTUtil;
+import org.eclipse.libra.framework.ui.internal.editor.ServerChangedCommand;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+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.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.help.IWorkbenchHelpSystem;
+import org.eclipse.wst.server.ui.editor.ServerEditorSection;
+
+public class JMXPropertiesEditorSection extends ServerEditorSection {
+ protected Section section;
+ protected IOSGIFrameworkInstance frameworkInstance;
+
+ protected PropertyChangeListener listener;
+ Button jmxEnabled;
+ Text jmxPortText;
+
+ protected boolean updating = false;
+
+ public JMXPropertiesEditorSection() {
+ super();
+ }
+
+ /**
+ * Add listeners to detect undo changes and publishing of the server.
+ */
+ protected void addChangeListeners() {
+ listener = new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ if (updating)
+ return;
+ updating = true;
+ if (IOSGIFrameworkInstance.PROPERTY_JMX_PORT.equals(event
+ .getPropertyName())
+ || IOSGIFrameworkInstance.PROPERTY_JMX_ENABLED
+ .equals(event.getPropertyName())) {
+ validate();
+ }
+ updating = false;
+ }
+ };
+ server.addPropertyChangeListener(listener);
+
+ }
+
+ /**
+ * Creates the SWT controls for this workbench part.
+ *
+ * @param parent
+ * the parent control
+ */
+ public void createSection(Composite parent) {
+ super.createSection(parent);
+ FormToolkit toolkit = getFormToolkit(parent.getDisplay());
+ section = toolkit.createSection(parent, ExpandableComposite.TWISTIE
+ | ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR
+ | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
+ section.setText(Messages.jmxSection);
+ section.setDescription(Messages.jmxSectionDescription);
+ section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
+ | GridData.VERTICAL_ALIGN_FILL));
+
+ Composite composite = toolkit.createComposite(section);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 3;
+ layout.marginHeight = 5;
+ layout.marginWidth = 10;
+ layout.verticalSpacing = 5;
+ layout.horizontalSpacing = 15;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
+ | GridData.VERTICAL_ALIGN_FILL));
+ IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
+ whs.setHelp(composite, ContextIds.FRAMEWORK_INSTANCE_EDITOR);
+ whs.setHelp(section, ContextIds.FRAMEWORK_INSTANCE_EDITOR);
+ toolkit.paintBordersFor(composite);
+ section.setClient(composite);
+
+ // JMX Selection
+ jmxEnabled = SWTUtil.createCheckButton(composite, Messages.jmxEnabled, 1);
+ jmxEnabled.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent event) {
+ handleEdit();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent event) {
+ handleEdit();
+ }
+ });
+
+ Label label = createLabel(toolkit, composite, Messages.jmxSection);
+ GridData data = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
+ label.setLayoutData(data);
+ jmxPortText = SWTUtil.createText(composite, SWT.SINGLE | SWT.BORDER, 1);
+ jmxPortText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ handleEdit();
+ }
+ });
+
+ initialize();
+ }
+
+ protected Label createLabel(FormToolkit toolkit, Composite parent,
+ String text) {
+ Label label = toolkit.createLabel(parent, text);
+ label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ return label;
+ }
+
+ /**
+ * @see ServerEditorSection#dispose()
+ */
+ public void dispose() {
+ //do nothing
+ }
+
+ /**
+ * @see ServerEditorSection#init(IEditorSite, IEditorInput)
+ */
+ public void init(IEditorSite site, IEditorInput input) {
+ super.init(site, input);
+
+ // Cache workspace and default deploy paths
+ if (server != null) {
+ frameworkInstance = (IOSGIFrameworkInstance) server.loadAdapter(
+ IOSGIFrameworkInstance.class, null);
+ addChangeListeners();
+ }
+ initialize();
+ }
+
+ /**
+ * Initialize the fields in this editor.
+ */
+ protected void initialize() {
+ if (frameworkInstance == null)
+ return;
+ updating = true;
+
+ int port = frameworkInstance.getJMXPort();
+ boolean enabled = frameworkInstance.getJMXEnabled();
+
+ if (jmxPortText != null) {
+ jmxPortText.setText("" + port);
+ jmxPortText.setEnabled(enabled);
+ }
+ if (jmxEnabled != null) {
+ jmxEnabled.setSelection(enabled);
+ }
+ updating = false;
+ validate();
+ }
+
+ protected void validate() {
+ if (frameworkInstance != null && jmxEnabled != null && jmxPortText != null ) {
+ boolean en = jmxEnabled.getSelection();
+ String port = jmxPortText.getText();
+ if (en) {
+ try {
+ Integer.parseInt(port);
+ } catch (Exception ex) {
+ setErrorMessage(Messages.jmxInvalidPort);
+ }
+ }
+ }
+ // All is okay, clear any previous error
+ setErrorMessage(null);
+ }
+
+ void makeDirty() {
+ //This command does nothing but execute sets the dirty flag
+ //for the editor because the content of the target definition has
+ //changed
+ execute(new ServerChangedCommand(frameworkInstance));
+ }
+
+ protected void handleEdit() {
+
+ if (frameworkInstance != null && updating == false) {
+ boolean enabledNewValue = jmxEnabled.getSelection();
+ String portNewValue = jmxPortText.getText();
+
+ boolean enabledOldValue = frameworkInstance.getJMXEnabled();
+ int portOldValue = frameworkInstance.getJMXPort();
+ try {
+ int p = portOldValue;
+ if (enabledNewValue) {
+ p = Integer.parseInt(portNewValue);
+ if(portOldValue != p)
+ frameworkInstance.setJMXPort(p);
+ }
+ frameworkInstance.setJMXEnabled(enabledNewValue);
+ jmxPortText.setEnabled(enabledNewValue);
+ if(p != portOldValue || enabledNewValue != enabledOldValue)
+ makeDirty();
+ } catch (Exception ex) {
+ //If the port cannot be set (i.e. not int)
+ }
+
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/Messages.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/Messages.java
new file mode 100644
index 0000000..f159a68
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/Messages.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.ui;
+
+import org.eclipse.libra.framework.ui.FrameworkUIPlugin;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Translated messages.
+ */
+public class Messages extends NLS {
+
+ public static String wizardTitle;
+ public static String wizardDescription;
+ public static String runtimeName;
+ public static String installDir;
+ public static String browse;
+ public static String install;
+ public static String installDialogTitle;
+ public static String selectInstallDir;
+ public static String installedJRE;
+ public static String installedJREs;
+ public static String runtimeDefaultJRE;
+ public static String editorAdd;
+ public static String editorEdit;
+ public static String editorRemove;
+ public static String editorBrowse;
+
+ public static String configurationEditorOSGIModulesPageTitle;
+ public static String configurationEditorOSGIModulesSection;
+ public static String configurationEditorOSGIModulesDescription;
+
+ public static String configurationEditorOSGIVersionColumn;
+ public static String configurationEditorOSGIIdColumn;
+ public static String configurationEditorOSGINameColumn;
+
+ public static String configurationEditorAddOSGIModule;
+
+ public static String serverEditorLocationsSection;
+ public static String serverEditorLocationsDescription;
+ public static String serverEditorLocationsDescription2;
+ public static String serverEditorGeneralSection;
+ public static String serverEditorGeneralDescription;
+ public static String serverEditorServerDirMetadata;
+ public static String serverEditorServerDirInstall;
+ public static String serverEditorServerDirCustom;
+ public static String serverEditorSetInternalServerDirLink;
+ public static String serverEditorSetInternalServerDirLink2;
+ public static String serverEditorSetInstallServerDirLink;
+ public static String serverEditorSetInstallServerDirLink2;
+ public static String serverEditorSetDefaultDeployDirLink;
+ public static String serverEditorSetDefaultDeployDirLink2;
+ public static String serverEditorServerDir;
+ public static String serverEditorDeployDir;
+ public static String serverEditorTestEnvironment;
+ public static String serverEditorNoPublish;
+ public static String serverEditorSeparateContextFiles;
+ public static String serverEditorSecure;
+ public static String serverEditorDebugMode;
+ public static String serverEditorNotSupported;
+ public static String serverEditorDoesNotModify;
+ public static String serverEditorTakesControl;
+ public static String errorServerMustBeStopped;
+ public static String errorServerDirIsRoot;
+ public static String errorServerDirUnderRoot;
+ public static String errorServerDirCustomNotMetadata;
+ public static String errorServerDirCustomNotInstall;
+ public static String errorDeployDirNotSpecified;
+ public static String serverEditorBrowseServerMessage;
+ public static String serverEditorBrowseDeployMessage;
+ public static String errorDefaultDialogTitle;
+ public static String confirmCleanWorkDirTitle;
+ public static String cleanServerStateChanging;
+ public static String cleanModuleWorkDir;
+ public static String cleanServerWorkDir;
+ public static String cleanServerRunning;
+ public static String cleanServerTask;
+ public static String errorCouldNotCleanStateChange;
+ public static String errorCouldNotCleanCantStop;
+ public static String errorCouldNotCleanStopFailed;
+ public static String errorCantIdentifyWebApp;
+ public static String errorCantDeleteServerNotStopped;
+ public static String errorErrorDuringClean;
+ public static String errorErrorDuringCleanWasRunning;
+ public static String errorCleanCantRestart;
+ public static String contextCleanup;
+
+
+
+
+ public static String configurationEditorTargetDefinitionTitle;
+ public static String cleanTerminateRuntimeInstanceDialogTitle;
+ public static String cleanTerminateRuntimeInstanceMessage;
+ public static String javaProfileSection;
+ public static String javaProfileSectionDescription;
+
+ public static String jmxSection;
+ public static String jmxSectionDescription;
+ public static String jmxInvalidPort;
+ public static String jmxEnabled;
+
+ static {
+ NLS.initializeMessages(FrameworkUIPlugin.PLUGIN_ID + ".Messages", Messages.class);
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/Messages.properties b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/Messages.properties
new file mode 100644
index 0000000..b033b0e
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/Messages.properties
@@ -0,0 +1,137 @@
+###############################################################################
+# Copyright (c) 2010 Eteration A.S. 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:
+# IBM Corporation - initial API and implementation
+# - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+# org.eclipse.jst.server.core
+# org.eclipse.jst.server.ui
+#
+# Naci Dai and Murat Yener, Eteration A.S.
+###############################################################################
+
+
+# --------------- General UI ---------------
+
+cleanTerminateRuntimeInstanceDialogTitle=Terminating framework instance
+cleanTerminateRuntimeInstanceMessage=Terminating framework instance
+
+runtimeName=Na&me:
+browse=B&rowse...
+install=Download and Install...
+installDialogTitle=Download and Install
+installDir=OSGI Framework installation &directory:
+installedJRE=&JRE:
+installedJREs=&Installed JREs...
+selectInstallDir=Select osgi framework installation directory.
+runtimeDefaultJRE=Workbench default JRE
+contextCleanup=The context root of module {0} has been modified. Do you want to update the framework configuration to match?
+
+# New Felix Runtime Instance Wizard
+wizardTitle=OSGi Service Platform
+wizardDescription=Specify the installation directory
+
+# --------------- Editors ---------------
+
+configurationEditorTargetDefinitionTitle=Update target definition for the osgi framework instance
+# General text used in both editors
+editorRemove=Remove
+editorAdd=Add...
+editorEdit=Edit...
+editorBrowse=Browse...
+
+# --- Configuration Editor ---
+configurationEditorOSGIModulesPageTitle=OSGi Module Composition
+configurationEditorOSGIModulesSection=Bundles from workspace
+configurationEditorOSGIModulesDescription=Configure the bundles that will be deployed framework.
+
+# Fields
+configurationEditorOSGIVersionColumn=Version
+configurationEditorOSGIIdColumn=Id
+configurationEditorOSGINameColumn=Name
+configurationEditorAddOSGIModule=Add OSGi Bundle...
+
+
+# --- framework Editor ---
+serverEditorLocationsSection=OSGi framework instance locations
+serverEditorLocationsDescription=Specify the location path. Bundles are deployed here and framework instance will run from this location. No modules must be published here to make changes.
+serverEditorLocationsDescription2=Specify the location path. Bundles are deployed here and framework instance will run from this location. No modules must be published here to make changes.
+serverEditorGeneralSection=Framework Options
+serverEditorGeneralDescription=Enter settings for the framework.
+
+# Link Fields
+serverEditorSetInternalServerDirLink=Set framework path to internally supplied location
+serverEditorSetInternalServerDirLink2=Set framework path to internally supplied location (currently set)
+serverEditorSetInstallServerDirLink=Set framework path to the location of the installation
+serverEditorSetInstallServerDirLink2=Set framework path to the location of the installation (currently set)
+serverEditorSetDefaultDeployDirLink=Set deploy path to the default value
+serverEditorSetDefaultDeployDirLink2=Set deploy path to the default value (currently set)
+
+# Fields
+# Note: The argument for the following three strings will be the string for
+# one of serverEditorDoesNotModify or serverEditorTakesControl or and empty string.
+serverEditorServerDirMetadata=Use workspace metadata {0}
+serverEditorServerDirInstall=Use OSGi Framework installation {0}
+serverEditorServerDirCustom=Use custom location {0}
+serverEditorServerDir=Framework instance path:
+serverEditorDeployDir=Deploy path:
+serverEditorSecure=Enable security
+# Note: The argument for the following string will be the serverEditorNotSupported string or an empty string
+serverEditorDebugMode=Enable felix debug logging {0}
+serverEditorTestEnvironment=Run modules directly from the workspace (do not modify the OSGI installation)
+# Note: The argument for the following string will be the serverEditorNotSupported string or an empty string
+serverEditorNoPublish=Serve modules without publishing {0}
+serverEditorSeparateContextFiles=Publish module contexts to separate XML files {0}
+errorServerDirIsRoot=The instance path may not be set to the the root of your workspace.
+errorServerDirUnderRoot=The instance path may not be under the \"{0}\" folder of your workspace unless it is the workspace metadata location.
+# Note: The argument for the following string will be the string for serverEditorServerDirMetadata with a blank string for its argument
+errorServerDirCustomNotMetadata=Only the \"{0}\" selection may set the framework path to the workspace metadata location.
+# Note: The argument for the following string will be the string for serverEditorServerDirInstall with a blank string for its argument
+errorServerDirCustomNotInstall=Only the \"{0}\" selection may set the server path to the Framework installation.
+errorDeployDirNotSpecified=A deploy path must be specified.
+serverEditorNotSupported=(not supported by this runtime version)
+serverEditorDoesNotModify=(does not modify runtime installation)
+serverEditorTakesControl=(takes control of runtime installation)
+errorServerMustBeStopped=The runtime must be stopped before a change to the \"{0}\" setting can be saved.
+
+# Browse for framework dialog
+serverEditorBrowseServerMessage=Select a runtime instance directory.
+
+# Browse for Deploy dialog
+serverEditorBrowseDeployMessage=Select a deploy directory.
+
+# --- Clean Work Directory ---
+confirmCleanWorkDirTitle=Confirm Clean Work Directory
+cleanServerStateChanging=The state of {0} is in transition or unknown. Try again when the framework has reached a stable state.
+cleanModuleWorkDir=Clean work directory for module {0} on {1}.
+cleanServerWorkDir=Clean work directories for all Web applications on {0}.
+cleanServerRunning=The framework must be stopped to clean the work directory. Clicking OK will include stopping and restarting the framework.
+cleanServerTask=Cleaning {0} work directory
+
+# --- Error Strings ---
+errorDefaultDialogTitle=OSGi Framework Error
+
+# --- Clean Work Directory Errors ---
+errorCouldNotCleanStateChange=Clean operation was aborted because {0} independently changed state after confirmation dialog was displayed. Try again once the framework has reached a stable state.
+errorCouldNotCleanCantStop={0} can not be stopped at this time. Try again when the framework is stopped or can be stopped.
+errorCouldNotCleanStopFailed={0} failed to stop. Try again when the framework is stopped or can be stopped.
+
+errorCantIdentifyWebApp=Module {0} could not be associated with a Web application on a framework.
+errorCantDeleteServerNotStopped={0} work directory could not be deleted. framework was not stopped. Try again when the framework is stopped or can be stopped.
+errorErrorDuringClean=An error occurred while cleaning {0} work directory.
+errorErrorDuringCleanWasRunning=An error occurred while cleaning {0} work directory. {1} will not be automatically restarted.
+
+errorCleanCantRestart={0} is unable to restart at this time.
+
+
+javaProfileSection= Runtime Java Profile
+javaProfileSectionDescription = Choose the suitable profile that fits your runtime environment. The selected profile will determine the list of classes and packages that are visible from the JRE.
+
+jmxSection = JMX Port
+jmxSectionDescription = Choose the suitable properties that enables the JMX Console for your runtime. Your JMX server will expect connections using selected port
+jmxInvalidPort = JMX Port should be an integer value
+jmxEnabled = Enable JMX Console
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/OSGIFrameworkComposite.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/OSGIFrameworkComposite.java
new file mode 100644
index 0000000..32a9fb5
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/OSGIFrameworkComposite.java
@@ -0,0 +1,404 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+
+package org.eclipse.libra.framework.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+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.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMInstallType;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.preference.IPreferenceNode;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.preference.PreferenceManager;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.libra.framework.core.IOSGIFrameworkWorkingCopy;
+import org.eclipse.libra.framework.ui.internal.SWTUtil;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.TaskModel;
+import org.eclipse.wst.server.core.internal.IInstallableRuntime;
+import org.eclipse.wst.server.core.internal.ServerPlugin;
+import org.eclipse.wst.server.ui.internal.wizard.TaskWizard;
+import org.eclipse.wst.server.ui.internal.wizard.fragment.LicenseWizardFragment;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
+
+
+/**
+ * Wizard page to set the OSGI framework install directory.
+ */
+public class OSGIFrameworkComposite extends Composite {
+ protected IRuntimeWorkingCopy runtimeWC;
+ protected IOSGIFrameworkWorkingCopy runtime;
+
+ protected IWizardHandle wizard;
+
+ protected Text installDir;
+ protected Text name;
+ protected Combo combo;
+ protected List installedJREs;
+ protected String[] jreNames;
+ protected IInstallableRuntime ir;
+ protected Job installRuntimeJob;
+ protected IJobChangeListener jobListener;
+ protected Label installLabel;
+ protected Button install;
+
+ /**
+ * OSGIFrameworkComposite wizard page constructor comment.
+ *
+ * @param parent the parent composite
+ * @param wizard the wizard handle
+ */
+ protected OSGIFrameworkComposite(Composite parent, IWizardHandle wizard) {
+ super(parent, SWT.NONE);
+ this.wizard = wizard;
+
+ wizard.setTitle(Messages.wizardTitle);
+ wizard.setDescription(Messages.wizardDescription);
+ //wizard.setImageDescriptor(FrameworkUIPlugin.getImageDescriptor(FrameworkUIPlugin.IMG_WIZ_FELIX));
+
+ createControl();
+ }
+
+ protected void setRuntime(IRuntimeWorkingCopy newRuntime) {
+ if (newRuntime == null) {
+ runtimeWC = null;
+ runtime = null;
+ } else {
+ runtimeWC = newRuntime;
+ runtime = (IOSGIFrameworkWorkingCopy) newRuntime.loadAdapter(IOSGIFrameworkWorkingCopy.class, null);
+ }
+
+ if (runtimeWC == null) {
+ ir = null;
+ install.setEnabled(false);
+ installLabel.setText("");
+ } else {
+ ir = ServerPlugin.findInstallableRuntime(runtimeWC.getRuntimeType().getId());
+ if (ir != null) {
+ install.setEnabled(true);
+ installLabel.setText(ir.getName());
+ }
+ }
+
+ init();
+ validate();
+ }
+
+ public void dispose() {
+ super.dispose();
+ if (installRuntimeJob != null) {
+ installRuntimeJob.removeJobChangeListener(jobListener);
+ }
+ }
+
+ /**
+ * Provide a wizard page to change the Felix installation directory.
+ */
+ protected void createControl() {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ setLayout(layout);
+ setLayoutData(new GridData(GridData.FILL_BOTH));
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ContextIds.FRAMEWORK_COMPOSITE);
+
+ Label label = new Label(this, SWT.NONE);
+ label.setText(Messages.runtimeName);
+ GridData data = new GridData();
+ data.horizontalSpan = 2;
+ label.setLayoutData(data);
+
+ name = new Text(this, SWT.BORDER);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ name.setLayoutData(data);
+ name.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ runtimeWC.setName(name.getText());
+ validate();
+ }
+ });
+
+ label = new Label(this, SWT.NONE);
+ label.setText(Messages.installDir);
+ data = new GridData();
+ data.horizontalSpan = 2;
+ label.setLayoutData(data);
+
+ installDir = new Text(this, SWT.BORDER);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ installDir.setLayoutData(data);
+ installDir.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ runtimeWC.setLocation(new Path(installDir.getText()));
+ validate();
+ }
+ });
+
+ Button browse = SWTUtil.createButton(this, Messages.browse);
+ browse.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent se) {
+ DirectoryDialog dialog = new DirectoryDialog(OSGIFrameworkComposite.this.getShell());
+ dialog.setMessage(Messages.selectInstallDir);
+ dialog.setFilterPath(installDir.getText());
+ String selectedDirectory = dialog.open();
+ if (selectedDirectory != null)
+ installDir.setText(selectedDirectory);
+ }
+ });
+
+ installLabel = new Label(this, SWT.RIGHT);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalIndent = 10;
+ installLabel.setLayoutData(data);
+
+ install = SWTUtil.createButton(this, Messages.install);
+ install.setEnabled(false);
+ install.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent se) {
+ String license = null;
+ try {
+ license = ir.getLicense(new NullProgressMonitor());
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "Error getting license", e);
+ }
+ TaskModel taskModel = new TaskModel();
+ taskModel.putObject(LicenseWizardFragment.LICENSE, license);
+ TaskWizard wizard2 = new TaskWizard(Messages.installDialogTitle, new WizardFragment() {
+ protected void createChildFragments(List list) {
+ list.add(new LicenseWizardFragment());
+ }
+ }, taskModel);
+
+ WizardDialog dialog2 = new WizardDialog(getShell(), wizard2);
+ if (dialog2.open() == Window.CANCEL)
+ return;
+
+ DirectoryDialog dialog = new DirectoryDialog(OSGIFrameworkComposite.this.getShell());
+ dialog.setMessage(Messages.selectInstallDir);
+ dialog.setFilterPath(installDir.getText());
+ String selectedDirectory = dialog.open();
+ if (selectedDirectory != null) {
+// ir.install(new Path(selectedDirectory));
+ final IPath installPath = new Path(selectedDirectory);
+ installRuntimeJob = new Job("Installing osgi runtime environment") {
+ public boolean belongsTo(Object family) {
+ return ServerPlugin.PLUGIN_ID.equals(family);
+ }
+
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ ir.install(installPath, monitor);
+ } catch (CoreException ce) {
+ return ce.getStatus();
+ }
+
+ return Status.OK_STATUS;
+ }
+ };
+
+ installDir.setText(selectedDirectory);
+ jobListener = new JobChangeAdapter() {
+ public void done(IJobChangeEvent event) {
+ installRuntimeJob.removeJobChangeListener(this);
+ installRuntimeJob = null;
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ if (!isDisposed()) {
+ validate();
+ }
+ }
+ });
+ }
+ };
+ installRuntimeJob.addJobChangeListener(jobListener);
+ installRuntimeJob.schedule();
+ }
+ }
+ });
+
+ updateJREs();
+
+ // JDK location
+ label = new Label(this, SWT.NONE);
+ label.setText(Messages.installedJRE);
+ data = new GridData();
+ data.horizontalSpan = 2;
+ label.setLayoutData(data);
+
+ combo = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
+ combo.setItems(jreNames);
+ data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ combo.setLayoutData(data);
+
+ combo.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ int sel = combo.getSelectionIndex();
+ IVMInstall vmInstall = null;
+ if (sel > 0)
+ vmInstall = (IVMInstall) installedJREs.get(sel - 1);
+
+ runtime.setVMInstall(vmInstall);
+ validate();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
+
+ Button button = SWTUtil.createButton(this, Messages.installedJREs);
+ button.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ String currentVM = combo.getText();
+ if (showPreferencePage()) {
+ updateJREs();
+ combo.setItems(jreNames);
+ combo.setText(currentVM);
+ if (combo.getSelectionIndex() == -1)
+ combo.select(0);
+ validate();
+ }
+ }
+ });
+
+ init();
+ validate();
+
+ Dialog.applyDialogFont(this);
+
+ name.forceFocus();
+ }
+
+ protected void updateJREs() {
+ // get all installed JVMs
+ installedJREs = new ArrayList();
+ IVMInstallType[] vmInstallTypes = JavaRuntime.getVMInstallTypes();
+ int size = vmInstallTypes.length;
+ for (int i = 0; i < size; i++) {
+ IVMInstall[] vmInstalls = vmInstallTypes[i].getVMInstalls();
+ int size2 = vmInstalls.length;
+ for (int j = 0; j < size2; j++) {
+ installedJREs.add(vmInstalls[j]);
+ }
+ }
+
+ // get names
+ size = installedJREs.size();
+ jreNames = new String[size+1];
+ jreNames[0] = Messages.runtimeDefaultJRE;
+ for (int i = 0; i < size; i++) {
+ IVMInstall vmInstall = (IVMInstall) installedJREs.get(i);
+ jreNames[i+1] = vmInstall.getName();
+ }
+ }
+
+ protected boolean showPreferencePage() {
+ String id = "org.eclipse.jdt.debug.ui.preferences.VMPreferencePage";
+
+ // should be using the following API, but it only allows a single preference page instance.
+ // see bug 168211 for details
+ //PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), id, new String[] { id }, null);
+ //return (dialog.open() == Window.OK);
+
+ PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager();
+ IPreferenceNode node = manager.find("org.eclipse.jdt.ui.preferences.JavaBasePreferencePage").findSubNode(id);
+ PreferenceManager manager2 = new PreferenceManager();
+ manager2.addToRoot(node);
+ PreferenceDialog dialog = new PreferenceDialog(getShell(), manager2);
+ dialog.create();
+ return (dialog.open() == Window.OK);
+ }
+
+ protected void init() {
+ if (name == null || runtime == null)
+ return;
+
+ if (runtimeWC.getName() != null)
+ name.setText(runtimeWC.getName());
+ else
+ name.setText("");
+
+ if (runtimeWC.getLocation() != null)
+ installDir.setText(runtimeWC.getLocation().toOSString());
+ else
+ installDir.setText("");
+
+ // set selection
+ if (runtime.isUsingDefaultJRE())
+ combo.select(0);
+ else {
+ boolean found = false;
+ int size = installedJREs.size();
+ for (int i = 0; i < size; i++) {
+ IVMInstall vmInstall = (IVMInstall) installedJREs.get(i);
+ if (vmInstall.equals(runtime.getVMInstall())) {
+ combo.select(i + 1);
+ found = true;
+ }
+ }
+ if (!found)
+ combo.select(0);
+ }
+ }
+
+ protected void validate() {
+ if (runtime == null) {
+ wizard.setMessage("", IMessageProvider.ERROR);
+ return;
+ }
+
+ IStatus status = runtimeWC.validate(null);
+ if (status == null || status.isOK())
+ wizard.setMessage(null, IMessageProvider.NONE);
+ else if (status.getSeverity() == IStatus.WARNING)
+ wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
+ else
+ wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
+ wizard.update();
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/OSGIFrameworkWizardFragment.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/OSGIFrameworkWizardFragment.java
new file mode 100644
index 0000000..f179bbc
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/OSGIFrameworkWizardFragment.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+
+package org.eclipse.libra.framework.ui;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.libra.framework.core.FrameworkCorePlugin;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.TaskModel;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
+
+
+
+/**
+ *
+ */
+public class OSGIFrameworkWizardFragment extends WizardFragment {
+ protected OSGIFrameworkComposite comp;
+
+ public OSGIFrameworkWizardFragment() {
+ // do nothing
+ }
+
+ public boolean hasComposite() {
+ return true;
+ }
+
+ public boolean isComplete() {
+ IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
+
+ if (runtime == null)
+ return false;
+ IStatus status = runtime.validate(null);
+ return (status == null || status.getSeverity() != IStatus.ERROR);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.server.ui.task.WizardFragment#createComposite()
+ */
+ public Composite createComposite(Composite parent, IWizardHandle wizard) {
+ comp = new OSGIFrameworkComposite(parent, wizard);
+ return comp;
+ }
+
+ public void enter() {
+ if (comp != null) {
+ IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
+ comp.setRuntime(runtime);
+ }
+ }
+
+ public void exit() {
+ IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
+ IPath path = runtime.getLocation();
+ if (runtime.validate(null).getSeverity() != IStatus.ERROR)
+ FrameworkCorePlugin.setPreference("location" + runtime.getRuntimeType().getId(), path.toString());
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/Trace.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/Trace.java
new file mode 100644
index 0000000..5cbee20
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/Trace.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+
+package org.eclipse.libra.framework.ui;
+
+
+/**
+ * Helper class to route trace output.
+ */
+public class Trace {
+ public static final byte CONFIG = 0;
+ public static final byte WARNING = 1;
+ public static final byte SEVERE = 2;
+ public static final byte FINEST = 3;
+ public static final byte FINER = 4;
+
+ /**
+ * Trace constructor comment.
+ */
+ private Trace() {
+ super();
+ }
+
+ /**
+ * Trace the given text.
+ *
+ * @param level the trace level
+ * @param s a message
+ */
+ public static void trace(byte level, String s) {
+ Trace.trace(level, s, null);
+ }
+
+ /**
+ * Trace the given message and exception.
+ *
+ * @param level the trace level
+ * @param s a message
+ * @param t a throwable
+ */
+ public static void trace(byte level, String s, Throwable t) {
+ if (!FrameworkUIPlugin.getInstance().isDebugging())
+ return;
+
+ System.out.println(FrameworkUIPlugin.PLUGIN_ID + " " + s);
+ if (t != null)
+ t.printStackTrace();
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/ModulePublisherDelegate.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/ModulePublisherDelegate.java
new file mode 100644
index 0000000..b9cd128
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/ModulePublisherDelegate.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.ui.internal;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.libra.framework.core.FrameworkInstanceDelegate;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.TaskModel;
+import org.eclipse.wst.server.core.model.PublisherDelegate;
+
+
+public class ModulePublisherDelegate extends PublisherDelegate {
+
+ public IStatus execute(int kind, IProgressMonitor monitor, IAdaptable info) throws CoreException {
+ // this publisher only runs when there is a UI
+ if (info == null)
+ return Status.OK_STATUS;
+
+ final Shell shell = (Shell) info.getAdapter(Shell.class);
+ if (shell == null)
+ return Status.OK_STATUS;
+
+ IServer server = (IServer) getTaskModel().getObject(TaskModel.TASK_SERVER);
+ FrameworkInstanceDelegate runtimeInstance = (FrameworkInstanceDelegate) server.loadAdapter(FrameworkInstanceDelegate.class, monitor);
+
+ List modules = (List) getTaskModel().getObject(TaskModel.TASK_MODULES);
+ int size = modules.size();
+ for (int i = 0; i < size; i++) {
+ IModule[] module = (IModule[]) modules.get(i);
+ final IModule m = module[module.length - 1];
+ if (m != null) {
+ // TODO OSAMI Module Publish Starts Here
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/SWTUtil.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/SWTUtil.java
new file mode 100644
index 0000000..14c4110
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/SWTUtil.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+
+package org.eclipse.libra.framework.ui.internal;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+/**
+ * SWT Utility class.
+ */
+public class SWTUtil {
+ private static FontMetrics fontMetrics;
+
+ protected static void initializeDialogUnits(Control testControl) {
+ // Compute and store a font metric
+ GC gc = new GC(testControl);
+ gc.setFont(JFaceResources.getDialogFont());
+ fontMetrics = gc.getFontMetrics();
+ gc.dispose();
+ }
+
+ /**
+ * Returns a width hint for a button control.
+ */
+ protected static int getButtonWidthHint(Button button) {
+ int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, 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 the button for which to set the dimension hint
+ */
+ public static void setButtonDimensionHint(Button button) {
+ Object gd = button.getLayoutData();
+ if (gd instanceof GridData) {
+ ((GridData) gd).widthHint = getButtonWidthHint(button);
+ ((GridData) gd).horizontalAlignment = GridData.FILL;
+ }
+ }
+
+ /**
+ * Create a new button with the standard size.
+ *
+ * @param comp the component to add the button to
+ * @param label the button label
+ * @return a button
+ */
+ public static Button createButton(Composite comp, String label) {
+ Button b = new Button(comp, SWT.PUSH);
+ b.setText(label);
+ if (fontMetrics == null)
+ initializeDialogUnits(comp);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ data.widthHint = getButtonWidthHint(b);
+ b.setLayoutData(data);
+ return b;
+ }
+
+ /**
+ * Creates and returns a new radio button with the given
+ * label.
+ *
+ * @param parent parent control
+ * @param label button label or <code>null</code>
+ * @param hspan number of columns to horizontally span in the parent composite
+ * @return a new radio button
+ */
+ public static Button createCheckButton(Composite parent, String label, int hspan) {
+ Button button = new Button(parent, SWT.CHECK);
+ button.setFont(parent.getFont());
+ if (label != null) {
+ button.setText(label);
+ }
+ GridData gd = new GridData();
+ gd.horizontalSpan = hspan;
+ button.setLayoutData(gd);
+ return button;
+ }
+
+ /**
+ * Creates a new text widget
+ *
+ * @param parent the parent composite to add this text widget to
+ * @param style the style bits for the text widget
+ * @param hspan the horizontal span to take up on the parent composite
+ * @param fill the fill for the grid layout
+ * @return the new text widget
+ */
+
+ public static Text createText(Composite parent, int style, int hspan) {
+ Text t = new Text(parent, style);
+ t.setFont(parent.getFont());
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = hspan;
+ t.setLayoutData(gd);
+ return t;
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/TerminationDialog.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/TerminationDialog.java
new file mode 100644
index 0000000..24e8200
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/TerminationDialog.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.ui.internal;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.libra.framework.ui.ContextIds;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Dialog that prompts a user to see if a server should
+ * be terminated.
+ */
+public class TerminationDialog extends Dialog {
+ protected String title;
+ protected String message;
+
+ /**
+ * TerminationDialog constructor.
+ *
+ * @param parentShell a shell
+ * @param title title of dialog
+ * @param message message to display
+ */
+ public TerminationDialog(Shell parentShell, String title, String message) {
+ super(parentShell);
+ this.title = title;
+ this.message = message;
+ setBlockOnOpen(true);
+ }
+
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(title);
+ }
+
+ /**
+ * Creates and returns the contents of the upper part
+ * of this dialog (above the button bar).
+ *
+ * @param parent the parent composite to contain the dialog area
+ * @return the dialog area control
+ */
+ protected Control createDialogArea(Composite parent) {
+ // create a composite with standard margins and spacing
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ composite.setFont(parent.getFont());
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, ContextIds.FRAMEWORK_INSTANCE_CLEAN_WORK_DIR_TERMINATE);
+
+ Label label = new Label(composite, SWT.WRAP);
+ label.setText(message);
+ GridData data = new GridData();
+ data.widthHint = 400;
+ label.setLayoutData(data);
+
+ Dialog.applyDialogFont(composite);
+
+ return composite;
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/actions/AbstractSyncLaunch.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/actions/AbstractSyncLaunch.java
new file mode 100644
index 0000000..3e44f51
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/actions/AbstractSyncLaunch.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Eteration A.S. - initial API and implementation
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.ui.internal.actions;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServer.IOperationListener;
+import org.eclipse.wst.server.ui.IServerModule;
+import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
+import org.eclipse.wst.server.ui.internal.Trace;
+
+public abstract class AbstractSyncLaunch {
+ protected String launchMode = ILaunchManager.RUN_MODE;
+
+ protected IServer selectedServer;
+ protected IModule selectedModule;
+
+ /**
+ * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+
+ }
+
+ /**
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ selectedServer = null;
+ selectedModule = null;
+ if (!selection.isEmpty()) {
+ if (selection instanceof IStructuredSelection) {
+ Object obj = ((IStructuredSelection)selection).getFirstElement();
+ if (obj instanceof IServer) {
+ selectedServer = (IServer)obj;
+ }
+ else if (obj instanceof IServerModule) {
+ IServerModule sm = (IServerModule)obj;
+ IModule [] module = sm.getModule();
+ selectedModule = module[module.length - 1];
+ if (selectedModule != null)
+ selectedServer = sm.getServer();
+ }
+ }
+ }
+ }
+
+
+
+
+
+ public static void start(IServer server, String launchMode, final Shell shell) {
+ if (server.getServerState() != IServer.STATE_STARTED) {
+ if (!ServerUIPlugin.saveEditors())
+ return;
+
+ /*final IAdaptable info = new IAdaptable() {
+ public Object getAdapter(Class adapter) {
+ if (Shell.class.equals(adapter))
+ return shell;
+ return null;
+ }
+ };*/
+ try {
+ //deprecated but start method does not support sync start
+ server.synchronousStart(launchMode, (IProgressMonitor)null);
+ } catch (CoreException e) {
+ Trace.trace(Trace.STRING_SEVERE, "Error starting server", e);
+ }
+ } else {
+ if (shell != null && !ServerUIPlugin.promptIfDirty(shell, server))
+ return;
+
+ try {
+ String launchMode2 = launchMode;
+ if (launchMode2 == null)
+ launchMode2 = server.getMode();
+ server.restart(launchMode2, (IOperationListener) null);
+ } catch (Exception e) {
+ if (Trace.SEVERE) {
+ Trace.trace(Trace.STRING_SEVERE, "Error restarting server", e);
+ }
+ }
+ }
+ }
+
+ public void run(IAction action) {
+
+ if (selectedServer.getServerState() != IServer.STATE_STARTED) {
+ if (!ServerUIPlugin.saveEditors())
+ return;
+
+ /*final IAdaptable info = new IAdaptable() {
+ public Object getAdapter(Class adapter) {
+ if (Shell.class.equals(adapter))
+ return shell;
+ return null;
+ }
+ };*/
+ try {
+ //deprecated but start method does not support sync start
+ selectedServer.synchronousStart(launchMode, (IProgressMonitor)null);
+ } catch (CoreException e) {
+ Trace.trace(Trace.STRING_SEVERE, "Error starting server", e);
+ }
+ } else {
+
+
+ try {
+ String launchMode2 = launchMode;
+ if (launchMode2 == null)
+ launchMode2 = selectedServer.getMode();
+ selectedServer.restart(launchMode2, (IOperationListener) null);
+ } catch (Exception e) {
+ if (Trace.SEVERE) {
+ Trace.trace(Trace.STRING_SEVERE, "Error restarting server", e);
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/actions/CleanWorkDirAction.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/actions/CleanWorkDirAction.java
new file mode 100644
index 0000000..a28ca5a
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/actions/CleanWorkDirAction.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.ui.internal.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.libra.framework.ui.CleanWorkDirDialog;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.ui.IServerModule;
+
+
+
+public class CleanWorkDirAction implements IObjectActionDelegate {
+ private IWorkbenchPart targetPart;
+ private IServer selectedServer;
+ private IModule selectedModule;
+
+ /**
+ * Constructor for Action1.
+ */
+ public CleanWorkDirAction() {
+ super();
+ }
+
+ /**
+ * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ this.targetPart = targetPart;
+ }
+
+ /**
+ * @see org.eclipse.ui.IActionDelegate#run(IAction)
+ */
+ public void run(IAction action) {
+ CleanWorkDirDialog dlg = new CleanWorkDirDialog(targetPart.getSite().getShell(), selectedServer, selectedModule);
+ dlg.open();
+ }
+
+ /**
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ selectedServer = null;
+ selectedModule = null;
+ if (!selection.isEmpty()) {
+ if (selection instanceof IStructuredSelection) {
+ Object obj = ((IStructuredSelection)selection).getFirstElement();
+ if (obj instanceof IServer) {
+ selectedServer = (IServer)obj;
+ }
+ else if (obj instanceof IServerModule) {
+ IServerModule sm = (IServerModule)obj;
+ IModule [] module = sm.getModule();
+ selectedModule = module[module.length - 1];
+ if (selectedModule != null)
+ selectedServer = sm.getServer();
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/actions/SyncDebugAction.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/actions/SyncDebugAction.java
new file mode 100644
index 0000000..d0baf65
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/actions/SyncDebugAction.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Eteration A.S. - initial API and implementation
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+
+package org.eclipse.libra.framework.ui.internal.actions;
+
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.ui.IObjectActionDelegate;
+
+public class SyncDebugAction extends AbstractSyncLaunch implements IObjectActionDelegate {
+
+ public void run(IAction action) {
+ launchMode = ILaunchManager.DEBUG_MODE;
+
+ super.run(action);
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/actions/SyncStartAction.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/actions/SyncStartAction.java
new file mode 100644
index 0000000..2c120b1
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/actions/SyncStartAction.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * Eteration A.S. - initial API and implementation
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.ui.internal.actions;
+
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.ui.IObjectActionDelegate;
+
+public class SyncStartAction extends AbstractSyncLaunch implements IObjectActionDelegate {
+
+ public void run(IAction action) {
+ launchMode = ILaunchManager.RUN_MODE;
+
+ super.run(action);
+ }
+
+}
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/ConfigurationOSGiModuleEditorPart.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/ConfigurationOSGiModuleEditorPart.java
new file mode 100644
index 0000000..507e73f
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/ConfigurationOSGiModuleEditorPart.java
@@ -0,0 +1,349 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.ui.internal.editor;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.libra.framework.core.FrameworkInstanceConfiguration;
+import org.eclipse.libra.framework.core.FrameworkInstanceDelegate;
+import org.eclipse.libra.framework.core.IOSGIFrameworkInstance;
+import org.eclipse.libra.framework.core.IOSGIFrameworkWorkingCopy;
+import org.eclipse.libra.framework.core.Trace;
+import org.eclipse.libra.framework.ui.ContextIds;
+import org.eclipse.libra.framework.ui.FrameworkUIPlugin;
+import org.eclipse.libra.framework.ui.Messages;
+import org.eclipse.pde.core.plugin.IPluginModelBase;
+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.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.help.IWorkbenchHelpSystem;
+import org.eclipse.wst.server.ui.editor.ServerEditorPart;
+
+
+/**
+ * felix configuration module editor page.
+ */
+
+public class ConfigurationOSGiModuleEditorPart extends ServerEditorPart implements ISelectionProvider {
+ protected IOSGIFrameworkWorkingCopy framework2;
+ protected FrameworkInstanceConfiguration configuration;
+
+ protected Table osgiBundlesTable;
+ protected int selection = -1;
+ protected Button addBundleProject;
+ protected Button remove;
+
+ protected PropertyChangeListener listener;
+
+
+ public ConfigurationOSGiModuleEditorPart() {
+ super();
+
+ }
+
+ /**
+ *
+ */
+ protected void addChangeListener() {
+ listener = new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ if (FrameworkInstanceConfiguration.ADD_BUNDLE.equals(event.getPropertyName())) {
+ initialize();
+ } else if (FrameworkInstanceConfiguration.REMOVE_BUNDLE.equals(event.getPropertyName())) {
+ initialize();
+ }
+ }
+ };
+ configuration.addPropertyChangeListener(listener);
+
+ }
+
+ /**
+ * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createPartControl(Composite parent) {
+ FormToolkit toolkit = getFormToolkit(parent.getDisplay());
+
+ ScrolledForm form = toolkit.createScrolledForm(parent);
+ toolkit.decorateFormHeading(form.getForm());
+ form.setText(Messages.configurationEditorOSGIModulesPageTitle);
+ form.setImage(FrameworkUIPlugin.getImage(FrameworkUIPlugin.IMG_WEB_MODULE));
+ GridLayout layout = new GridLayout();
+ layout.marginTop = 6;
+ layout.marginLeft = 6;
+ form.getBody().setLayout(layout);
+
+ getSite().setSelectionProvider(this);
+
+ Section section = toolkit.createSection(form.getBody(),
+ ExpandableComposite.TITLE_BAR | Section.DESCRIPTION);
+ section.setText(Messages.configurationEditorOSGIModulesSection);
+ section.setDescription(Messages.configurationEditorOSGIModulesDescription);
+ section.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Composite composite = toolkit.createComposite(section);
+ layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 5;
+ layout.marginWidth = 10;
+ layout.verticalSpacing = 5;
+ layout.horizontalSpacing = 15;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
+ whs.setHelp(composite, ContextIds.CONFIGURATION_EDITOR_MODULES);
+ toolkit.paintBordersFor(composite);
+ section.setClient(composite);
+
+ osgiBundlesTable = toolkit.createTable(composite, SWT.V_SCROLL | SWT.SINGLE
+ | SWT.FULL_SELECTION);
+ osgiBundlesTable.setHeaderVisible(true);
+ osgiBundlesTable.setLinesVisible(true);
+ whs.setHelp(osgiBundlesTable,
+ ContextIds.CONFIGURATION_EDITOR_MODULES_LIST);
+
+ TableLayout tableLayout = new TableLayout();
+
+ TableColumn col = new TableColumn(osgiBundlesTable, SWT.NONE);
+ col.setText("Name");
+ ColumnWeightData colData = new ColumnWeightData(8, 250, true);
+ tableLayout.addColumnData(colData);
+
+ TableColumn col2 = new TableColumn(osgiBundlesTable, SWT.NONE);
+ col2.setText("Id");
+ colData = new ColumnWeightData(13, 250, true);
+ tableLayout.addColumnData(colData);
+
+ TableColumn col3 = new TableColumn(osgiBundlesTable, SWT.NONE);
+ col3.setText("Version");
+ colData = new ColumnWeightData(5, 50, true);
+ tableLayout.addColumnData(colData);
+
+
+ osgiBundlesTable.setLayout(tableLayout);
+
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = 450;
+ data.heightHint = 120;
+ osgiBundlesTable.setLayoutData(data);
+ osgiBundlesTable.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ selectOsgiBundle();
+ }
+ });
+
+ Composite rightPanel = toolkit.createComposite(composite);
+ layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ rightPanel.setLayout(layout);
+ data = new GridData();
+ rightPanel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_BEGINNING));
+
+ form.setContent(section);
+ form.reflow(true);
+
+ initialize();
+ }
+
+
+
+ public void dispose() {
+ super.dispose();
+ if (configuration != null) {
+ configuration.removePropertyChangeListener(listener);
+ }
+
+ }
+
+ /*
+ * (non-Javadoc) Initializes the editor part with a site and input.
+ */
+ public void init(IEditorSite site, IEditorInput input) {
+ super.init(site, input);
+
+ IOSGIFrameworkInstance ts = (IOSGIFrameworkInstance) server.loadAdapter(
+ FrameworkInstanceDelegate.class, null);
+
+ try {
+ configuration = ts.getFrameworkInstanceConfiguration();
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "cannot access configuration",e);
+ }
+
+ if (server != null)
+ framework2 = (IOSGIFrameworkWorkingCopy) server.loadAdapter(
+ IOSGIFrameworkWorkingCopy.class, null);
+
+ addChangeListener();
+ initialize();
+ }
+
+ /**
+ *
+ */
+ protected void initialize() {
+ if (osgiBundlesTable == null)
+ return;
+
+ osgiBundlesTable.removeAll();
+ setErrorMessage(null);
+ }
+
+ /**
+ *
+ */
+ protected void selectOsgiBundle() {
+ if (readOnly)
+ return;
+
+ try {
+ selection = osgiBundlesTable.getSelectionIndex();
+ remove.setEnabled(true);
+ for(ISelectionChangedListener changedListener: selectionChangedListeners)
+ changedListener.selectionChanged(new SelectionChangedEvent(this, getSelection()));
+ } catch (Exception e) {
+ selection = -1;
+ remove.setEnabled(false);
+ }
+ }
+
+
+ /*
+ * @see IWorkbenchPart#setFocus()
+ */
+ public void setFocus() {
+ if (osgiBundlesTable != null)
+ osgiBundlesTable.setFocus();
+ }
+
+
+ /**
+ * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>();
+
+ /**
+ * This keeps track of the selection of the editor as a whole.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ISelection editorSelection = StructuredSelection.EMPTY;
+
+
+
+
+ public ISelection getSelection() {
+ final TableItem[] sel = osgiBundlesTable.getSelection();
+ if(sel == null || sel.length == 0)
+ return StructuredSelection.EMPTY;
+
+ return new IStructuredSelection() {
+
+ public boolean isEmpty() {
+ return false;
+ }
+
+ public List toList() {
+ List<IPluginModelBase> all = new ArrayList<IPluginModelBase>();
+ for(TableItem s: sel)
+ all.add((IPluginModelBase)s.getData());
+ return all;
+ }
+
+ public Object[] toArray() {
+
+ return toList().toArray();
+ }
+
+ public int size() {
+
+ return sel.length;
+ }
+
+ public Iterator iterator() {
+ return toList().iterator();
+ }
+
+ public Object getFirstElement() {
+ return sel[0].getData();
+ }
+ };
+
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void addSelectionChangedListener(ISelectionChangedListener listener2) {
+ selectionChangedListeners.add(listener2);
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void removeSelectionChangedListener(ISelectionChangedListener listener2) {
+ selectionChangedListeners.remove(listener2);
+ }
+
+ public void setSelection(ISelection selection) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+
+
+}
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/FrameworkInstanceLocationEditorSection.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/FrameworkInstanceLocationEditorSection.java
new file mode 100644
index 0000000..403d56b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/FrameworkInstanceLocationEditorSection.java
@@ -0,0 +1,461 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+
+package org.eclipse.libra.framework.ui.internal.editor;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.libra.framework.core.FrameworkInstanceDelegate;
+import org.eclipse.libra.framework.core.IOSGIFrameworkInstance;
+import org.eclipse.libra.framework.core.TargetDefinitionUtil;
+import org.eclipse.libra.framework.ui.ContextIds;
+import org.eclipse.libra.framework.ui.FrameworkUIPlugin;
+import org.eclipse.libra.framework.ui.Messages;
+import org.eclipse.libra.framework.ui.Trace;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.pde.internal.core.target.provisional.ITargetDefinition;
+import org.eclipse.pde.internal.core.target.provisional.ITargetPlatformService;
+import org.eclipse.pde.internal.ui.wizards.target.EditTargetDefinitionWizard;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+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.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.help.IWorkbenchHelpSystem;
+import org.eclipse.wst.server.core.IPublishListener;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.util.PublishAdapter;
+import org.eclipse.wst.server.ui.editor.ServerEditorSection;
+
+
+
+
+
+public class FrameworkInstanceLocationEditorSection extends ServerEditorSection {
+ protected Section section;
+ protected IOSGIFrameworkInstance frameworkInstance;
+
+ protected boolean defaultDeployDirIsSet;
+
+ protected Button frameworkInstanceDirCustom;
+
+ protected Text frameworkInstanceDir;
+ protected Button frameworkInstanceDirBrowse;
+
+ protected Text targetPlatformName;
+ protected Button targetPlatformEdit;
+
+ protected PropertyChangeListener listener;
+ protected IPublishListener publishListener;
+ protected IPath workspacePath;
+
+ protected boolean allowRestrictedEditing;
+ protected IPath tempDirPath;
+ protected IPath installDirPath;
+
+ protected boolean updating=false;
+
+ public FrameworkInstanceLocationEditorSection() {
+ super();
+ }
+
+ /**
+ * Add listeners to detect undo changes and publishing of the server.
+ */
+ protected void addChangeListeners() {
+ listener = new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ if (updating)
+ return;
+ updating = true;
+ if (IOSGIFrameworkInstance.PROPERTY_INSTANCE_DIR.equals(event.getPropertyName())) {
+ updateServerDirButtons();
+ updateServerDirFields();
+ validate();
+ }
+ updating = false;
+ }
+ };
+ server.addPropertyChangeListener(listener);
+
+ publishListener = new PublishAdapter() {
+ public void publishFinished(IServer server2, IStatus status) {
+ boolean flag = false;
+ if (status.isOK() && server2.getModules().length == 0)
+ flag = true;
+ if (flag != allowRestrictedEditing) {
+ allowRestrictedEditing = flag;
+ // Update the state of the fields
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ boolean customServerDir = false;
+ if (!FrameworkInstanceLocationEditorSection.this.frameworkInstanceDirCustom.isDisposed())
+ customServerDir = FrameworkInstanceLocationEditorSection.this.frameworkInstanceDirCustom.getSelection();
+ if (!FrameworkInstanceLocationEditorSection.this.frameworkInstanceDirCustom.isDisposed())
+ FrameworkInstanceLocationEditorSection.this.frameworkInstanceDirCustom.setEnabled(allowRestrictedEditing);
+ if (!FrameworkInstanceLocationEditorSection.this.frameworkInstanceDir.isDisposed())
+ FrameworkInstanceLocationEditorSection.this.frameworkInstanceDir.setEnabled(allowRestrictedEditing && customServerDir);
+ if (!FrameworkInstanceLocationEditorSection.this.frameworkInstanceDirBrowse.isDisposed())
+ FrameworkInstanceLocationEditorSection.this.frameworkInstanceDirBrowse.setEnabled(allowRestrictedEditing && customServerDir);
+ }
+ });
+ }
+ }
+ };
+ server.getOriginal().addPublishListener(publishListener);
+ }
+
+ /**
+ * Creates the SWT controls for this workbench part.
+ *
+ * @param parent the parent control
+ */
+ public void createSection(Composite parent) {
+ super.createSection(parent);
+ FormToolkit toolkit = getFormToolkit(parent.getDisplay());
+
+ section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
+ | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
+ section.setText(Messages.serverEditorLocationsSection);
+ section.setDescription(Messages.serverEditorLocationsDescription);
+ section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
+
+ Composite composite = toolkit.createComposite(section);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 3;
+ layout.marginHeight = 5;
+ layout.marginWidth = 10;
+ layout.verticalSpacing = 5;
+ layout.horizontalSpacing = 15;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
+ IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
+ whs.setHelp(composite, ContextIds.FRAMEWORK_INSTANCE_EDITOR);
+ whs.setHelp(section, ContextIds.FRAMEWORK_INSTANCE_EDITOR);
+ toolkit.paintBordersFor(composite);
+ section.setClient(composite);
+
+ frameworkInstanceDirCustom = toolkit.createButton(composite,
+ NLS.bind(Messages.serverEditorServerDirCustom, Messages.serverEditorDoesNotModify), SWT.RADIO);
+ GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ data.horizontalSpan = 3;
+ frameworkInstanceDirCustom.setLayoutData(data);
+ frameworkInstanceDirCustom.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ if (updating || !frameworkInstanceDirCustom.getSelection())
+ return;
+ updating = true;
+ //execute(new SetTestEnvironmentCommand(felixRuntimeInstance, true));
+ updateServerDirFields();
+ updating = false;
+ validate();
+ }
+ });
+
+ // server directory
+ Label label = createLabel(toolkit, composite, Messages.serverEditorServerDir);
+ data = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
+ label.setLayoutData(data);
+
+ frameworkInstanceDir = toolkit.createText(composite, null, SWT.SINGLE);
+ data = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ data.widthHint = 75;
+ frameworkInstanceDir.setLayoutData(data);
+ frameworkInstanceDir.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ if (updating)
+ return;
+ updating = true;
+ //execute(new SetInstanceDirectoryCommand(felixRuntimeInstance, getServerDir()));
+ updating = false;
+ validate();
+ }
+ });
+
+ frameworkInstanceDirBrowse = toolkit.createButton(composite, Messages.editorBrowse, SWT.PUSH);
+ frameworkInstanceDirBrowse.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent se) {
+ DirectoryDialog dialog = new DirectoryDialog(frameworkInstanceDir.getShell());
+ dialog.setMessage(Messages.serverEditorBrowseDeployMessage);
+ dialog.setFilterPath(frameworkInstanceDir.getText());
+ String selectedDirectory = dialog.open();
+ if (selectedDirectory != null && !selectedDirectory.equals(frameworkInstanceDir.getText())) {
+ updating = true;
+ // Make relative if relative to the workspace
+// IPath path = new Path(selectedDirectory);
+// if (workspacePath.isPrefixOf(path)) {
+// int cnt = path.matchingFirstSegments(workspacePath);
+// path = path.removeFirstSegments(cnt).setDevice(null);
+// selectedDirectory = path.toOSString();
+// }
+ //execute(new SetInstanceDirectoryCommand(felixRuntimeInstance, selectedDirectory));
+ updateServerDirButtons();
+ updateServerDirFields();
+ updating = false;
+ validate();
+ }
+ }
+ });
+ frameworkInstanceDirBrowse.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+
+
+
+ // server directory
+ Label label2 = createLabel(toolkit, composite, "Target Platform");
+ data = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
+ label2.setLayoutData(data);
+
+ targetPlatformName = toolkit.createText(composite, null, SWT.SINGLE);
+ data = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ data.widthHint = 75;
+ targetPlatformName.setLayoutData(data);
+
+
+ targetPlatformEdit = toolkit.createButton(composite, "Edit...", SWT.PUSH);
+ targetPlatformEdit.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent se) {
+ handleEdit();
+ }
+ });
+ targetPlatformEdit.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+
+
+ initialize();
+ }
+
+ protected Label createLabel(FormToolkit toolkit, Composite parent, String text) {
+ Label label = toolkit.createLabel(parent, text);
+ label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ return label;
+ }
+
+ /**
+ * @see ServerEditorSection#dispose()
+ */
+ public void dispose() {
+ if (server != null) {
+ server.removePropertyChangeListener(listener);
+ if (server.getOriginal() != null)
+ server.getOriginal().removePublishListener(publishListener);
+ }
+ }
+
+ /**
+ * @see ServerEditorSection#init(IEditorSite, IEditorInput)
+ */
+ public void init(IEditorSite site, IEditorInput input) {
+ super.init(site, input);
+
+ // Cache workspace and default deploy paths
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ workspacePath = root.getLocation();
+
+ if (server != null) {
+ frameworkInstance = (FrameworkInstanceDelegate) server.loadAdapter(FrameworkInstanceDelegate.class, null);
+ addChangeListeners();
+ }
+ initialize();
+ }
+
+ /**
+ * Initialize the fields in this editor.
+ */
+ protected void initialize() {
+ if (frameworkInstanceDir== null || frameworkInstance == null)
+ return;
+ updating = true;
+
+ IRuntime runtime = server.getRuntime();
+ section.setDescription(Messages.serverEditorLocationsDescription2);
+ if (runtime != null)
+ installDirPath = runtime.getLocation();
+
+ // determine if editing of locations is allowed
+ allowRestrictedEditing = false;
+ IPath basePath = new Path(frameworkInstance.getInstanceDirectory());
+ if (!readOnly) {
+ // If server has not been published, or server is published with no modules, allow editing
+ // TODO Find better way to determine if server hasn't been published
+ if ((basePath != null && !basePath.append("conf").toFile().exists())
+ || (server.getOriginal().getServerPublishState() == IServer.PUBLISH_STATE_NONE
+ && server.getOriginal().getModules().length == 0)) {
+ allowRestrictedEditing = true;
+ }
+ }
+
+ try {
+ if (frameworkInstance != null && frameworkInstance.getFrameworkInstanceConfiguration() != null) {
+
+ ITargetDefinition original = frameworkInstance.getFrameworkInstanceConfiguration()
+ .getTargetDefinition();
+ targetPlatformName.setText(original.getName());
+ targetPlatformName.setEditable(false);
+ }
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ // Update server related fields
+ updateServerDirButtons();
+ updateServerDirFields();
+ updating = false;
+ validate();
+ }
+
+ protected String getServerDir() {
+ String dir = null;
+ if (frameworkInstanceDir != null) {
+ dir = frameworkInstanceDir.getText().trim();
+ IPath path = new Path(dir);
+ // Adjust if the temp dir is known and has been entered
+ if (tempDirPath != null && tempDirPath.equals(path))
+ dir = null;
+
+ }
+ return dir;
+ }
+
+ protected void updateServerDirButtons() {
+ if (frameworkInstance.getInstanceDirectory() == null) {
+ IPath path = new Path(frameworkInstance.getInstanceDirectory());
+ if (path != null && path.equals(installDirPath)) {
+ frameworkInstanceDirCustom.setSelection(false);
+ } else {
+ frameworkInstanceDirCustom.setSelection(false);
+ }
+ } else {
+ frameworkInstanceDirCustom.setSelection(false);
+ }
+ }
+
+ protected void updateServerDirFields() {
+ updateServerDir();
+ boolean customServerDir = frameworkInstanceDirCustom.getSelection();
+ frameworkInstanceDir.setEnabled(allowRestrictedEditing && customServerDir);
+ frameworkInstanceDirBrowse.setEnabled(allowRestrictedEditing && customServerDir);
+ }
+
+ protected void updateServerDir() {
+ IPath path = new Path(frameworkInstance.getInstanceDirectory());
+
+ frameworkInstanceDir.setText(path.toOSString());
+ }
+
+
+
+ /**
+ * @see ServerEditorSection#getSaveStatus()
+ */
+ public IStatus[] getSaveStatus() {
+ if (frameworkInstance != null) {
+ // Check the instance directory
+ String dir = frameworkInstance.getInstanceDirectory();
+ if (dir != null) {
+ IPath path = new Path(dir);
+ // Must not be the same as the workspace location
+ if (dir.length() == 0 || workspacePath.equals(path)) {
+ return new IStatus [] {
+ new Status(IStatus.ERROR, FrameworkUIPlugin.PLUGIN_ID, Messages.errorServerDirIsRoot)};
+ }
+
+ else if (path.equals(installDirPath))
+ return new IStatus [] {
+ new Status(IStatus.ERROR, FrameworkUIPlugin.PLUGIN_ID,
+ NLS.bind(Messages.errorServerDirCustomNotInstall,
+ NLS.bind(Messages.serverEditorServerDirInstall, "").trim()))};
+ }
+
+
+ }
+ // use default implementation to return success
+ return super.getSaveStatus();
+ }
+
+ protected void validate() {
+ if (frameworkInstance != null) {
+ // Validate instance directory
+ String dir = frameworkInstance.getInstanceDirectory();
+ if (dir != null) {
+ IPath path = new Path(dir);
+ // Must not be the same as the workspace location
+ if (dir.length() == 0 || workspacePath.equals(path)) {
+ setErrorMessage(Messages.errorServerDirIsRoot);
+ return;
+ }
+ else if (path.equals(installDirPath)) {
+ setErrorMessage(NLS.bind(Messages.errorServerDirCustomNotInstall,
+ NLS.bind(Messages.serverEditorServerDirInstall, "").trim()));
+ return;
+ }
+ }
+
+ }
+ // All is okay, clear any previous error
+ setErrorMessage(null);
+ }
+
+
+ protected void handleEdit() {
+
+ try {
+ if (frameworkInstance != null && frameworkInstance.getFrameworkInstanceConfiguration() != null) {
+
+ ITargetDefinition original = frameworkInstance.getFrameworkInstanceConfiguration()
+ .getTargetDefinition();
+
+ EditTargetDefinitionWizard wizard = new EditTargetDefinitionWizard(
+ original, true);
+ wizard.setWindowTitle(Messages.configurationEditorTargetDefinitionTitle);
+ WizardDialog dialog = new WizardDialog(this.getShell(),
+ wizard);
+ if (dialog.open() == Window.OK) {
+ // Replace all references to the original with the new target
+ ITargetDefinition newTarget = wizard.getTargetDefinition();
+ frameworkInstance.getFrameworkInstanceConfiguration().setTargetDefinition(newTarget);
+ ITargetPlatformService service = TargetDefinitionUtil.getTargetPlatformService();
+ service.saveTargetDefinition(newTarget);
+ }
+ }
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "failed to update target platform definition");
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/ServerChangedCommand.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/ServerChangedCommand.java
new file mode 100644
index 0000000..dde279b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/ServerChangedCommand.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Eteration A.S. 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:
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.ui.internal.editor;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.libra.framework.core.IOSGIFrameworkInstance;
+
+
+
+
+/**
+ * This command does nothing but execute sets the dirty for the editor
+ * because the content of the target definition has changed.
+ */
+public class ServerChangedCommand extends AbstractOperation {
+
+ public ServerChangedCommand(IOSGIFrameworkInstance instance) {
+ super( "SERVER CHANGED...");
+
+ }
+
+
+
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public IStatus redo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return execute(monitor, info);
+ }
+
+ @Override
+ public IStatus undo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return Status.OK_STATUS;
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/TargetChangedCommand.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/TargetChangedCommand.java
new file mode 100644
index 0000000..51eb068
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/TargetChangedCommand.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.ui.internal.editor;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.libra.framework.core.Messages;
+import org.eclipse.pde.core.plugin.IPluginModelBase;
+import org.eclipse.pde.internal.core.target.provisional.ITargetDefinition;
+
+
+
+
+/**
+ * This command does nothing but execute sets the dirty for the editor
+ * because the content of the target definition has changed.
+ */
+public class TargetChangedCommand extends AbstractOperation {
+ protected IPluginModelBase module;
+ protected int modules = -1;
+
+
+
+ public TargetChangedCommand(ITargetDefinition definition) {
+ super( Messages.configurationEditorActionAddOsgiModule);
+
+ }
+
+
+
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public IStatus redo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return execute(monitor, info);
+ }
+
+ @Override
+ public IStatus undo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return Status.OK_STATUS;
+ }
+}
diff --git a/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/TargetDefinitionEditorPart.java b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/TargetDefinitionEditorPart.java
new file mode 100644
index 0000000..2261b0b
--- /dev/null
+++ b/plugins/org.eclipse.libra.framework.ui/src/org/eclipse/libra/framework/ui/internal/editor/TargetDefinitionEditorPart.java
@@ -0,0 +1,731 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Eteration A.S. 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:
+ * IBM Corporation - initial API and implementation
+ * - This code is based on WTP SDK frameworks and Tomcat Server Adapters
+ * org.eclipse.jst.server.core
+ * org.eclipse.jst.server.ui
+ *
+ * Naci Dai and Murat Yener, Eteration A.S.
+ *******************************************************************************/
+package org.eclipse.libra.framework.ui.internal.editor;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.TreeSet;
+
+import org.eclipse.core.runtime.CoreException;
+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.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.debug.ui.StringVariableSelectionDialog;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
+import org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager;
+import org.eclipse.jface.window.Window;
+import org.eclipse.libra.framework.core.FrameworkInstanceConfiguration;
+import org.eclipse.libra.framework.core.IOSGIFrameworkInstance;
+import org.eclipse.libra.framework.core.IOSGIFrameworkWorkingCopy;
+import org.eclipse.libra.framework.core.TargetDefinitionUtil;
+import org.eclipse.libra.framework.core.Trace;
+import org.eclipse.pde.internal.core.ICoreConstants;
+import org.eclipse.pde.internal.core.PDECore;
+import org.eclipse.pde.internal.core.target.provisional.ITargetDefinition;
+import org.eclipse.pde.internal.core.target.provisional.ITargetPlatformService;
+import org.eclipse.pde.internal.core.util.VMUtil;
+import org.eclipse.pde.internal.ui.IHelpContextIds;
+import org.eclipse.pde.internal.ui.PDEUIMessages;
+import org.eclipse.pde.internal.ui.SWTFactory;
+import org.eclipse.pde.internal.ui.shared.target.ArgumentsFromContainerSelectionDialog;
+import org.eclipse.pde.internal.ui.shared.target.ITargetChangedListener;
+import org.eclipse.pde.internal.ui.shared.target.TargetContentsGroup;
+import org.eclipse.pde.internal.ui.shared.target.TargetLocationsGroup;
+import org.eclipse.pde.internal.ui.util.LocaleUtil;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.progress.UIJob;
+import org.eclipse.wst.server.ui.editor.ServerEditorPart;
+
+
+@SuppressWarnings("restriction")
+public class TargetDefinitionEditorPart extends ServerEditorPart {
+
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
+ protected ITargetDefinition targetDefinition;
+ protected IOSGIFrameworkWorkingCopy server2;
+ protected FrameworkInstanceConfiguration configuration;
+
+ private Text fNameText;
+ private TabItem fLocationTab;
+ private TargetLocationsGroup fLocationTree;
+ private TargetContentsGroup fContentTree;
+
+ protected PropertyChangeListener listener;
+ private Button fDefaultJREButton;
+ private Button fNamedJREButton;
+ private Combo fNamedJREsCombo;
+ private Button fExecEnvButton;
+ private TreeSet fExecEnvChoices;
+ private Combo fExecEnvsCombo;
+ private TreeSet fOSChoices;
+ private Combo fOSCombo;
+ private Combo fWSCombo;
+ private TreeSet fArchChoices;
+ private Combo fArchCombo;
+ private Combo fNLCombo;
+ private Text fProgramArgs;
+ private Text fVMArgs;
+
+ private TreeSet fWSChoices;
+
+ private TreeSet fNLChoices;
+
+ public TargetDefinitionEditorPart() {
+ super();
+
+ }
+
+ public ITargetDefinition getTargetDefinition() {
+ if (configuration != null && targetDefinition == null)
+ targetDefinition = configuration.getTargetDefinition();
+ return targetDefinition;
+ }
+
+ /**
+ *
+ */
+ protected void addChangeListener() {
+ listener = new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ if (FrameworkInstanceConfiguration.ADD_BUNDLE.equals(event
+ .getPropertyName())) {
+ initialize();
+ } else if (FrameworkInstanceConfiguration.REMOVE_BUNDLE
+ .equals(event.getPropertyName())) {
+ initialize();
+ }
+ }
+ };
+ configuration.addPropertyChangeListener(listener);
+
+ }
+
+ public IStatus resolveBundles(final ITargetDefinition definition) {
+ if (!definition.isResolved()) {
+ definition.resolve(new NullProgressMonitor());
+ }
+ fContentTree.setInput(definition);
+ fLocationTree.setInput(definition);
+ if (definition.isResolved()
+ && definition.getBundleStatus().getSeverity() == IStatus.ERROR) {
+ fLocationTab.setImage(PlatformUI.getWorkbench().getSharedImages()
+ .getImage(ISharedImages.IMG_OBJS_ERROR_TSK));
+ } else {
+ fLocationTab.setImage(null);
+ }
+ return Status.OK_STATUS;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.pde.internal.ui.wizards.target.TargetDefinitionPage#targetChanged
+ * ()
+ */
+ protected void targetChanged(ITargetDefinition definition) {
+ if (fContentTree == null || fLocationTree == null)
+ return;
+
+ if (definition != null) {
+
+ String name = definition.getName();
+ if (name == null) {
+ name = "";
+ }
+
+ if (name.trim().length() > 0)
+ fNameText.setText(name);
+
+ fLocationTree.setInput(definition);
+ fContentTree.setInput(definition);
+ updateArgsEnv(definition);
+
+ }
+ }
+
+ public void targetDefinitionContentsChanged(
+ final ITargetDefinition definition, Object source, boolean resolve,
+ boolean forceResolve) {
+
+ boolean setCancelled = false;
+
+ makeDirty(definition);
+
+ targetDefinition = definition;
+
+ try {
+ new UIJob(PDEUIMessages.TargetDefinitionContentPage_0) {
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ return resolveBundles(definition);
+ }
+
+ }.schedule();
+ } catch (Exception e) {
+ Trace.trace(Trace.SEVERE, "", e);
+ }
+ if (fContentTree != source) {
+ if (setCancelled) {
+ fContentTree.setCancelled();
+ } else {
+ fContentTree.setInput(definition);
+ }
+ }
+ if (fLocationTree != source) {
+ fLocationTree.setInput(definition);
+ }
+ if (definition.isResolved()
+ && definition.getBundleStatus().getSeverity() == IStatus.ERROR) {
+ fLocationTab.setImage(PlatformUI.getWorkbench().getSharedImages()
+ .getImage(ISharedImages.IMG_OBJS_ERROR_TSK));
+ } else {
+ fLocationTab.setImage(null);
+ }
+
+
+ updateArgsEnv(definition);
+
+ //fElementViewer.refresh();
+
+ }
+
+ void makeDirty(final ITargetDefinition definition) {
+ //This command does nothing but execute sets the dirty flag
+ //for the editor because the content of the target definition has
+ //changed
+ execute(new TargetChangedCommand(definition));
+ }
+
+ private void updateArgsEnv(final ITargetDefinition definition) {
+ String presetValue = (definition.getOS() == null) ? EMPTY_STRING : definition.getOS();
+ fOSCombo.setText(presetValue);
+ presetValue = (definition.getWS() == null) ? EMPTY_STRING : definition.getWS();
+ fWSCombo.setText(presetValue);
+ presetValue = (definition.getArch() == null) ? EMPTY_STRING : definition.getArch();
+ fArchCombo.setText(presetValue);
+ presetValue = (definition.getNL() == null) ? EMPTY_STRING : LocaleUtil.expandLocaleName(definition.getNL());
+ fNLCombo.setText(presetValue);
+
+ IPath jrePath = definition.getJREContainer();
+ if (jrePath == null || jrePath.equals(JavaRuntime.newDefaultJREContainerPath())) {
+ fDefaultJREButton.setSelection(true);
+ } else {
+ String ee = JavaRuntime.getExecutionEnvironmentId(jrePath);
+ if (ee != null) {
+ fExecEnvButton.setSelection(true);
+ fExecEnvsCombo.select(fExecEnvsCombo.indexOf(ee));
+ } else {
+ String vm = JavaRuntime.getVMInstallName(jrePath);
+ if (vm != null) {
+ fNamedJREButton.setSelection(true);
+ fNamedJREsCombo.select(fNamedJREsCombo.indexOf(vm));
+ }
+ }
+ }
+
+ if (fExecEnvsCombo.getSelectionIndex() == -1)
+ fExecEnvsCombo.setText(fExecEnvChoices.first().toString());
+
+ if (fNamedJREsCombo.getSelectionIndex() == -1)
+ fNamedJREsCombo.setText(VMUtil.getDefaultVMInstallName());
+
+ updateJREWidgets();
+
+ presetValue = (definition.getProgramArguments() == null) ? EMPTY_STRING : definition.getProgramArguments();
+ fProgramArgs.setText(presetValue);
+ presetValue = (definition.getVMArguments() == null) ? EMPTY_STRING : definition.getVMArguments();
+ fVMArgs.setText(presetValue);
+ }
+
+ private void addTargetListeners() {
+
+ ITargetChangedListener listener2 = new ITargetChangedListener() {
+ public void contentsChanged(ITargetDefinition definition,
+ Object source, boolean resolve, boolean forceResolve) {
+ targetDefinitionContentsChanged(definition, source, resolve,
+ forceResolve);
+ }
+ };
+ fContentTree.addTargetChangedListener(listener2);
+ fLocationTree.addTargetChangedListener(listener2);
+ }
+
+ public void createPartControl(Composite parent) {
+ FormToolkit toolkit = getFormToolkit(parent.getDisplay());
+ targetChanged(getTargetDefinition());
+
+ Composite comp = SWTFactory.createComposite(parent, 1, 1,
+ GridData.FILL_BOTH, 0, 0);
+
+ Composite nameComp = SWTFactory.createComposite(comp, 2, 1,
+ GridData.FILL_HORIZONTAL, 0, 0);
+
+ SWTFactory.createLabel(nameComp,
+ PDEUIMessages.TargetDefinitionContentPage_4, 1);
+
+ fNameText = SWTFactory.createSingleText(nameComp, 1);
+ fNameText.setEditable(false);
+
+ TabFolder tabs = new TabFolder(comp, SWT.NONE);
+ tabs.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ fLocationTab = new TabItem(tabs, SWT.NONE);
+ fLocationTab.setText(PDEUIMessages.LocationSection_0);
+
+ Composite pluginTabContainer = SWTFactory.createComposite(tabs, 1, 1,
+ GridData.FILL_BOTH);
+ SWTFactory.createWrapLabel(pluginTabContainer,
+ PDEUIMessages.TargetDefinitionContentPage_LocationDescription,
+ 2, 400);
+ fLocationTree = TargetLocationsGroup.createInForm(pluginTabContainer,
+ toolkit);
+ fLocationTab.setControl(pluginTabContainer);
+
+ TabItem contentTab = new TabItem(tabs, SWT.NONE);
+ contentTab.setText(PDEUIMessages.TargetDefinitionContentPage_6);
+ Composite contentTabContainer = SWTFactory.createComposite(tabs, 1, 1,
+ GridData.FILL_BOTH);
+ SWTFactory.createWrapLabel(contentTabContainer,
+ PDEUIMessages.ContentSection_1, 2, 400);
+ fContentTree = TargetContentsGroup.createInForm(contentTabContainer,
+ toolkit);
+ contentTab.setControl(contentTabContainer);
+
+
+ TabItem envTab = new TabItem(tabs, SWT.NONE);
+ envTab.setText(PDEUIMessages.TargetDefinitionEnvironmentPage_3);
+ Composite envTabContainer = SWTFactory.createComposite(tabs, 1, 1, GridData.FILL_BOTH);
+ createTargetEnvironmentGroup(envTabContainer);
+ createJREGroup(envTabContainer);
+ envTab.setControl(envTabContainer);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(envTabContainer, IHelpContextIds.EDIT_TARGET_WIZARD_ENVIRONMENT_TAB);
+
+ TabItem argsTab = new TabItem(tabs, SWT.NONE);
+ argsTab.setText(PDEUIMessages.TargetDefinitionEnvironmentPage_4);
+ argsTab.setControl(createArgumentsGroup(tabs));
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(argsTab.getControl(), IHelpContextIds.EDIT_TARGET_WIZARD_ARGUMENT_TAB);
+
+
+
+ initialize();
+
+ addTargetListeners();
+
+ }
+
+ private void createJREGroup(Composite container) {
+ Group group = SWTFactory.createGroup(container, PDEUIMessages.EnvironmentBlock_jreTitle, 2, 1, GridData.FILL_HORIZONTAL);
+
+ initializeJREValues();
+
+ SWTFactory.createWrapLabel(group, PDEUIMessages.JRESection_description, 2);
+
+ fDefaultJREButton = SWTFactory.createRadioButton(group, PDEUIMessages.JRESection_defaultJRE, 2);
+ fDefaultJREButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ updateJREWidgets();
+ getTargetDefinition().setJREContainer(JavaRuntime.newDefaultJREContainerPath());
+ makeDirty(getTargetDefinition());
+ }
+ });
+
+ fNamedJREButton = SWTFactory.createRadioButton(group, PDEUIMessages.JRESection_JREName);
+ fNamedJREButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ updateJREWidgets();
+ getTargetDefinition().setJREContainer(JavaRuntime.newJREContainerPath(VMUtil.getVMInstall(fNamedJREsCombo.getText())));
+ makeDirty(getTargetDefinition());
+ }
+ });
+
+ fNamedJREsCombo = SWTFactory.createCombo(group, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY, 1, VMUtil.getVMInstallNames());
+ fNamedJREsCombo.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ getTargetDefinition().setJREContainer(JavaRuntime.newJREContainerPath(VMUtil.getVMInstall(fNamedJREsCombo.getText())));
+ makeDirty(getTargetDefinition());
+ }
+ });
+
+ fExecEnvButton = SWTFactory.createRadioButton(group, PDEUIMessages.JRESection_ExecutionEnv);
+ fExecEnvButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ updateJREWidgets();
+ getTargetDefinition().setJREContainer(JavaRuntime.newJREContainerPath(VMUtil.getExecutionEnvironment(fExecEnvsCombo.getText())));
+ makeDirty(getTargetDefinition());
+ }
+ });
+
+ fExecEnvsCombo = SWTFactory.createCombo(group, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY, 1, (String[]) fExecEnvChoices.toArray(new String[fExecEnvChoices.size()]));
+ fExecEnvsCombo.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ getTargetDefinition().setJREContainer(JavaRuntime.newJREContainerPath(VMUtil.getExecutionEnvironment(fExecEnvsCombo.getText())));
+ makeDirty(getTargetDefinition());
+ }
+ });
+
+ }
+
+
+ /**
+ * Initializes the combo with possible execution environments
+ */
+ protected void initializeJREValues() {
+ fExecEnvChoices = new TreeSet();
+ IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
+ IExecutionEnvironment[] envs = manager.getExecutionEnvironments();
+ for (int i = 0; i < envs.length; i++)
+ fExecEnvChoices.add(envs[i].getId());
+ }
+
+ protected void updateJREWidgets() {
+ fNamedJREsCombo.setEnabled(fNamedJREButton.getSelection());
+ fExecEnvsCombo.setEnabled(fExecEnvButton.getSelection());
+ }
+ private void createTargetEnvironmentGroup(Composite container) {
+ Group group = SWTFactory.createGroup(container, PDEUIMessages.EnvironmentBlock_targetEnv, 2, 1, GridData.FILL_HORIZONTAL);
+
+ initializeChoices();
+
+ SWTFactory.createWrapLabel(group, PDEUIMessages.EnvironmentSection_description, 2);
+
+ SWTFactory.createLabel(group, PDEUIMessages.Preferences_TargetEnvironmentPage_os, 1);
+
+ fOSCombo = SWTFactory.createCombo(group, SWT.SINGLE | SWT.BORDER, 1, (String[]) fOSChoices.toArray(new String[fOSChoices.size()]));
+ fOSCombo.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ String val = getModelValue(fOSCombo.getText());
+ if(getTargetDefinition().getOS() != null && !getTargetDefinition().getOS().equals(val) )
+ makeDirty(getTargetDefinition());
+ getTargetDefinition().setOS(val);
+
+ }
+ });
+
+ SWTFactory.createLabel(group, PDEUIMessages.Preferences_TargetEnvironmentPage_ws, 1);
+
+ fWSCombo = SWTFactory.createCombo(group, SWT.SINGLE | SWT.BORDER, 1, (String[]) fWSChoices.toArray(new String[fWSChoices.size()]));
+ fWSCombo.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ String val = getModelValue(fWSCombo.getText());
+ if(getTargetDefinition().getWS() != null && !getTargetDefinition().getWS().equals(val) )
+ makeDirty(getTargetDefinition());
+ getTargetDefinition().setWS(val);
+ }
+ });
+
+ SWTFactory.createLabel(group, PDEUIMessages.Preferences_TargetEnvironmentPage_arch, 1);
+
+ fArchCombo = SWTFactory.createCombo(group, SWT.SINGLE | SWT.BORDER, 1, (String[]) fArchChoices.toArray(new String[fArchChoices.size()]));
+ fArchCombo.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ String val = getModelValue(fArchCombo.getText());
+ if(getTargetDefinition().getArch() != null && !getTargetDefinition().getArch().equals(val) )
+ makeDirty(getTargetDefinition());
+ getTargetDefinition().setArch(val);
+ }
+ });
+
+ SWTFactory.createLabel(group, PDEUIMessages.Preferences_TargetEnvironmentPage_nl, 1);
+
+ fNLCombo = SWTFactory.createCombo(group, SWT.SINGLE | SWT.BORDER, 1, (String[]) fNLChoices.toArray(new String[fNLChoices.size()]));
+ fNLCombo.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ String value = fNLCombo.getText();
+ int index = value.indexOf("-"); //$NON-NLS-1$
+ if (index > 0)
+ value = value.substring(0, index);
+ String val = getModelValue(value);
+ if(getTargetDefinition().getNL() != null && !getTargetDefinition().getNL().equals(val) )
+ makeDirty(getTargetDefinition());
+ getTargetDefinition().setNL(val);
+ }
+ });
+ }
+
+ /**
+ * Returns the given string or <code>null</code> if the string is empty.
+ * Used when setting a value in the target definition.
+ *
+ * @param value
+ * @return trimmed value or <code>null</code>
+ */
+ private String getModelValue(String value) {
+ if (value != null) {
+ value = value.trim();
+ if (value.length() == 0) {
+ return null;
+ }
+ }
+ return value;
+ }
+
+ /**
+ * Delimits a comma separated preference and add the items to the given set
+ * @param set
+ * @param preference
+ */
+ private void addExtraChoices(Set set, String preference) {
+ StringTokenizer tokenizer = new StringTokenizer(preference, ","); //$NON-NLS-1$
+ while (tokenizer.hasMoreTokens()) {
+ set.add(tokenizer.nextToken().trim());
+ }
+ }
+ /**
+ * Loads combo choices fromt he platform and from PDE core preferences
+ */
+ private void initializeChoices() {
+ IEclipsePreferences node = new InstanceScope().getNode(PDECore.PLUGIN_ID);
+
+ fOSChoices = new TreeSet();
+ String[] os = Platform.knownOSValues();
+ for (int i = 0; i < os.length; i++) {
+ fOSChoices.add(os[i]);
+ }
+ String pref = node.get(ICoreConstants.OS_EXTRA, EMPTY_STRING);
+ if (!EMPTY_STRING.equals(pref)) {
+ addExtraChoices(fOSChoices, pref);
+ }
+
+ fWSChoices = new TreeSet();
+ String[] ws = Platform.knownWSValues();
+ for (int i = 0; i < ws.length; i++) {
+ fWSChoices.add(ws[i]);
+ }
+ pref = node.get(ICoreConstants.WS_EXTRA, EMPTY_STRING);
+ if (!EMPTY_STRING.equals(pref)) {
+ addExtraChoices(fWSChoices, pref);
+ }
+
+ fArchChoices = new TreeSet();
+ String[] arch = Platform.knownOSArchValues();
+ for (int i = 0; i < arch.length; i++) {
+ fArchChoices.add(arch[i]);
+ }
+ pref = node.get(ICoreConstants.ARCH_EXTRA, EMPTY_STRING);
+ if (!EMPTY_STRING.equals(pref)) {
+ addExtraChoices(fArchChoices, pref);
+ }
+
+ fNLChoices = new TreeSet();
+ String[] nl = LocaleUtil.getLocales();
+ for (int i = 0; i < nl.length; i++) {
+ fNLChoices.add(nl[i]);
+ }
+ pref = node.get(ICoreConstants.NL_EXTRA, EMPTY_STRING);
+ if (!EMPTY_STRING.equals(pref)) {
+ addExtraChoices(fNLChoices, pref);
+ }
+ }
+ private Control createArgumentsGroup(Composite parent) {
+ Composite container = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH);
+
+ SWTFactory.createWrapLabel(container, PDEUIMessages.JavaArgumentsTab_description, 1);
+
+ Group programGroup = SWTFactory.createGroup(container, PDEUIMessages.JavaArgumentsTab_progamArgsGroup, 1, 1, GridData.FILL_HORIZONTAL);
+
+ fProgramArgs = SWTFactory.createText(programGroup, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL, 1, 200, 60, GridData.FILL_BOTH);
+ fProgramArgs.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ String val = fProgramArgs.getText().trim();
+ if(getTargetDefinition().getProgramArguments() != null && !getTargetDefinition().getProgramArguments().equals(val) )
+ makeDirty(getTargetDefinition());
+ getTargetDefinition().setProgramArguments(val);
+
+ }
+ });
+
+ Composite programButtons = SWTFactory.createComposite(programGroup, 1, 1, GridData.HORIZONTAL_ALIGN_END, 0, 0);
+
+ Button programVars = SWTFactory.createPushButton(programButtons, PDEUIMessages.JavaArgumentsTab_programVariables, null, GridData.HORIZONTAL_ALIGN_END);
+ programVars.addSelectionListener(getVariablesListener(fProgramArgs));
+
+ Group vmGroup = new Group(container, SWT.NONE);
+ vmGroup.setLayout(new GridLayout(1, false));
+ vmGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ vmGroup.setText(PDEUIMessages.JavaArgumentsTab_vmArgsGroup);
+
+ fVMArgs = SWTFactory.createText(vmGroup, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL, 1, 200, 60, GridData.FILL_BOTH);
+ fVMArgs.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ String val = fVMArgs.getText().trim();
+ if(getTargetDefinition().getVMArguments() != null && !getTargetDefinition().getVMArguments().equals(val) )
+ makeDirty(getTargetDefinition());
+ getTargetDefinition().setVMArguments(val);
+ }
+ });
+
+ Composite buttons = SWTFactory.createComposite(vmGroup, 2, 1, GridData.HORIZONTAL_ALIGN_END, 0, 0);
+
+ Button vmArgs = SWTFactory.createPushButton(buttons, PDEUIMessages.JavaArgumentsTab_addVMArgs, null, GridData.HORIZONTAL_ALIGN_END);
+ vmArgs.addSelectionListener(getVMArgsListener(fVMArgs));
+
+ Button vmVars = SWTFactory.createPushButton(buttons, PDEUIMessages.JavaArgumentsTab_vmVariables, null, GridData.HORIZONTAL_ALIGN_END);
+ vmVars.addSelectionListener(getVariablesListener(fVMArgs));
+ return container;
+ }
+
+
+ /**
+ * Provide a listener for the Add VM Arguments button.
+ * The listener invokes the <code>VMArgumentsSelectionDialog</code> and
+ * updates the selected VM Arguments back in the VM Arguments Text Box
+ *
+ * @param textControl
+ * @return <code>SelectionListener</code> for the Add VM Arguments button
+ */
+ private SelectionListener getVMArgsListener(final Text textControl) {
+ return new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ ArgumentsFromContainerSelectionDialog dialog = new ArgumentsFromContainerSelectionDialog(getEditorSite()
+ .getShell(), getTargetDefinition());
+ if (dialog.open() == Window.OK) {
+ String[] args = dialog.getSelectedArguments();
+ if (args != null && args.length > 0) {
+ StringBuffer resultBuffer = new StringBuffer();
+ for (int index = 0; index < args.length; ++index) {
+ resultBuffer.append(args[index] + " "); //$NON-NLS-1$
+ }
+ fVMArgs.insert(resultBuffer.toString());
+ }
+ }
+ }
+ };
+ }
+
+ /**
+ * Provide a listener for the Variables button.
+ * The listener invokes the <code>StringVariableSelectionDialog</code> and
+ * updates the selected Variables back in the VM Arguments Text Box
+ *
+ * @param textControl
+ * @return <code>SelectionListener</code> for the Variables button
+ */
+ private SelectionListener getVariablesListener(final Text textControl) {
+ return new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getEditorSite()
+ .getShell());
+ dialog.open();
+ String variable = dialog.getVariableExpression();
+ if (variable != null) {
+ textControl.insert(variable);
+ }
+ }
+ };
+ }
+
+
+
+
+ public void dispose() {
+ super.dispose();
+ if (configuration != null) {
+ configuration.removePropertyChangeListener(listener);
+ }
+
+ }
+
+ /*
+ * (non-Javadoc) Initializes the editor part with a site and input.
+ */
+ public void init(IEditorSite site, IEditorInput input) {
+ super.init(site, input);
+
+ IOSGIFrameworkInstance ts = (IOSGIFrameworkInstance) server.loadAdapter(
+ IOSGIFrameworkInstance.class, null);
+
+ try {
+ configuration = ts.getFrameworkInstanceConfiguration();
+ if (configuration != null
+ && configuration.getTargetDefinition() != null)
+ getTargetDefinition().resolve(new NullProgressMonitor());
+ } catch (CoreException e) {
+ Trace.trace(Trace.SEVERE, "cannot access configuration", e);
+ }
+
+ if (server != null)
+ server2 = (IOSGIFrameworkWorkingCopy) server.loadAdapter(
+ IOSGIFrameworkWorkingCopy.class, null);
+
+ addChangeListener();
+ initialize();
+ }
+
+ /**
+ *
+ */
+ protected void initialize() {
+
+ ITargetDefinition definition = getTargetDefinition();
+ if (definition != null)
+ definition.resolve(new NullProgressMonitor());
+ targetChanged(definition);
+ }
+
+ /*
+ * @see IWorkbenchPart#setFocus()
+ */
+ public void setFocus() {
+
+ }
+
+ @Override
+ public void doSave(IProgressMonitor monitor) {
+ super.doSave(monitor);
+ IOSGIFrameworkInstance runtimeInstance = (IOSGIFrameworkInstance) server
+ .loadAdapter(IOSGIFrameworkInstance.class, null);
+
+ try {
+ runtimeInstance.getFrameworkInstanceConfiguration()
+ .setTargetDefinition(getTargetDefinition());
+ ITargetPlatformService service = TargetDefinitionUtil.getTargetPlatformService();
+ service.saveTargetDefinition(getTargetDefinition());
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+
+ }
+}