Richard S. Hall | 85bafab | 2009-07-13 13:25:46 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | |
| 20 | package org.cauldron.bld.core; |
| 21 | |
| 22 | import java.util.logging.Level; |
| 23 | import java.util.logging.Logger; |
| 24 | |
| 25 | import org.cauldron.bld.core.internal.license.LicenseManager; |
| 26 | import org.cauldron.bld.core.internal.model.eclipse.DownloadJar; |
| 27 | import org.cauldron.bld.core.internal.model.eclipse.Library; |
| 28 | import org.cauldron.bld.core.internal.model.eclipse.LibraryImport; |
| 29 | import org.cauldron.bld.core.internal.model.eclipse.SigilBundle; |
| 30 | import org.cauldron.bld.core.internal.model.osgi.BundleModelElement; |
| 31 | import org.cauldron.bld.core.internal.model.osgi.PackageExport; |
| 32 | import org.cauldron.bld.core.internal.model.osgi.PackageImport; |
| 33 | import org.cauldron.bld.core.internal.model.osgi.RequiredBundle; |
| 34 | import org.cauldron.bld.core.licence.ILicenseManager; |
| 35 | import org.cauldron.sigil.model.ModelElementFactory; |
| 36 | import org.cauldron.sigil.model.eclipse.IDownloadJar; |
| 37 | import org.cauldron.sigil.model.eclipse.ILibrary; |
| 38 | import org.cauldron.sigil.model.eclipse.ILibraryImport; |
| 39 | import org.cauldron.sigil.model.eclipse.INewtonSystem; |
| 40 | import org.cauldron.sigil.model.eclipse.ISCAComposite; |
| 41 | import org.cauldron.sigil.model.eclipse.ISigilBundle; |
| 42 | import org.cauldron.sigil.model.osgi.IBundleModelElement; |
| 43 | import org.cauldron.sigil.model.osgi.IPackageExport; |
| 44 | import org.cauldron.sigil.model.osgi.IPackageImport; |
| 45 | import org.cauldron.sigil.model.osgi.IRequiredBundle; |
| 46 | import org.osgi.framework.BundleActivator; |
| 47 | import org.osgi.framework.BundleContext; |
| 48 | |
| 49 | public class BldCore implements BundleActivator { |
| 50 | private static LicenseManager licenceManager = new LicenseManager(); |
| 51 | |
| 52 | private static final Logger log = Logger.getLogger(BldCore.class.getName()); |
| 53 | |
| 54 | public static void error(String string, Throwable e) { |
| 55 | // TODO |
| 56 | log.log( Level.WARNING, string, e ); |
| 57 | } |
| 58 | |
| 59 | public static void error(String string) { |
| 60 | log.log( Level.WARNING, string ); |
| 61 | } |
| 62 | |
| 63 | public static ILicenseManager getLicenseManager() { |
| 64 | return licenceManager; |
| 65 | } |
| 66 | |
| 67 | public void start(BundleContext context) throws Exception { |
| 68 | init(); |
| 69 | } |
| 70 | |
| 71 | public static void init() throws Exception { |
| 72 | String uri = "http://sigil.codecauldron.org/xml/sigil-namespace"; |
| 73 | ModelElementFactory.getInstance().register(ISigilBundle.class, |
| 74 | SigilBundle.class, "bundle", "sigil", uri); |
| 75 | ModelElementFactory.getInstance().register(IDownloadJar.class, |
| 76 | DownloadJar.class, "download", "sigil", uri); |
| 77 | ModelElementFactory.getInstance().register(ILibrary.class, |
| 78 | Library.class, "library", "sigil", uri); |
| 79 | ModelElementFactory.getInstance().register(ILibraryImport.class, |
| 80 | LibraryImport.class, "library-import", "sigil", uri); |
| 81 | |
| 82 | // osgi elements |
| 83 | ModelElementFactory.getInstance().register(IBundleModelElement.class, |
| 84 | BundleModelElement.class, "bundle", null, null); |
| 85 | ModelElementFactory.getInstance().register(IPackageExport.class, |
| 86 | PackageExport.class, "package.export", null, null); |
| 87 | ModelElementFactory.getInstance().register(IPackageImport.class, |
| 88 | PackageImport.class, "package.import", null, null); |
| 89 | ModelElementFactory.getInstance().register(IRequiredBundle.class, |
| 90 | RequiredBundle.class, "required.bundle", null, null); |
| 91 | } |
| 92 | |
| 93 | public void stop(BundleContext context) throws Exception { |
| 94 | // TODO Auto-generated method stub |
| 95 | |
| 96 | } |
| 97 | |
| 98 | } |