/**
   * Gets the experiment jaxb.
   *
   * @param experiment the experiment
   * @return the experiment jaxb
   * @throws Exception the exception
   */
  public static edu.sga.apex.rest.jaxb.Experiment getExperimentJAXB(Experiment experiment)
      throws Exception {
    /* check valid experiment dao */
    if (experiment != null) {
      edu.sga.apex.rest.jaxb.Experiment experimentJAXB = factory.createExperiment();

      /* set basic jaxb parameters */
      experimentJAXB.setJobID(experiment.getJobId());
      experimentJAXB.setJobName(experiment.getJobName());
      experimentJAXB.setStatus(experiment.getStatus());
      experimentJAXB.setWallTime(experiment.getWallTime());
      experimentJAXB.setNumNodes(experiment.getNumOfNodes());
      experimentJAXB.setNumProcPerNode(experiment.getProcPerNode());

      /* set date parameters */
      if (experiment.getCreatedAt() != null && experiment.getUpdatedAt() != null) {
        experimentJAXB.setCreatedAt(APIUtil.getXMLGregorianCalendar(experiment.getCreatedAt()));
        experimentJAXB.setUpdatedAt(APIUtil.getXMLGregorianCalendar(experiment.getUpdatedAt()));
      }

      /* check if user entity exists */
      if (experiment.getUserName() != null) {
        experimentJAXB.setUserName(experiment.getUserName().getUsername());
      }

      /* construct the application jaxb from dao */
      if (experiment.getApplication() != null) {
        Application applicationJAXB = factory.createApplication();
        applicationJAXB.setAppID(experiment.getApplication().getAppId());
        applicationJAXB.setAppName(experiment.getApplication().getAppName());
        applicationJAXB.setScriptPath(experiment.getApplication().getScript_path());

        /* set the application jaxb */
        experimentJAXB.setApplication(applicationJAXB);
      }

      /* construct the machine jaxb from dao */
      if (experiment.getMachine() != null) {
        Machine machineJAXB = factory.createMachine();
        machineJAXB.setHostName(experiment.getMachine().getHostname());
        machineJAXB.setMachineID(experiment.getMachine().getMachineId());
        machineJAXB.setMachineName(experiment.getMachine().getMachineName());
        machineJAXB.setPortNumber(experiment.getMachine().getPortNum());
        machineJAXB.setWorkingDir(experiment.getMachine().getWorking_dir());

        /* set the machine jaxb */
        experimentJAXB.setMachine(machineJAXB);
      }

      return experimentJAXB;
    } else {
      throw new Exception("Empty Experiment DAO received. Cannot construct JAXB.");
    }
  }
 /*     */ public static void glShaderSourceARB(int shader, CharSequence[] strings) /*     */ {
   /* 120 */ ContextCapabilities caps = GLContext.getCapabilities();
   /* 121 */ long function_pointer = caps.glShaderSourceARB;
   /* 122 */ BufferChecks.checkFunctionAddress(function_pointer);
   /* 123 */ BufferChecks.checkArray(strings);
   /* 124 */ nglShaderSourceARB3(
       shader,
       strings.length,
       APIUtil.getBuffer(caps, strings),
       APIUtil.getLengths(caps, strings),
       function_pointer);
   /*     */ }
