KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > ddloaders > ejb > EjbJarDataLoader


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * 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-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.ddloaders.ejb;
21
22 import java.io.IOException JavaDoc;
23 //import java.util.Vector;
24

25 import org.openide.actions.*;
26 import org.openide.filesystems.FileObject;
27 import org.openide.loaders.UniFileLoader;
28 import org.openide.loaders.MultiDataObject;
29 import org.openide.loaders.DataObjectExistsException;
30
31 import org.openide.util.actions.SystemAction;
32 import org.openide.util.NbBundle;
33 import org.netbeans.modules.j2ee.ddloaders.multiview.*;
34
35 /** Recognizes deployment descriptors of ejb modules.
36  *
37  *@see EjbJar30DataLoader
38  *
39  * @author Ludovic Champenois
40  */

41 public class EjbJarDataLoader extends UniFileLoader {
42     
43     private static final long serialVersionUID = 8616780278674213L;
44     private static final String JavaDoc REQUIRED_MIME_PREFIX_1 = "text/x-dd-ejbjar2.0"; // NOI18N
45
private static final String JavaDoc REQUIRED_MIME_PREFIX_2 = "text/x-dd-ejbjar2.1"; // NOI18N
46

47     public EjbJarDataLoader () {
48         this("org.netbeans.modules.j2ee.ddloaders.multiview.EjbJarMultiViewDataObject"); // NOI18N
49
}
50
51     public EjbJarDataLoader(String JavaDoc name){
52         super(name);
53     }
54
55     protected String JavaDoc defaultDisplayName () {
56         return NbBundle.getMessage (EjbJarDataLoader.class, "LBL_loaderName");
57     }
58     
59     protected String JavaDoc actionsContext() {
60         return "Loaders/text/x-dd/Actions/"; // NOI18N
61
}
62     
63     protected void initialize () {
64          super.initialize ();
65          String JavaDoc[] supportedTypes = getSupportedMimeTypes();
66          for (int i = 0; i < supportedTypes.length; i++) {
67              getExtensions().addMimeType(supportedTypes[i]);
68          }
69      }
70
71     protected MultiDataObject createMultiObject (FileObject primaryFile)
72     throws DataObjectExistsException, IOException JavaDoc {
73         return new EjbJarMultiViewDataObject(primaryFile, this);
74     }
75
76     /**
77      *@return Array containing MIME types that this loader supports.
78      */

79     protected String JavaDoc[] getSupportedMimeTypes(){
80         return new String JavaDoc[]{REQUIRED_MIME_PREFIX_1, REQUIRED_MIME_PREFIX_2};
81     }
82 }
83
Popular Tags