You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2005/08/19 21:54:41 UTC
svn commit: r233548 [3/6] - in /incubator/felix/trunk: ./
src/org/apache/felix/ src/org/apache/felix/bundlerepository/
src/org/apache/felix/bundlerepository/impl/
src/org/apache/felix/bundlerepository/impl/kxmlsax/
src/org/apache/felix/bundlerepository...
Added: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/RepositoryState.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/RepositoryState.java?rev=233548&view=auto
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/RepositoryState.java (added)
+++ incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/RepositoryState.java Fri Aug 19 12:53:58 2005
@@ -0,0 +1,563 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.felix.bundlerepository.impl;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+import org.apache.felix.bundlerepository.impl.kxmlsax.KXmlSAXParser;
+import org.apache.felix.bundlerepository.impl.metadataparser.MultivalueMap;
+import org.apache.felix.bundlerepository.impl.metadataparser.XmlCommonHandler;
+import org.apache.felix.bundlerepository.BundleRecord;
+import org.apache.felix.bundlerepository.ResolveException;
+import org.osgi.framework.*;
+
+public class RepositoryState
+{
+ private BundleContext m_context = null;
+ private String[] m_urls = null;
+ private Map m_recordMap = new HashMap();
+ private BundleRecord[] m_recordArray = null;
+ private boolean m_initialized = false;
+
+ private int m_hopCount = 1;
+
+ private static final String[] DEFAULT_REPOSITORY_URL = {
+ "http://oscar-osgi.sf.net/alpha/repository.xml"
+ };
+ public static final String REPOSITORY_URL_PROP = "osgi.repository.url";
+ public static final String EXTERN_REPOSITORY_TAG = "extern-repositories";
+
+ public RepositoryState(BundleContext context)
+ {
+ m_context = context;
+
+ String urlStr = m_context.getProperty(REPOSITORY_URL_PROP);
+ if (urlStr != null)
+ {
+ StringTokenizer st = new StringTokenizer(urlStr);
+ if (st.countTokens() > 0)
+ {
+ m_urls = new String[st.countTokens()];
+ for (int i = 0; i < m_urls.length; i++)
+ {
+ m_urls[i] = st.nextToken();
+ }
+ }
+ }
+
+ // Use the default URL if none were specified.
+ if (m_urls == null)
+ {
+ m_urls = DEFAULT_REPOSITORY_URL;
+ }
+ }
+
+ public String[] getURLs()
+ {
+ // Return a copy because the array is mutable.
+ return (m_urls == null) ? null : (String[]) m_urls.clone();
+ }
+
+ public void setURLs(String[] urls)
+ {
+ if (urls != null)
+ {
+ m_urls = urls;
+ initialize();
+ }
+ }
+
+ public BundleRecord[] getRecords()
+ {
+ if (!m_initialized)
+ {
+ initialize();
+ }
+
+ // Returned cached array of bundle records.
+ return m_recordArray;
+ }
+
+ public BundleRecord[] getRecords(String symName)
+ {
+ if (!m_initialized)
+ {
+ initialize();
+ }
+
+ // Return a copy of the array, since it would be mutable
+ // otherwise.
+ BundleRecord[] records = (BundleRecord[]) m_recordMap.get(symName);
+ // Return a copy because the array is mutable.
+ return (records == null) ? null : (BundleRecord[]) records.clone();
+ }
+
+ public BundleRecord getRecord(String symName, int[] version)
+ {
+ if (!m_initialized)
+ {
+ initialize();
+ }
+
+ BundleRecord[] records = (BundleRecord[]) m_recordMap.get(symName);
+ if ((records != null) && (records.length > 0))
+ {
+ for (int i = 0; i < records.length; i++)
+ {
+ int[] targetVersion = Util.parseVersionString(
+ (String) records[i].getAttribute(BundleRecord.BUNDLE_VERSION));
+
+ if (Util.compareVersion(targetVersion, version) == 0)
+ {
+ return records[i];
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public BundleRecord[] resolvePackages(LocalState localState, Filter[] reqFilters)
+ throws ResolveException
+ {
+ // Create a list that will contain the transitive closure of
+ // all import dependencies; use a list because this will keep
+ // everything in order.
+ List deployList = new ArrayList();
+ // Add the target bundle
+ resolvePackages(localState, reqFilters, deployList);
+
+ // Convert list of symbolic names to an array of bundle
+ // records and return it.
+ BundleRecord[] records = new BundleRecord[deployList.size()];
+ return (BundleRecord[]) deployList.toArray(records);
+ }
+
+ private void resolvePackages(
+ LocalState localState, Filter[] reqFilters, List deployList)
+ throws ResolveException
+ {
+ for (int reqIdx = 0;
+ (reqFilters != null) && (reqIdx < reqFilters.length);
+ reqIdx++)
+ {
+ // If the package can be locally resolved, then
+ // it can be completely ignored; otherwise, try
+ // to find a resolving bundle.
+ if (!localState.isResolvable(reqFilters[reqIdx]))
+ {
+ // Select resolving bundle for current package.
+ BundleRecord source = selectResolvingBundle(
+ deployList, localState, reqFilters[reqIdx]);
+ // If there is no resolving bundle, then throw a
+ // resolve exception.
+ if (source == null)
+ {
+throw new IllegalArgumentException("HACK: SHOULD THROW RESOLVE EXCEPTION: " + reqFilters[reqIdx]);
+// throw new ResolveException(reqFilters[reqIdx]);
+ }
+ // If the resolving bundle is already in the deploy list,
+ // then just ignore it; otherwise, add it to the deploy
+ // list and resolve its packages.
+ if (!deployList.contains(source))
+ {
+ deployList.add(source);
+ Filter[] filters = (Filter[])
+ source.getAttribute("requirements");
+ resolvePackages(localState, filters, deployList);
+ }
+ }
+ }
+ }
+
+ /**
+ * Selects a single source bundle record for the target package from
+ * the repository. The algorithm tries to select a source bundle record
+ * if it is already installed locally in the framework; this approach
+ * favors updating already installed bundles rather than installing
+ * new ones. If no matching bundles are installed locally, then the
+ * first bundle record providing the target package is returned.
+ * @param targetPkg the target package for which to select a source
+ * bundle record.
+ * @return the selected bundle record or <tt>null</tt> if no sources
+ * could be found.
+ **/
+ private BundleRecord selectResolvingBundle(
+ List deployList, LocalState localState, Filter targetFilter)
+ {
+ BundleRecord[] exporters = findExporters(targetFilter);
+ if (exporters == null)
+ {
+ return null;
+ }
+
+ // Try to select a source bundle record that is already
+ // in the deployed list to minimize the number of bundles
+ // that need to be deployed. If this is not possible, then
+ // try to select a bundle that is already installed locally,
+ // since it might be possible to update this bundle to
+ // minimize the number of bundles installed in the framework.
+ for (int i = 0; i < exporters.length; i++)
+ {
+ if (deployList.contains(exporters[i]))
+ {
+ return exporters[i];
+ }
+ else
+ {
+ String symName = (String)
+ exporters[i].getAttribute(BundleRecord.BUNDLE_SYMBOLICNAME);
+ if (symName != null)
+ {
+ BundleRecord[] records = localState.findBundles(symName);
+ if (records != null)
+ {
+ return exporters[i];
+ }
+ }
+ }
+ }
+
+ // If none of the sources are installed locally, then
+ // just pick the first one.
+ return exporters[0];
+ }
+
+ /**
+ * Returns an array of bundle records that resolve the supplied
+ * package declaration.
+ * @param target the package declaration to resolve.
+ * @return an array of bundle records that resolve the package
+ * declaration or <tt>null</tt> if none are found.
+ **/
+ private BundleRecord[] findExporters(Filter targetFilter)
+ {
+ MapToDictionary mapDict = new MapToDictionary(null);
+
+ // Create a list for storing bundles that can resolve package.
+ List resolveList = new ArrayList();
+ for (int recIdx = 0; recIdx < m_recordArray.length; recIdx++)
+ {
+ Map[] capMaps = (Map[]) m_recordArray[recIdx].getAttribute("capability");
+ for (int capIdx = 0; capIdx < capMaps.length; capIdx++)
+ {
+ mapDict.setSourceMap(capMaps[capIdx]);
+ if (targetFilter.match(mapDict))
+ {
+ resolveList.add(m_recordArray[recIdx]);
+ }
+ }
+ }
+
+ // If no resolving bundles were found, return null.
+ if (resolveList.size() == 0)
+ {
+ return null;
+ }
+
+ // Otherwise, return an array containing resolving bundles.
+ return (BundleRecord[]) resolveList.toArray(new BundleRecord[resolveList.size()]);
+ }
+
+ private boolean isUpdateAvailable(
+ PrintStream out, PrintStream err, Bundle bundle)
+ {
+ // Get the bundle's update location.
+ String symname =
+ (String) bundle.getHeaders().get(BundleRecord.BUNDLE_SYMBOLICNAME);
+
+ // Get associated repository bundle recorded for the
+ // local bundle and see if an update is necessary.
+ BundleRecord[] records = getRecords(symname);
+ if (records == null)
+ {
+ err.println(Util.getBundleName(bundle) + " not in repository.");
+ return false;
+ }
+
+ // Check bundle version againts bundle record version.
+ for (int i = 0; i < records.length; i++)
+ {
+ int[] bundleVersion = Util.parseVersionString(
+ (String) bundle.getHeaders().get(BundleRecord.BUNDLE_VERSION));
+ int[] recordVersion = Util.parseVersionString(
+ (String) records[i].getAttribute(BundleRecord.BUNDLE_VERSION));
+ if (Util.compareVersion(recordVersion, bundleVersion) > 0)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void initialize()
+ {
+ m_initialized = true;
+ m_recordMap.clear();
+
+ for (int urlIdx = 0; (m_urls != null) && (urlIdx < m_urls.length); urlIdx++)
+ {
+ parseRepositoryFile(m_hopCount, m_urls[urlIdx]);
+ }
+
+ // Cache a sorted array of all bundle records.
+ List list = new ArrayList();
+ for (Iterator i = m_recordMap.entrySet().iterator(); i.hasNext(); )
+ {
+ BundleRecord[] records = (BundleRecord[]) ((Map.Entry) i.next()).getValue();
+ for (int recIdx = 0; recIdx < records.length; recIdx++)
+ {
+ list.add(records[recIdx]);
+ }
+ }
+ m_recordArray = (BundleRecord[]) list.toArray(new BundleRecord[list.size()]);
+ Arrays.sort(m_recordArray, new Comparator() {
+ public int compare(Object o1, Object o2)
+ {
+ BundleRecord r1 = (BundleRecord) o1;
+ BundleRecord r2 = (BundleRecord) o2;
+ String name1 = (String) r1.getAttribute(BundleRecord.BUNDLE_NAME);
+ String name2 = (String) r2.getAttribute(BundleRecord.BUNDLE_NAME);
+ return name1.compareToIgnoreCase(name2);
+ }
+ });
+ }
+
+ private void parseRepositoryFile(int hopCount, String urlStr)
+ {
+ InputStream is = null;
+ BufferedReader br = null;
+
+ try
+ {
+ // Do it the manual way to have a chance to
+ // set request properties as proxy auth (EW).
+ URL url = new URL(urlStr);
+ URLConnection conn = url.openConnection();
+
+ // Support for http proxy authentication
+ String auth = System.getProperty("http.proxyAuth");
+ if ((auth != null) && (auth.length() > 0))
+ {
+ if ("http".equals(url.getProtocol()) ||
+ "https".equals(url.getProtocol()))
+ {
+ String base64 = Util.base64Encode(auth);
+ conn.setRequestProperty(
+ "Proxy-Authorization", "Basic " + base64);
+ }
+ }
+ is = conn.getInputStream();
+
+ // Create the parser Kxml
+ XmlCommonHandler handler = new XmlCommonHandler();
+ handler.addType("bundles", ArrayList.class);
+ handler.addType("repository", HashMap.class);
+ handler.addType("extern-repositories", ArrayList.class);
+ handler.addType("bundle", MultivalueMap.class);
+ handler.addType("requirement", String.class);
+ handler.addType("capability", ArrayList.class);
+ handler.addType("property", HashMap.class);
+ handler.setDefaultType(String.class);
+
+ br = new BufferedReader(new InputStreamReader(is));
+ KXmlSAXParser parser;
+ parser = new KXmlSAXParser(br);
+ try
+ {
+ parser.parseXML(handler);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ return;
+ }
+
+ List root = (List) handler.getRoot();
+ for (int bundleIdx = 0; bundleIdx < root.size(); bundleIdx++)
+ {
+ Object obj = root.get(bundleIdx);
+
+ // The elements of the root will either be a HashMap for
+ // the repository tag or a MultivalueMap for the bundle
+ // tag, as indicated above when we parsed the file.
+
+ // If HashMap, then read repository information.
+ if (obj instanceof HashMap)
+ {
+ // Create a case-insensitive map.
+ Map repoMap = new TreeMap(new Comparator() {
+ public int compare(Object o1, Object o2)
+ {
+ return o1.toString().compareToIgnoreCase(o2.toString());
+ }
+ });
+ repoMap.putAll((Map) obj);
+
+ // Process external repositories if hop count is
+ // greater than zero.
+ if (hopCount > 0)
+ {
+ // Get the external repository list.
+ List externList = (List) repoMap.get(EXTERN_REPOSITORY_TAG);
+ for (int i = 0; (externList != null) && (i < externList.size()); i++)
+ {
+ parseRepositoryFile(hopCount - 1, (String) externList.get(i));
+ }
+ }
+ }
+ // Else if mulitvalue map, then create a bundle record
+ // for the associated bundle meta-data.
+ else if (obj instanceof MultivalueMap)
+ {
+ // Create a case-insensitive map.
+ Map bundleMap = new TreeMap(new Comparator() {
+ public int compare(Object o1, Object o2)
+ {
+ return o1.toString().compareToIgnoreCase(o2.toString());
+ }
+ });
+ bundleMap.putAll((Map) obj);
+
+ // Convert capabilities into case-insensitive maps.
+ List list = (List) bundleMap.get("capability");
+ Map[] capabilityMaps = convertCapabilities(list);
+ bundleMap.put("capability", capabilityMaps);
+
+ // Convert requirements info filters.
+ list = (List) bundleMap.get("requirement");
+ Filter[] filters = convertRequirements(list);
+ bundleMap.put("requirement", filters);
+
+ // Convert any remaining single-element lists into
+ // the element itself.
+ for (Iterator i = bundleMap.keySet().iterator(); i.hasNext(); )
+ {
+ Object key = i.next();
+ Object value = bundleMap.get(key);
+ if ((value instanceof List) &&
+ (((List) value).size() == 1))
+ {
+ bundleMap.put(key, ((List) value).get(0));
+ }
+ }
+
+ // Create a bundle record using the map.
+ BundleRecord record = new BundleRecord(bundleMap);
+ // TODO: Filter duplicates.
+ BundleRecord[] records =
+ (BundleRecord[]) m_recordMap.get(
+ record.getAttribute(BundleRecord.BUNDLE_SYMBOLICNAME));
+ if (records == null)
+ {
+ records = new BundleRecord[] { record };
+ }
+ else
+ {
+ BundleRecord[] newRecords = new BundleRecord[records.length + 1];
+ System.arraycopy(records, 0, newRecords, 0, records.length);
+ newRecords[records.length] = record;
+ records = newRecords;
+ }
+ m_recordMap.put(
+ record.getAttribute(BundleRecord.BUNDLE_SYMBOLICNAME), records);
+ }
+ }
+ }
+ catch (MalformedURLException ex)
+ {
+ ex.printStackTrace(System.err);
+// System.err.println("Error: " + ex);
+ }
+ catch (IOException ex)
+ {
+ ex.printStackTrace(System.err);
+// System.err.println("Error: " + ex);
+ }
+ finally
+ {
+ try
+ {
+ if (is != null) is.close();
+ }
+ catch (IOException ex)
+ {
+ // Not much we can do.
+ }
+ }
+ }
+
+ private Map[] convertCapabilities(List capLists)
+ {
+ Map[] capabilityMaps = new Map[(capLists == null) ? 0 : capLists.size()];
+ for (int capIdx = 0; (capLists != null) && (capIdx < capLists.size()); capIdx++)
+ {
+ // Create a case-insensitive map.
+ capabilityMaps[capIdx] = new TreeMap(new Comparator() {
+ public int compare(Object o1, Object o2)
+ {
+ return o1.toString().compareToIgnoreCase(o2.toString());
+ }
+ });
+
+ List capList = (List) capLists.get(capIdx);
+
+ for (int propIdx = 0; propIdx < capList.size(); propIdx++)
+ {
+ Map propMap = (Map) capList.get(propIdx);
+ String name = (String) propMap.get("name");
+ String type = (String) propMap.get("type");
+ String value = (String) propMap.get("value");
+ try
+ {
+ Class clazz = this.getClass().getClassLoader().loadClass(type);
+ Object o = clazz
+ .getConstructor(new Class[] { String.class })
+ .newInstance(new Object[] { value });
+ capabilityMaps[capIdx].put(name, o);
+ }
+ catch (Exception ex)
+ {
+// TODO: DETERMINE WHAT TO DO HERE.
+ // Two options here, we can either ignore the
+ // entire capability or we can just ignore the
+ // property. For now, just ignore the property.
+ continue;
+ }
+ }
+ }
+ return capabilityMaps;
+ }
+
+ private Filter[] convertRequirements(List reqsList)
+ {
+ Filter[] filters = new Filter[(reqsList == null) ? 0 : reqsList.size()];
+ for (int i = 0; (reqsList != null) && (i < reqsList.size()); i++)
+ {
+ try
+ {
+ filters[i] = m_context.createFilter((String) reqsList.get(i));
+ }
+ catch (InvalidSyntaxException ex)
+ {
+ }
+ }
+ return filters;
+ }
+}
\ No newline at end of file
Propchange: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/RepositoryState.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/RepositoryState.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/Util.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/Util.java?rev=233548&view=auto
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/Util.java (added)
+++ incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/Util.java Fri Aug 19 12:53:58 2005
@@ -0,0 +1,208 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.felix.bundlerepository.impl;
+
+import java.io.*;
+import java.util.StringTokenizer;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+
+public class Util
+{
+ public static String getBundleName(Bundle bundle)
+ {
+ String name = (String) bundle.getHeaders().get(Constants.BUNDLE_NAME);
+ return (name == null)
+ ? "Bundle " + Long.toString(bundle.getBundleId())
+ : name;
+ }
+
+ public static int compareVersion(int[] v1, int[] v2)
+ {
+ if (v1[0] > v2[0])
+ {
+ return 1;
+ }
+ else if (v1[0] < v2[0])
+ {
+ return -1;
+ }
+ else if (v1[1] > v2[1])
+ {
+ return 1;
+ }
+ else if (v1[1] < v2[1])
+ {
+ return -1;
+ }
+ else if (v1[2] > v2[2])
+ {
+ return 1;
+ }
+ else if (v1[2] < v2[2])
+ {
+ return -1;
+ }
+ return 0;
+ }
+
+ public static int[] parseVersionString(String s)
+ {
+ int[] version = new int[] { 0, 0, 0 };
+
+ if (s != null)
+ {
+ StringTokenizer st = new StringTokenizer(s, ".");
+ if (st.hasMoreTokens())
+ {
+ try
+ {
+ version[0] = Integer.parseInt(st.nextToken());
+ if (st.hasMoreTokens())
+ {
+ version[1] = Integer.parseInt(st.nextToken());
+ if (st.hasMoreTokens())
+ {
+ version[2] = Integer.parseInt(st.nextToken());
+ }
+ }
+ return version;
+ }
+ catch (NumberFormatException ex)
+ {
+ throw new IllegalArgumentException(
+ "Improper version number.");
+ }
+ }
+ }
+
+ return version;
+ }
+
+ private static final byte encTab[] = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46,
+ 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52,
+ 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x61, 0x62, 0x63, 0x64,
+ 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
+ 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x30, 0x31,
+ 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2b, 0x2f };
+
+ private static final byte decTab[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1,
+ -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1,
+ -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, -1, -1, -1, -1, -1 };
+
+ public static String base64Encode(String s) throws IOException
+ {
+ return encode(s.getBytes(), 0);
+ }
+
+ /**
+ * Encode a raw byte array to a Base64 String.
+ *
+ * @param in Byte array to encode.
+ * @param len Length of Base64 lines. 0 means no line breaks.
+ **/
+ public static String encode(byte[] in, int len) throws IOException
+ {
+ ByteArrayOutputStream baos = null;
+ ByteArrayInputStream bais = null;
+ try
+ {
+ baos = new ByteArrayOutputStream();
+ bais = new ByteArrayInputStream(in);
+ encode(bais, baos, len);
+ // ASCII byte array to String
+ return (new String(baos.toByteArray()));
+ }
+ finally
+ {
+ if (baos != null)
+ {
+ baos.close();
+ }
+ if (bais != null)
+ {
+ bais.close();
+ }
+ }
+ }
+
+ public static void encode(InputStream in, OutputStream out, int len)
+ throws IOException
+ {
+
+ // Check that length is a multiple of 4 bytes
+ if (len % 4 != 0)
+ {
+ throw new IllegalArgumentException("Length must be a multiple of 4");
+ }
+
+ // Read input stream until end of file
+ int bits = 0;
+ int nbits = 0;
+ int nbytes = 0;
+ int b;
+
+ while ((b = in.read()) != -1)
+ {
+ bits = (bits << 8) | b;
+ nbits += 8;
+ while (nbits >= 6)
+ {
+ nbits -= 6;
+ out.write(encTab[0x3f & (bits >> nbits)]);
+ nbytes++;
+ // New line
+ if (len != 0 && nbytes >= len)
+ {
+ out.write(0x0d);
+ out.write(0x0a);
+ nbytes -= len;
+ }
+ }
+ }
+
+ switch (nbits)
+ {
+ case 2:
+ out.write(encTab[0x3f & (bits << 4)]);
+ out.write(0x3d); // 0x3d = '='
+ out.write(0x3d);
+ break;
+ case 4:
+ out.write(encTab[0x3f & (bits << 2)]);
+ out.write(0x3d);
+ break;
+ }
+
+ if (len != 0)
+ {
+ if (nbytes != 0)
+ {
+ out.write(0x0d);
+ out.write(0x0a);
+ }
+ out.write(0x0d);
+ out.write(0x0a);
+ }
+ }
+}
\ No newline at end of file
Propchange: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/Util.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/Util.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXHandler.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXHandler.java?rev=233548&view=auto
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXHandler.java (added)
+++ incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXHandler.java Fri Aug 19 12:53:58 2005
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.felix.bundlerepository.impl.kxmlsax;
+
+import java.util.Properties;
+
+import org.xml.sax.SAXException;
+
+/**
+ * Interface for SAX handler with kXML
+ *
+ * @author Didier Donsez (didier.donsez@imag.fr)
+ */
+public interface KXmlSAXHandler {
+
+ /**
+ * Method called when parsing text
+ *
+ * @param ch
+ * @param offset
+ * @param length
+ * @exception SAXException
+ */
+ public void characters(char[] ch, int offset, int length) throws Exception;
+
+ /**
+ * Method called when a tag opens
+ *
+ * @param uri
+ * @param localName
+ * @param qName
+ * @param attrib
+ * @exception SAXException
+ **/
+ public void startElement(
+ String uri,
+ String localName,
+ String qName,
+ Properties attrib)
+ throws Exception;
+ /**
+ * Method called when a tag closes
+ *
+ * @param uri
+ * @param localName
+ * @param qName
+ * @exception SAXException
+ */
+ public void endElement(
+ java.lang.String uri,
+ java.lang.String localName,
+ java.lang.String qName)
+ throws Exception;
+}
\ No newline at end of file
Propchange: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXHandler.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXParser.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXParser.java?rev=233548&view=auto
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXParser.java (added)
+++ incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXParser.java Fri Aug 19 12:53:58 2005
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.felix.bundlerepository.impl.kxmlsax;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.Properties;
+
+import org.kxml.Attribute;
+import org.kxml.Xml;
+import org.kxml.parser.ParseEvent;
+import org.kxml.parser.XmlParser;
+
+/**
+ * The KXmlSAXParser extends the XmlParser from kxml. This is a very
+ * simple parser that does not take into account the DTD
+ *
+ * @version 1.0 08 Nov 2002
+ * @version 1.1 24 Apr 2004
+ * @author Humberto Cervantes, Didier Donsez
+ */
+public class KXmlSAXParser extends XmlParser {
+ /**
+ * The constructor for a parser, it receives a java.io.Reader.
+ *
+ * @param reader The reader
+ * @exception IOException thrown by the superclass
+ */
+ public KXmlSAXParser(Reader r) throws IOException {
+ super(r);
+ }
+
+ /**
+ * Parser from the reader provided in the constructor, and call
+ * the startElement and endElement in a KxmlHandler
+ *
+ * @param reader The reader
+ * @exception Exception thrown by the superclass
+ */
+ public void parseXML(KXmlSAXHandler handler) throws Exception {
+ ParseEvent evt = null;
+ do {
+ evt = read();
+ if (evt.getType() == Xml.START_TAG) {
+ Properties props = new Properties();
+ for (int i = 0; i < evt.getAttributeCount(); i++) {
+ Attribute attr = evt.getAttribute(i);
+ props.put(attr.getName(), attr.getValue());
+ }
+ handler.startElement(
+ "uri",
+ evt.getName(),
+ evt.getName(),
+ props);
+ } else if (evt.getType() == Xml.END_TAG) {
+ handler.endElement("uri", evt.getName(), evt.getName());
+ } else if (evt.getType() == Xml.TEXT) {
+ String text = evt.getText();
+ handler.characters(text.toCharArray(),0,text.length());
+ } else {
+ // do nothing
+ }
+ } while (evt.getType() != Xml.END_DOCUMENT);
+ }
+}
Propchange: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/kxmlsax/KXmlSAXParser.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/manifest.mf
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/manifest.mf?rev=233548&view=auto
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/manifest.mf (added)
+++ incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/manifest.mf Fri Aug 19 12:53:58 2005
@@ -0,0 +1,10 @@
+Bundle-Name: Bundle Repository
+Bundle-SymbolicName: org.apache.felix.bundlerepository.impl
+Bundle-Description: A simple bundle repository for Felix.
+Bundle-Activator: org.apache.felix.bundlerepository.impl.Activator
+Bundle-ClassPath: .,org/apache/felix/bundlerepository/impl/kxml.jar
+Bundle-Version: 2.0.0.alpha2
+Import-Package: org.osgi.framework
+DynamicImport-Package: org.apache.felix.shell
+Export-Package:
+ org.apache.felix.bundlerepository; specification-version="1.1.0"
Added: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/ClassUtility.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/ClassUtility.java?rev=233548&view=auto
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/ClassUtility.java (added)
+++ incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/ClassUtility.java Fri Aug 19 12:53:58 2005
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.felix.bundlerepository.impl.metadataparser;
+
+/**
+ * This class provides methods to process class name
+ */
+
+public class ClassUtility {
+
+ /**
+ * This method capitalizes the first character in the provided string.
+ * @return resulted string
+ */
+ public static String capitalize(String name) {
+
+ int len=name.length();
+ StringBuffer sb=new StringBuffer(len);
+ boolean setCap=true;
+ for(int i=0; i<len; i++){
+ char c=name.charAt(i);
+ if(c=='-' || c=='_') {
+ setCap=true;
+ } else {
+ if(setCap){
+ sb.append(Character.toUpperCase(c));
+ setCap=false;
+ } else {
+ sb.append(c);
+ }
+ }
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * This method capitalizes all characters in the provided string.
+ * @return resulted string
+ */
+ public static String finalstaticOf(String membername) {
+ int len=membername.length();
+ StringBuffer sb=new StringBuffer(len+2);
+ for(int i=0; i<len; i++){
+ char c=membername.charAt(i);
+ if(Character.isLowerCase(c) ) {
+ sb.append(Character.toUpperCase(c));
+ } else if(Character.isUpperCase(c) ) {
+ sb.append('_').append(c);
+ } else {
+ sb.append(c);
+ }
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * This method returns the package name in a full class name
+ * @return resulted string
+ */
+ public static String packageOf(String fullclassname) {
+ int index=fullclassname.lastIndexOf(".");
+ if(index>0) {
+ return fullclassname.substring(0,index);
+ } else {
+ return "";
+ }
+ }
+
+ /**
+ * This method returns the package name in a full class name
+ * @return resulted string
+ */
+ public static String classOf(String fullclassname) {
+ int index=fullclassname.lastIndexOf(".");
+ if(index>0) {
+ return fullclassname.substring(index+1);
+ } else {
+ return fullclassname;
+ }
+ }
+}
\ No newline at end of file
Propchange: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/ClassUtility.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/ClassUtility.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/KXmlMetadataHandler.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/KXmlMetadataHandler.java?rev=233548&view=auto
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/KXmlMetadataHandler.java (added)
+++ incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/KXmlMetadataHandler.java Fri Aug 19 12:53:58 2005
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.felix.bundlerepository.impl.metadataparser;
+
+import java.io.*;
+
+import org.apache.felix.bundlerepository.impl.kxmlsax.KXmlSAXParser;
+
+
+/**
+ * handles the metadata in XML format
+ * (use kXML (http://kxml.enhydra.org/) a open-source very light weight XML parser
+ * @version 1.00 11 Nov 2003
+ * @author Didier Donsez
+ */
+public class KXmlMetadataHandler /*implements MetadataHandler*/ {
+
+ private XmlCommonHandler handler;
+
+ public KXmlMetadataHandler() {
+ handler = new XmlCommonHandler();
+ }
+
+ /**
+ * Called to parse the InputStream and set bundle list and package hash map
+ */
+ public void parse(InputStream is) throws Exception {
+ BufferedReader br = new BufferedReader(new InputStreamReader(is));
+ KXmlSAXParser parser;
+ parser = new KXmlSAXParser(br);
+ parser.parseXML(handler);
+ }
+
+ /**
+ * return the metadata
+ * @return a Objet
+ */
+ public Object getMetadata() {
+ return handler.getRoot();
+ }
+
+ public void addType(String qname, Class clazz) {
+ handler.addType(qname, clazz);
+ }
+
+ public void setDefaultType(Class clazz) {
+ handler.setDefaultType(clazz);
+ }
+}
Propchange: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/KXmlMetadataHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/KXmlMetadataHandler.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/MultivalueMap.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/MultivalueMap.java?rev=233548&view=auto
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/MultivalueMap.java (added)
+++ incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/MultivalueMap.java Fri Aug 19 12:53:58 2005
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.felix.bundlerepository.impl.metadataparser;
+
+import java.util.*;
+
+public class MultivalueMap implements Map {
+ private Map m_map = null;
+
+ public MultivalueMap() {
+ m_map = new HashMap();
+ }
+
+ public MultivalueMap(Map map) {
+ m_map = map;
+ }
+
+ /**
+ * @see java.util.Map#size()
+ */
+ public int size() {
+ return m_map.size();
+ }
+
+ /**
+ * @see java.util.Map#clear()
+ */
+ public void clear() {
+ m_map.clear();
+ }
+
+ /**
+ * @see java.util.Map#isEmpty()
+ */
+ public boolean isEmpty() {
+ return m_map.isEmpty();
+ }
+
+ /**
+ * @see java.util.Map#containsKey(java.lang.Object)
+ */
+ public boolean containsKey(Object arg0) {
+ return m_map.containsKey(arg0);
+ }
+
+ /**
+ * @see java.util.Map#containsValue(java.lang.Object)
+ */
+ public boolean containsValue(Object arg0) {
+ return false;
+ }
+
+ /**
+ * @see java.util.Map#values()
+ */
+ public Collection values() {
+ return null;
+ }
+
+ /**
+ * @see java.util.Map#putAll(java.util.Map)
+ */
+ public void putAll(Map arg0) {
+ }
+
+ /**
+ * @see java.util.Map#entrySet()
+ */
+ public Set entrySet() {
+ return m_map.entrySet();
+ }
+
+ /**
+ * @see java.util.Map#keySet()
+ */
+ public Set keySet() {
+ return m_map.keySet();
+ }
+
+ /**
+ * @see java.util.Map#get(java.lang.Object)
+ */
+ public Object get(Object key) {
+ return m_map.get(key);
+ }
+
+ /**
+ * @see java.util.Map#remove(java.lang.Object)
+ */
+ public Object remove(Object arg0) {
+ return m_map.remove(arg0);
+ }
+
+ /**
+ * @see java.util.Map#put(java.lang.Object, java.lang.Object)
+ */
+ public Object put(Object key, Object value) {
+ Object prev = m_map.get(key);
+ if (prev == null) {
+ List list = new ArrayList();
+ list.add(value);
+ m_map.put(key, list);
+ return list;
+ } else {
+ ((List) prev).add(value);
+ return prev;
+ }
+ }
+
+ public String toString() {
+ StringBuffer sb=new StringBuffer();
+ sb.append("[MultivalueMap:");
+ if(m_map.isEmpty()) {
+ sb.append("empty");
+ } else {
+ Set keys=m_map.keySet();
+ Iterator iter=keys.iterator();
+ while(iter.hasNext()){
+ String key=(String)iter.next();
+ sb.append("\n\"").append(key).append("\":");
+ sb.append(m_map.get(key).toString());
+ }
+ sb.append('\n');
+ }
+ sb.append(']');
+ return sb.toString();
+ }
+}
\ No newline at end of file
Propchange: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/MultivalueMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/MultivalueMap.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/XmlCommonHandler.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/XmlCommonHandler.java?rev=233548&view=auto
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/XmlCommonHandler.java (added)
+++ incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/XmlCommonHandler.java Fri Aug 19 12:53:58 2005
@@ -0,0 +1,405 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.felix.bundlerepository.impl.metadataparser;
+
+import java.lang.reflect.Method;
+import java.util.*;
+
+import org.apache.felix.bundlerepository.impl.kxmlsax.KXmlSAXHandler;
+import org.xml.sax.SAXException;
+
+/**
+ * SAX handler for the XML OBR file
+ *
+ * @author Didier Donsez (didier.donsez@imag.fr)
+ */
+public class XmlCommonHandler implements KXmlSAXHandler {
+
+ private static final String PI_MAPPING="mapping";
+
+ private int columnNumber;
+
+ private int lineNumber;
+
+ //
+ // Data
+ //
+
+ private Object root;
+
+ private Stack objectStack;
+ private Stack qnameStack;
+
+ private Map types;
+ private Class defaultType;
+
+ private StringBuffer currentText;
+
+ public XmlCommonHandler() {
+ objectStack = new Stack();
+ qnameStack = new Stack();
+ types = new HashMap();
+ }
+
+ public void addType(String qname, Class clazz) {
+ types.put(qname, clazz);
+ }
+
+ public void setDefaultType(Class clazz) {
+ defaultType=clazz;
+ }
+
+ public Object getRoot() {
+ return root;
+ }
+
+ /* for PCDATA */
+ public void characters(char[] ch, int offset, int length)
+ throws Exception {
+ if (currentText != null)
+ currentText.append(ch, offset, length);
+ }
+
+ private String adderOf(Class clazz) {
+ return "add"
+ + ClassUtility.capitalize(ClassUtility.classOf(clazz.getName()));
+ }
+
+ private String adderOf(String key) {
+ return "add" + ClassUtility.capitalize(key);
+ }
+
+ private String setterOf(Class clazz) {
+ return "set"
+ + ClassUtility.capitalize(ClassUtility.classOf(clazz.getName()));
+ }
+
+ private String setterOf(String key) {
+ return "set" + ClassUtility.capitalize(key);
+ }
+
+ /**
+ * Method called when a tag opens
+ *
+ * @param uri
+ * @param localName
+ * @param qName
+ * @param attrib
+ * @exception SAXException
+ **/
+ public void startElement(
+ String uri,
+ String localName,
+ String qName,
+ Properties attrib)
+ throws Exception {
+
+ trace("START ("+lineNumber+","+columnNumber+"):" + uri + ":" + qName);
+
+ Class clazz = (Class) types.get(qName);
+ // TODO: should add uri in the future
+
+ if(clazz==null && defaultType!=null)
+ clazz=defaultType;
+
+ Object obj;
+ if (clazz != null) {
+
+ try {
+ obj = clazz.newInstance();
+ } catch (InstantiationException e) {
+ throw new Exception(lineNumber+","+columnNumber+":"+
+ "class "+clazz.getName()+" for element " + qName + " should have an empty constructor");
+ } catch (IllegalAccessException e) {
+ throw new Exception(lineNumber+","+columnNumber+":"+
+ "illegal access on the empty constructor of class "+clazz.getName()+" for element " + qName);
+ }
+
+ Set keyset = attrib.keySet();
+ Iterator iter = keyset.iterator();
+ while (iter.hasNext()) {
+ String key = (String) iter.next();
+
+ if (obj instanceof Map) {
+ ((Map) obj).put(key, attrib.get(key));
+ } else if (obj instanceof List) {
+ throw new Exception(lineNumber+","+columnNumber+":"+
+ "List element " + qName + " cannot have any attribute");
+ } else if (obj instanceof String) {
+ if(key.equals("value")){
+ obj=(String)attrib.get(key);
+ } else {
+ throw new Exception(lineNumber+","+columnNumber+":"+
+ "String element " + qName + " cannot have other attribute than value");
+ }
+ } else {
+ Method method = null;
+ try {
+ method =
+ clazz.getMethod(
+ setterOf(key),
+ new Class[] { String.class });
+ } catch (NoSuchMethodException e) {
+ // do nothing
+ }
+ if (method == null)
+ try {
+ method =
+ clazz.getMethod(
+ adderOf(key),
+ new Class[] { String.class });
+
+ } catch (NoSuchMethodException e) {
+ throw new Exception(lineNumber+","+columnNumber+":"+
+ "element "
+ + qName
+ + " does not support the attribute "
+ + key);
+ }
+ if (method != null)
+ method.invoke(
+ obj,
+ new String[] {(String) attrib.get(key)});
+ }
+
+ }
+
+ } else {
+ throw new Exception(lineNumber+","+columnNumber+":"+
+ "this element " + qName + " has not corresponding class");
+ }
+
+ if (root == null)
+ root = obj;
+ objectStack.push(obj);
+ qnameStack.push(qName);
+ currentText = new StringBuffer();
+
+ trace("START/ ("+lineNumber+","+columnNumber+"):" + uri + ":" + qName);
+ }
+
+ /**
+ * Method called when a tag closes
+ *
+ * @param uri
+ * @param localName
+ * @param qName
+ * @exception SAXException
+ */
+ public void endElement(
+ java.lang.String uri,
+ java.lang.String localName,
+ java.lang.String qName)
+ throws Exception {
+
+ trace("END ("+lineNumber+","+columnNumber+"):" + uri + ":" + qName);
+
+ Object obj = objectStack.pop();
+
+ if (currentText != null && currentText.length() != 0) {
+ if (obj instanceof Map) {
+ ((Map) obj).put(qName, currentText.toString().trim());
+ } else if (obj instanceof List) {
+ throw new Exception(lineNumber+","+columnNumber+":"+
+ "List element " + qName + " cannot have PCDATAs");
+ } else if (obj instanceof String) {
+ String str=(String)obj;
+ if(str.length()!=0){
+ throw new Exception(lineNumber+","+columnNumber+":"+
+ "String element " + qName + " cannot have both PCDATA and an attribute value");
+ } else {
+ obj=currentText.toString().trim();
+ }
+ } else {
+ Method method = null;
+ try {
+ method =
+ obj.getClass().getMethod(
+ "addText",
+ new Class[] { String.class });
+ } catch (NoSuchMethodException e) {
+ // do nothing
+ }
+ if (method != null) {
+ method.invoke(obj, new String[] { currentText.toString().trim()});
+ }
+ }
+ }
+
+ currentText = null;
+
+ if (!objectStack.isEmpty()) {
+
+ Object parent = objectStack.peek();
+ String parentName = (String) qnameStack.peek();
+
+ if (parent instanceof Map) {
+ ((Map) parent).put(qName, obj);
+ } else if (parent instanceof List) {
+ ((List) parent).add(obj);
+ } else {
+ Method method = null;
+ try {
+ method =
+ parent.getClass().getMethod(
+ adderOf(ClassUtility.capitalize(qName)),
+ new Class[] { obj.getClass()});
+ } catch (NoSuchMethodException e) {
+ trace(
+ "NoSuchMethodException: "
+ + adderOf(ClassUtility.capitalize(qName)));
+ // do nothing
+ }
+ if (method == null)
+ try {
+ method =
+ parent.getClass().getMethod(
+ setterOf(ClassUtility.capitalize(qName)),
+ new Class[] { obj.getClass()});
+ } catch (NoSuchMethodException e) {
+ trace(
+ "NoSuchMethodException: "
+ + setterOf(ClassUtility.capitalize(qName)));
+ // do nothing
+ }
+ if (method == null)
+ try {
+ method =
+ parent.getClass().getMethod(
+ adderOf(obj.getClass()),
+ new Class[] { obj.getClass()});
+ } catch (NoSuchMethodException e) {
+ trace(
+ "NoSuchMethodException: "
+ + adderOf(obj.getClass()));
+ // do nothing
+ }
+ if (method == null)
+ try {
+ method =
+ parent.getClass().getMethod(
+ setterOf(obj.getClass()),
+ new Class[] { obj.getClass()});
+ } catch (NoSuchMethodException e) {
+ trace(
+ "NoSuchMethodException: "
+ + setterOf(obj.getClass()));
+ // do nothing
+ }
+
+ if (method != null) {
+ trace(method.getName());
+ method.invoke(parent, new Object[] { obj });
+ } else {
+ throw new Exception(lineNumber+","+columnNumber+":"+
+ " element " + parentName + " cannot have an attribute " + qName + " of type " + obj.getClass());
+ }
+ }
+
+ }
+
+ trace("END/ ("+lineNumber+","+columnNumber+"):" + uri + ":" + qName);
+
+ }
+
+ private void trace(String msg) {
+ if (false)
+ System.err.println(msg);
+ }
+
+ /**
+ * @see kxml.sax.KXmlSAXHandler#setLineNumber(int)
+ */
+ public void setLineNumber(int lineNumber) {
+ this.lineNumber=lineNumber;
+ }
+
+ /**
+ * @see kxml.sax.KXmlSAXHandler#setColumnNumber(int)
+ */
+ public void setColumnNumber(int columnNumber) {
+ this.columnNumber=columnNumber;
+
+ }
+
+ /**
+ * @see kxml.sax.KXmlSAXHandler#processingInstruction(java.lang.String, java.lang.String)
+ */
+ public void processingInstruction(String target, String data) throws Exception {
+ trace("pi:"+target+";"+data);
+ if(target==null){ // TODO kXML
+ if(!data.startsWith(PI_MAPPING)) return;
+ } else if(!target.equals(PI_MAPPING))return;
+
+
+ // defaultclass attribute
+ String datt="defaultclass=\"";
+ int dstart=data.indexOf(datt);
+ if(dstart!=-1) {
+ int dend=data.indexOf("\"",dstart+datt.length());
+ if(dend==-1)
+ throw new Exception(lineNumber+","+columnNumber+":"+
+ " \"defaultclass\" attribute in \"mapping\" PI is not quoted");
+
+ String classname=data.substring(dstart+datt.length(),dend);
+ Class clazz=null;
+ try {
+ clazz=getClass().getClassLoader().loadClass(classname);
+ } catch (ClassNotFoundException e) {
+ throw new Exception(lineNumber+","+columnNumber+":"+
+ " cannot found class "+ classname+" for \"mapping\" PI");
+ }
+ setDefaultType(clazz);
+ return;
+ }
+
+ // element attribute
+ String eatt="element=\"";
+ int estart=data.indexOf(eatt);
+ if(estart==-1)
+ throw new Exception(lineNumber+","+columnNumber+":"+
+ " missing \"element\" attribute in \"mapping\" PI");
+ int eend=data.indexOf("\"",estart+eatt.length());
+ if(eend==-1)
+ throw new Exception(lineNumber+","+columnNumber+":"+
+ " \"element\" attribute in \"mapping\" PI is not quoted");
+
+ String element=data.substring(estart+eatt.length(),eend);
+
+ // element class
+ String catt="class=\"";
+ int cstart=data.indexOf(catt);
+ if(cstart==-1)
+ throw new Exception(lineNumber+","+columnNumber+":"+
+ " missing \"class\" attribute in \"mapping\" PI");
+ int cend=data.indexOf("\"",cstart+catt.length());
+ if(cend==-1)
+ throw new Exception(lineNumber+","+columnNumber+":"+
+ " \"class\" attribute in \"mapping\" PI is not quoted");
+
+ String classname=data.substring(cstart+catt.length(),cend);
+
+ Class clazz=null;
+ try {
+ clazz=getClass().getClassLoader().loadClass(classname);
+ } catch (ClassNotFoundException e) {
+ throw new Exception(lineNumber+","+columnNumber+":"+
+ " cannot found class "+ classname+" for \"mapping\" PI");
+ }
+ addType(element,clazz);
+ }
+}
Propchange: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/XmlCommonHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/felix/trunk/src/org/apache/felix/bundlerepository/impl/metadataparser/XmlCommonHandler.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: incubator/felix/trunk/src/org/apache/felix/framework/BundleContextImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/BundleContextImpl.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/BundleContextImpl.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/BundleContextImpl.java Fri Aug 19 12:53:58 2005
@@ -14,13 +14,13 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import java.io.File;
import java.io.InputStream;
import java.util.Dictionary;
-import org.apache.osgi.framework.ext.FelixBundleContext;
+import org.apache.felix.framework.ext.FelixBundleContext;
import org.osgi.framework.*;
class BundleContextImpl implements FelixBundleContext
Modified: incubator/felix/trunk/src/org/apache/felix/framework/BundleImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/BundleImpl.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/BundleImpl.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/BundleImpl.java Fri Aug 19 12:53:58 2005
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import java.io.IOException;
import java.io.InputStream;
Modified: incubator/felix/trunk/src/org/apache/felix/framework/BundleInfo.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/BundleInfo.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/BundleInfo.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/BundleInfo.java Fri Aug 19 12:53:58 2005
@@ -14,12 +14,12 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import java.util.Map;
-import org.apache.osgi.framework.cache.BundleArchive;
-import org.apache.osgi.moduleloader.Module;
+import org.apache.felix.framework.cache.BundleArchive;
+import org.apache.felix.moduleloader.Module;
import org.osgi.framework.*;
class BundleInfo
Modified: incubator/felix/trunk/src/org/apache/felix/framework/BundleURLConnection.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/BundleURLConnection.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/BundleURLConnection.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/BundleURLConnection.java Fri Aug 19 12:53:58 2005
@@ -14,14 +14,14 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.security.Permission;
-import org.apache.osgi.moduleloader.*;
+import org.apache.felix.moduleloader.*;
class BundleURLConnection extends URLConnection
{
Modified: incubator/felix/trunk/src/org/apache/felix/framework/BundleURLStreamHandler.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/BundleURLStreamHandler.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/BundleURLStreamHandler.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/BundleURLStreamHandler.java Fri Aug 19 12:53:58 2005
@@ -14,12 +14,12 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import java.io.IOException;
import java.net.*;
-import org.apache.osgi.moduleloader.ModuleManager;
+import org.apache.felix.moduleloader.ModuleManager;
class BundleURLStreamHandler extends URLStreamHandler
{
Modified: incubator/felix/trunk/src/org/apache/felix/framework/ExportedPackageImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/ExportedPackageImpl.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/ExportedPackageImpl.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/ExportedPackageImpl.java Fri Aug 19 12:53:58 2005
@@ -14,9 +14,9 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
-import org.apache.osgi.framework.searchpolicy.R4Version;
+import org.apache.felix.framework.searchpolicy.R4Version;
import org.osgi.framework.Bundle;
import org.osgi.service.packageadmin.ExportedPackage;
Modified: incubator/felix/trunk/src/org/apache/felix/framework/FakeURLStreamHandler.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/FakeURLStreamHandler.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/FakeURLStreamHandler.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/FakeURLStreamHandler.java Fri Aug 19 12:53:58 2005
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import java.io.IOException;
import java.net.*;
Modified: incubator/felix/trunk/src/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/Felix.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/Felix.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/Felix.java Fri Aug 19 12:53:58 2005
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import java.io.*;
import java.net.*;
@@ -22,13 +22,13 @@
import java.security.PrivilegedActionException;
import java.util.*;
-import org.apache.osgi.framework.cache.*;
-import org.apache.osgi.framework.searchpolicy.*;
-import org.apache.osgi.framework.util.*;
-import org.apache.osgi.framework.util.Util;
-import org.apache.osgi.moduleloader.*;
-import org.apache.osgi.moduleloader.search.ResolveException;
-import org.apache.osgi.moduleloader.search.ResolveListener;
+import org.apache.felix.framework.cache.*;
+import org.apache.felix.framework.searchpolicy.*;
+import org.apache.felix.framework.util.*;
+import org.apache.felix.framework.util.Util;
+import org.apache.felix.moduleloader.*;
+import org.apache.felix.moduleloader.search.ResolveException;
+import org.apache.felix.moduleloader.search.ResolveListener;
import org.osgi.framework.*;
import org.osgi.service.packageadmin.ExportedPackage;
Modified: incubator/felix/trunk/src/org/apache/felix/framework/FilterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/FilterImpl.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/FilterImpl.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/FilterImpl.java Fri Aug 19 12:53:58 2005
@@ -14,14 +14,14 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import java.io.CharArrayReader;
import java.io.IOException;
import java.util.*;
-import org.apache.osgi.framework.util.CaseInsensitiveMap;
-import org.apache.osgi.framework.util.ldap.*;
+import org.apache.felix.framework.util.CaseInsensitiveMap;
+import org.apache.felix.framework.util.ldap.*;
import org.osgi.framework.*;
/**
Modified: incubator/felix/trunk/src/org/apache/felix/framework/FrameworkUtil.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/FrameworkUtil.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/FrameworkUtil.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/FrameworkUtil.java Fri Aug 19 12:53:58 2005
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import org.osgi.framework.Filter;
import org.osgi.framework.InvalidSyntaxException;
Modified: incubator/felix/trunk/src/org/apache/felix/framework/LogWrapper.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/LogWrapper.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/LogWrapper.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/LogWrapper.java Fri Aug 19 12:53:58 2005
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import org.osgi.framework.BundleException;
import org.osgi.framework.ServiceReference;
Modified: incubator/felix/trunk/src/org/apache/felix/framework/Main.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/Main.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/Main.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/Main.java Fri Aug 19 12:53:58 2005
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import java.io.*;
import java.net.MalformedURLException;
@@ -22,9 +22,9 @@
import java.util.Enumeration;
import java.util.Properties;
-import org.apache.osgi.framework.cache.DefaultBundleCache;
-import org.apache.osgi.framework.util.CaseInsensitiveMap;
-import org.apache.osgi.framework.util.MutablePropertyResolverImpl;
+import org.apache.felix.framework.cache.DefaultBundleCache;
+import org.apache.felix.framework.util.CaseInsensitiveMap;
+import org.apache.felix.framework.util.MutablePropertyResolverImpl;
/**
* <p>
@@ -95,7 +95,7 @@
* using the <tt>felix.config.properties</tt> system property;
* this should be set using the <tt>-D</tt> syntax when executing
* the JVM. Refer to the
- * <a href="Felix.html#start(org.apache.osgi.framework.util.MutablePropertyResolver, org.apache.osgi.framework.util.MutablePropertyResolver, java.util.List)">
+ * <a href="Felix.html#start(org.apache.felix.framework.util.MutablePropertyResolver, org.apache.felix.framework.util.MutablePropertyResolver, java.util.List)">
* <tt>Felix.start()</tt></a> method documentation for more
* information on the framework configuration options.
* </li>
@@ -123,13 +123,13 @@
* <p>
* It should be noted that simply starting an instance of the framework is not enough
* to create an interactive session with it. It is necessary to install
- * and start bundles that provide an interactive shell; this is generally
+ * and start bundles that provide an interactive impl; this is generally
* done by specifying an "auto-start" property in the framework configuration
- * property file. If no interactive shell bundles are installed or if
+ * property file. If no interactive impl bundles are installed or if
* the configuration property file cannot be found, the framework will appear to
* be hung or deadlocked. This is not the case, it is executing correctly,
* there is just no way to interact with it. Refer to the
- * <a href="Felix.html#start(org.apache.osgi.framework.util.MutablePropertyResolver, org.apache.osgi.framework.util.MutablePropertyResolver, java.util.List)">
+ * <a href="Felix.html#start(org.apache.felix.framework.util.MutablePropertyResolver, org.apache.felix.framework.util.MutablePropertyResolver, java.util.List)">
* <tt>Felix.start()</tt></a> method documentation for more information on
* framework configuration options.
* </p>
Modified: incubator/felix/trunk/src/org/apache/felix/framework/OSGiLibrarySource.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/OSGiLibrarySource.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/OSGiLibrarySource.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/OSGiLibrarySource.java Fri Aug 19 12:53:58 2005
@@ -14,11 +14,11 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
-import org.apache.osgi.framework.cache.BundleCache;
-import org.apache.osgi.framework.util.LibraryInfo;
-import org.apache.osgi.moduleloader.LibrarySource;
+import org.apache.felix.framework.cache.BundleCache;
+import org.apache.felix.framework.util.LibraryInfo;
+import org.apache.felix.moduleloader.LibrarySource;
import org.osgi.framework.Constants;
public class OSGiLibrarySource implements LibrarySource
Modified: incubator/felix/trunk/src/org/apache/felix/framework/OSGiURLPolicy.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/OSGiURLPolicy.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/OSGiURLPolicy.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/OSGiURLPolicy.java Fri Aug 19 12:53:58 2005
@@ -14,14 +14,14 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
-import org.apache.osgi.framework.util.FelixConstants;
-import org.apache.osgi.moduleloader.*;
+import org.apache.felix.framework.util.FelixConstants;
+import org.apache.felix.moduleloader.*;
public class OSGiURLPolicy implements URLPolicy
{
Modified: incubator/felix/trunk/src/org/apache/felix/framework/PackageAdminActivator.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/PackageAdminActivator.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/PackageAdminActivator.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/PackageAdminActivator.java Fri Aug 19 12:53:58 2005
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import org.osgi.framework.*;
Modified: incubator/felix/trunk/src/org/apache/felix/framework/PackageAdminImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/PackageAdminImpl.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/PackageAdminImpl.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/PackageAdminImpl.java Fri Aug 19 12:53:58 2005
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import org.osgi.framework.Bundle;
import org.osgi.service.packageadmin.*;
Modified: incubator/felix/trunk/src/org/apache/felix/framework/ServiceReferenceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/ServiceReferenceImpl.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/ServiceReferenceImpl.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/ServiceReferenceImpl.java Fri Aug 19 12:53:58 2005
@@ -14,11 +14,10 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
-import org.apache.osgi.framework.searchpolicy.R4SearchPolicy;
-import org.apache.osgi.framework.searchpolicy.R4Wire;
-import org.apache.osgi.framework.util.FelixConstants;
+import org.apache.felix.framework.searchpolicy.R4SearchPolicy;
+import org.apache.felix.framework.searchpolicy.R4Wire;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
@@ -116,7 +115,7 @@
boolean allow = true;
// Get the package.
String pkgName =
- org.apache.osgi.moduleloader.Util.getClassPackage(className);
+ org.apache.felix.moduleloader.Util.getClassPackage(className);
// Get package wiring from service provider and requester.
R4Wire requesterWire = R4SearchPolicy.getWire(
((BundleImpl) requester).getInfo().getCurrentModule(), pkgName);
Modified: incubator/felix/trunk/src/org/apache/felix/framework/ServiceRegistrationImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/ServiceRegistrationImpl.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/ServiceRegistrationImpl.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/ServiceRegistrationImpl.java Fri Aug 19 12:53:58 2005
@@ -14,13 +14,13 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
import java.util.*;
-import org.apache.osgi.framework.util.CaseInsensitiveMap;
+import org.apache.felix.framework.util.CaseInsensitiveMap;
import org.osgi.framework.*;
class ServiceRegistrationImpl implements ServiceRegistration
Modified: incubator/felix/trunk/src/org/apache/felix/framework/ServiceRegistry.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/ServiceRegistry.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/ServiceRegistry.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/ServiceRegistry.java Fri Aug 19 12:53:58 2005
@@ -14,11 +14,11 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import java.util.*;
-import org.apache.osgi.framework.util.FelixConstants;
+import org.apache.felix.framework.util.FelixConstants;
import org.osgi.framework.*;
public class ServiceRegistry
Modified: incubator/felix/trunk/src/org/apache/felix/framework/StartLevelActivator.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/StartLevelActivator.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/StartLevelActivator.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/StartLevelActivator.java Fri Aug 19 12:53:58 2005
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import org.osgi.framework.*;
Modified: incubator/felix/trunk/src/org/apache/felix/framework/StartLevelImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/StartLevelImpl.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/StartLevelImpl.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/StartLevelImpl.java Fri Aug 19 12:53:58 2005
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import java.security.AccessController;
import java.util.ArrayList;
Modified: incubator/felix/trunk/src/org/apache/felix/framework/SystemBundle.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/SystemBundle.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/SystemBundle.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/SystemBundle.java Fri Aug 19 12:53:58 2005
@@ -14,18 +14,18 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import java.io.InputStream;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.*;
-import org.apache.osgi.framework.searchpolicy.*;
-import org.apache.osgi.framework.util.CaseInsensitiveMap;
-import org.apache.osgi.framework.util.FelixConstants;
-import org.apache.osgi.moduleloader.LibrarySource;
-import org.apache.osgi.moduleloader.ResourceSource;
+import org.apache.felix.framework.searchpolicy.*;
+import org.apache.felix.framework.util.CaseInsensitiveMap;
+import org.apache.felix.framework.util.FelixConstants;
+import org.apache.felix.moduleloader.LibrarySource;
+import org.apache.felix.moduleloader.ResourceSource;
import org.osgi.framework.*;
Modified: incubator/felix/trunk/src/org/apache/felix/framework/SystemBundleActivator.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/SystemBundleActivator.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/SystemBundleActivator.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/SystemBundleActivator.java Fri Aug 19 12:53:58 2005
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import java.util.List;
Modified: incubator/felix/trunk/src/org/apache/felix/framework/SystemBundleArchive.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/SystemBundleArchive.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/SystemBundleArchive.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/SystemBundleArchive.java Fri Aug 19 12:53:58 2005
@@ -14,13 +14,13 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework;
+package org.apache.felix.framework;
import java.io.File;
import java.util.Map;
-import org.apache.osgi.framework.cache.BundleArchive;
-import org.apache.osgi.framework.util.FelixConstants;
+import org.apache.felix.framework.cache.BundleArchive;
+import org.apache.felix.framework.util.FelixConstants;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
Modified: incubator/felix/trunk/src/org/apache/felix/framework/cache/BundleArchive.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/cache/BundleArchive.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/cache/BundleArchive.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/cache/BundleArchive.java Fri Aug 19 12:53:58 2005
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework.cache;
+package org.apache.felix.framework.cache;
import java.io.File;
import java.util.Map;
@@ -29,7 +29,7 @@
* this interface will be related to a specific implementation of the
* <tt>BundleCache</tt> interface.
* </p>
- * @see org.apache.osgi.framework.BundleCache
+ * @see org.apache.felix.framework.BundleCache
**/
public interface BundleArchive
{
Modified: incubator/felix/trunk/src/org/apache/felix/framework/cache/BundleCache.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/src/org/apache/felix/framework/cache/BundleCache.java?rev=233548&r1=233470&r2=233548&view=diff
==============================================================================
--- incubator/felix/trunk/src/org/apache/felix/framework/cache/BundleCache.java (original)
+++ incubator/felix/trunk/src/org/apache/felix/framework/cache/BundleCache.java Fri Aug 19 12:53:58 2005
@@ -14,12 +14,12 @@
* limitations under the License.
*
*/
-package org.apache.osgi.framework.cache;
+package org.apache.felix.framework.cache;
import java.io.InputStream;
-import org.apache.osgi.framework.LogWrapper;
-import org.apache.osgi.framework.util.PropertyResolver;
+import org.apache.felix.framework.LogWrapper;
+import org.apache.felix.framework.util.PropertyResolver;
/**
* <p>
@@ -32,7 +32,7 @@
* <tt>felix.cache.class</tt> system property. Bundle cache implemenations
* should implement this interface and provide a default constructor.
* </p>
- * @see org.apache.osgi.framework.BundleArchive
+ * @see org.apache.felix.framework.BundleArchive
**/
public interface BundleCache
{