001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.php.rt.spi.providers;
043:
044: import java.util.List;
045:
046: import org.openide.nodes.Node;
047: import org.openide.util.Lookup;
048: import org.openide.util.Lookup.Result;
049:
050: /**
051: * This is entry point for certnain type Web server functionality.<br/>
052: * This provider has responibility to manipulate Hosts, Nodes in runtime
053: * explorer ( that correspond to Hosts ) ,
054: * providing UI : for host configuration and project configuration
055: * ( it provide specific settings when host is chosen in project wizard ),
056: * performing commands ( commands
057: * are delegated from project to this provider ).
058: *
059: * @author ads
060: *
061: */
062: public interface WebServerProvider {
063:
064: public static final String HOST_ID = "host.id"; // NOI18N
065:
066: /**
067: * @return list of all configured hosts supplied by this provider
068: */
069: List<Host> getHosts();
070:
071: /**
072: * @return provider that responsible for configuration of new host in runtime
073: * explorer. It is used in wizard iterator.
074: */
075: UiConfigProvider getConfigProvider();
076:
077: /**
078: * @return provider that responsible for command execution. Commands
079: * are delegated from project.
080: */
081: CommandProvider getCommandProvider();
082:
083: /**
084: * @return provider that responsible for additional properties for
085: * project configuration.
086: */
087: ProjectConfigProvider getProjectConfigProvider();
088:
089: /**
090: * Creates new Node for <code>host</code>.
091: * @param host configured host.
092: * @return new Node for host
093: */
094: Node createNode(Host host);
095:
096: /**
097: * @return short name of web server type. It is used on first panel in wizrd
098: * in list of all available web server types.
099: */
100: String getTypeName();
101:
102: /**
103: * @return full description for this type of web server.
104: */
105: String getDescription();
106:
107: Host findHost(String id);
108:
109: public static class ServerFactory {
110:
111: public static WebServerProvider[] getProviders() {
112: return myProviders;
113: }
114:
115: private static void initProviders() {
116: Result<WebServerProvider> result = Lookup.getDefault()
117: .lookup(
118: new Lookup.Template<WebServerProvider>(
119: WebServerProvider.class));
120: myProviders = result.allInstances()
121: .toArray(
122: new WebServerProvider[result.allInstances()
123: .size()]);
124: }
125:
126: static {
127: initProviders();
128: }
129:
130: private static WebServerProvider[] myProviders;
131: }
132:
133: }
|