org.xlcloud.xsa.ext.HpcServiceDescriptor.java Source code

Java tutorial

Introduction

Here is the source code for org.xlcloud.xsa.ext.HpcServiceDescriptor.java

Source

/*
    
 * Copyright 2012 AMG.lab, a Bull Group Company
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *    http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.xlcloud.xsa.ext;

import java.util.HashSet;
import java.util.Set;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.openide.util.lookup.ServiceProvider;
import org.xlcloud.xsa.ext.hpc.ApplicationsService;
import org.xlcloud.xsa.ext.hpc.HpcJobsService;
import org.xlcloud.xsa.ext.spi.ServiceDescription;
import org.xlcloud.xsa.ext.spi.ServiceDescriptor;

/**
 * {@link ServiceDescriptor} interface implementation for HPC extension.
 * 
 * @author Tomek Adamczewski, AMG.net
 */
@ServiceProvider(service = ServiceDescriptor.class)
public class HpcServiceDescriptor implements ServiceDescriptor {

    private static ServiceDescription serviceDescription;
    private static Set<Class<?>> serviceClasses;
    private static Set<Class<?>> modelClasses;

    static {
        serviceDescription = new ServiceDescription();
        serviceDescription.setServiceName("XSA HPC extension");
        serviceDescription.setDescription("Service providing HPC functionalities to the XSA");
        serviceDescription.setUriPrefix("/hpc");

        serviceClasses = new HashSet<Class<?>>();
        serviceClasses.add(ApplicationsService.class);
        serviceClasses.add(HpcJobsService.class);
    }

    /** {@inheritDoc} */
    @Override
    public Set<Class<?>> getServiceClasses() {
        return serviceClasses;
    }

    /** {@inheritDoc} */
    @Override
    public ServiceDescription getServiceDescription() {
        return serviceDescription;
    }

    @Override
    public String toString() {
        return this.getClass().getName() + "["
                + ToStringBuilder.reflectionToString(serviceDescription, ToStringStyle.SHORT_PREFIX_STYLE) + ", "
                + ToStringBuilder.reflectionToString(serviceClasses, ToStringStyle.SHORT_PREFIX_STYLE) + ", "
                + ToStringBuilder.reflectionToString(modelClasses, ToStringStyle.SHORT_PREFIX_STYLE) + "]";
    }

}