Examples of ResourceConfig


Examples of com.sun.appserv.management.config.ResourceConfig

                    createJndiResource(handlerCtx);
                    return;
                }
                String jndiName = (String) handlerCtx.getInputValue("jndiName");
                String type = (String) handlerCtx.getInputValue("type");
                ResourceConfig resource = null;
                if (type.equals("custom")){
                    CustomResourceConfig custom;
                    resource = custom = AMXUtil.getDomainConfig().getCustomResourceConfigMap().get(jndiName);
                    if (resource == null){
                        GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("msg.NoSuchResource"));
                        return;
                    }
                    custom.setResType((String)handlerCtx.getInputValue("resType"));
                    custom.setFactoryClass((String)handlerCtx.getInputValue("factoryClass"));
                }else{
                    JNDIResourceConfig jndi = null;
                    resource = jndi = AMXUtil.getDomainConfig().getJNDIResourceConfigMap().get(jndiName);
                    if (resource == null){
                        GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("msg.NoSuchResource"));
                        return;
                    }
                    jndi.setJNDILookupName((String)handlerCtx.getInputValue("jndiLookupName"));
                    jndi.setResType((String)handlerCtx.getInputValue("resType"));
                    jndi.setFactoryClass((String)handlerCtx.getInputValue("factoryClass"));
                }
                resource.setDescription((String)handlerCtx.getInputValue("description"));
                AMXUtil.editProperties(handlerCtx, resource);
                if(! AMXUtil.isEE()){
                    Boolean enabled = (Boolean) handlerCtx.getInputValue("enabled");
                    TargetUtil.setResourceEnabled(resource, "server", enabled);
                }
View Full Code Here

Examples of com.sun.appserv.management.config.ResourceConfig

        try{
            String jndiName = (String) handlerCtx.getInputValue("jndiName");
            String type = (String) handlerCtx.getInputValue("type");
            String resType = (String) handlerCtx.getInputValue("resType");
            String factoryClass = (String) handlerCtx.getInputValue("factoryClass");
            ResourceConfig resource = null;
            Map optionalMap = AMXUtil.convertToPropertiesOptionMap((Map)handlerCtx.getInputValue("AddProps"), null);
            if (type.equals("custom")){
                resource = AMXUtil.getDomainConfig().createCustomResourceConfig(jndiName, resType, factoryClass, optionalMap);
            }else{
                resource = AMXUtil.getDomainConfig().createJNDIResourceConfig(jndiName, (String)handlerCtx.getInputValue("jndiLookupName"), resType, factoryClass, optionalMap);
            }
            JavaMailHandlers.createNewTargets(handlerCtx, jndiName);
            resource.setDescription((String)handlerCtx.getInputValue("description"));
        }catch (Exception ex){
            GuiUtil.handleException(handlerCtx, ex);
        }
       
    }
View Full Code Here

