Example usage for java.lang IllegalAccessException IllegalAccessException

List of usage examples for java.lang IllegalAccessException IllegalAccessException

Introduction

In this page you can find the example usage for java.lang IllegalAccessException IllegalAccessException.

Prototype

public IllegalAccessException(String s) 

Source Link

Document

Constructs an IllegalAccessException with a detail message.

Usage

From source file:com.reactivetechnologies.platform.datagrid.HazelcastKeyValueAdapterBean.java

/**
 * Add a membership event observer to receive Hazelcast membership event callbacks. Membership observers have to be
 * registered before {@link #acceptJoin()} is invoked.
 * @param observer/* w ww .  ja  v a  2  s. co m*/
 * @throws IllegalAccessException if added after service is already started
 */
public void addMembershipObserver(MembershipEventObserver observer) throws IllegalAccessException {
    if (hz.isStarted())
        throw new IllegalAccessException(
                "MembershipEventObserver cannot be added after Hazelcast service has been started");
    hz.addInstanceListenerObserver(observer);
}

From source file:com.yahoo.sql4d.sql4ddriver.BrokerAccessor.java

/**
 * Get timeboundary.//  ww  w  .  jav a 2s  .co  m
 *
 * @param dataSource 
 * @param reqHeaders 
 * @return
 * @throws java.lang.IllegalAccessException
 */
public Interval getTimeBoundary(String dataSource, Map<String, String> reqHeaders)
        throws IllegalAccessException {
    Program<BaseStatementMeta> pgm = DCompiler.compileSql(format("SELECT FROM %s", dataSource));
    Either<String, Either<Mapper4All, JSONArray>> res = fireQuery(pgm.nthStmnt(0).toString(), reqHeaders, true);
    if (res.isLeft()) {
        throw new IllegalAccessException(
                format("DataSource %s does not exist(or) check if druid is accessible, faced exception %s",
                        dataSource, res.left().get()));
    }
    Mapper4All finalRes = res.right().get().left().get();// Thats because we know Time boundary cannot be a Join result!!
    int min = finalRes.baseFieldNames.indexOf("minTime");
    int max = finalRes.baseFieldNames.indexOf("maxTime");
    if (finalRes.baseAllRows.isEmpty()) {// Possible when table does not exist.
        throw new IllegalAccessException("Either table does not exist(or) druid is not accessible");
    }
    List<Object> row = finalRes.baseAllRows.get(0);// Only 1 element is returned in Timeboundary.
    return new Interval(row.get(min).toString(), row.get(max).toString());
}

From source file:org.rhq.enterprise.server.rest.SetCallerInterceptor.java

/**
 * We need to take the Principal that was passed through the web-integration,
 * get an RHQ Subject and set a session for it. When the call was made, we need
 * to invalidate the session again./*from  w  ww . j  a va2 s . c om*/
 * @param ctx InvocationContext from the EJB invocation chain
 * @return result of the method call
 * @throws Exception from method call or if no (valid) principal was provided
 */
@AroundInvoke
public Object setCaller(InvocationContext ctx) throws Exception {

    Subject caller = null;
    java.security.Principal p = ejbContext.getCallerPrincipal();
    if (!startupBean.isInitialized()) {
        String notInitMessage = "Tried to call REST endpoint but the server is not ready - still booting up";
        log.debug(notInitMessage);
        return Response.status(Response.Status.SERVICE_UNAVAILABLE).header("Retry-After", "30")
                .entity(notInitMessage).build();
    }

    if (p != null) {
        caller = subjectManager.getSubjectByName(p.getName());
    }

    if (caller == null) {
        throw new IllegalAccessException("No calling principal provided");
    }

    // Get Subject with a session
    caller = sessionManager.put(caller);

    // Provide it to the EJB
    AbstractRestBean target = (AbstractRestBean) ctx.getTarget();
    target.caller = caller;

    // Call the EJBs
    Object result = ctx.proceed();

    // if result is StreamingOutput, we do not want to invalidate the session until it
    // is finished writing the output; otherwise, any secure SLSB calls will fail. We
    // instead wrap the result in an instance of SecureStreamingOutput which
    // invalidates the session after the output has been written.
    if (result instanceof StreamingOutput) {
        return new SecureStreamingOutput((StreamingOutput) result, caller);
    }

    // Invalidate the session again.
    sessionManager.invalidate(caller.getSessionId());

    return result;
}

