geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r375386 - in /geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core: schema/discouragedRuntimeAccess.exsd src/org/apache/geronimo/core/internal/GeronimoServerRuntimeTargetHandler.java
Date Mon, 06 Feb 2006 21:38:03 GMT
Author: sppatel
Date: Mon Feb  6 13:38:01 2006
New Revision: 375386

URL: http://svn.apache.org/viewcvs?rev=375386&view=rev
Log:
need to bind extension point to runtimeTypeId

Modified:
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/schema/discouragedRuntimeAccess.exsd
    geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServerRuntimeTargetHandler.java

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/schema/discouragedRuntimeAccess.exsd
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/schema/discouragedRuntimeAccess.exsd?rev=375386&r1=375385&r2=375386&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/schema/discouragedRuntimeAccess.exsd
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/schema/discouragedRuntimeAccess.exsd
Mon Feb  6 13:38:01 2006
@@ -13,7 +13,7 @@
    <element name="extension">
       <complexType>
          <sequence>
-            <element ref="path" minOccurs="0" maxOccurs="unbounded"/>
+            <element ref="restriction" minOccurs="0" maxOccurs="unbounded"/>
          </sequence>
          <attribute name="point" type="string" use="required">
             <annotation>
@@ -44,7 +44,22 @@
 
    <element name="path">
       <complexType>
-         <attribute name="value" type="string">
+         <attribute name="value" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="restriction">
+      <complexType>
+         <sequence>
+            <element ref="path" minOccurs="1" maxOccurs="unbounded"/>
+         </sequence>
+         <attribute name="id" type="string" use="required">
             <annotation>
                <documentation>
                   

Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServerRuntimeTargetHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServerRuntimeTargetHandler.java?rev=375386&r1=375385&r2=375386&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServerRuntimeTargetHandler.java
(original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServerRuntimeTargetHandler.java
Mon Feb  6 13:38:01 2006
@@ -17,10 +17,11 @@
 
 import java.io.File;
 import java.util.ArrayList;
-import java.util.HashSet;
+import java.util.Collection;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
+import java.util.Map;
 
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IExtensionRegistry;
@@ -45,26 +46,39 @@
 
 	String cachedArchiveString = null;
 	IClasspathEntry[] cachedClasspath = null;
-	private static Set discouragedAccessPaths;
+	private static Map map;
 	private IPath runtimeLoc;
+	private String runtimeTypeId;
 
 	static {
 		loadExtensions();
 	}
 
 	private static synchronized void loadExtensions() {
-		discouragedAccessPaths = new HashSet();
+		map = new HashMap();
 		IExtensionRegistry registry = Platform.getExtensionRegistry();
 		IConfigurationElement[] cf = registry.getConfigurationElementsFor(
 				GeronimoPlugin.PLUGIN_ID, EXTENSION_RUNTIME_ACCESS);
 		for (int i = 0; i < cf.length; i++) {
 			IConfigurationElement element = cf[i];
-			if ("path".equals(element.getName())) {
-				String path = element.getAttribute("value");
-				if (path != null) {
-					discouragedAccessPaths.add(new Path(path));
+			if ("restriction".equals(element.getName())) {
+				String runtimeId = element.getAttribute("id");
+				if (runtimeId != null) {
+					IConfigurationElement[] children = element.getChildren();
+					for (int j = 0; j < children.length; j++) {
+						String path = children[j].getAttribute("value");
+						if (path != null) {
+							Collection c = (Collection) map.get(runtimeId);
+							if (c == null) {
+								c = new ArrayList();
+								map.put(runtimeId, c);
+							}
+							c.add(new Path(path));
+						}
+					}
 				}
 			}
+
 		}
 	}
 
@@ -76,6 +90,8 @@
 	 */
 	public IClasspathEntry[] resolveClasspathContainer(IRuntime runtime,
 			String id) {
+		System.out.println(runtime.getRuntimeType().getId());
+		this.runtimeTypeId = runtime.getRuntimeType().getId();
 		return getServerClassPathEntry(runtime);
 	}
 
@@ -126,12 +142,17 @@
 	}
 
 	private boolean isAccessDiscouraged(IPath path) {
-		Iterator i = discouragedAccessPaths.iterator();
+		Collection c = (Collection) map.get(runtimeTypeId);
+		if (c == null || c.isEmpty())
+			return false;
+
+		Iterator i = c.iterator();
 		while (i.hasNext()) {
 			IPath xPath = (IPath) i.next();
-			if(path.toFile().isDirectory() && runtimeLoc.append(xPath).isPrefixOf(path)) {
+			if (path.toFile().isDirectory()
+					&& runtimeLoc.append(xPath).isPrefixOf(path)) {
 				return true;
-			} else if(runtimeLoc.append(xPath).equals(path)) {
+			} else if (runtimeLoc.append(xPath).equals(path)) {
 				return true;
 			}
 		}



Mime
View raw message