Examples of com.sun.appserv.management.config.ResourceConfig

        boolean hasOrig = false;
      
        List result = new ArrayList();
        if (iter != null){
            while(iter.hasNext()){
                ResourceConfig resConfig = (ResourceConfig) iter.next();
                HashMap oneRow = new HashMap();
                String name=resConfig.getJNDIName();
                oneRow.put("name", name);
                oneRow.put("enabled", TargetUtil.getEnabledStatus(resConfig, false));
                oneRow.put("selected", (hasOrig)? isSelected(name, selectedList): false);
                oneRow.put("description", checkEmpty(resConfig.getDescription()));
                if(isJdbc){
                    oneRow.put("pool", ((JDBCResourceConfig)resConfig).getPoolName());
                }else
                if(isConnector){
                    oneRow.put("pool", ((ConnectorResourceConfig)resConfig).getPoolName());
View Full Code Here

Examples of com.sun.jersey.api.core.ResourceConfig

    this.dbPort = dbPort;
  }

  public void run() throws Exception {
    URI baseUri = getBaseUrl(port);
    ResourceConfig rc = new PackagesResourceConfig("hello", "org.eluder.jersey.mustache");
    rc.setPropertiesAndFeatures(properties());
    rc.getContainerResponseFilters().add(new ServerResponseFilter());
    HttpServer server = GrizzlyServerFactory.createHttpServer(baseUri, rc);

    try {
        server.start();
View Full Code Here

Examples of com.sun.jersey.api.core.ResourceConfig

    public static GrizzlyAdapter exposeContext(Set classes, ServerContext sc)
            throws EndpointRegistrationException {

        Adapter adapter = null;

        ResourceConfig rc = new DefaultResourceConfig(classes);

        //Use common classloader. Jersey artifacts are not visible through
        //module classloader
        ClassLoader originalContextClassLoader = Thread.currentThread().getContextClassLoader();
        try {
View Full Code Here

Examples of com.sun.jersey.api.core.ResourceConfig

      e.printStackTrace();
    }
  }

  private void setupServer(Application application) {
    ResourceConfig rc = new ApplicationAdapter(application);

    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put(ResourceConfig.FEATURE_TRACE, "true");
    rc.setPropertiesAndFeatures(properties);

    Properties serverProperties = readProperties();
    int port = Integer.parseInt(serverProperties.getProperty(PORT_PROPERTY));
    URI serverUri = UriBuilder.fromPath(ROOT_RESOURCE_PATH).scheme("http").host("localhost").port(port).build();
    try {
View Full Code Here

Examples of com.sun.jersey.api.core.ResourceConfig

    private ApplicationDescription createApplication(String[] paths) {
        final ClassLoader cl = Thread.currentThread().getContextClassLoader();
        final ClassLoader ncl = new Loader(classpath.list(), this.getClass().getClassLoader());
        Thread.currentThread().setContextClassLoader(ncl);
        try {
            ResourceConfig rc = new ClasspathResourceConfig(classpath.list());
            rc.validate();
            Set<AbstractResource> s = new HashSet<AbstractResource>();
            for (Class c : rc.getRootResourceClasses()) {
                s.add(IntrospectionModeller.createResource(c));
            }
           
            return new WadlBuilder().generate(null, s);
        } catch(Exception e) {
View Full Code Here

Examples of com.sun.jersey.api.core.ResourceConfig

     * @throws java.io.IOException if there is an error starting the Grizzly
     *         HTTP container.
     */
    protected static HttpServer startServer() throws IOException {

        ResourceConfig rc = new PackagesResourceConfig("com.sun.jersey.samples.optimisticconcurrency.resources");
        System.out.println("Starting grizzly...");
        return GrizzlyServerFactory.createHttpServer(BASE_URI, rc);
    }
View Full Code Here

Examples of com.sun.jersey.api.core.ResourceConfig

    private void addServletWithExistingRegistration(ServletContext sc, ServletRegistration sr,
            Class<? extends Application> a, Set<Class<?>> classes) {
        if (sr.getClassName() == null) {

            final ResourceConfig rc = new DeferredResourceConfig(a, getRootResourceAndProviderClasses(classes));
            final Map<String, Object> initParams = new HashMap<String, Object>();
            for(Map.Entry<String, String> entry : sr.getInitParameters().entrySet())
                initParams.put(entry.getKey(), entry.getValue());

            rc.setPropertiesAndFeatures(initParams);

            final ServletContainer s = new ServletContainer(rc);
            sr = sc.addServlet(a.getName(), s);
            if (sr.getMappings().isEmpty()) {
                final ApplicationPath ap = a.getAnnotation(ApplicationPath.class);
View Full Code Here

Examples of com.sun.jersey.api.core.ResourceConfig

    public static <A> A createContainer(Class<A> type, String packageName)
    throws ContainerException, IllegalArgumentException {
        String resourcesClassName = packageName + ".WebResources";
        try {
            Class<?> resourcesClass = ContainerFactory.class.getClassLoader().loadClass(resourcesClassName);
            ResourceConfig config = (ResourceConfig) resourcesClass.newInstance();
            return createContainer(type, config, null);
        } catch (ClassNotFoundException e) {
            throw new ContainerException(e);
        } catch (InstantiationException e) {
            throw new ContainerException(e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.