Package org.w3.x2005.x08.addressing

Examples of org.w3.x2005.x08.addressing.EndpointReferenceType


    this.resolver = resolveWSA(endpoint);
    this.client = client;
  }

  public static EndpointReferenceType createWSA(String address) {
    EndpointReferenceType epr = new EndpointReferenceType();
    AttributedURIType attUri = new AttributedURIType();
    attUri.setValue(address);
    epr.setAddress(attUri);
    return epr;
  }
View Full Code Here


      throws GFacProviderException {
    UnicoreHostType host = (UnicoreHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
       
        String factoryUrl = host.getUnicoreHostAddressArray()[0];

        EndpointReferenceType eprt = EndpointReferenceType.Factory.newInstance();
        eprt.addNewAddress().setStringValue(factoryUrl);

        CreateActivityDocument cad = CreateActivityDocument.Factory
                .newInstance();
       
        try {
      cad.addNewCreateActivity().addNewActivityDocument()
              .setJobDefinition(JSDLGenerator.buildJSDLInstance(jobExecutionContext).getJobDefinition());
    } catch (Exception e1) {
      throw new GFacProviderException("Cannot generate JSDL instance from the JobExecutionContext.",e1);
    }
       
        FactoryClient factory = null;
        try {
            factory = new FactoryClient(eprt, secProperties);
        } catch (Exception e) {
            throw new GFacProviderException("");
        }
        CreateActivityResponseDocument response = null;
        try {
            log.info(String.format("Activity Submitting to %s ... \n", factoryUrl));
            response = factory.createActivity(cad);
            log.info(String.format("Activity Submitted to %s \n", factoryUrl));
        } catch (Exception e) {
          e.printStackTrace();
            throw new GFacProviderException("Cannot create activity.", e);
        }
        EndpointReferenceType activityEpr = response
                .getCreateActivityResponse().getActivityIdentifier();
       
        log.debug("Activity EPR: "+activityEpr);
       
        log.info("Activity: "+activityEpr.getAddress().getStringValue()" Submitted.");
       
        //factory.waitWhileActivityIsDone(activityEpr, 1000);
        jobId = WSUtilities.extractResourceID(activityEpr);
        if (jobId == null) {
            jobId = new Long(Calendar.getInstance().getTimeInMillis())
                    .toString();
        }
       
        log.info(formatStatusMessage(activityEpr.getAddress().getStringValue(), factory.getActivityStatus(activityEpr)
                .toString()));
       
       
        //TODO publish the status messages to the message bus
        while ((factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FINISHED) &&
                (factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FAILED)){
         
            ActivityStatusType activityStatus = null;
        try {
          activityStatus = getStatus(factory, activityEpr);
          log.info (subStatusAsString(activityStatus));
        } catch (UnknownActivityIdentifierFault e) {
          throw new GFacProviderException(e.getMessage(), e.getCause());
        }
 
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            }
            continue;
        }
       
        ActivityStatusType activityStatus = null;
    try {
      activityStatus = getStatus(factory, activityEpr);
    } catch (UnknownActivityIdentifierFault e) {
      throw new GFacProviderException(e.getMessage(), e.getCause());
    }
       
        log.info(formatStatusMessage(activityEpr.getAddress().getStringValue(), activityStatus.getState().toString()));
       
    if ((activityStatus.getState() == ActivityStateEnumeration.FAILED)) {
        log.info(activityStatus.getFault().getFaultcode().getLocalPart()
            + "\n" + activityStatus.getFault().getFaultstring());
        log.info("EXITCODE: "+activityStatus.getExitCode());
View Full Code Here

            /*
             * Set Security
             */
            securityProperties = initSecurityProperties();
            String factoryUrl = job.getFactoryUrl();
            EndpointReferenceType eprt = EndpointReferenceType.Factory
                    .newInstance();
            eprt.addNewAddress().setStringValue(factoryUrl);
            System.out.println("========================================");
            System.out.println(String.format("Job Submitted to %s.\n", factoryUrl));
            FactoryClient factory = null;
            try {
                factory = new FactoryClient(eprt, securityProperties);
            } catch (Exception e) {
                e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            }
            CreateActivityDocument cad = CreateActivityDocument.Factory
                    .newInstance();
            cad.addNewCreateActivity().addNewActivityDocument()
                    .setJobDefinition(job.getJobDoc().getJobDefinition());
            CreateActivityResponseDocument response = null;
            try {
                response = factory.createActivity(cad);
            } catch (NotAcceptingNewActivitiesFault notAcceptingNewActivitiesFault) {
                notAcceptingNewActivitiesFault.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            } catch (InvalidRequestMessageFault invalidRequestMessageFault) {
                invalidRequestMessageFault.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            } catch (UnsupportedFeatureFault unsupportedFeatureFault) {
                unsupportedFeatureFault.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            }
            EndpointReferenceType activityEpr = response
                    .getCreateActivityResponse().getActivityIdentifier();
            //factory.waitWhileActivityIsDone(activityEpr, 1000);
            jobId = WSUtilities.extractResourceID(activityEpr);
            if (jobId == null) {
                jobId = new Long(Calendar.getInstance().getTimeInMillis())
                        .toString();
            }
            ActivityStateEnumeration.Enum state = factory.getActivityStatus(activityEpr);

            String status;

            status = String.format("Job %s is %s.\n", activityEpr.getAddress()
                    .getStringValue(), factory.getActivityStatus(activityEpr)
                    .toString()).toString();


            while ((factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FINISHED) &&
                    (factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FAILED)){
                status = String.format("Job %s is %s.\n", activityEpr.getAddress()
                        .getStringValue(), factory.getActivityStatus(activityEpr)
                        .toString()).toString();
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
                }
                continue;
            }

            status = String.format("Job %s is %s.\n", activityEpr.getAddress()
                    .getStringValue(), factory.getActivityStatus(activityEpr)
                    .toString()).toString();

            log.debug("Request to contact:" + unicoreHost);

View Full Code Here

      throws GFacProviderException {
    UnicoreHostType host = (UnicoreHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
       
        String factoryUrl = host.getUnicoreBESEndPointArray()[0];

        EndpointReferenceType eprt = EndpointReferenceType.Factory.newInstance();
        eprt.addNewAddress().setStringValue(factoryUrl);

        CreateActivityDocument cad = CreateActivityDocument.Factory
                .newInstance();
       
    JobDefinitionType jobDefinition = null;
        try {
            //FIXME: Replace by a native client
//      jobDefinition = JSDLGenerator.buildJSDLInstance(jobExecutionContext).getJobDefinition();
//      cad.addNewCreateActivity().addNewActivityDocument().setJobDefinition(jobDefinition);
      System.out.println("REMOVE ME");
    } catch (Exception e1) {
      throw new GFacProviderException("Cannot generate JSDL instance from the JobExecutionContext.",e1);
    }
       
        FactoryClient factory = null;
        try {
            factory = new FactoryClient(eprt, secProperties);
        } catch (Exception e) {
            throw new GFacProviderException("");
        }
        CreateActivityResponseDocument response = null;
        try {
            log.info(String.format("Activity Submitting to %s ... \n", factoryUrl));
            response = factory.createActivity(cad);
            log.info(String.format("Activity Submitted to %s \n", factoryUrl));
        } catch (Exception e) {
          e.printStackTrace();
            throw new GFacProviderException("Cannot create activity.", e);
        }
        EndpointReferenceType activityEpr = response
                .getCreateActivityResponse().getActivityIdentifier();
       
        log.debug("Activity EPR: "+activityEpr);
       
        log.info("Activity: "+activityEpr.getAddress().getStringValue()" Submitted.");
       
        //factory.waitWhileActivityIsDone(activityEpr, 1000);
        jobId = WSUtilities.extractResourceID(activityEpr);
        if (jobId == null) {
            jobId = new Long(Calendar.getInstance().getTimeInMillis())
                    .toString();
        }
    saveApplicationJob(jobExecutionContext, jobDefinition);
        log.info(formatStatusMessage(activityEpr.getAddress().getStringValue(), factory.getActivityStatus(activityEpr)
                .toString()));
       
       
        //TODO publish the status messages to the message bus
        while ((factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FINISHED) &&
                (factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FAILED)){
         
            ActivityStatusType activityStatus = null;
        try {
          activityStatus = getStatus(factory, activityEpr);
          GFacUtils.updateApplicationJobStatus(jobExecutionContext, jobId, getApplicationJobStatus(activityStatus));
          log.info (subStatusAsString(activityStatus));
        } catch (UnknownActivityIdentifierFault e) {
          throw new GFacProviderException(e.getMessage(), e.getCause());
        }
 
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            }
            continue;
        }
       
        ActivityStatusType activityStatus = null;
    try {
      activityStatus = getStatus(factory, activityEpr);
    } catch (UnknownActivityIdentifierFault e) {
      throw new GFacProviderException(e.getMessage(), e.getCause());
    }
       
        log.info(formatStatusMessage(activityEpr.getAddress().getStringValue(), activityStatus.getState().toString()));
       
    if ((activityStatus.getState() == ActivityStateEnumeration.FAILED)) {
        log.info(activityStatus.getFault().getFaultcode().getLocalPart()
            + "\n" + activityStatus.getFault().getFaultstring());
        log.info("EXITCODE: "+activityStatus.getExitCode());
View Full Code Here

      throws GFacProviderException {
    UnicoreHostType host = (UnicoreHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
       
        String factoryUrl = host.getUnicoreBESEndPointArray()[0];

        EndpointReferenceType eprt = EndpointReferenceType.Factory.newInstance();
        eprt.addNewAddress().setStringValue(factoryUrl);

        CreateActivityDocument cad = CreateActivityDocument.Factory
                .newInstance();
       
    JobDefinitionType jobDefinition = null;
        try {
            //FIXME: Replace by a native client
//      jobDefinition = JSDLGenerator.buildJSDLInstance(jobExecutionContext).getJobDefinition();
//      cad.addNewCreateActivity().addNewActivityDocument().setJobDefinition(jobDefinition);
      System.out.println("REMOVE ME");
    } catch (Exception e1) {
      throw new GFacProviderException("Cannot generate JSDL instance from the JobExecutionContext.",e1);
    }
       
        FactoryClient factory = null;
        try {
            factory = new FactoryClient(eprt, secProperties);
        } catch (Exception e) {
            throw new GFacProviderException("");
        }
        CreateActivityResponseDocument response = null;
        try {
            log.info(String.format("Activity Submitting to %s ... \n", factoryUrl));
            response = factory.createActivity(cad);
            log.info(String.format("Activity Submitted to %s \n", factoryUrl));
        } catch (Exception e) {
          e.printStackTrace();
            throw new GFacProviderException("Cannot create activity.", e);
        }
        EndpointReferenceType activityEpr = response
                .getCreateActivityResponse().getActivityIdentifier();
       
        log.debug("Activity EPR: "+activityEpr);
       
        log.info("Activity: "+activityEpr.getAddress().getStringValue()" Submitted.");
       
        //factory.waitWhileActivityIsDone(activityEpr, 1000);
        jobId = WSUtilities.extractResourceID(activityEpr);
        if (jobId == null) {
            jobId = new Long(Calendar.getInstance().getTimeInMillis())
                    .toString();
        }
    saveApplicationJob(jobExecutionContext, jobDefinition);
        log.info(formatStatusMessage(activityEpr.getAddress().getStringValue(), factory.getActivityStatus(activityEpr)
                .toString()));
       
       
        //TODO publish the status messages to the message bus
        while ((factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FINISHED) &&
                (factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FAILED)){
         
            ActivityStatusType activityStatus = null;
        try {
          activityStatus = getStatus(factory, activityEpr);
          GFacUtils.updateApplicationJobStatus(jobExecutionContext, jobId, getApplicationJobStatus(activityStatus));
          log.info (subStatusAsString(activityStatus));
        } catch (UnknownActivityIdentifierFault e) {
          throw new GFacProviderException(e.getMessage(), e.getCause());
        }
 
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            }
            continue;
        }
       
        ActivityStatusType activityStatus = null;
    try {
      activityStatus = getStatus(factory, activityEpr);
    } catch (UnknownActivityIdentifierFault e) {
      throw new GFacProviderException(e.getMessage(), e.getCause());
    }
       
        log.info(formatStatusMessage(activityEpr.getAddress().getStringValue(), activityStatus.getState().toString()));
       
    if ((activityStatus.getState() == ActivityStateEnumeration.FAILED)) {
        log.info(activityStatus.getFault().getFaultcode().getLocalPart()
            + "\n" + activityStatus.getFault().getFaultstring());
        log.info("EXITCODE: "+activityStatus.getExitCode());
View Full Code Here

        UnicoreHostType host = (UnicoreHostType) jobExecutionContext.getApplicationContext().getHostDescription()
                .getType();

        String factoryUrl = host.getUnicoreBESEndPointArray()[0];

        EndpointReferenceType eprt = EndpointReferenceType.Factory.newInstance();
        eprt.addNewAddress().setStringValue(factoryUrl);

        String userDN = getUserName(jobExecutionContext);

        if (userDN == null || userDN.equalsIgnoreCase("admin")) {
            userDN = "CN=zdv575, O=Ultrascan Gateway, C=DE";
        }

        String xlogin = getCNFromUserDN(userDN);
        // create storage
        StorageCreator storageCreator = new StorageCreator(secProperties, factoryUrl, 5, xlogin);

        StorageClient sc = null;
        try {
            try {
                sc = storageCreator.createStorage();
            } catch (Exception e2) {
                log.error("Cannot create storage..");
                throw new GFacProviderException("Cannot create storage..", e2);
            }

            CreateActivityDocument cad = CreateActivityDocument.Factory.newInstance();
            JobDefinitionDocument jobDefDoc = JobDefinitionDocument.Factory.newInstance();

            JobDefinitionType jobDefinition = jobDefDoc.addNewJobDefinition();
            try {
                jobDefinition = JSDLGenerator.buildJSDLInstance(jobExecutionContext, sc.getUrl()).getJobDefinition();
                cad.addNewCreateActivity().addNewActivityDocument().setJobDefinition(jobDefinition);

                log.info("JSDL" + jobDefDoc.toString());
            } catch (Exception e1) {
                throw new GFacProviderException("Cannot generate JSDL instance from the JobExecutionContext.", e1);
            }

            // upload files if any
            DataTransferrer dt = new DataTransferrer(jobExecutionContext, sc);
            dt.uploadLocalFiles();

            FactoryClient factory = null;
            try {
                factory = new FactoryClient(eprt, secProperties);
            } catch (Exception e) {
                throw new GFacProviderException(e.getLocalizedMessage(), e);
            }

            CreateActivityResponseDocument response = null;
            try {
                log.info(String.format("Activity Submitting to %s ... \n", factoryUrl));
                response = factory.createActivity(cad);
                log.info(String.format("Activity Submitted to %s \n", factoryUrl));
            } catch (Exception e) {
                throw new GFacProviderException("Cannot create activity.", e);
            }
            EndpointReferenceType activityEpr = response.getCreateActivityResponse().getActivityIdentifier();

            log.info("Activity : " + activityEpr.getAddress().getStringValue() + " Submitted.");

            // factory.waitWhileActivityIsDone(activityEpr, 1000);
            jobId = WSUtilities.extractResourceID(activityEpr);
            if (jobId == null) {
                jobId = new Long(Calendar.getInstance().getTimeInMillis()).toString();
            }
            log.info("JobID: " + jobId);
            jobExecutionContext.getNotifier().publish(new UnicoreJobIDEvent(jobId));
            saveApplicationJob(jobExecutionContext, jobDefinition, activityEpr.toString());

            factory.getActivityStatus(activityEpr);
            log.info(formatStatusMessage(activityEpr.getAddress().getStringValue(),
                    factory.getActivityStatus(activityEpr).toString()));

            // TODO publish the status messages to the message bus
            while ((factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FINISHED)
                    && (factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.FAILED)
                    && (factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.CANCELLED)) {

                ActivityStatusType activityStatus = null;
                try {
                    activityStatus = getStatus(factory, activityEpr);
                    JobState jobStatus = getApplicationJobStatus(activityStatus);
                    String jobStatusMessage = "Status of job " + jobId + "is " + jobStatus;
                    jobExecutionContext.getNotifier().publish(new StatusChangeEvent(jobStatusMessage));
                    details.setJobID(jobId);
                    GFacUtils.updateJobStatus(jobExecutionContext, details, jobStatus);
                } catch (UnknownActivityIdentifierFault e) {
                    throw new GFacProviderException(e.getMessage(), e.getCause());
                }catch (GFacException e) {
                    throw new GFacProviderException(e.getMessage(), e.getCause());
                }

                try {
                    Thread.sleep(5000);
                } catch (InterruptedException e) {
                }
                continue;
            }

            ActivityStatusType activityStatus = null;
            try {
                activityStatus = getStatus(factory, activityEpr);
            } catch (UnknownActivityIdentifierFault e) {
                throw new GFacProviderException(e.getMessage(), e.getCause());
            }

            log.info(formatStatusMessage(activityEpr.getAddress().getStringValue(), activityStatus.getState()
                    .toString()));

            if ((activityStatus.getState() == ActivityStateEnumeration.FAILED)) {
                String error = activityStatus.getFault().getFaultcode().getLocalPart() + "\n"
                        + activityStatus.getFault().getFaultstring() + "\n EXITCODE: " + activityStatus.getExitCode();
View Full Code Here

     * @throws GFacProviderException
     */
    public void cancelJob(String activityEpr, JobExecutionContext jobExecutionContext) throws GFacProviderException {
        try {
            initSecurityProperties(jobExecutionContext);
            EndpointReferenceType eprt = EndpointReferenceType.Factory.parse(activityEpr);
            UnicoreHostType host = (UnicoreHostType) jobExecutionContext.getApplicationContext().getHostDescription()
                    .getType();

            String factoryUrl = host.getUnicoreBESEndPointArray()[0];
            EndpointReferenceType epr = EndpointReferenceType.Factory.newInstance();
            epr.addNewAddress().setStringValue(factoryUrl);

            FactoryClient factory = new FactoryClient(epr, secProperties);
            factory.terminateActivity(eprt);
        } catch (Exception e) {
            throw new GFacProviderException(e.getLocalizedMessage(),e);
View Full Code Here

    }

    protected void downloadOffline(String smsEpr, JobExecutionContext jobExecutionContext) throws GFacProviderException {
        try {
            initSecurityProperties(jobExecutionContext);
            EndpointReferenceType eprt = EndpointReferenceType.Factory.parse(smsEpr);
            StorageClient sms = new StorageClient(eprt, secProperties);
            DataTransferrer dt = new DataTransferrer(jobExecutionContext, sms);
            // there must be output files there
            // this is also possible if client is re-connected, the jobs are
            // still
View Full Code Here

   
    if(factoryUrl == null) {
      throw new Exception("Cannot create Storage Factory Url");
    }
   
    EndpointReferenceType sfEpr= WSUtilities.makeServiceEPR(factoryUrl, StorageFactory.SMF_PORT);
   
    String dn = findServerName(factoryUrl, sfEpr);
   
    WSUtilities.addServerIdentity(sfEpr, dn);
   
View Full Code Here

   
    int besIndex = besUrl.indexOf("StorageFactory?res");
    String ss = besUrl.substring(0, besIndex);
    ss = ss + "Registry";
   
    EndpointReferenceType eprt = WSUtilities.makeServiceEPR(ss, "default_registry", Registry.REGISTRY_PORT);
   
    RegistryClient registry = new RegistryClient(eprt, secProps);
   
    //first, check if server name is already in the EPR...
    String dn=WSUtilities.extractServerIDFromEPR(smsEpr);
View Full Code Here

TOP

Related Classes of org.w3.x2005.x08.addressing.EndpointReferenceType

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.