01: /*
02: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
03: *
04: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
05: *
06: * The contents of this file are subject to the terms of either the GNU
07: * General Public License Version 2 only ("GPL") or the Common
08: * Development and Distribution License("CDDL") (collectively, the
09: * "License"). You may not use this file except in compliance with the
10: * License. You can obtain a copy of the License at
11: * http://www.netbeans.org/cddl-gplv2.html
12: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13: * specific language governing permissions and limitations under the
14: * License. When distributing the software, include this License Header
15: * Notice in each file and include the License file at
16: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
17: * particular file as subject to the "Classpath" exception as provided
18: * by Sun in the GPL Version 2 section of the License file that
19: * accompanied this code. If applicable, add the following below the
20: * License Header, with the fields enclosed by brackets [] replaced by
21: * your own identifying information:
22: * "Portions Copyrighted [year] [name of copyright owner]"
23: *
24: * Contributor(s):
25: *
26: * Portions Copyrighted 2007 Sun Microsystems, Inc.
27: */
28:
29: package org.netbeans.modules.visualweb.insync;
30:
31: import org.openide.filesystems.FileSystem;
32: import org.openide.filesystems.FileUtil;
33: import org.openide.filesystems.MultiFileSystem;
34: import org.openide.filesystems.Repository;
35: import org.openide.filesystems.XMLFileSystem;
36: import org.xml.sax.SAXException;
37:
38: /**
39: * Repository whose getDefaultFileSystem() returns a writeable FS containing
40: * the layers of j2seplatform and visual jsf web project. It is put in the
41: * default lookup, thus it is returned by Repository.getDefault().
42: *
43: */
44: public class RepositoryImpl extends Repository {
45:
46: public RepositoryImpl() {
47: super (createDefFs());
48: }
49:
50: private static FileSystem createDefFs() {
51: try {
52: FileSystem writeFs = FileUtil.createMemoryFileSystem();
53: FileSystem layerJ2sePlatform = new XMLFileSystem(
54: RepositoryImpl.class
55: .getClassLoader()
56: .getResource(
57: "org/netbeans/modules/java/j2seplatform/resources/layer.xml"));
58: FileSystem layerVisualWebProject = new XMLFileSystem(
59: RepositoryImpl.class
60: .getClassLoader()
61: .getResource(
62: "org/netbeans/modules/visualweb/project/jsf/resources/layer.xml"));
63: return new MultiFileSystem(new FileSystem[] { writeFs,
64: layerJ2sePlatform, layerVisualWebProject });
65: } catch (SAXException e) {
66: AssertionError ae = new AssertionError(e.getMessage());
67: ae.initCause(e);
68: throw ae;
69: }
70: }
71: }
|