From source file:jdao.JDAO.java

public void checkReadOnly() throws Exception {
    if (this.isReadOnly()) {
        throw new IllegalAccessException("JDAO is read-only.");
    }/*w ww. j a v  a 2  s. c  om*/
}

From source file:tech.sirwellington.alchemy.generator.ObjectGenerators.java

ObjectGenerators() throws IllegalAccessException {
    throw new IllegalAccessException("cannot instantiate this class");
}

From source file:org.apache.hadoop.chukwa.datastore.WidgetStore.java

public static void cacheWidgets() throws IllegalAccessException {
    StringBuilder widgetPath = new StringBuilder();
    widgetPath.append(hiccPath);//from  w ww. j a va2s  . c o m
    Path widgetFiles = new Path(widgetPath.toString());
    FileSystem fs;
    catalog = new CatalogBean();
    catalog.setId("root");
    catalog.setLabel("root");
    try {
        fs = FileSystem.get(config);
        FileStatus[] fstatus = fs.listStatus(widgetFiles);
        if (fstatus != null) {
            for (int i = 0; i < fstatus.length; i++) {
                long size = fstatus[i].getLen();
                FSDataInputStream widgetStream = fs.open(fstatus[i].getPath());
                byte[] buffer = new byte[(int) size];
                widgetStream.readFully(buffer);
                widgetStream.close();
                try {
                    WidgetBean widget = new WidgetBean(new JSONObject(new String(buffer)));
                    catalog.addCatalog(widget);
                    list.put(widget.getId(), widget);
                } catch (Exception e) {
                    log.error(ExceptionUtil.getStackTrace(e));
                }
            }
        }
    } catch (IOException ex) {
        log.error(ExceptionUtil.getStackTrace(ex));
        throw new IllegalAccessException("Unable to access user view database.");
    }
}

From source file:psidev.psi.mi.tab.converter.tab2xml.Tab2Xml.java

/**
 * This method convert a Collection of BinaryInteractions to a EntrySet, grouping the interactions by entries depending on its source db.
 *
 * @param binaryInteractions//from   w w  w  . j  a  v  a  2s . c om
 * @return EntrySet
 * @throws IllegalAccessException
 * @throws XmlConversionException
 */
public EntrySet convert(Collection<BinaryInteraction> binaryInteractions)
        throws IllegalAccessException, XmlConversionException {

    if (binaryInteractions.isEmpty()) {
        throw new IllegalAccessException("No binary interactions found in the collection");
    }

    EntrySet entrySet = new EntrySet(PsimiXmlVersion.VERSION_25_UNDEFINED);

    HashMap<List<CrossReference>, Entry> listXrefEntryHashMap = new HashMap<List<CrossReference>, Entry>();

    Map<Entry, List<BinaryInteraction>> interactionsPerSource = new HashMap<Entry, List<BinaryInteraction>>();

    for (BinaryInteraction<?> binaryInteraction : binaryInteractions) {

        Entry xmlEntry;

        List<CrossReference> sources = binaryInteraction.getSourceDatabases();

        if (!listXrefEntryHashMap.containsKey(sources)) {
            //If we have more than one source we only use the first one
            Source xmlSource = createSource(sources);
            xmlEntry = new Entry();
            xmlEntry.setSource(xmlSource);
            listXrefEntryHashMap.put(sources, xmlEntry);

            List<BinaryInteraction> lbi = new ArrayList<BinaryInteraction>();
            lbi.add(binaryInteraction);

            interactionsPerSource.put(xmlEntry, lbi);

        } else {
            xmlEntry = listXrefEntryHashMap.get(sources);
            interactionsPerSource.get(xmlEntry).add(binaryInteraction);
        }
    }

    for (Entry entry : interactionsPerSource.keySet()) {
        Collection<BinaryInteraction> binaryInteractionsPerSource = interactionsPerSource.get(entry);
        Map<String, Collection<Participant>> interactionMap = createInteractionMap(binaryInteractionsPerSource);

        for (BinaryInteraction interaction : binaryInteractionsPerSource) {
            Collection<Interaction> interactions = interactionConverter.fromMitab(interaction, interactionMap);
            entry.getInteractions().addAll(interactions);
        }
        entrySet.getEntries().add(entry);
    }

    return entrySet;
}

