Package net.fortytwo.twitlogic.util.properties

Examples of net.fortytwo.twitlogic.util.properties.TypedProperties


        final DatasetFactory datasetFactory = new DatasetFactory(new ValueFactoryImpl());
        for (RDFContentLanguage l : RDFContentLanguage.values()) {
            datasetFactory.addLanguage(l);
        }

        TypedProperties p = TwitLogic.getConfiguration();
        String platformName = p.getString(TwitLogic.RDFAGENTS_PLATFORM_NAME);
        int port = p.getInt(TwitLogic.RDFAGENTS_PLATFORM_PORT);
        String providerName = p.getString(TwitLogic.RDFAGENTS_AGENT_NAME);
        String xmppServer = p.getString("jade_mtp_xmpp_server");
        String xmppUserName = p.getString("jade_mtp_xmpp_username");

        RDFAgentsPlatform platform = new RDFAgentsPlatformImpl(platformName, datasetFactory, port, config);

        String address = RDFAgents.XMPP_URI_PREFIX + xmppUserName + "@" + xmppServer;// + "/acc";
        String name = RDFAgents.NAME_PREFIX + providerName + "@" + platformName;
View Full Code Here


    public static TypedProperties getConfiguration() {
        return CONFIGURATION;
    }

    public static void setConfiguration(final Properties properties) {
        CONFIGURATION = new TypedProperties(properties);
    }
View Full Code Here

    public static Logger getLogger(final Class c) {
        return Logger.getLogger(c.getName());
    }

    public static Set<String> findTrackTerms() throws PropertyException {
        TypedProperties props = TwitLogic.getConfiguration();

        // Note: this doesn't really need to be an order-preserving collection,
        // because Java properties are not order-preserving.
        Set<String> terms = new LinkedHashSet<String>();
        for (String key : props.stringPropertyNames()) {
            if (key.startsWith(TwitLogic.TRACKTERMS)) {
                String listVal = props.getString(key);
                String[] these = listVal.split(",");
                for (String t : these) {
                    t = t.trim();
                    if (0 < t.length()) {
                        terms.add(t);
View Full Code Here

        return terms;
    }

    public static TwitterClient.GeoDisc findGeoDisc() throws PropertyException {
        TypedProperties props = TwitLogic.getConfiguration();

        String s = props.getString(TwitLogic.GEODISC, null);

        return null == s ? null : new TwitterClient.GeoDisc(s);
    }
View Full Code Here

        return null == s ? null : new TwitterClient.GeoDisc(s);
    }

    public static double[][] findGeoBoxes() throws PropertyException {
        TypedProperties props = TwitLogic.getConfiguration();

        Set<String> matches = new LinkedHashSet<String>();
        for (String key : props.stringPropertyNames()) {
            if (key.startsWith(TwitLogic.GEOBOX)) {
                String listVal = props.getString(key);
                String[] these = listVal.split(",");
                for (String t : these) {
                    t = t.trim();
                    if (0 < t.length()) {
                        matches.add(t);
View Full Code Here

        }
    }

    // Note: for now, lists are not persisted in any way
    public static Set<User> findFollowList(final TwitterClient client) throws TwitterClientException, PropertyException {
        TypedProperties props = TwitLogic.getConfiguration();

        // Note: this doesn't really need to be an order-preserving collection,
        // because Java properties are not order-preserving.
        Set<User> users = new LinkedHashSet<User>();
        for (String key : props.stringPropertyNames()) {
            if (key.startsWith(TwitLogic.FOLLOWLIST)) {
                String listVal = props.getString(key);
                if (!CONFIG_LIST_PATTERN.matcher(listVal).matches()) {
                    throw new PropertyException("invalid list: " + listVal + " (should be of the form user_name/list_id)");
                }

                String[] parts = listVal.split("/");
                User user = new User(parts[0]);
                String listId = parts[1];

                List<User> l = client.getListMembers(user, listId);
                users.addAll(l);
            } else if (key.startsWith(TwitLogic.FOLLOWUSER)) {
                String screenName = props.getString(key);
                if (!CONFIG_USERNAME_PATTERN.matcher(screenName).matches()) {
                    throw new PropertyException("invalid screen name: " + screenName);
                }

                // Twitter requires user IDs (as opposed to screen names) for follow filters.
                User u = client.findUserInfo(screenName);
                users.add(u);
            } else if (key.startsWith(TwitLogic.FOLLOWFOLLOWED)) {
                String screenName = props.getString(key);
                if (!CONFIG_USERNAME_PATTERN.matcher(screenName).matches()) {
                    throw new PropertyException("invalid screen name: " + screenName);
                }

                // Twitter requires user IDs (as opposed to screen names) for follow filters.
View Full Code Here

        }
        return ports;
    }

    private void run() throws Exception {
        TypedProperties config = TwitLogic.getConfiguration();
        String host = config.getString(TwitLogic.UDP_REMOTEHOST);
        String portsStr = config.getString(TwitLogic.UDP_REMOTEPORTS);
        int[] ports = parsePorts(portsStr);

        InetAddress address = InetAddress.getByName(host);

        Sail workingSail = new MemoryStore();
View Full Code Here

    // TODO: does bit.ly have a rate-limiting policy?
    private final RequestExecutor client = new DefaultRequestExecutor();

    public BitlyClient() throws BitlyClientException {
        TypedProperties conf = TwitLogic.getConfiguration();
        try {
            bitlyLogin = conf.getString(TwitLogic.BITLY_LOGIN);
            bitlyAPIKey = conf.getString(TwitLogic.BITLY_APIKEY);
        } catch (PropertyException e) {
            throw new BitlyClientException(e);
        }
    }
View Full Code Here

        initialized = true;
    }

    private void addPeriodicDump() throws TweetStoreException {
        TypedProperties conf = TwitLogic.getConfiguration();
        try {
            File file = conf.getFile(TwitLogic.DUMP_FILE, null);
            if (null == file) {
                LOGGER.info("no dump file specified. Periodic data dumps will not be generated.");
            } else {
                long interval = conf.getLong(TwitLogic.DUMP_INTERVAL, -1);
                if (-1 == interval) {
                    LOGGER.warning("no dump interval specified. Periodic data dumps will not be generated.");
                } else {
                    boolean compressed = false;
                    String s = file.getName();
View Full Code Here

    }

    ////////////////////////////////////////////////////////////////////////////

    public static Sail createSail() throws TweetStoreException {
        TypedProperties props = TwitLogic.getConfiguration();

        String sailType;
        try {
            sailType = props.getString(TwitLogic.SAIL_CLASS);
        } catch (PropertyException e) {
            throw new TweetStoreException(e);
        }

        System.out.println("creating Sail of type: " + sailType);
View Full Code Here

TOP

Related Classes of net.fortytwo.twitlogic.util.properties.TypedProperties

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.