KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > jbi > management > deployment > DeploymentUtils


1 /**
2  * PETALS - PETALS Services Platform.
3  * Copyright (c) 2006 EBM Websourcing, http://www.ebmwebsourcing.com/
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * -------------------------------------------------------------------------
19  * $Id: DeploymentUtils.java 154 6 oct. 06 ofabre $
20  * -------------------------------------------------------------------------
21  */

22 package org.objectweb.petals.jbi.management.deployment;
23
24 import java.io.File JavaDoc;
25 import java.net.URI JavaDoc;
26
27 import org.objectweb.petals.jbi.management.autoload.AutoLoaderImpl;
28 import org.objectweb.petals.tools.jbicommon.descriptor.JBIDescriptor;
29 import org.objectweb.petals.tools.jbicommon.descriptor.ServiceUnit;
30
31 public class DeploymentUtils {
32
33     /**
34      * Retrieve the service assembly name found in the SA production element of
35      * the given descriptor
36      *
37      * @param descriptor
38      * the service assembly jbi descriptor
39      * @return the service assembly name
40      */

41     public static String JavaDoc getServiceAssemblyName(JBIDescriptor descriptor) {
42         return descriptor.getServiceAssembly().getIdentification().getName();
43     }
44
45     /**
46      * Retrieve the service unit name found in the SU production element
47      *
48      * @param serviceUnit
49      * the service unit production element
50      * @return the service unit name
51      */

52     public static String JavaDoc getServiceUnitName(ServiceUnit serviceUnit) {
53         return serviceUnit.getIdentification().getName();
54     }
55
56     /**
57      * Retrieve the service unit targeted component found in the SU production
58      * element
59      *
60      * @param serviceUnit
61      * the service unit production element
62      * @return the service unit targeted component
63      */

64     public static String JavaDoc getServiceUnitTargetedComponent(ServiceUnit serviceUnit) {
65         return serviceUnit.getTargetComponentName();
66     }
67
68     /**
69      * Get the file according to the archive URI
70      *
71      * @param archiveURI
72      * URI of the archive
73      * @return a File pointing on the archive
74      */

75     public static File JavaDoc getArchiveFile(URI JavaDoc archiveURI) {
76         return new File JavaDoc(archiveURI);
77     }
78
79     /**
80      * Get a file of the given name in the "installed directory"
81      *
82      * @param file
83      * the file to look for
84      * @return a File pointing on the file name in the "installed directory"
85      */

86     public static File JavaDoc getInstalledArchive(File JavaDoc file) {
87         return new File JavaDoc(AutoLoaderImpl.getInstalledDirectory(), file.getName());
88     }
89
90 }
91
Popular Tags