Package fr.norsys.mapper.console.model

Examples of fr.norsys.mapper.console.model.Connection


    }
    ExecutionContext.get().getSession().setAttribute(ConsoleCst.IS_APPLICATION_MODIFIED,ConsoleCst.APPLICATION_NOT_MODIFIED);
    return true;
  }
  public boolean saveConnectionConfig(String idthrows Exception {
    Connection connection = null;
      connection = connectionService.get(id,(Collection)ExecutionContext.get().getSession().getAttribute(ConsoleCst.CONNECTIONS_SESSION_BEAN));
    Map map = BeanUtils.toMap(connection);
    map.remove("class");
    map.remove("id");
    try {
      propertyService.setProperty(connectionService.getConnectionsDirPath()+connection.getName()+".properties",map);
    } catch(PropertyException e) {
      log.error(e);
      return false;
    }
    ExecutionContext.get().getSession().setAttribute(ConsoleCst.IS_CONNECTION_MODIFIED,
View Full Code Here


    BeanUtils.toObject(map,con);
    assertNotNull("must not be null",con);
    assertEquals("user name must be source1","user1",con.getUser());
  }
  public void testCopyFilledProperties() {
    Connection con = new Connection("con1");
    Connection con2 = new Connection();
    con2.setPass("pass");
    BeanUtils.copyFilledProperties(con2,con);
    assertEquals("name must be con1","con1",con2.getName());
    assertNotNull("pass must not be null",con2.getPass());
  }
View Full Code Here

    }
    ExecutionContext.get().getSession().setAttribute(ConsoleCst.IS_APPLICATION_MODIFIED,ConsoleCst.APPLICATION_NOT_MODIFIED);
    return href;
  }
  public String saveConnectionConfigAndLoad(String id, String hrefthrows Exception {
    Connection connection = null;
      connection = connectionService.get(id,(Collection)ExecutionContext.get().getSession().getAttribute(ConsoleCst.CONNECTIONS_SESSION_BEAN));
    Map map = BeanUtils.toMap(connection);
    map.remove("class");
    map.remove("id");
    try {
      propertyService.setProperty(connectionService.getConnectionsDirPath()+connection.getName()+".properties",map);
    } catch(PropertyException e) {
      log.error(e);
      return null;
    }
    ExecutionContext.get().getSession().setAttribute(ConsoleCst.IS_CONNECTION_MODIFIED,ConsoleCst.CONNECTION_NOT_MODIFIED);
View Full Code Here

    application.clear();
    Validate.notNull("applicationName must not be null", applicationName);
    Validate.notEmpty("applicationName must not be empty", applicationName);
    MapperConfig mc = (MapperConfig) unmarshall(is);
    if (mc == null){
      application.setConnection(new Connection());
      application
          .setConnectionName(application.getConnection().getName());
    }
    else {
      fillApplication(application, mc);
View Full Code Here

    application.clear();
    Validate.notNull("applicationName must not be null", applicationName);
    Validate.notEmpty("applicationName must not be empty", applicationName);
    MapperConfig mc = (MapperConfig) unmarshall(mapFile);
    if (mc == null){
      application.setConnection(new Connection());
      application
          .setConnectionName(application.getConnection().getName());
    }
    else {
      fillApplication(application, mc);
View Full Code Here

    }
    return result;
  }

  private void fillConnection(Application application, Vector properties) {
    Connection connection = new Connection();
    connection.setId(UIDGenerator.generateId());
    for (Iterator it = properties.iterator(); it.hasNext();) {
      Property property = (Property) it.next();
      if (Context.PROVIDER_URL.equals(property.getKey())) {
        connection.setUrl(getValue(property.getVal(), application
            .getVariables()));
      } else if (Context.SECURITY_PRINCIPAL.equals(property.getKey())) {
        connection.setUser(getValue(property.getVal(), application
            .getVariables()));
      } else if (Context.SECURITY_CREDENTIALS.equals(property.getKey())) {
        connection.setPass(getValue(property.getVal(), application
            .getVariables()));
      } else if ("jndi.connection.pool.minPoolSize".equals(property
          .getKey())) {
        connection.setMinPoolSize(getValue(property.getVal(),
            application.getVariables()));
      } else if ("jndi.connection.pool.maxPoolSize".equals(property
          .getKey())) {
        connection.setMaxPoolSize(getValue(property.getVal(),
            application.getVariables()));
      } else if ("jndi.connection.pool.timeout".equals(property.getKey())) {
        connection.setTimeoutPool(getValue(property.getVal(),
            application.getVariables()));
      } else if ("jndi.connection.name".equals(property.getKey())) {
        connection.setName(getValue(property.getVal(), application
            .getVariables()));
      }
    }
    application.setConnection(connection);
    application.setConnectionName(connection.getName());
  }
View Full Code Here

      fr.norsys.mapper.console.model.Variable v = (fr.norsys.mapper.console.model.Variable)it.next();
      BeanUtils.copyFilledProperties(variable, v);
      mapperConfig.addVariable(variable);
    }

    Connection connection = application.getConnection();
    mapperConfig.getJndiMapper().getSource().setName(connection.getName());
    Config config = mapperConfig.getJndiMapper().getSource().getConfig();
    config.getProperties().add(
        new Property(Context.INITIAL_CONTEXT_FACTORY,
            "com.sun.jndi.ldap.LdapCtxFactory"));
    config.getProperties().add(
        new Property(Context.PROVIDER_URL, connection.getUrl()));
    config.getProperties().add(
        new Property(Context.SECURITY_PRINCIPAL, connection.getUser()));
    config.getProperties()
        .add(
            new Property(Context.SECURITY_CREDENTIALS, connection
                .getPass()));
    config.getProperties().add(
        new Property("jndi.connection.pool.minPoolSize", connection
            .getMinPoolSize()));
    config.getProperties().add(
        new Property("jndi.connection.pool.maxPoolSize", connection
            .getMaxPoolSize()));
    config.getProperties().add(
        new Property("jndi.connection.pool.timeout", connection
            .getTimeoutPool()));
    config.getProperties().add(
        new Property("jndi.connection.name", connection.getName()));

    mapperConfig.getSubConfig().setName(
        "http://norsys.fr/framework-ldap/jndi-configuration.dtd");
    mapperConfig.getSubConfig().setClasse(
        "fr.norsys.mapper.jndi.JNDIXMLConfigurator");
View Full Code Here

  private Connection connection;
  private Resource resource;
  protected void setUp() throws Exception {
    super.setUp();
    vh = new ValidationHelperImpl();
    connection = new Connection("test");
    connection.setUrl("ldap://130.81.9.192:389");
    connection.setUser("cn=admin,ou=users,o=services");
    connection.setPass("12345678");
   
    resource = new Resource("toto");
View Full Code Here

        conMenu.setLocation("javascript:saveBeforeLoad('"+isAppliModified+"','"+currentAppli+"','connection.do?method=init')");
    repository.addMenu(conMenu);
   
    for(Iterator it=connexions.iterator();it.hasNext();) {
          MenuComponent mc = new MenuComponent();
          Connection connection = (Connection) it.next();
          String name = connection.getName();
          mc.setName(name);
          mc.setTitle(name);
          mc.setLocation("javascript:saveBeforeLoad('"+isAppliModified+"','"+currentAppli+"','connection.do?method=edit&forward=connection&id="+URLEncoderUtil.escape(connection.getId())+"')");
          mc.setParent(conMenu);
    }

    MenuComponent appliMenu = new MenuComponent();
    appliMenu.setName("Applications");
View Full Code Here

          conMenu.setLocation("javascript:saveConBeforeLoad('"+isConModified+"','"+con+"','connection.do?method=init')");
      repository.addMenu(conMenu);
     
      for(Iterator it=connexions.iterator();it.hasNext();) {
            MenuComponent mc = new MenuComponent();
            Connection connection = (Connection) it.next();
            String name = connection.getName();
            mc.setName(name);
            mc.setTitle(name);
            mc.setLocation("javascript:saveConBeforeLoad('"+isConModified+"','"+con+"','connection.do?method=edit&forward=connection&id="+URLEncoderUtil.escape(connection.getId())+"')");
            mc.setParent(conMenu);
      }

      MenuComponent appliMenu = new MenuComponent();
      appliMenu.setName("Applications");
View Full Code Here

TOP

Related Classes of fr.norsys.mapper.console.model.Connection

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.