Example #3
0
  /**
   * Get the addressURl from the Extensibility element
   *
   * @param exElement - {@link ExtensibilityElement}
   * @return {@link String}
   * @throws APIManagementException
   */
  private void setAddressUrl(ExtensibilityElement exElement) throws APIManagementException {

    if (exElement instanceof SOAP12AddressImpl) {
      ((SOAP12AddressImpl) exElement).setLocationURI(APIUtil.getGatewayendpoint());
    } else if (exElement instanceof SOAPAddressImpl) {
      ((SOAPAddressImpl) exElement).setLocationURI(APIUtil.getGatewayendpoint());
    } else if (exElement instanceof HTTPAddressImpl) {
      ((HTTPAddressImpl) exElement).setLocationURI(APIUtil.getGatewayendpoint());
    } else {
      String msg = "Unsupported WSDL errors!";
      log.error(msg);
      throw new APIManagementException(msg);
    }
  }
 /*     */ public static String glGetInfoLogARB(int obj, int maxLength) {
   /* 391 */ ContextCapabilities caps = GLContext.getCapabilities();
   /* 392 */ long function_pointer = caps.glGetInfoLogARB;
   /* 393 */ BufferChecks.checkFunctionAddress(function_pointer);
   /* 394 */ IntBuffer infoLog_length = APIUtil.getLengths(caps);
   /* 395 */ ByteBuffer infoLog = APIUtil.getBufferByte(caps, maxLength);
   /* 396 */ nglGetInfoLogARB(
       obj,
       maxLength,
       MemoryUtil.getAddress0(infoLog_length),
       MemoryUtil.getAddress(infoLog),
       function_pointer);
   /* 397 */ infoLog.limit(infoLog_length.get(0));
   /* 398 */ return APIUtil.getString(caps, infoLog);
   /*     */ }
 /*     */ public static String glGetShaderSourceARB(int obj, int maxLength) {
   /* 543 */ ContextCapabilities caps = GLContext.getCapabilities();
   /* 544 */ long function_pointer = caps.glGetShaderSourceARB;
   /* 545 */ BufferChecks.checkFunctionAddress(function_pointer);
   /* 546 */ IntBuffer source_length = APIUtil.getLengths(caps);
   /* 547 */ ByteBuffer source = APIUtil.getBufferByte(caps, maxLength);
   /* 548 */ nglGetShaderSourceARB(
       obj,
       maxLength,
       MemoryUtil.getAddress0(source_length),
       MemoryUtil.getAddress(source),
       function_pointer);
   /* 549 */ source.limit(source_length.get(0));
   /* 550 */ return APIUtil.getString(caps, source);
   /*     */ }
 /*     */ public static int glGetActiveUniformTypeARB(int programObj, int index) /*     */ {
   /* 504 */ ContextCapabilities caps = GLContext.getCapabilities();
   /* 505 */ long function_pointer = caps.glGetActiveUniformARB;
   /* 506 */ BufferChecks.checkFunctionAddress(function_pointer);
   /* 507 */ IntBuffer type = APIUtil.getBufferInt(caps);
   /* 508 */ nglGetActiveUniformARB(
       programObj,
       index,
       0,
       0L,
       MemoryUtil.getAddress(type, 1),
       MemoryUtil.getAddress(type),
       APIUtil.getBufferByte0(caps),
       function_pointer);
   /* 509 */ return type.get(0);
   /*     */ }
 /*     */ public static int glGetActiveUniformSizeARB(int programObj, int index) /*     */ {
   /* 490 */ ContextCapabilities caps = GLContext.getCapabilities();
   /* 491 */ long function_pointer = caps.glGetActiveUniformARB;
   /* 492 */ BufferChecks.checkFunctionAddress(function_pointer);
   /* 493 */ IntBuffer size = APIUtil.getBufferInt(caps);
   /* 494 */ nglGetActiveUniformARB(
       programObj,
       index,
       0,
       0L,
       MemoryUtil.getAddress(size),
       MemoryUtil.getAddress(size, 1),
       APIUtil.getBufferByte0(caps),
       function_pointer);
   /* 495 */ return size.get(0);
   /*     */ }
 /*     */ public static void glShaderSourceARB(int shader, CharSequence string) {
   /* 112 */ ContextCapabilities caps = GLContext.getCapabilities();
   /* 113 */ long function_pointer = caps.glShaderSourceARB;
   /* 114 */ BufferChecks.checkFunctionAddress(function_pointer);
   /* 115 */ nglShaderSourceARB(
       shader, 1, APIUtil.getBuffer(caps, string), string.length(), function_pointer);
   /*     */ }
  private void setServiceDefinitionForWSDL2(org.apache.woden.wsdl20.Description definition, API api)
      throws APIManagementException {
    org.apache.woden.wsdl20.Service[] serviceMap = definition.getServices();
    URL addressURI;
    try {
      for (org.apache.woden.wsdl20.Service svc : serviceMap) {
        Endpoint[] portMap = svc.getEndpoints();
        for (Endpoint endpoint : portMap) {
          EndpointElement element = endpoint.toElement();

          addressURI = endpoint.getAddress().toURL();
          if (addressURI == null) {
            break;
          } else {
            String endpointTransport =
                determineURLTransport(endpoint.getAddress().getScheme(), api.getTransports());
            setAddressUrl(
                element,
                new URI(
                    APIUtil.getGatewayendpoint(endpointTransport)
                        + api.getContext()
                        + "/"
                        + api.getId().getVersion()));
          }
        }
      }

    } catch (Exception e) {
      log.error("Error occured while getting the wsdl address location", e);
      throw new APIManagementException(e);
    }
  }
 /** Overloads glBindFragDataLocationEXT. */
 public static void glBindFragDataLocationEXT(int program, int colorNumber, CharSequence name) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glBindFragDataLocationEXT;
   BufferChecks.checkFunctionAddress(function_pointer);
   nglBindFragDataLocationEXT(
       program, colorNumber, APIUtil.getBufferNT(name), 0, function_pointer);
 }
