KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > system > server > profileservice > ProfileServiceImpl


1 /*
2  * JBoss, Home of Professional Open Source
3  * Copyright 2005, JBoss Inc., and individual contributors as indicated
4  * by the @authors tag. See the copyright.txt in the distribution for a
5  * full listing of individual contributors.
6  *
7  * This is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation; either version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this software; if not, write to the Free
19  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21  */

22 package org.jboss.system.server.profileservice;
23
24 import java.io.IOException JavaDoc;
25
26 import org.jboss.deployers.spi.management.ManagementView;
27 import org.jboss.profileservice.spi.NoSuchProfileException;
28 import org.jboss.profileservice.spi.Profile;
29 import org.jboss.profileservice.spi.ProfileKey;
30 import org.jboss.profileservice.spi.ProfileService;
31 import org.jboss.system.server.profile.basic.ProfileImpl;
32
33
34 /**
35  * An initial ProfileService impl for loading server deployments.
36  *
37  * @author Scott.Stark@jboss.org
38  * @version $Revision$
39  */

40 public class ProfileServiceImpl
41    implements ProfileService
42 {
43    private String JavaDoc name;
44    private String JavaDoc profileRoot;
45    private Profile defaultImpl;
46    private ManagementView mgtView;
47
48    public ProfileServiceImpl(String JavaDoc name) throws IOException JavaDoc
49    {
50       this.name = name;
51       mgtView = new ManagementViewImpl(this);
52    }
53    // Properties ------------------------
54

55    public String JavaDoc getName()
56    {
57       return this.name;
58    }
59    public void setName(String JavaDoc name)
60    {
61       this.name = name;
62    }
63    public String JavaDoc getProfileRoot()
64    {
65       return this.profileRoot;
66    }
67    public void setProfileRoot(String JavaDoc profileRoot)
68    {
69       this.profileRoot = profileRoot;
70    }
71
72    public void start()
73    {
74       defaultImpl = new ProfileImpl(profileRoot, name);
75    }
76
77    // ProfileService implementation --------------------
78
public String JavaDoc[] getDomains()
79    {
80       String JavaDoc[] domains = {ProfileKey.DEFAULT};
81       return domains;
82    }
83
84    public ProfileKey[] getProfileKeys()
85    {
86       ProfileKey[] keys = {new ProfileKey(null)};
87       return keys;
88    }
89
90    /**
91     * Always returns the default profile.
92     */

93    public Profile getProfile(ProfileKey key)
94       throws NoSuchProfileException
95    {
96       return defaultImpl;
97    }
98
99    public String JavaDoc[] getProfileDeploymentNames(ProfileKey key)
100       throws NoSuchProfileException
101    {
102       String JavaDoc[] names = {"default"};
103       return names;
104    }
105
106    public ManagementView getViewManager()
107    {
108       return mgtView;
109    }
110    public void setViewManager(ManagementView mgtView)
111    {
112       this.mgtView = mgtView;
113    }
114
115    // Admin of profiles @todo could be an option plugin
116
public Profile newProfile(ProfileKey key)
117    {
118       return new ProfileImpl(profileRoot, name);
119    }
120
121    public void removeProfile(ProfileKey key)
122       throws NoSuchProfileException
123    {
124    }
125 }
126
127
Popular Tags