org.glassfish.admin.rest
Class Util

java.lang.Object
  extended by org.glassfish.admin.rest.Util

public class Util
extends java.lang.Object

Utilities class. Extended by ResourceUtil and ProviderUtil utilities. Used by resource and providers.

Author:
Rajeshwar Patil

Field Summary
static LocalStringManagerImpl localStrings
           
 
Method Summary
static ActionReporter applyChanges(java.util.Map<java.lang.String,java.lang.String> data, javax.ws.rs.core.UriInfo uriInfo, org.jvnet.hk2.component.Habitat habitat)
          Apply changes passed in data using CLI "set".
static java.lang.String decode(java.lang.String string)
           
static void deleteFile(java.lang.String fileName, java.lang.String mimeType, java.io.InputStream fileStream)
           
static java.lang.String eleminateHypen(java.lang.String string)
          Removes any hypens ( - ) from the given string.
static java.lang.String getGrandparentName(java.lang.String url)
           
static java.lang.String getGrandparentName(javax.ws.rs.core.UriInfo uriInfo)
           
protected static java.lang.String getHtml(java.lang.String message, javax.ws.rs.core.UriInfo uriInfo, boolean delete)
          Returns the html for the given message.
static com.sun.jersey.api.client.Client getJerseyClient(org.jvnet.hk2.component.Habitat habitat)
           
static java.lang.String getName(java.lang.String typeName)
          Returns just the name of the given fully qualified name.
static java.lang.String getName(java.lang.String typeName, char delimiter)
          Returns just the name of the given fully qualified name.
static java.lang.String getParentName(java.lang.String url)
          returns just the parent name of the resource from the resource url.
static java.lang.String getParentName(javax.ws.rs.core.UriInfo uriInfo)
          Returns name of the resource parent from UriInfo.
static java.lang.String getResourceName(javax.ws.rs.core.UriInfo uriInfo)
          Returns name of the resource from UriInfo.
static java.lang.String methodNameFromBeanName(java.lang.String elementName, java.lang.String prefix)
          Constructs a method name from element's bean name for a given prefix.(schema2beans convention)
static java.lang.String methodNameFromDtdName(java.lang.String elementName, java.lang.String prefix)
          Constructs a method name from element's dtd name name for a given prefix.(schema2beans convention)
static java.io.File saveFile(java.lang.String fileName, java.lang.String mimeType, java.io.InputStream fileStream)
           
static java.lang.String upperCaseFirstLetter(java.lang.String string)
          Converts the first letter of the given string to Uppercase.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localStrings

public static final LocalStringManagerImpl localStrings
Method Detail

getResourceName

public static java.lang.String getResourceName(javax.ws.rs.core.UriInfo uriInfo)
Returns name of the resource from UriInfo.


getParentName

public static java.lang.String getParentName(javax.ws.rs.core.UriInfo uriInfo)
Returns name of the resource parent from UriInfo.


getGrandparentName

public static java.lang.String getGrandparentName(javax.ws.rs.core.UriInfo uriInfo)

getName

public static java.lang.String getName(java.lang.String typeName)
Returns just the name of the given fully qualified name.


getName

public static java.lang.String getName(java.lang.String typeName,
                                       char delimiter)
Returns just the name of the given fully qualified name.


getParentName

public static java.lang.String getParentName(java.lang.String url)
returns just the parent name of the resource from the resource url.


getGrandparentName

public static java.lang.String getGrandparentName(java.lang.String url)

eleminateHypen

public static java.lang.String eleminateHypen(java.lang.String string)
Removes any hypens ( - ) from the given string. When it removes a hypen, it converts next immediate character, if any, to an Uppercase.(schema2beans convention)

Parameters:
string - the input string
Returns:
a String resulted after removing the hypens

decode

public static java.lang.String decode(java.lang.String string)

upperCaseFirstLetter

public static java.lang.String upperCaseFirstLetter(java.lang.String string)
Converts the first letter of the given string to Uppercase.

Parameters:
string - the input string
Returns:
the string with the Uppercase first letter

getHtml

protected static java.lang.String getHtml(java.lang.String message,
                                          javax.ws.rs.core.UriInfo uriInfo,
                                          boolean delete)
Returns the html for the given message.

Parameters:
uriInfo - the uriInfo context of the request
Returns:
String the html representation of the given message

methodNameFromDtdName

public static java.lang.String methodNameFromDtdName(java.lang.String elementName,
                                                     java.lang.String prefix)
Constructs a method name from element's dtd name name for a given prefix.(schema2beans convention)

Parameters:
elementName - the given element name
prefix - the given prefix
Returns:
a method name formed from the given name and the prefix

methodNameFromBeanName

public static java.lang.String methodNameFromBeanName(java.lang.String elementName,
                                                      java.lang.String prefix)
Constructs a method name from element's bean name for a given prefix.(schema2beans convention)

Parameters:
elementName - the given element name
prefix - the given prefix
Returns:
a method name formed from the given name and the prefix

getJerseyClient

public static com.sun.jersey.api.client.Client getJerseyClient(org.jvnet.hk2.component.Habitat habitat)

applyChanges

public static ActionReporter applyChanges(java.util.Map<java.lang.String,java.lang.String> data,
                                          javax.ws.rs.core.UriInfo uriInfo,
                                          org.jvnet.hk2.component.Habitat habitat)
Apply changes passed in data using CLI "set".

Parameters:
data - The set of changes to be applied
Returns:
ActionReporter containing result of "set" execution

deleteFile

public static void deleteFile(java.lang.String fileName,
                              java.lang.String mimeType,
                              java.io.InputStream fileStream)

saveFile

public static java.io.File saveFile(java.lang.String fileName,
                                    java.lang.String mimeType,
                                    java.io.InputStream fileStream)


Copyright © 2012 GlassFish Community. All Rights Reserved.