Example #11
0
  /**
   * Read the wsdl and clean the actual service endpoint instead of that set the gateway endpoint.
   *
   * @return {@link OMElement} - the OMElemnt of the new WSDL content
   * @throws APIManagementException
   */
  public OMElement readAndCleanWsdl() throws APIManagementException {

    try {
      Definition wsdlDefinition = readWSDLFile();

      setServiceDefinition(wsdlDefinition);

      WSDLWriter writer = getWsdlFactoryInstance().newWSDLWriter();

      ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

      writer.writeWSDL(wsdlDefinition, byteArrayOutputStream);

      ByteArrayInputStream byteArrayInputStream =
          new ByteArrayInputStream(byteArrayOutputStream.toByteArray());

      OMElement wsdlElement = APIUtil.buildOMElement(byteArrayInputStream);

      return wsdlElement;

    } catch (Exception e) {
      String msg = " Error occurs when change the addres URL of the WSDL";
      log.error(msg);
      throw new APIManagementException(msg, e);
    }
  }
 /*     */ public static int glGetUniformLocationARB(int programObj, CharSequence name) {
   /* 431 */ ContextCapabilities caps = GLContext.getCapabilities();
   /* 432 */ long function_pointer = caps.glGetUniformLocationARB;
   /* 433 */ BufferChecks.checkFunctionAddress(function_pointer);
   /* 434 */ int __result =
       nglGetUniformLocationARB(programObj, APIUtil.getBufferNT(caps, name), function_pointer);
   /* 435 */ return __result;
   /*     */ }
 /** Overloads glDebugMessageInsertARB. */
 public static void glDebugMessageInsertARB(
     int source, int type, int id, int severity, CharSequence buf) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glDebugMessageInsertARB;
   BufferChecks.checkFunctionAddress(function_pointer);
   nglDebugMessageInsertARB(
       source, type, id, severity, buf.length(), APIUtil.getBuffer(buf), 0, function_pointer);
 }
 /** Overloads glGenQueriesARB. */
 public static int glGenQueriesARB() {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glGenQueriesARB;
   BufferChecks.checkFunctionAddress(function_pointer);
   IntBuffer ids = APIUtil.getBufferInt(caps);
   nglGenQueriesARB(1, MemoryUtil.getAddress(ids), function_pointer);
   return ids.get(0);
 }
 /** Overloads glGetFragDataLocationEXT. */
 public static int glGetFragDataLocationEXT(int program, CharSequence name) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glGetFragDataLocationEXT;
   BufferChecks.checkFunctionAddress(function_pointer);
   int __result =
       nglGetFragDataLocationEXT(program, APIUtil.getBufferNT(name), 0, function_pointer);
   return __result;
 }
 /** Overloads glGetQueryObjectuivARB. */
 public static int glGetQueryObjectuiARB(int id, int pname) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glGetQueryObjectuivARB;
   BufferChecks.checkFunctionAddress(function_pointer);
   IntBuffer params = APIUtil.getBufferInt(caps);
   nglGetQueryObjectuivARB(id, pname, MemoryUtil.getAddress(params), function_pointer);
   return params.get(0);
 }
 /*     */ public static float glGetObjectParameterfARB(int obj, int pname) {
   /* 351 */ ContextCapabilities caps = GLContext.getCapabilities();
   /* 352 */ long function_pointer = caps.glGetObjectParameterfvARB;
   /* 353 */ BufferChecks.checkFunctionAddress(function_pointer);
   /* 354 */ FloatBuffer params = APIUtil.getBufferFloat(caps);
   /* 355 */ nglGetObjectParameterfvARB(
       obj, pname, MemoryUtil.getAddress(params), function_pointer);
   /* 356 */ return params.get(0);
   /*     */ }
