blob: c39e8ab0906e05242bd945c165afe072d85f4348 [file] [log] [blame]
Richard S. Hall85bafab2009-07-13 13:25:46 +00001/*
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
20package org.cauldron.bld.core;
21
22import java.util.logging.Level;
23import java.util.logging.Logger;
24
25import org.cauldron.bld.core.internal.license.LicenseManager;
26import org.cauldron.bld.core.internal.model.eclipse.DownloadJar;
27import org.cauldron.bld.core.internal.model.eclipse.Library;
28import org.cauldron.bld.core.internal.model.eclipse.LibraryImport;
29import org.cauldron.bld.core.internal.model.eclipse.SigilBundle;
30import org.cauldron.bld.core.internal.model.osgi.BundleModelElement;
31import org.cauldron.bld.core.internal.model.osgi.PackageExport;
32import org.cauldron.bld.core.internal.model.osgi.PackageImport;
33import org.cauldron.bld.core.internal.model.osgi.RequiredBundle;
34import org.cauldron.bld.core.licence.ILicenseManager;
35import org.cauldron.sigil.model.ModelElementFactory;
36import org.cauldron.sigil.model.eclipse.IDownloadJar;
37import org.cauldron.sigil.model.eclipse.ILibrary;
38import org.cauldron.sigil.model.eclipse.ILibraryImport;
39import org.cauldron.sigil.model.eclipse.INewtonSystem;
40import org.cauldron.sigil.model.eclipse.ISCAComposite;
41import org.cauldron.sigil.model.eclipse.ISigilBundle;
42import org.cauldron.sigil.model.osgi.IBundleModelElement;
43import org.cauldron.sigil.model.osgi.IPackageExport;
44import org.cauldron.sigil.model.osgi.IPackageImport;
45import org.cauldron.sigil.model.osgi.IRequiredBundle;
46import org.osgi.framework.BundleActivator;
47import org.osgi.framework.BundleContext;
48
49public 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}