Package de.fzj.unicore.bes.client

Examples of de.fzj.unicore.bes.client.FactoryClient


              .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));
View Full Code Here


            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);

            buf.append("Finished launching job, Host = ").append(host.getHostAddress()).append(" JSDL = ")
View Full Code Here

      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));
View Full Code Here

      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));
View Full Code Here

            // 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);
View Full Code Here

            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

            // 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);
                    ApplicationJobStatus applicationJobStatus = getApplicationJobStatus(activityStatus);
View Full Code Here

            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

TOP

Related Classes of de.fzj.unicore.bes.client.FactoryClient

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.