KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > tests > j2eeserver > plugin > registry > NodeFactory


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
21 package org.netbeans.tests.j2eeserver.plugin.registry;
22
23 import org.netbeans.tests.j2eeserver.plugin.jsr88.*;
24 import javax.enterprise.deploy.spi.factories.DeploymentFactory JavaDoc;
25 import javax.enterprise.deploy.spi.DeploymentManager JavaDoc;
26 import javax.enterprise.deploy.spi.Target JavaDoc;
27 /**
28  *
29  * @author nn136682
30  */

31 public class NodeFactory implements org.netbeans.modules.j2ee.deployment.plugins.api.RegistryNodeFactory {
32
33     /** Creates a new instance of NodeFactory */
34     public NodeFactory() {
35     }
36
37     public org.openide.nodes.Node getFactoryNode(org.openide.util.Lookup lookup) {
38         DeploymentFactory JavaDoc depFactory = (DeploymentFactory JavaDoc) lookup.lookup(DeploymentFactory JavaDoc.class);
39         if (depFactory == null || ! (depFactory instanceof DepFactory)) {
40             System.out.println("WARNING: getFactoryNode lookup returned "+depFactory);
41             return null;
42         }
43         System.out.println("INFO: getFactoryNode returning new plugin node");
44         return new PluginNode((DepFactory)depFactory);
45     }
46     
47     public org.openide.nodes.Node getManagerNode(org.openide.util.Lookup lookup) {
48         DeploymentManager JavaDoc depManager = (DeploymentManager JavaDoc) lookup.lookup(DeploymentManager JavaDoc.class);
49         if (depManager == null || ! (depManager instanceof DepManager)) {
50             System.out.println("WARNING: getManagerNode lookup returned "+depManager);
51             return null;
52         }
53         System.out.println("INFO: getManagerNode returning new Manager node");
54         return new ManagerNode((DepManager)depManager);
55     }
56     
57     public org.openide.nodes.Node getTargetNode(org.openide.util.Lookup lookup) {
58         Target JavaDoc target = (Target JavaDoc) lookup.lookup(Target JavaDoc.class);
59         if (target == null || ! (target instanceof Targ) ) {
60             System.out.println("WARNING: getTargetNode lookup returned "+target);
61             return null;
62         }
63         System.out.println("INFO: getManagerNode returning new Target node");
64         return new TargNode((Targ)target);
65     }
66 }
67
Popular Tags