01: /*
02: * The contents of this file are subject to the terms of the Common Development
03: * and Distribution License (the License). You may not use this file except in
04: * compliance with the License.
05: *
06: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
07: * or http://www.netbeans.org/cddl.txt.
08: *
09: * When distributing Covered Code, include this CDDL Header Notice in each file
10: * and include the License file at http://www.netbeans.org/cddl.txt.
11: * If applicable, add the following below the CDDL Header, with the fields
12: * enclosed by brackets [] replaced by your own identifying information:
13: * "Portions Copyrighted [year] [name of copyright owner]"
14: *
15: * The Original Software is NetBeans. The Initial Developer of the Original
16: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17: * Microsystems, Inc. All Rights Reserved.
18: */
19:
20: /*
21: * Sun Public License Notice
22: *
23: * The contents of this file are subject to the Sun Public License
24: * Version 1.0 (the "License"). You may not use this file except in
25: * compliance with the License. A copy of the License is available at
26: * http://www.sun.com/
27: *
28: * The Original Code is NetBeans. The Initial Developer of the Original
29: * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
30: * Microsystems, Inc. All Rights Reserved.
31: */
32: package org.netbeans.modules.sql.project.wsdl;
33:
34: import org.openide.filesystems.FileSystem;
35: import org.openide.filesystems.FileUtil;
36: import org.openide.filesystems.MultiFileSystem;
37: import org.openide.filesystems.Repository;
38: import org.openide.filesystems.XMLFileSystem;
39: import org.xml.sax.SAXException;
40:
41: /**
42: * Repository whose getDefaultFileSystem() returns a writeable FS containing
43: * the layer of the Database Explorer module. It is put in the default lookup,
44: * thus it is returned by Repository.getDefault().
45: *
46: * @author Andrei Badea
47: */
48: public class RepositoryImpl extends Repository {
49:
50: private XMLFileSystem system;
51:
52: public RepositoryImpl() {
53: super (createDefFs());
54: }
55:
56: private static FileSystem createDefFs() {
57: try {
58: FileSystem writeFs = FileUtil.createMemoryFileSystem();
59: FileSystem layerFs = new XMLFileSystem(
60: RepositoryImpl.class
61: .getClassLoader()
62: .getResource(
63: "org/netbeans/modules/db/resources/mf-layer.xml"));
64: return new MultiFileSystem(new FileSystem[] { writeFs,
65: layerFs });
66: } catch (SAXException e) {
67: return null;
68: }
69: }
70: }
|