Example #18
0
 /** Overloads glGetInternalformativ. */
 public static int glGetInternalformat(int target, int internalformat, int pname) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glGetInternalformativ;
   BufferChecks.checkFunctionAddress(function_pointer);
   IntBuffer params = APIUtil.getBufferInt(caps);
   nglGetInternalformativ(
       target, internalformat, pname, 1, MemoryUtil.getAddress(params), function_pointer);
   return params.get(0);
 }
Example #19
0
 /** Overloads glGetActiveAtomicCounterBufferiv. */
 public static int glGetActiveAtomicCounterBuffer(int program, int bufferIndex, int pname) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glGetActiveAtomicCounterBufferiv;
   BufferChecks.checkFunctionAddress(function_pointer);
   IntBuffer params = APIUtil.getBufferInt(caps);
   nglGetActiveAtomicCounterBufferiv(
       program, bufferIndex, pname, MemoryUtil.getAddress(params), function_pointer);
   return params.get(0);
 }
 /*     */ public static int glGetObjectParameteriARB(int obj, int pname) {
   /* 370 */ ContextCapabilities caps = GLContext.getCapabilities();
   /* 371 */ long function_pointer = caps.glGetObjectParameterivARB;
   /* 372 */ BufferChecks.checkFunctionAddress(function_pointer);
   /* 373 */ IntBuffer params = APIUtil.getBufferInt(caps);
   /* 374 */ nglGetObjectParameterivARB(
       obj, pname, MemoryUtil.getAddress(params), function_pointer);
   /* 375 */ return params.get(0);
   /*     */ }
  /**
   * Returns the value of the sync object attribute.
   *
   * @param sync the sync object
   * @param attribute the attribute to query
   * @return the attribute value
   * @throws org.lwjgl.LWJGLException if an EGL error occurs.
   */
  public static int eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, int attribute)
      throws LWJGLException {
    final IntBuffer value = APIUtil.getBufferInt();

    if (!neglGetSyncAttribKHR(
        dpy.getPointer(), sync.getPointer(), attribute, MemoryUtil.getAddress(value)))
      throwEGLError("Failed to get KHR fence sync object attribute.");

    return value.get(0);
  }
 /*     */ public static String glGetActiveUniformARB(int programObj, int index, int maxLength)
       /*     */ {
   /* 474 */ ContextCapabilities caps = GLContext.getCapabilities();
   /* 475 */ long function_pointer = caps.glGetActiveUniformARB;
   /* 476 */ BufferChecks.checkFunctionAddress(function_pointer);
   /* 477 */ IntBuffer name_length = APIUtil.getLengths(caps);
   /* 478 */ ByteBuffer name = APIUtil.getBufferByte(caps, maxLength);
   /* 479 */ nglGetActiveUniformARB(
       programObj,
       index,
       maxLength,
       MemoryUtil.getAddress0(name_length),
       MemoryUtil.getAddress0(APIUtil.getBufferInt(caps)),
       MemoryUtil.getAddress(APIUtil.getBufferInt(caps), 1),
       MemoryUtil.getAddress(name),
       function_pointer);
   /* 480 */ name.limit(name_length.get(0));
   /* 481 */ return APIUtil.getString(caps, name);
   /*     */ }
 /*     */ public static String glGetActiveUniformARB(
     int programObj, int index, int maxLength, IntBuffer sizeType)
       /*     */ {
   /* 457 */ ContextCapabilities caps = GLContext.getCapabilities();
   /* 458 */ long function_pointer = caps.glGetActiveUniformARB;
   /* 459 */ BufferChecks.checkFunctionAddress(function_pointer);
   /* 460 */ BufferChecks.checkBuffer(sizeType, 2);
   /* 461 */ IntBuffer name_length = APIUtil.getLengths(caps);
   /* 462 */ ByteBuffer name = APIUtil.getBufferByte(caps, maxLength);
   /* 463 */ nglGetActiveUniformARB(
       programObj,
       index,
       maxLength,
       MemoryUtil.getAddress0(name_length),
       MemoryUtil.getAddress(sizeType),
       MemoryUtil.getAddress(sizeType, sizeType.position() + 1),
       MemoryUtil.getAddress(name),
       function_pointer);
   /* 464 */ name.limit(name_length.get(0));
   /* 465 */ return APIUtil.getString(caps, name);
   /*     */ }
  public OMElement readAndCleanWsdl2(API api) throws APIManagementException {

    try {
      org.apache.woden.wsdl20.Description wsdlDefinition = readWSDL2File();
      setServiceDefinitionForWSDL2(wsdlDefinition, api);
      org.apache.woden.WSDLWriter writer =
          org.apache.woden.WSDLFactory.newInstance().newWSDLWriter();
      ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
      writer.writeWSDL(wsdlDefinition.toElement(), byteArrayOutputStream);
      ByteArrayInputStream byteArrayInputStream =
          new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
      return APIUtil.buildOMElement(byteArrayInputStream);
      //            String wsdlDoc = toString(byteArrayInputStream);
    } catch (Exception e) {
      String msg = " Error occurs when change the addres URL of the WSDL";
      log.error(msg);
      throw new APIManagementException(msg, e);
    }
  }
 /** Overloads glDeleteFramebuffersOES. */
 public static void glDeleteFramebuffersOES(int framebuffer) {
   nglDeleteFramebuffersOES(1, APIUtil.getInt(framebuffer));
 }
 /** Overloads glGenRenderbuffersOES. */
 public static int glGenRenderbuffersOES() {
   IntBuffer renderbuffers = APIUtil.getBufferInt();
   nglGenRenderbuffersOES(1, MemoryUtil.getAddress(renderbuffers));
   return renderbuffers.get(0);
 }
 /** Overloads glDeleteRenderbuffersOES. */
 public static void glDeleteRenderbuffersOES(int renderbuffer) {
   nglDeleteRenderbuffersOES(1, APIUtil.getInt(renderbuffer));
 }
 /** Overloads glGenFramebuffersOES. */
 public static int glGenFramebuffersOES() {
   IntBuffer framebuffers = APIUtil.getBufferInt();
   nglGenFramebuffersOES(1, MemoryUtil.getAddress(framebuffers));
   return framebuffers.get(0);
 }
 /** Overloads glGetFramebufferAttachmentParameterivOES. */
 public static int glGetFramebufferAttachmentParameteriOES(int target, int attachment, int pname) {
   IntBuffer params = APIUtil.getBufferInt();
   nglGetFramebufferAttachmentParameterivOES(
       target, attachment, pname, MemoryUtil.getAddress(params));
   return params.get(0);
 }
 /** Overloads glDeleteQueriesARB. */
 public static void glDeleteQueriesARB(int id) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glDeleteQueriesARB;
   BufferChecks.checkFunctionAddress(function_pointer);
   nglDeleteQueriesARB(1, APIUtil.getInt(caps, id), function_pointer);
 }