Merge branch 'gwt_with_maven' into gwt

Conflicts:
	java/com.sap.sailing.gwt.ui/war/AdminConsole.html
	java/com.sap.sailing.gwt.ui/war/com.sap.sailing.gwt.ui.AdminConsole/25D478C27AF504BEED94EB4348AAF86D.cache.html
	java/com.sap.sailing.gwt.ui/war/com.sap.sailing.gwt.ui.AdminConsole/2D39CCE77021C160B4503B8E88B59BBC.cache.html
	java/com.sap.sailing.gwt.ui/war/com.sap.sailing.gwt.ui.AdminConsole/5BC57D4AD0A2D0CCD94DDAD844D45D70.cache.html
	java/com.sap.sailing.gwt.ui/war/com.sap.sailing.gwt.ui.AdminConsole/75CCF863D8F64D3E950E0037F93CEACB.cache.html
	java/com.sap.sailing.gwt.ui/war/com.sap.sailing.gwt.ui.AdminConsole/E011E94D758C5ABB01DCBAED8E54B8B5.cache.html
	java/com.sap.sailing.gwt.ui/war/com.sap.sailing.gwt.ui.AdminConsole/E4F8045C2518B78CB125CAC288391796.cache.html
	java/com.sap.sailing.gwt.ui/war/com.sap.sailing.gwt.ui.AdminConsole/com.sap.sailing.gwt.ui.AdminConsole.nocache.js
This commit is contained in:
Axel Uhl committed 2011-08-22 15:39:49 +02:00
commit a747987177
88 files changed
+779 -14994

No files matched your search

