Package x10

Examples of x10.Command


     * @return the <code>UnitActionPackage</code>
     * @throws XmlException if an error ocurrs.
     */
    public static UnitActionPackage parseWADL(final String wadl) throws XmlException {
        ApplicationDocument applicationDocument = ApplicationDocument.Factory.parse(wadl);
        Application application = applicationDocument.getApplication();
        return Converter.convertWADLtoUnitActionPackage(application);
    }
View Full Code Here


public class WADLGenerator {   
    public static String generateWADLForMashupRESTService(String myCocktailPath, int mashupId) throws DAOException, IOException {
        Mashup mashup = getMashup(mashupId);
       
        ApplicationDocument applicationDocument = ApplicationDocument.Factory.newInstance();
        Application application = applicationDocument.addNewApplication();
        Resources resources = application.addNewResources();
        resources.setBase(myCocktailPath);
       
        Resource resource = resources.addNewResource();
        resource.setPath("RESTService/mashupId="+mashupId);
       
View Full Code Here

   
    public static String generateWADLForMashupRESTServiceJSON(String myCocktailPath, int mashupId) throws DAOException, IOException {
        Mashup mashup = getMashup(mashupId);
       
        ApplicationDocument applicationDocument = ApplicationDocument.Factory.newInstance();
        Application application = applicationDocument.addNewApplication();
        Resources resources = application.addNewResources();
        resources.setBase(myCocktailPath);
       
        Resource resource = resources.addNewResource();
        resource.setPath("RESTService/mashupId="+mashupId);
       
View Full Code Here

     * @param wadl the WADL as String
     * @return the <code>UnitActionPackage</code>
     * @throws XmlException if an error ocurrs.
     */
    public static UnitActionPackage parseWADL(final String wadl) throws XmlException {
        ApplicationDocument applicationDocument = ApplicationDocument.Factory.parse(wadl);
        Application application = applicationDocument.getApplication();
        return Converter.convertWADLtoUnitActionPackage(application);
    }
View Full Code Here

public class WADLGenerator {   
    public static String generateWADLForMashupRESTService(String myCocktailPath, int mashupId) throws DAOException, IOException {
        Mashup mashup = getMashup(mashupId);
       
        ApplicationDocument applicationDocument = ApplicationDocument.Factory.newInstance();
        Application application = applicationDocument.addNewApplication();
        Resources resources = application.addNewResources();
        resources.setBase(myCocktailPath);
       
        Resource resource = resources.addNewResource();
        resource.setPath("RESTService/mashupId="+mashupId);
       
        addResource(resource, "json""format=json",  mashup, "application/json");
        addResource(resource, "xml",   "format=xml",   mashup, "application/xml");
        addResource(resource, "jsonp", "format=jsonp", mashup, "application/javascript");
       
        return applicationDocument.xmlText(new XmlOptions().setSavePrettyPrint());
    }
View Full Code Here

    }
   
    public static String generateWADLForMashupRESTServiceJSON(String myCocktailPath, int mashupId) throws DAOException, IOException {
        Mashup mashup = getMashup(mashupId);
       
        ApplicationDocument applicationDocument = ApplicationDocument.Factory.newInstance();
        Application application = applicationDocument.addNewApplication();
        Resources resources = application.addNewResources();
        resources.setBase(myCocktailPath);
       
        Resource resource = resources.addNewResource();
        resource.setPath("RESTService/mashupId="+mashupId);
       
        addMethod(resource.addNewMethod(), "json", mashup, "application/json");
       
        return applicationDocument.xmlText(new XmlOptions().setSavePrettyPrint());
    }
View Full Code Here

            JSONArray jsonArray = jsonObject.getJSONArray("params");
            for(int i=0; i<jsonArray.length(); i++) {
                try {
                    String paramName    = jsonArray.getJSONObject(i).getString("name");
                    String paramDefault = jsonArray.getJSONObject(i).getString("default");
                    Param param = request.addNewParam();
                    param.setName(paramName);
                    param.setDefault(paramDefault);
                    param.setStyle(ParamStyle.Enum.forString("query"));
                    param.setType("xs:string");
                } catch (JSONException ex) {
                    Logger.getLogger(WADLGenerator.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        } catch (JSONException ex) {
View Full Code Here

        executeMethod.setUrl(path);
        executeMethod.setHttpMethod(methodName);

        Response response = method.getResponse();
        if (response != null) {
            Representation representation = response.getRepresentation();
            if (representation != null) {
                String mediaType = representation.getMediaType();
                executeMethod.setResponseType(mediaType);
            }
        }

        UnitAction unitAction = new UnitAction();
View Full Code Here

            Logger.getLogger(WADLGenerator.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
   
    private static void addResponse(Response response, String mediaType) {
        Representation representation = response.addNewRepresentation();
        representation.setMediaType(mediaType);
    }
View Full Code Here

     */
    private static UnitAction convertMethodToUnitAction(final Method method,
        final Resource resource, final String path) {
        String id = method.getId();
        String methodName = method.getName();
        Request request = method.getRequest();

        List<Parameter> parameters = new ArrayList<Parameter>();
        if (request != null) {
            List<Param> params = request.getParamList();
            if (params != null) {
                for (Param param : params) {
                    Parameter parameter = convertParameter(param);
                    parameter.setStyle(Parameter.ParameterStyle.QUERY);
                    parameters.add(parameter);
View Full Code Here

TOP

Related Classes of x10.Command

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.