From source file:org.apache.axis.utils.BeanPropertyDescriptor.java

/**
 * Get the property value//from w w w . jav a 2s .c o  m
 * @param obj is the object
 * @return the entire propery value
 */
public Object get(Object obj) throws InvocationTargetException, IllegalAccessException {
    Method readMethod = myPD.getReadMethod();
    if (readMethod != null) {
        return readMethod.invoke(obj, noArgs);
    } else {
        throw new IllegalAccessException(Messages.getMessage("badGetter00"));
    }
}

From source file:org.rhq.modules.plugins.jbossas7.ConfigurationWriteDelegate.java

/**
 * Trigger loading of a configuration by talking to the remote resource.
 * @return The initialized configuration
 * @throws Exception If anything goes wrong.
 *//*from www .ja va  2  s  .c o  m*/
public Configuration loadResourceConfiguration() throws Exception {

    throw new IllegalAccessException("Please use ConfigurationLoadDelegate");

}

From source file:org.wicketstuff.nashorn.resource.NashornResource.java

/**
 * Executes the java script code received from the client and returns the response
 *//*w  w  w .  j a v  a 2  s .co m*/
@Override
protected ResourceResponse newResourceResponse(Attributes attributes) {
    RequestCycle cycle = RequestCycle.get();
    Long startbyte = cycle.getMetaData(CONTENT_RANGE_STARTBYTE);
    Long endbyte = cycle.getMetaData(CONTENT_RANGE_ENDBYTE);
    HttpServletRequest httpServletRequest = (HttpServletRequest) attributes.getRequest().getContainerRequest();
    try (InputStream inputStream = httpServletRequest.getInputStream()) {
        String script = IOUtils.toString(inputStream);
        if (script.contains("nashornResourceReferenceScriptExecutionThread")) {
            throw new IllegalAccessException(
                    "It is not allowed to gain access to the nashorn thread itself! (nashornResourceReferenceScriptExecutionThread)");
        }
        String safeScript = ensureSafetyScript(script, attributes);
        NashornScriptCallable nashornScriptCallable = new NashornScriptCallable(safeScript, attributes,
                getClassFilter(), getWriter(), getErrorWriter()) {
            @Override
            protected void setup(Attributes attributes, Bindings bindings) {
                NashornResource.this.setup(attributes, bindings);
            }
        };
        Object scriptResult = executeScript(nashornScriptCallable, true);
        ResourceResponse resourceResponse = new ResourceResponse();
        resourceResponse.setContentType("text/plain");
        resourceResponse.setWriteCallback(new PartWriterCallback(
                IOUtils.toInputStream(scriptResult != null ? scriptResult.toString() : ""),
                Long.valueOf(scriptResult != null ? scriptResult.toString().length() : 0), startbyte, endbyte));
        return resourceResponse;
    } catch (Exception e) {
        ResourceResponse errorResourceResponse = processError(e);
        if (errorResourceResponse == null) {
            throw new WicketRuntimeException("Error while reading / executing the script the script", e);
        } else {
            return errorResourceResponse;
        }

    }
}