Package org.jayasoft.woj.common.model

Examples of org.jayasoft.woj.common.model.Server


        if (auth instanceof AuthSuccessfull) {
            AuthSuccessfull success = (AuthSuccessfull) auth;
            getUnifiedAuthentificationService().setUAK(success.getKey());
            if (success.getServer() != null) {
                try {
                    _ssp.getCluster().setCurrent(new Server(new URL(success.getServer())));
                } catch (MalformedURLException e) {
                    LOGGER.error("Unable to build from url current server for cluster url="+success.getServer());
                }
            }
            LOGGER.info("User logged in: "+user+" uak="+success.getKey());
View Full Code Here


    public Server getNextTargetServer() {
        if (!hasNext()) {
            throw new IllegalStateException("no next target server");
        } else {
            Server ret = _currentServer;
            _currentServer = null;
            return ret;
        }
    }
View Full Code Here

        List servers = getServersUpToHandle(uak, visibility, org, mod, rev, path);
        LOGGER.debug("found servers able to handle "+request+": "+servers);
        if (servers.isEmpty()) {
            throw new UnknwownContentException(visibility+"/"+org+"/"+mod+"/"+rev+"/"+path);
        } else {           
            Server selected = (Server)servers.get(RANDOM.nextInt(servers.size()));
            LOGGER.info("selected "+selected+" to handle "+request+" among "+servers);
            if (WOJServer.getInstance().getServerManagementService().getLocalServer().equals(selected)) {
                return doGetContentReference(uak, visibility, org, mod, rev, path);
            } else {
                throw new ServerRedirectException(selected);
View Full Code Here

        UAK uak = SecurityHelper.getUAK(m);
        if (uak == null) {
            throw new NoUAKException();
        }
        String encodedObject = (String) m.get(ServerCommands.NOTIFY_NEW_MASTER.P_SERVER);
        Server server = (Server) ServiceProvider.getDefault().getEncodingService().decode(encodedObject);
        encodedObject = (String) m.get(ServerCommands.NOTIFY_NEW_MASTER.P_KEY);
        encodedObject = encodedObject == null ? "" : encodedObject.trim();
        Key key = encodedObject.length() == 0 ? null : (Key)ServiceProvider.getDefault().getEncodingService().decode(encodedObject);
       
        WOJServer.getInstance().getServerManagementService().notifyNewMaster(server, key);
View Full Code Here

    public static ClientServerServicesProvider get(Server server) {
        return get(new WOJCluster(Collections.singletonList(server)));
    }
   
    public static ClientServerServicesProvider get(URL serverFullURL) {
        return get(new Server(serverFullURL));
    }
View Full Code Here

    }
   
    public static ClientServerServicesProvider get(String serverUrlString) {
        try {
            URL serverFullURL = new URL(serverUrlString);
            return get(new Server(serverFullURL.getHost(), serverFullURL.getPort(), serverFullURL.getPath()));
        } catch (MalformedURLException e) {
            throw new IllegalArgumentException("MalformedURL :"+serverUrlString+" unable to obtain woj server service");
        }
    }
View Full Code Here

    }

    public Object securedInvoke(UAK uak, Map m) {
        List servers = WOJServer.getInstance().getServerManagementService().getKnownServers();
        // we add ourself to the list at the correct position
        Server local = WOJServer.getInstance().getServerManagementService().getLocalServer();
        boolean added = false;
        for (int i=0; i<servers.size() && !added; i++) {
            Server server = (Server)servers.get(i);
            if (server.getId() > local.getId()) {
                servers.add(i, local);
                added = true;
            }
        }
        if (!added) {
View Full Code Here

      TargetServerProvider portal =  new SimpleTargetServerProvider(getPortalServer());
        _registrationService = new HttpRegistrationServiceImpl(portal);
    }

  protected Server getPortalServer() {
    Server portal = null;
    try {
            portal = new Server(0, new URL("http://www.worldofjava.org/"));
            //for dev 
            if(System.getProperty("portal.address") != null) {
              try {
          portal = new Server(0, new URL(System.getProperty("portal.address")));
        } catch (MalformedURLException e) {e.printStackTrace();}
            }
        } catch (MalformedURLException notpossible) {}
        return portal;
  }
View Full Code Here

    protected void computeUserKey(UAK uak) {
        LOGGER.info("master is not known yet, authentication is only done on this machine, returning unvalidated UAK: "+uak);
    }

    public Authentification authenticate(String userName, String userPassword, String computerIdent, String pluginId) {
        Server master = WOJServer.getInstance().getServerManagementService().getCurrentMaster();
        if(master == null) {
            return super.authenticate(userName, userPassword, computerIdent, pluginId);
        } else {
            return new AuthNotDone(master);
        }
View Full Code Here

    private Timer _timer;

    private long _checkPeriod;

    public ServerManagementServiceImpl(long id, String ip, int port, String base) {
        _localServer = new Server(id, ip, port, base);
    }
View Full Code Here

TOP

Related Classes of org.jayasoft.woj.common.model.Server

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.