+4 -4
View File
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry exported="true" kind="lib" path="war/WEB-INF/classes/"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-maps.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-servlet.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-visualization.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/pwt-sap.ui.commons-0.18.0-20110817.025846-27.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/pwt-sap.ui.core-0.18.0-20110817.025846-27.jar"/>
<classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath>
+6
View File
@@ -30,8 +30,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
@@ -1,3 +1,6 @@
#Mon Jul 04 13:54:49 CEST 2011
#Mon Aug 22 09:21:00 CEST 2011
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
launchConfigExternalUrlPrefix=
warSrcDir=war
warSrcDirIsOutput=true
@@ -15,12 +15,20 @@ Require-Bundle: javax.servlet;bundle-version="2.5.0",
org.json.simple;bundle-version="1.1.0",
com.sap.sailing.mongodb,
com.mongodb.driver;bundle-version="2.6.2",
com.sap.sailing.declination
Bundle-ClassPath: war/WEB-INF/classes/,
.,
lib/gwt-maps.jar,
com.sap.sailing.declination,
com.sap.ui.phoenix.pwt-sap.ui.commons,
com.sap.ui.phoenix.pwt-sap.ui.core,
com.sap.ui.phoenix.commons,
com.sap.ui.phoenix.core
Bundle-ClassPath: lib/resource-0.18.0-20110822.000513-32.jar,
lib/gwt-visualization.jar,
lib/gwt-maps.jar,
lib/pwt-sap.ui.commons-0.18.0-20110817.025846-27.jar,
lib/pwt-sap.ui.core-0.18.0-20110817.025846-27.jar
lib/pwt-sap.ui.core-0.18.0-20110817.025846-27.jar,
lib/commons-0.18.0-20110822.000513-32.jar,
lib/core-0.18.0-20110822.000513-32.jar,
war/WEB-INF/classes/,
.
Bundle-Activator: com.sap.sailing.gwt.ui.server.Activator
Bundle-ActivationPolicy: lazy
Export-Package: com.sap.sailing.gwt.ui.server
@@ -12,7 +12,7 @@
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-noserver -remoteUI &quot;${gwt_remote_ui_server_port}:${unique_id}&quot; -logLevel INFO -codeServerPort auto -war C:\data\SAP\sailing\workspace\java\com.sap.sailing.gwt.ui\war com.sap.sailing.gwt.ui.AdminConsole"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-war C:\data\SAP\sailing\workspace\java\com.sap.sailing.gwt.ui\war -noserver -remoteUI &quot;${gwt_remote_ui_server_port}:${unique_id}&quot; -logLevel INFO -codeServerPort auto com.sap.sailing.gwt.ui.AdminConsole"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.gwt.ui"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx512m"/>
</launchConfiguration>
+11 -4
View File
@@ -1,9 +1,16 @@
source.. = src/
source.. = src/main/java,\
src/main/resources
output.. = war/WEB-INF/classes
bin.includes = META-INF/,\
.,\
plugin.xml,\
war/,\
lib/gwt-maps.jar,\
lib/gwt-visualization.jar,\
lib/pwt-sap.ui.commons-0.18.0-20110817.025846-27.jar,\
lib/pwt-sap.ui.core-0.18.0-20110817.025846-27.jar
lib/pwt-sap.ui.core-0.18.0-20110817.025846-27.jar,\
lib/commons-0.18.0-20110822.000513-32.jar,\
lib/core-0.18.0-20110822.000513-32.jar,\
lib/resource-0.18.0-20110822.000513-32.jar,\
lib/gwt-maps.jar,\
bin/com.sap.sailing.gwt.ui-1.0.0-SNAPSHOT/
bin.excludes = war/com.sap.sailing.gwt.ui.AdminConsole/,\
war/WEB-INF/deploy/
Binary file not shown.
+63
View File
@@ -10,4 +10,67 @@
<artifactId>com.sap.sailing.gwt.ui</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sap.ui.phoenix</groupId>
<artifactId>pwt-sap.ui.commons</artifactId>
<version>0.18.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sap.ui.phoenix</groupId>
<artifactId>pwt-sap.ui.core</artifactId>
<version>0.18.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sap.ui.phoenix</groupId>
<artifactId>core</artifactId>
<version>0.18.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sap.ui.phoenix</groupId>
<artifactId>commons</artifactId>
<version>0.18.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.gwt.google-apis</groupId>
<artifactId>gwt-maps</artifactId>
<version>1.1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.3.0-1</version>
<executions>
<!-- GWT version detected from dependencyManagement -->
<execution>
<configuration>
<module>com.sap.sailing.gwt.ui.AdminConsole</module>
</configuration>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -21,8 +21,7 @@
<script id="sap-ui-bootstrap"
type="text/javascript"
<!-- use the following line to obtain the Phoenix bootstrap code from SAP's internal server:
src="http://vephxinfra.dhcp.wdf.sap.corp:8080/phoenix-cdn/resources/sap-ui-core.js"
src="/resources/sap-ui-core.js"
-->
<!-- Use the following line to use a cached/checked-in copy of the Phoenix bootstrap code: -->
src="/sap-ui-core.js"
@@ -24,5 +24,5 @@
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
<booleanAttribute key="useDefaultConfigArea" value="false"/>
<stringAttribute key="workspace_bundles" value="com.google.gwt.osgi@default:default,com.googlecode.java-diff-utils.test@default:default,com.googlecode.java-diff-utils@default:default,com.mongodb.driver@default:default,com.sap.sailing.declination.test@default:default,com.sap.sailing.declination@default:default,com.sap.sailing.domain.test@default:default,com.sap.sailing.domain.tractracadapter@default:default,com.sap.sailing.domain@default:default,com.sap.sailing.expeditionconnector.test@default:default,com.sap.sailing.expeditionconnector@default:default,com.sap.sailing.gwt.ui@default:default,com.sap.sailing.mongodb.test@default:default,com.sap.sailing.mongodb@default:default,com.sap.sailing.server.test@default:default,com.sap.sailing.server@default:default,com.tractrac.clientmodule@default:default,com.tractrac.resultapi@default:default,org.json.simple@default:default"/>
<stringAttribute key="workspace_bundles" value="com.google.gwt.osgi@default:default,com.googlecode.java-diff-utils.test@default:default,com.googlecode.java-diff-utils@default:default,com.mongodb.driver@default:default,com.sap.sailing.declination.test@default:default,com.sap.sailing.declination@default:default,com.sap.sailing.domain.test@default:default,com.sap.sailing.domain.tractracadapter@default:default,com.sap.sailing.domain@default:default,com.sap.sailing.expeditionconnector.test@default:default,com.sap.sailing.expeditionconnector@default:default,com.sap.sailing.gwt.ui@default:default,com.sap.sailing.mongodb.test@default:default,com.sap.sailing.mongodb@default:default,com.sap.sailing.server.test@default:default,com.sap.sailing.server@default:default,com.sap.ui.phoenix.resource-osgi@default:false,com.tractrac.clientmodule@default:default,com.tractrac.resultapi@default:default,org.json.simple@default:default"/>
</launchConfiguration>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
+28
View File
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.sap.ui.phoenix.resource-osgi</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>
@@ -0,0 +1,8 @@
#Mon Aug 22 11:03:06 CEST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
@@ -0,0 +1,4 @@
#Mon Aug 22 11:03:06 CEST 2011
eclipse.preferences.version=1
pluginProject.extensions=false
resolve.requirebundle=false
+11
View File
@@ -0,0 +1,11 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Resource-osgi
Bundle-SymbolicName: com.sap.ui.phoenix.resource-osgi;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: SAP
Fragment-Host: com.sap.ui.phoenix.resource
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.osgi,
javax.servlet,
com.sap.sailing.gwt.ui
+4
View File
@@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>root</artifactId>
<groupId>com.sap.sailing</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>com.sap.ui.phoenix.resource-osgi</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<dependencies>
<dependency>
<groupId>com.sap.ui.phoenix</groupId>
<artifactId>resource</artifactId>
<version>0.18.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sap.ui.phoenix</groupId>
<artifactId>pwt-sap.ui.commons</artifactId>
<version>0.18.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,486 @@
/*
* Copyright 2010 by SAP AG, Walldorf., http://www.sap.com.
* All rights reserved. Use is subject to license terms.
* This software is the confidential and proprietary information
* of SAP AG, Walldorf. You shall not disclose such confidential
* information and shall use it only in accordance with the terms
* of the license agreement you entered into with SAP.
*/
package com.sap.phx.resource.impl.osgi;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.ServletContext;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleListener;
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
import com.sap.phx.resource.Resource;
import com.sap.phx.resource.ResourceLocator;
import com.sap.phx.resource.ResourceUtil;
import com.sap.phx.resource.impl.ServletResource;
import com.sap.sailing.gwt.ui.server.Activator;
/**
* The class <b><code>OSGiResourceLocator</code></b> is used to find the
* Phoenix resource within an OSGi environment. Is extracts the bundle
* context out of the servlet context and uses the bundles to determine
* the resources from.
* <br>
* @author D039071@exchange.sap.corp
* @author <code>Revision Author: ($Author: d039071 $)</code>
* @version 1.0 - 20.12.2010 13:20:23
* @version <code>Revision Version: ($Revision: #5 $)</code>
* @version <code>Revision Date: ($Date: 2011/08/18 $)</code>
*/
public class OSGiResourceLocator implements ResourceLocator, BundleListener {
/** pattern to split the require-bundle header to determine each bundle */
private final static String REQUIRE_BUNDLE_SPLITTER = ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)";
/** reference to the logger */
private final static Logger LOG = Logger.getLogger(OSGiResourceLocator.class.getName());
/** reference to the <code>ServletContext</code> */
private ServletContext context = null;
/** reference to the <code>BundleContext</code> */
private BundleContext bundleContext = null;
/** list of <code>BundleInfo</code>s of the required bundles */
private Map<String, BundleInfo> requiredBundles = null;
/** list of library <code>Bundle</code>s */
private List<Bundle> libraryBundles = null;
/** list of <code>Bundle</code>s to be aware of */
private List<Bundle> resourceBundles = null;
/**
* constructs the class <code>OSGiResourceLocator</code>
*/
public OSGiResourceLocator() {
super();
} // constructor
/* (non-Javadoc)
* @see com.sap.phx.resource.ResourceLocator#init(javax.servlet.ServletContext)
*/
@Override
public void init(ServletContext context) {
this.bundleContext = Activator.getDefault();
// keep the references to the servlet context and retrieve the
// bundle context
this.context = context;
// this.bundleContext = (BundleContext) this.context.getAttribute(ATTR_BUNDLECONTEXT);
this.bundleContext.addBundleListener(this);
// determine the bundles which should be observed for resources
this.libraryBundles = new ArrayList<Bundle>();
this.libraryBundles.add(this.bundleContext.getBundle());
for (Bundle bundle : this.bundleContext.getBundles()) {
if (this.isLibraryBundle(bundle)) {
this.libraryBundles.add(bundle);
}
}
// find the list of the required bundles in the list of
// available UI library bundles depending on their version
// (this feature is not supported by the OSGi framework)
String requireBundleString = (String) this.bundleContext.getBundle().getHeaders().get(Constants.REQUIRE_BUNDLE);
String[] bundles = requireBundleString != null ? requireBundleString.split(REQUIRE_BUNDLE_SPLITTER) : new String[0];
this.requiredBundles = new HashMap<String, BundleInfo>();
for (String b : bundles) {
BundleInfo info = new BundleInfo(b);
this.requiredBundles.put(info.getSymbolicName(), info);
}
// determine the resource bundles
this.determineResourceBundles();
} // method: init
/* (non-Javadoc)
* @see com.sap.phx.resource.ResourceLocator#findResource(java.lang.String)
*/
@Override
public Resource findResource(String requestPath) {
// check for a valid context
assert(context != null);
try {
// resolve the resource either out of the bundle/bundle classpath or
// out of the resource bundles
URL resourceUrl = this.bundleContext.getBundle().getResource(requestPath);
if (resourceUrl == null) {
for (Bundle bundle : this.resourceBundles) {
resourceUrl = bundle.getResource(ResourceUtil.CLASSPATH_PATH_PREFIX + requestPath);
if (resourceUrl != null) {
return new ServletResource(this.context, requestPath, resourceUrl, "CLASSPATH");
}
}
} else {
return new ServletResource(this.context, requestPath, resourceUrl, "CLASSPATH");
}
// check locally => if not in classpath
resourceUrl = ResourceLocator.class.getClassLoader().getResource(ResourceUtil.CLASSPATH_PATH_PREFIX + requestPath);
if (resourceUrl != null) {
return new ServletResource(this.context, requestPath, resourceUrl, "CLASSPATH");
}
} catch (MalformedURLException ex) {
LOG.log(Level.WARNING, ex.getMessage(), ex); // (should never occur)
}
// check for themes request => negotiate
if (Resource.isThemeRequest(requestPath)) {
// prevent additional negotiation of request path (once it has been done!)
String newRequestPath = Resource.negotiateThemeRequest(requestPath);
if (!requestPath.equals(newRequestPath)) {
return this.findResource(newRequestPath);
}
}
return null;
} // method: findResource
/* (non-Javadoc)
* @see com.sap.phx.resource.ResourceLocator#listResources(java.lang.String)
*/
@SuppressWarnings("unchecked")
@Override
public List<Resource> listResources(String requestPath) {
// check for a valid context
assert(context != null);
if (!Resource.isFileRequest(requestPath)) {
List<Resource> resources = new ArrayList<Resource>();
// check the current bundle for relevant entries
Enumeration<String> resourcePaths = this.bundleContext.getBundle().getEntryPaths(requestPath);
if (resourcePaths != null) {
while (resourcePaths.hasMoreElements()) {
resources.add(this.findResource(resourcePaths.nextElement()));
}
}
// check the classpath bundles for relevant entries
for (Bundle bundle : this.resourceBundles) {
resourcePaths = bundle.getEntryPaths(ResourceUtil.CLASSPATH_PATH_PREFIX + requestPath);
if (resourcePaths != null) {
while (resourcePaths.hasMoreElements()) {
resources.add(this.findResource(resourcePaths.nextElement().substring(ResourceUtil.CLASSPATH_PATH_PREFIX.length())));
}
}
}
return resources;
}
return Collections.EMPTY_LIST;
} // method: listResources
/* (non-Javadoc)
* @see com.sap.phx.resource.ResourceLocator#listResourcePaths(java.lang.String)
*/
@SuppressWarnings("unchecked")
@Override
public List<String> listResourcePaths(String requestPath) {
// check for a valid context
assert(context != null);
if (!Resource.isFileRequest(requestPath)) {
List<String> paths = new ArrayList<String>();
// check the current bundle for relevant entries
Enumeration<String> resourcePaths = this.bundleContext.getBundle().getEntryPaths(requestPath);
if (resourcePaths != null) {
while (resourcePaths.hasMoreElements()) {
paths.add(resourcePaths.nextElement());
}
}
// check the classpath bundles for relevant entries
for (Bundle bundle : this.resourceBundles) {
resourcePaths = bundle.getEntryPaths(ResourceUtil.CLASSPATH_PATH_PREFIX + requestPath);
if (resourcePaths != null) {
while (resourcePaths.hasMoreElements()) {
paths.add(resourcePaths.nextElement().substring(ResourceUtil.CLASSPATH_PATH_PREFIX.length()));
}
}
}
return paths;
}
return Collections.EMPTY_LIST;
} // method: listResourcePaths
/* (non-Javadoc)
* @see org.osgi.framework.BundleListener#bundleChanged(org.osgi.framework.BundleEvent)
*/
@Override
public void bundleChanged(BundleEvent event) {
// update the list of library bundles
Bundle b = event.getBundle();
if (this.isLibraryBundle(b)) {
switch (event.getType()) {
case BundleEvent.INSTALLED:
this.libraryBundles.add(b);
break;
case BundleEvent.UNINSTALLED:
if (this.libraryBundles.contains(b)) {
this.libraryBundles.remove(b);
}
break;
case BundleEvent.UPDATED:
if (this.libraryBundles.contains(b)) {
this.libraryBundles.remove(b);
}
this.libraryBundles.add(b);
}
// update the list of the resource bundles only when the new bundle
// is in specified as required bundle for this bundle
if (this.requiredBundles.containsKey(b.getSymbolicName()) &&
this.requiredBundles.get(b.getSymbolicName()).isBundleInRange(b)) {
this.determineResourceBundles();
}
}
} // method: bundleChanged
/**
* determines the resource bundles, which can be used for resource
* determination by the OSGi resource handler
*/
private void determineResourceBundles() {
// determine the resource bundles
Map<String, Bundle> bundles = new HashMap<String, Bundle>();
for (Bundle b : this.libraryBundles) {
// only check bundles, which are required
BundleInfo bi = this.requiredBundles.get(b.getSymbolicName());
if (bi != null) {
// check the bundle to be in the range as defined in require-bundle
if (bi.isBundleInRange(b)) {
// is the bundle already added - cause it could only be added once!
if (!bundles.containsKey(b.getSymbolicName())) {
// no: so add it!
bundles.put(b.getSymbolicName(), b);
} else {
// yes: so only add the bundle with the latest version!
Bundle old = bundles.get(b.getSymbolicName());
if (b.getVersion().compareTo(old.getVersion()) > 0) {
bundles.put(b.getSymbolicName(), b);
}
}
}
}
}
this.resourceBundles = new ArrayList<Bundle>(bundles.values());
} // method: determineResourceBundles
/**
* checks within the MANIFEST for containing the information to be a UILIbrary
* @param bundle reference to the <code>Bundle</code>
* @return true, if the <code>Bundle</code> is a UILibrary in Phoenix manner
*/
private boolean isLibraryBundle(Bundle bundle) {
String header = (String) bundle.getHeaders().get("x-sap-ui-ContentTypes");
return header != null && header.contains("UILibrary");
} // method: isLibraryBundle
/**
* The inner class <b><code>BundleInfo</code></b> parses the require-bundle
* string and provides support for checking a <code>Bundle</code> to be in
* the range of the require-bundle specification.
* <br>
* @author D039071@exchange.sap.corp
* @author <code>Revision Author: ($Author: d039071 $)</code>
* @version 1.0 - 18.08.2011 09:47:18
* @version <code>Revision Version: ($Revision: #5 $)</code>
* @version <code>Revision Date: ($Date: 2011/08/18 $)</code>
*/
static class BundleInfo {
/** pattern to parse the bundle version information */
private static final Pattern BUNDLE_VERSION = Pattern.compile(".*bundle-version=\"([\\(\\[])?([^,]*)?(,([^,\\)\\]]*)?([\\)\\]])?)?\".*", Pattern.DOTALL);
/** symbolic name of the bundle */
private String symbolicName = null;
/** min version */
private Version minVersion = null;
/** min version inclusive */
private boolean minInclusive = false;
/** max version */
private Version maxVersion = null;
/** max version inclusive */
private boolean maxInclusive = false;
/**
* constructs the class <code>BundleInfo</code>
* @param requireBundleString require bundle string
*/
public BundleInfo(String requireBundleString) {
super();
// options are separated with a semicolon
if (requireBundleString.indexOf(";") == -1) {
// no additional options, only the symbolic name of the bundle
this.symbolicName = requireBundleString;
} else {
// split the symbolic name and the options
this.symbolicName = requireBundleString.substring(0, requireBundleString.indexOf(";"));
String options = requireBundleString.substring(requireBundleString.indexOf(";") + 1);
// extract the bundle version information with a regex to fetch the
// inclusive/exclusive information and the min and max version if specified
Matcher m = BUNDLE_VERSION.matcher(options);
if (m.matches()) {
for (int i = 0; i <= m.groupCount(); i++) {
this.minInclusive = m.group(1) != null && m.group(1).equals("[");
this.minVersion = m.group(2) != null ? Version.parseVersion(m.group(2)) : null;
this.maxVersion = m.group(4) != null ? Version.parseVersion(m.group(4)) : null;
this.maxInclusive = m.group(5) != null && m.group(5).equals("]");
}
}
}
} // constructor
/**
* returns the symbolic name of the bundle
* @return symbolic name of the bundle
*/
public String getSymbolicName() {
return this.symbolicName;
} // method: getSymbolicName
/**
* check the given <code>Bundle</code> to be in the specifed range of the
* require-bundle information
* @param bundle <code>Bundle</code> to be checked
* @return true, if the <code>Bundle</code> is in range
*/
public boolean isBundleInRange(Bundle bundle) {
// new org.osgi.framework.Version("0.18.0").compareTo(new org.osgi.framework.Version("0.17.0"))
// (int) 1
// new org.osgi.framework.Version("0.17.0").compareTo(new org.osgi.framework.Version("0.18.0"))
// (int) -1
// new org.osgi.framework.Version("0.18.0").compareTo(new org.osgi.framework.Version("0.18.0"))
// (int) 0
if (bundle != null) {
// check for being in range
if (this.minVersion == null && this.maxVersion == null) {
// no versions are specified: supported!
return true;
} else if (this.minVersion != null && this.maxVersion == null) {
// only the min version is specified so we accept the same
// an larger versions of the bundle
return this.minVersion.compareTo(bundle.getVersion()) <= 0;
} else {
// in case of min and max version is specified we check that the
// given bundle is between those versions by checking the inlusion
// and exclusion information of the specified range
int result = this.minVersion.compareTo(bundle.getVersion());
if (result <= (this.minInclusive ? 0 : -1)) {
result = this.maxVersion.compareTo(bundle.getVersion());
return (result >= (this.maxInclusive ? 0 : 1));
}
}
}
return false;
} // method: isBundleInRange
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
StringBuffer infoString = new StringBuffer(this.symbolicName);
if (minVersion != null && maxVersion == null) {
infoString.append(" - ");
infoString.append(this.minVersion);
} else if (minVersion != null && maxVersion != null) {
infoString.append(" - ");
infoString.append(minInclusive ? "[" : "(");
infoString.append(minVersion);
infoString.append(",");
infoString.append(maxVersion);
infoString.append(maxInclusive ? "]" : ")");
}
return infoString.toString();
} // method: toString
} // inner class: BundleInfo
} // class: OSGiResourceLocator
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>
+28
View File
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.sap.ui.phoenix.resource-servlet</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>
@@ -0,0 +1,8 @@
#Mon Aug 22 15:13:12 CEST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
@@ -0,0 +1,4 @@
#Mon Aug 22 15:13:12 CEST 2011
eclipse.preferences.version=1
pluginProject.extensions=false
resolve.requirebundle=false
@@ -0,0 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Resource-servlet
Bundle-SymbolicName: com.sap.ui.phoenix.resource-servlet;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: SAP
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.osgi.framework;version="1.3.0"
Require-Bundle: com.sap.ui.phoenix.resource
@@ -0,0 +1,3 @@
bin.includes = META-INF/,\
.,\
plugin.xml
+13
View File
@@ -0,0 +1,13 @@
<plugin>
<extension
point="org.eclipse.equinox.http.registry.servlets">
<servlet
alias="/resources"
class="com.sap.phx.resource.ResourceServlet"
load-on-startup="true">
<init-param
name="com.sap.phx.resource.DEV_MODE" value="true">
</init-param>
</servlet>
</extension>
</plugin>
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>root</artifactId>
<groupId>com.sap.sailing</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>com.sap.ui.phoenix.resource-servlet</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<dependencies>
<dependency>
<groupId>com.sap.ui.phoenix</groupId>
<artifactId>resource</artifactId>
<version>0.18.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
+8
View File
@@ -33,6 +33,7 @@
<module>com.mongodb.driver</module>
<module>com.googlecode.java-diff-utils</module>
<module>com.googlecode.java-diff-utils.test</module>
<module>com.sap.ui.phoenix.resource-osgi</module>
</modules>
<properties>
@@ -101,6 +102,7 @@
<arch>x86_64</arch>
</environment>
</environments>
<pomDependencies>consider</pomDependencies>
</configuration>
</plugin>
<plugin>
@@ -159,6 +161,12 @@
<id>eclipse</id>
<url>http://download.eclipse.org/releases/indigo/</url>
</repository>
<!--
<repository>
<id>sap-nexus</id>
<url>http://nexus.wdf.sap.corp:8081/nexus</url>
</repository>
-->
<!--
<repository>
<id>central</id>