Example usage for com.liferay.portal.kernel.util StringPool SLASH

List of usage examples for com.liferay.portal.kernel.util StringPool SLASH

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util StringPool SLASH.

Prototype

String SLASH

To view the source code for com.liferay.portal.kernel.util StringPool SLASH.

Click Source Link

Usage

From source file:com.liferay.google.apps.connector.GUserManagerImpl.java

License:Open Source License

public GUserManagerImpl(GoogleAppsConnection googleApps) {
    super(googleApps);

    GAuthenticator gAuthenticator = googleApps.getGAuthenticator();

    StringBundler sb = new StringBundler(4);

    sb.append(APPS_URL);/*  w  w w . j a v a2  s  . c  o m*/
    sb.append(StringPool.SLASH);
    sb.append(gAuthenticator.getDomain());
    sb.append("/user/2.0");

    userURL = sb.toString();
}

From source file:com.liferay.google.apps.connector.GUserManagerImpl.java

License:Open Source License

protected String getUserURL(long userId) {
    return userURL.concat(StringPool.SLASH).concat(String.valueOf(userId));
}

From source file:com.liferay.googleapps.GNicknameManagerImpl.java

License:Open Source License

public GNicknameManagerImpl(GoogleApps googleApps) {
    super(googleApps);

    GAuthenticator gAuthenticator = googleApps.getGAuthenticator();

    StringBundler sb = new StringBundler(4);

    sb.append(APPS_URL);//from   ww w.j a va 2s  .co  m
    sb.append(StringPool.SLASH);
    sb.append(gAuthenticator.getDomain());
    sb.append("/nickname/2.0");

    nicknameURL = sb.toString();
}

From source file:com.liferay.googleapps.GUserManagerImpl.java

License:Open Source License

public GUserManagerImpl(GoogleApps googleApps) {
    super(googleApps);

    GAuthenticator gAuthenticator = googleApps.getGAuthenticator();

    StringBundler sb = new StringBundler(4);

    sb.append(APPS_URL);/*from w ww  .  j a  v  a  2  s .  c  o  m*/
    sb.append(StringPool.SLASH);
    sb.append(gAuthenticator.getDomain());
    sb.append("/user/2.0");

    userURL = sb.toString();
}

From source file:com.liferay.hadoop.search.HadoopDLIndexerPostProcessor.java

License:Open Source License

public void postProcessDocument(Document document, Object obj) throws Exception {

    DLFileEntry dlFileEntry = (DLFileEntry) obj;

    long companyId = dlFileEntry.getCompanyId();
    long repositoryId = dlFileEntry.getRepositoryId();

    String stringObject = document.toString();

    // remove JSON chars

    stringObject = StringUtil.replace(stringObject, new String[] { "\"", ",", ":", "{", "}", "[", "]" },
            new String[] { StringPool.SPACE, StringPool.SPACE, StringPool.SPACE, StringPool.SPACE,
                    StringPool.SPACE, StringPool.SPACE, StringPool.SPACE });

    Path fullDirPath = HadoopManager.getFullDirPath(companyId, repositoryId, null);

    fullDirPath = new Path("/index".concat(fullDirPath.toString()));

    FSDataOutputStream outputStream = null;

    try {//from w  ww.  j  ava  2  s . c o  m
        FileSystem fileSystem = HadoopManager.getFileSystem();

        String suffix = StringPool.SLASH.concat(document.getUID());

        outputStream = fileSystem.create(fullDirPath.suffix(suffix));

        PrintWriter pw = new PrintWriter(outputStream);

        pw.write(stringObject);

        pw.flush();
        pw.close();
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        StreamUtil.cleanUp(outputStream);
    }
}

From source file:com.liferay.hadoop.util.HadoopManager.java

License:Open Source License

public static String getFullDirName(long companyId, long repositoryId, String dirName) {

    StringBundler sb = new StringBundler(5);

    sb.append(StringPool.SLASH);
    sb.append(companyId);/*from  w  ww  . j av a2  s  .  com*/
    sb.append(StringPool.SLASH);
    sb.append(repositoryId);

    if (Validator.isNotNull(dirName)) {
        sb.append(StringPool.SLASH);
        sb.append(dirName);
    }

    return sb.toString();
}

