CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-javax--javaee-api

Complete Java Enterprise Edition 8 specification APIs providing all standardized enterprise application development interfaces

Pending
Overview
Eval results
Files

enterprise-services.mddocs/

Enterprise Services

Additional enterprise APIs including JavaMail, JCA connectors, batch processing, and concurrency utilities.

JavaMail

public abstract class Message implements Part {
    public abstract void setFrom(Address address) throws MessagingException;
    public abstract void addFrom(Address[] addresses) throws MessagingException;
    public abstract Address[] getFrom() throws MessagingException;
    public abstract void setRecipients(Message.RecipientType type, Address[] addresses) throws MessagingException;
    public abstract void addRecipients(Message.RecipientType type, Address[] addresses) throws MessagingException;
    public abstract Address[] getRecipients(Message.RecipientType type) throws MessagingException;
    public abstract void setSubject(String subject) throws MessagingException;
    public abstract String getSubject() throws MessagingException;
    public abstract void setSentDate(Date date) throws MessagingException;
    public abstract Date getSentDate() throws MessagingException;
    public abstract void saveChanges() throws MessagingException;
}

public abstract class Transport extends Service {
    public static void send(Message msg) throws MessagingException;
    public static void send(Message msg, Address[] addresses) throws MessagingException;
    public abstract void sendMessage(Message msg, Address[] addresses) throws MessagingException;
}

Batch Processing

public interface JobOperator {
    long start(String jobXMLName, Properties jobParameters) throws JobStartException, JobSecurityException;
    long restart(long executionId, Properties restartParameters) throws JobExecutionAlreadyCompleteException, NoSuchJobExecutionException, JobExecutionNotMostRecentException, JobRestartException, JobSecurityException;
    void stop(long executionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException, JobSecurityException;
    void abandon(long executionId) throws NoSuchJobExecutionException, JobExecutionIsRunningException, JobSecurityException;
    JobExecution getJobExecution(long executionId) throws NoSuchJobExecutionException, JobSecurityException;
    List<JobExecution> getJobExecutions(JobInstance jobInstance) throws NoSuchJobInstanceException, JobSecurityException;
    JobInstance getJobInstance(long executionId) throws NoSuchJobExecutionException, JobSecurityException;
    List<JobInstance> getJobInstances(String jobName, int start, int count) throws NoSuchJobException, JobSecurityException;
    List<String> getJobNames() throws JobSecurityException;
    Properties getParameters(long executionId) throws NoSuchJobExecutionException, JobSecurityException;
    List<StepExecution> getStepExecutions(long jobExecutionId) throws NoSuchJobExecutionException, JobSecurityException;
}

public interface StepContext {
    String getStepName();
    Object getTransientUserData();
    void setTransientUserData(Object data);
    long getStepExecutionId();
    Properties getProperties();
    Serializable getPersistentUserData();
    void setPersistentUserData(Serializable data);
    BatchStatus getBatchStatus();
    String getExitStatus();
    void setExitStatus(String status);
    Exception getException();
    Metric[] getMetrics();
}

Concurrency Utilities

Managed Executor Services

public interface ManagedExecutorService extends ExecutorService {
    <T> Future<T> submit(Callable<T> task);
    <T> Future<T> submit(Runnable task, T result);
    Future<?> submit(Runnable task);
    <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException;
    <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException;
    <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException;
    <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException;
    void execute(Runnable command);
}

public interface ManagedScheduledExecutorService extends ManagedExecutorService, ScheduledExecutorService {
    ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit);
    <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit);
    ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit);
    ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit);
}

Managed Thread Factory

public interface ManagedThreadFactory extends ThreadFactory {
    Thread newThread(Runnable r);
}

Context Service

public interface ContextService {
    <T> T createContextualProxy(T instance, Class<T> intf);
    <T> T createContextualProxy(T instance, Class<?>... interfaces);
    Map<String, String> getExecutionProperties(Object contextualProxy);
    <T> Callable<T> contextualizeCallable(Callable<T> callable);
    Runnable contextualizeRunnable(Runnable runnable);
}

Last Execution and Trigger

public interface LastExecution {
    String getIdentityName();
    Date getRunStart();
    Date getRunEnd();
    Object getResult();
}

public interface Trigger {
    Date getNextRunTime(LastExecution lastExecutionInfo, Date taskScheduledTime);
    boolean skipRun(LastExecution lastExecutionInfo, Date scheduledRunTime);
}

Managed Task

public interface ManagedTask {
    String IDENTITY_NAME = "javax.enterprise.concurrent.IDENTITY_NAME";
    String USE_TRANSACTION_OF_EXECUTION_THREAD = "javax.enterprise.concurrent.USE_TRANSACTION_OF_EXECUTION_THREAD";
    String LONGRUNNING_HINT = "javax.enterprise.concurrent.LONGRUNNING_HINT";
    String TRANSACTION = "javax.enterprise.concurrent.TRANSACTION";
    
    Map<String, String> getExecutionProperties();
    ManagedTaskListener getManagedTaskListener();
}

public interface ManagedTaskListener {
    void taskSubmitted(Future<?> future, ManagedExecutorService executor, Object task);
    void taskAborted(Future<?> future, ManagedExecutorService executor, Object task, Throwable exception);
    void taskDone(Future<?> future, ManagedExecutorService executor, Object task, Throwable exception);
    void taskStarting(Future<?> future, ManagedExecutorService executor, Object task);
}

Usage Examples

// JavaMail
@Resource(name = "mail/MyMailSession")
Session mailSession;

public void sendEmail(String to, String subject, String body) throws MessagingException {
    Message message = new MimeMessage(mailSession);
    message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to));
    message.setSubject(subject);
    message.setText(body);
    Transport.send(message);
}

// Batch Processing
@Named
public class MyItemProcessor implements ItemProcessor {
    @Override
    public Object processItem(Object item) throws Exception {
        // Process item
        return processedItem;
    }
}

// Concurrency
@Resource
ManagedExecutorService executor;

public void executeAsync() {
    executor.submit(() -> {
        // Asynchronous task
    });
}

Install with Tessl CLI

npx tessl i tessl/maven-javax--javaee-api

docs

dependency-injection.md

ejb.md

enterprise-services.md

index.md

json-processing.md

messaging.md

persistence.md

rest-services.md

security.md

transactions.md

validation.md

web-services.md

web-technologies.md

xml-binding.md

tile.json