From source file:com.liferay.hadoop.util.HadoopManager.java

License:Open Source License

public static String getFullVersionFileName(long companyId, long repositoryId, String fileName,
        String version) {//w w w  .j  a  v a2s .co  m

    StringBundler sb = new StringBundler(3);

    sb.append(getFullDirName(companyId, repositoryId, fileName));
    sb.append(StringPool.SLASH);

    if (Validator.isNull(version)) {
        sb.append(Store.VERSION_DEFAULT);
    } else {
        sb.append(version);
    }

    return sb.toString();
}

From source file:com.liferay.httpservice.internal.definition.WebXMLDefinitionLoader.java

License:Open Source License

protected String getURLPattern(Element element) {
    String urlPattern = element.elementText("url-pattern");

    if (urlPattern.endsWith(_SLASH_STAR) && (urlPattern.length() > 2)) {
        urlPattern = urlPattern.substring(0, urlPattern.length() - 2);
    }// w  ww. j a  v  a 2 s .  co m

    if (urlPattern.startsWith(StringPool.STAR)) {
        urlPattern = StringPool.SLASH.concat(urlPattern);
    }

    return urlPattern;
}

From source file:com.liferay.httpservice.internal.event.EventUtil.java

License:Open Source License

private void _sendEvent(Bundle bundle, String eventTopic, Exception exception, boolean collision) {

    Map<String, Object> properties = new Hashtable<String, Object>();

    properties.put("bundle", bundle);
    properties.put("bundle.id", bundle.getBundleId());
    properties.put("bundle.symbolicName", bundle.getSymbolicName());
    properties.put("bundle.version", bundle.getVersion());

    String servletContextName = BundleServletContext.getServletContextName(bundle, true);

    String contextPath = StringPool.SLASH.concat(servletContextName);

    if (collision) {
        properties.put("collision", contextPath);

        List<String> collidedBundleIds = new ArrayList<String>();

        BundleContext bundleContext = bundle.getBundleContext();

        for (Bundle curBundle : bundleContext.getBundles()) {
            if (curBundle.equals(bundle) || (curBundle.getState() != Bundle.ACTIVE)) {

                continue;
            }/*from w  ww . j  av  a 2 s  . c  o  m*/

            String curServletContextName = BundleServletContext.getServletContextName(curBundle);

            if ((curServletContextName != null) && curServletContextName.equals(servletContextName)) {

                collidedBundleIds.add(String.valueOf(curBundle.getBundleId()));
            }
        }

        properties.put("collision.bundles", collidedBundleIds);
    }

    properties.put("context.path", contextPath);

    if (exception != null) {
        properties.put("exception", exception);
    }

    properties.put("extender.bundle", _webExtenderBundle);
    properties.put("extender.bundle.id", _webExtenderBundle.getBundleId());
    properties.put("extender.bundle.symbolicName", _webExtenderBundle.getSymbolicName());
    properties.put("extender.bundle.version", _webExtenderBundle.getVersion());
    properties.put("servlet.context.name", servletContextName);
    properties.put("timestamp", System.currentTimeMillis());

    Event event = new Event(eventTopic, properties);

    if (_log.isInfoEnabled()) {
        _log.info(event);
    }

    if (_eventAdmin == null) {
        return;
    }

    _eventAdmin.sendEvent(event);
}

From source file:com.liferay.httpservice.internal.http.DefaultHttpContext.java

License:Open Source License

@Override
public URL getResource(String path) {
    if (!path.startsWith(StringPool.SLASH)) {
        path = StringPool.SLASH.concat(path);
    }//w w w. j  a va 2s .  co  m

    URL url = null;

    if (!path.startsWith(_PATH_EXT)) {
        url = getResource(_PATH_EXT.concat(path));

        if (url != null) {
            return url;
        }
    }

    url = _bundle.getResource(path);

    if (url != null) {
        return url;
    }

    String filePattern = path;

    int index = path.lastIndexOf(StringPool.SLASH);

    if (index != -1) {
        filePattern = path.substring(index + 1);

        path = path.substring(0, index);
    }

    Enumeration<URL> enumeration = _bundle.findEntries(path, filePattern, false);

    if ((enumeration != null) && enumeration.hasMoreElements()) {
        return enumeration.nextElement();
    }

    return null;
}